[ROCm] Optimize Deepseek R1 on MI300X (#18242)

Co-authored-by: Chen, Todd <zhenchen@amd.com>
This commit is contained in:
Chen, Zhentao
2026-02-24 17:01:14 -08:00
committed by GitHub
co-authored by Chen, Todd <zhenchen@amd.com>
parent f1088beb6a
commit b9cf1563de
3 changed files with 7 additions and 2 deletions
+5 -2
View File
@@ -180,6 +180,9 @@ if _use_aiter_gfx95:
get_dsv3_gemm_output_zero_allocator_size,
)
if _use_aiter:
from sglang.srt.layers.rocm_linear_utils import fused_qk_rope_cat_and_cache_mla
if _is_cuda:
from sgl_kernel import bmm_fp8, dsv3_fused_a_gemm, dsv3_router_gemm
elif _is_cpu and _is_cpu_amx_available:
@@ -1724,7 +1727,7 @@ class DeepseekV2AttentionMLA(nn.Module, DeepseekMHAForwardMixin):
if (
self.rotary_emb is not None
and (not self._fuse_rope_for_trtllm_mla(forward_batch))
and (not _use_aiter or not _is_gfx95_supported or self.use_nsa)
and (not _use_aiter or not _is_hip or self.use_nsa)
):
q_pe, k_pe = self.rotary_emb(positions, q_pe, k_pe)
@@ -1780,7 +1783,7 @@ class DeepseekV2AttentionMLA(nn.Module, DeepseekMHAForwardMixin):
**(dict(topk_indices=topk_indices) if topk_indices is not None else {}),
)
else:
if _use_aiter_gfx95:
if _use_aiter:
cos = self.rotary_emb.cos_cache
sin = self.rotary_emb.sin_cache