[Bugfix][Quantization] Guard the MXFP8 FlashInfer path on FlashInfer availability (#52648)
Signed-off-by: Han Li <han.li124@imperial.ac.uk> Signed-off-by: Misha Goin <mgoin64@gmail.com> Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com> Co-authored-by: Misha Goin <mgoin64@gmail.com>
Han committed
Aug 18, 2026 at 03:38 UTC
69d3335066718b7e2b3d00713e02646874b424a9
2 files changed
+10
-5
vllm/model_executor/kernels/linear/mxfp8/flashinfer.py
+8
-4
@@ -11,7 +11,7 @@ from vllm.model_executor.layers.quantization.utils.mxfp8_utils import (
11
)
12
from vllm.platforms import current_platform
13
from vllm.utils import flashinfer as vllm_flashinfer
14
-from vllm.utils.flashinfer import has_flashinfer_cutedsl
14
+from vllm.utils.flashinfer import has_flashinfer, has_flashinfer_cutedsl
15
16
from .Mxfp8LinearKernel import Mxfp8LinearKernel, Mxfp8LinearLayerConfig
17
@@ -23,9 +23,13 @@ class FlashInferCutlassMxfp8LinearKernel(Mxfp8LinearKernel):
23
def is_supported(
24
cls, compute_capability: int | None = None
25
) -> tuple[bool, str | None]:
26
- if current_platform.has_device_capability(100):
27
- return True, None
28
- return False, "requires >=sm_100 (Blackwell)"
26
+ if not (
27
+ current_platform.is_cuda() and current_platform.has_device_capability(100)
28
+ ):
29
+ return False, "requires >=sm_100 (Blackwell)"
30
+ if not has_flashinfer():
31
+ return False, "requires FlashInfer"
32
+ return True, None
33
34
@classmethod
35
def can_implement(cls, c: Mxfp8LinearLayerConfig) -> tuple[bool, str | None]:
vllm/model_executor/layers/quantization/utils/mxfp8_utils.py
+2
-1
@@ -177,8 +177,9 @@ def _mxfp8_e4m3_quantize_impl(
177
alignment: int = 0,
178
) -> tuple[torch.Tensor, torch.Tensor]:
179
from vllm.platforms import current_platform
180
+ from vllm.utils.flashinfer import has_flashinfer
181
181
- if current_platform.has_device_capability(100):
182
+ if current_platform.has_device_capability(100) and has_flashinfer():
183
from flashinfer import mxfp8_quantize as flashinfer_mxfp8_quantize
184
185
x_q, x_scales = flashinfer_mxfp8_quantize(