[Bugfix][ROCm][CI] Restore the DeepSeek-V4 input GEMM override point (#51821)
Signed-off-by: Stefan Koncarevic <Stefan.Koncarevic@amd.com> Co-authored-by: Andreas Karatzas <akaratza@amd.com>
This commit is contained in:
co-authored by
Andreas Karatzas
parent
5936bac7d7
commit
b369f10d5c
@@ -443,6 +443,13 @@ class DeepseekV4Attention(nn.Module, AttentionLayerBase, ABC):
|
|||||||
# Inverse-RoPE + wo_a + wo_b output projection (platform-specific).
|
# Inverse-RoPE + wo_a + wo_b output projection (platform-specific).
|
||||||
return self._o_proj(o, positions)
|
return self._o_proj(o, positions)
|
||||||
|
|
||||||
|
def _fused_wqa_wkv_gemm(self, hidden_states: torch.Tensor) -> torch.Tensor:
|
||||||
|
# Override point: the ROCm layer preshuffles this weight in place, so
|
||||||
|
# it cannot go through fused_wqa_wkv directly.
|
||||||
|
# MergedColumnParallelLinear returns (output, bias); bias is None.
|
||||||
|
qr_kv, _ = self.fused_wqa_wkv(hidden_states)
|
||||||
|
return qr_kv
|
||||||
|
|
||||||
def _run_parallel_input_projections(
|
def _run_parallel_input_projections(
|
||||||
self, hidden_states: torch.Tensor
|
self, hidden_states: torch.Tensor
|
||||||
) -> tuple[
|
) -> tuple[
|
||||||
@@ -494,7 +501,7 @@ class DeepseekV4Attention(nn.Module, AttentionLayerBase, ABC):
|
|||||||
aux_fns[2] = indexer_compressor_kv_score
|
aux_fns[2] = indexer_compressor_kv_score
|
||||||
|
|
||||||
qr_kv, (kv_score, indexer_weights, indexer_kv_score) = execute_in_parallel(
|
qr_kv, (kv_score, indexer_weights, indexer_kv_score) = execute_in_parallel(
|
||||||
lambda: self.fused_wqa_wkv(hidden_states)[0],
|
lambda: self._fused_wqa_wkv_gemm(hidden_states),
|
||||||
aux_fns,
|
aux_fns,
|
||||||
self.ln_events[0],
|
self.ln_events[0],
|
||||||
self.ln_events[1:4],
|
self.ln_events[1:4],
|
||||||
|
|||||||
Reference in New Issue
Block a user