diff --git a/python/sglang/srt/layers/quantization/fp8.py b/python/sglang/srt/layers/quantization/fp8.py index b1a1df37a..b75e78936 100644 --- a/python/sglang/srt/layers/quantization/fp8.py +++ b/python/sglang/srt/layers/quantization/fp8.py @@ -50,7 +50,7 @@ from sglang.srt.layers.quantization.fp8_kernel import ( scaled_fp8_quant, ) from sglang.srt.layers.quantization.fp8_utils import ( - _use_aiter_gfx95, + _use_aiter_bpreshuffle_gfx95, apply_fp8_linear, can_auto_enable_marlin_fp8, cutlass_fp8_supported, @@ -515,7 +515,7 @@ class Fp8LinearMethod(LinearMethodBase): layer.weight_scale_inv.data = weight_scale.data if ( - _use_aiter_gfx95 + _use_aiter_bpreshuffle_gfx95 and self.w8a8_block_fp8_linear is aiter_w8a8_block_fp8_linear ): n, k = layer.weight.shape diff --git a/python/sglang/srt/layers/quantization/fp8_utils.py b/python/sglang/srt/layers/quantization/fp8_utils.py index 8d075b688..016fe71f5 100755 --- a/python/sglang/srt/layers/quantization/fp8_utils.py +++ b/python/sglang/srt/layers/quantization/fp8_utils.py @@ -34,6 +34,7 @@ from sglang.srt.utils import ( get_bool_env_var, get_cuda_version, get_device_capability, + get_hip_version, is_blackwell_supported, is_cuda, is_flashinfer_available, @@ -59,6 +60,8 @@ _is_musa = is_musa() _use_aiter = get_bool_env_var("SGLANG_USE_AITER") and _is_hip _use_aiter_gfx95 = _use_aiter and _is_gfx95_supported +# ROCm 7.0 hipcc miscompiles gemm_a8w8_blockscale_bpreshuffle on gfx95 (#23319). +_use_aiter_bpreshuffle_gfx95 = _use_aiter_gfx95 and get_hip_version() >= (7, 2, 0) def use_aiter_triton_gemm_w8a8_tuned_gfx950(n: int, k: int) -> bool: @@ -761,7 +764,7 @@ def aiter_w8a8_block_fp8_linear( n, k = weight.shape - if _use_aiter_gfx95: + if _use_aiter_bpreshuffle_gfx95: use_triton = use_aiter_triton_gemm_w8a8_tuned_gfx950(n, k) else: use_triton = True diff --git a/python/sglang/srt/utils/common.py b/python/sglang/srt/utils/common.py index 8c7cb4ae2..19f3a4838 100644 --- a/python/sglang/srt/utils/common.py +++ b/python/sglang/srt/utils/common.py @@ -3442,6 +3442,12 @@ def is_gfx95_supported(): return False +def get_hip_version(): + if torch.version.hip: + return tuple(map(int, torch.version.hip.split("-")[0].split("."))) + return (0, 0, 0) + + # LoRA-related constants and utilities SUPPORTED_LORA_TARGET_MODULES = [ "q_proj",