[AMD][bugfix] add gate rocm >= 7.2 for bpreshuffle (#23671)
This commit is contained in:
@@ -50,7 +50,7 @@ from sglang.srt.layers.quantization.fp8_kernel import (
|
|||||||
scaled_fp8_quant,
|
scaled_fp8_quant,
|
||||||
)
|
)
|
||||||
from sglang.srt.layers.quantization.fp8_utils import (
|
from sglang.srt.layers.quantization.fp8_utils import (
|
||||||
_use_aiter_gfx95,
|
_use_aiter_bpreshuffle_gfx95,
|
||||||
apply_fp8_linear,
|
apply_fp8_linear,
|
||||||
can_auto_enable_marlin_fp8,
|
can_auto_enable_marlin_fp8,
|
||||||
cutlass_fp8_supported,
|
cutlass_fp8_supported,
|
||||||
@@ -515,7 +515,7 @@ class Fp8LinearMethod(LinearMethodBase):
|
|||||||
layer.weight_scale_inv.data = weight_scale.data
|
layer.weight_scale_inv.data = weight_scale.data
|
||||||
|
|
||||||
if (
|
if (
|
||||||
_use_aiter_gfx95
|
_use_aiter_bpreshuffle_gfx95
|
||||||
and self.w8a8_block_fp8_linear is aiter_w8a8_block_fp8_linear
|
and self.w8a8_block_fp8_linear is aiter_w8a8_block_fp8_linear
|
||||||
):
|
):
|
||||||
n, k = layer.weight.shape
|
n, k = layer.weight.shape
|
||||||
|
|||||||
@@ -34,6 +34,7 @@ from sglang.srt.utils import (
|
|||||||
get_bool_env_var,
|
get_bool_env_var,
|
||||||
get_cuda_version,
|
get_cuda_version,
|
||||||
get_device_capability,
|
get_device_capability,
|
||||||
|
get_hip_version,
|
||||||
is_blackwell_supported,
|
is_blackwell_supported,
|
||||||
is_cuda,
|
is_cuda,
|
||||||
is_flashinfer_available,
|
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 = get_bool_env_var("SGLANG_USE_AITER") and _is_hip
|
||||||
_use_aiter_gfx95 = _use_aiter and _is_gfx95_supported
|
_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:
|
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
|
n, k = weight.shape
|
||||||
|
|
||||||
if _use_aiter_gfx95:
|
if _use_aiter_bpreshuffle_gfx95:
|
||||||
use_triton = use_aiter_triton_gemm_w8a8_tuned_gfx950(n, k)
|
use_triton = use_aiter_triton_gemm_w8a8_tuned_gfx950(n, k)
|
||||||
else:
|
else:
|
||||||
use_triton = True
|
use_triton = True
|
||||||
|
|||||||
@@ -3442,6 +3442,12 @@ def is_gfx95_supported():
|
|||||||
return False
|
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
|
# LoRA-related constants and utilities
|
||||||
SUPPORTED_LORA_TARGET_MODULES = [
|
SUPPORTED_LORA_TARGET_MODULES = [
|
||||||
"q_proj",
|
"q_proj",
|
||||||
|
|||||||
Reference in New Issue
Block a user