[AMD] [GLM-5.3-Flash Day 0] Enable zero-RoPE MHA prefill on ROCm (#39338)
Co-authored-by: Thomas Wang <thomawan@amd.com> Co-authored-by: Kevin Mi <45493463+kevin-mii@users.noreply.github.com>
This commit is contained in:
co-authored by
Thomas Wang
Kevin Mi
parent
582389cec5
commit
042b6a488f
+7
-1
@@ -279,8 +279,14 @@ class DeepseekMHARocmForwardMixin:
|
||||
def _concat_and_cast_mha_k_rocm(
|
||||
self: DeepseekV2AttentionMLA,
|
||||
k_nope: torch.Tensor,
|
||||
k_pe: torch.Tensor,
|
||||
k_pe: torch.Tensor | None,
|
||||
):
|
||||
if self.qk_rope_head_dim == 0:
|
||||
assert k_pe is None or k_pe.shape[-1] == 0
|
||||
# No RoPE tail to append, so k is k_nope as-is. The concat branch
|
||||
# below keeps k_nope's dtype, so no cast is needed here either.
|
||||
return k_nope.contiguous()
|
||||
|
||||
k_shape = (k_nope.shape[0], self.num_local_heads, self.qk_head_dim)
|
||||
k = k_nope.new_empty(*k_shape)
|
||||
if self.current_attention_backend == "aiter":
|
||||
|
||||
Reference in New Issue
Block a user