[NPU] fix extend_seq_lens_cpu shape in eager mode (#36843)

This commit is contained in:
heziiop
2026-09-04 09:03:30 +08:00
committed by GitHub
parent 6147a54ddf
commit 9ed2721c6d
2 changed files with 15 additions and 9 deletions
@@ -2021,9 +2021,12 @@ class AscendAttnBackend(AttentionBackend):
)
if forward_batch.forward_mode.is_draft_extend_v2():
actual_seq_lengths = (
np.array(forward_batch.extend_seq_lens_cpu).cumsum().tolist()
)
extend_seq_lens_cpu = forward_batch.extend_seq_lens_cpu
if not self.graph_mode:
extend_seq_lens_cpu = extend_seq_lens_cpu[
: forward_batch._original_batch_size
]
actual_seq_lengths = np.array(extend_seq_lens_cpu).cumsum().tolist()
else:
actual_seq_lengths = np.arange(
self.speculative_num_draft_tokens,
@@ -2031,6 +2034,10 @@ class AscendAttnBackend(AttentionBackend):
self.speculative_num_draft_tokens,
)
if not self.graph_mode:
actual_bs = len(actual_seq_lengths)
actual_seq_lengths_kv = actual_seq_lengths_kv[:actual_bs]
is_swa_layer = layer.sliding_window_size != -1
if (
is_swa_layer
@@ -25,7 +25,7 @@ MINIMAX_M2_5_W8A8_4P_IN64K_OUT1K_PREFIX90_ENVS = {
"DEEP_NORMAL_MODE_USE_INT8_QUANT": "1",
"DEEPEP_HCCL_BUFFSIZE": "1024",
"SGLANG_EXTERNAL_MODEL_PACKAGE": "custom_eagle3",
"SGLANG_PREFILL_DELAYER_MAX_PREFILL_BS_WINDOW_SIZE": "128",
"SGLANG_PREFILL_DELAYER_MAX_PREFILL_BS_WINDOW_SIZE": "999999999",
"PYTHONPATH": f"{MINIMAX_M2_5_EAGLE3_MODEL_PATH}:{os.environ.get('PYTHONPATH', '')}",
}
@@ -35,14 +35,14 @@ MINIMAX_M2_5_W8A8_4P_IN64K_OUT1K_PREFIX90_OTHER_ARGS = [
"--mem-fraction-static",
0.63,
"--max-running-requests",
26,
24,
"--reasoning-parser",
"minimax-append-think",
"--tool-call-parser",
"minimax-m2",
"--enable-prefill-delayer",
"--prefill-delayer-max-delay-passes",
128,
30,
"--prefill-max-requests",
10,
"--chunked-prefill-size",
@@ -59,7 +59,6 @@ MINIMAX_M2_5_W8A8_4P_IN64K_OUT1K_PREFIX90_OTHER_ARGS = [
20,
22,
24,
26,
"--moe-a2a-backend",
"ascend_fuseep",
"--fuseep-mode",
@@ -100,8 +99,8 @@ class TestNPUMiniMaxM2_5W8A8_4P_In64k_Out1k_Prefix90_50ms(
other_args = MINIMAX_M2_5_W8A8_4P_IN64K_OUT1K_PREFIX90_OTHER_ARGS
envs = MINIMAX_M2_5_W8A8_4P_IN64K_OUT1K_PREFIX90_ENVS
dataset_name = "generated-shared-prefix"
max_concurrency = 26
num_prompts = 104
max_concurrency = 24
num_prompts = 96
input_len = 65536
output_len = 1024
random_range_ratio = 1