[CPU] add indices in chunk_gated_delta_rule (#29267)
This commit is contained in:
@@ -503,7 +503,7 @@ class GDNAttnBackend(MambaAttnBackendBase):
|
||||
query_start_loc=query_start_loc,
|
||||
)
|
||||
|
||||
if (is_npu() or is_cpu()) and last_recurrent_state is not None:
|
||||
if is_npu() and last_recurrent_state is not None:
|
||||
last_recurrent_state = last_recurrent_state.to(
|
||||
ssm_states.dtype, copy=False
|
||||
)
|
||||
|
||||
@@ -141,9 +141,10 @@ class TritonGDNKernel(LinearAttnKernelBase):
|
||||
) -> tuple:
|
||||
recurrent_state = ssm_states
|
||||
recurrent_state_indices_args = {"initial_state_indices": cache_indices}
|
||||
if is_npu() or is_cpu():
|
||||
if is_npu():
|
||||
recurrent_state = ssm_states[cache_indices]
|
||||
recurrent_state_indices_args = {}
|
||||
|
||||
return chunk_gated_delta_rule(
|
||||
q=q,
|
||||
k=k,
|
||||
|
||||
@@ -534,7 +534,8 @@ def register_fake_ops(tp_size: int):
|
||||
cu_seqlens,
|
||||
head_first,
|
||||
use_qk_l2norm_in_kernel,
|
||||
eps,
|
||||
initial_state_indices,
|
||||
eps=1e-6,
|
||||
):
|
||||
output = torch.empty_like(value)
|
||||
assert initial_state is not None
|
||||
|
||||
@@ -1023,7 +1023,7 @@ class Qwen3_5AttentionDecoderLayer(nn.Module):
|
||||
attn_output = self.attn(q, k, v, forward_batch)
|
||||
|
||||
if self.attn_output_gate:
|
||||
if not _is_npu:
|
||||
if not (_is_npu or _is_cpu):
|
||||
attn_output = fused_sigmoid_mul(attn_output, gate, inplace=True)
|
||||
else:
|
||||
gate_val = gate.reshape(gate.shape[0], -1) if gate.ndim == 3 else gate
|
||||
|
||||
Reference in New Issue
Block a user