[NPU] Support chunk prefill for Qwen3.5/Qwen3.6 models (#25839)

This commit is contained in:
Liwansi
2026-05-21 14:44:25 +08:00
committed by GitHub
parent 4ea8282cb7
commit 190488e9a8
2 changed files with 8 additions and 8 deletions
@@ -350,14 +350,7 @@ class AscendGDNAttnBackend(AscendMambaAttnBackendBase):
ssm_states.dtype, copy=False
)
ssm_states[cache_indices] = last_recurrent_state
if not forward_batch.spec_algorithm.is_none():
last_recurrent_state = last_recurrent_state.transpose(-1, -2).to(
ssm_states.dtype, copy=False
)
else:
last_recurrent_state = last_recurrent_state.to(
ssm_states.dtype, copy=False
)
last_recurrent_state = last_recurrent_state.to(ssm_states.dtype, copy=False)
ssm_states[cache_indices] = last_recurrent_state
if h is not None:
self._track_mamba_state_extend(
@@ -289,6 +289,13 @@ class MambaPool:
device=device,
)
if speculative_num_draft_tokens is not None:
if _is_npu:
temporal_state = temporal_state.transpose(-1, -2)
temporal_state_shape = (
*temporal_state_shape[:-2],
temporal_state_shape[-1],
temporal_state_shape[-2],
)
# Cache intermediate SSM states per draft token during target verify
# Shape: [num_layers, size + 1, speculative_num_draft_tokens, HV, K, V]
intermediate_ssm_state_cache = torch.zeros(