[AMD] Fix DeepSeek import cascade by supporting both pre- and post-#2958 aiter fused_qk_rmsnorm APIs (#24799)

Co-authored-by: bingxche <cursoragent@cursor.com>
This commit is contained in:
Bingxu Chen
2026-05-10 23:41:57 -07:00
committed by GitHub
co-authored by bingxche
parent faad02b3dd
commit 3ffb37789a
@@ -64,9 +64,39 @@ if _is_cuda:
if _use_aiter:
from aiter.ops.fused_qk_norm_rope_cache_quant import (
fused_qk_rmsnorm as fused_qk_rmsnorm_bf16,
)
# aiter ROCm/aiter#2958 renamed the public `fused_qk_rmsnorm` in
# `aiter.ops.fused_qk_norm_rope_cache_quant` to a private `_fused_qk_rmsnorm`
# and introduced a unified entry point in `aiter.ops.fused_qk_rmsnorm_group_quant`
# with a different (in-place, kwarg-only, no-return) signature. Probe for the
# new symbol first so SGLang works with both pre- and post-#2958 aiter without
# requiring the docker pin to be bumped atomically.
try:
from aiter.ops.enum import QuantType as _AiterQuantType
from aiter.ops.fused_qk_rmsnorm_group_quant import (
fused_qk_rmsnorm as _aiter_fused_qk_rmsnorm_unified,
)
def fused_qk_rmsnorm_bf16(q, q_weight, q_eps, k, k_weight, k_eps):
q_out = torch.empty_like(q)
k_out = torch.empty_like(k)
_aiter_fused_qk_rmsnorm_unified(
q_out_quantized=q_out,
k_out=k_out,
q=q,
q_weight=q_weight,
q_epsilon=q_eps,
k=k,
k_weight=k_weight,
k_epsilon=k_eps,
quant_type=_AiterQuantType.No,
)
return q_out, k_out
except ImportError:
from aiter.ops.fused_qk_norm_rope_cache_quant import (
fused_qk_rmsnorm as fused_qk_rmsnorm_bf16,
)
from aiter.ops.triton.batched_gemm_a8w8_a_per_token_group_prequant_w_per_batched_tensor_quant import (
batched_gemm_a8w8_a_per_token_group_prequant_w_per_batched_tensor_quant,
)