Skip to content
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion python/sglang/srt/layers/quantization/fp8_kernel.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@
_is_hip = is_hip()
_is_cuda = is_cuda()
_is_cpu = is_cpu()
_is_sm100_supported = is_sm100_supported()
_is_sm120_supported = is_sm120_supported()
_use_aiter = get_bool_env_var("SGLANG_USE_AITER") and _is_hip

if _is_cuda:
Expand Down Expand Up @@ -1297,7 +1299,7 @@ def mxfp8_block_scaled_matmul_triton(
SM120: 1, SM100: 4.
"""
if num_stages is None:
num_stages = 1 if is_sm120_supported() else (4 if is_sm100_supported() else 1)
num_stages = 1 if _is_sm120_supported else (4 if _is_sm100_supported else 1)
M, K = a.shape
N, K_b = b.shape
assert K == K_b
Expand Down
6 changes: 4 additions & 2 deletions python/sglang/srt/layers/quantization/fp8_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@
_is_hip = is_hip()
_is_cuda = is_cuda()
_is_fp8_fnuz = is_fp8_fnuz()
_is_sm100_supported = is_sm100_supported()
_is_sm120_supported = is_sm120_supported()

_use_aiter = get_bool_env_var("SGLANG_USE_AITER") and _is_hip

Expand Down Expand Up @@ -843,7 +845,7 @@ def triton_mxfp8_blockscaled_linear(
bias: Optional[torch.Tensor] = None,
output_dtype: Optional[torch.dtype] = None,
) -> torch.Tensor:
if not (_is_cuda and (is_sm100_supported() or is_sm120_supported())):
if not (_is_cuda and (_is_sm100_supported or _is_sm120_supported)):
raise RuntimeError("MXFP8 dense linear requires Blackwell GPUs (SM100/SM120).")

input_2d = input.view(-1, input.shape[-1]).contiguous()
Expand Down Expand Up @@ -895,7 +897,7 @@ def triton_mxfp8_blockscaled_linear(
a_scale_packed = _pack_mxfp8_scales(x_scale_u8)
b_scale_packed = _pack_mxfp8_scales(weight_scale)

num_stages = 1 if is_sm120_supported() else (4 if is_sm100_supported() else 1)
num_stages = 1 if _is_sm120_supported else (4 if _is_sm100_supported else 1)
output = mxfp8_block_scaled_matmul_triton(
q_input,
a_scale_packed,
Expand Down
Loading