[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>
This commit is contained in:
co-authored by
Claude Opus 5
Misha Goin
parent
cdb8545a91
commit
69d3335066
@@ -11,7 +11,7 @@ from vllm.model_executor.layers.quantization.utils.mxfp8_utils import (
|
||||
)
|
||||
from vllm.platforms import current_platform
|
||||
from vllm.utils import flashinfer as vllm_flashinfer
|
||||
from vllm.utils.flashinfer import has_flashinfer_cutedsl
|
||||
from vllm.utils.flashinfer import has_flashinfer, has_flashinfer_cutedsl
|
||||
|
||||
from .Mxfp8LinearKernel import Mxfp8LinearKernel, Mxfp8LinearLayerConfig
|
||||
|
||||
@@ -23,9 +23,13 @@ class FlashInferCutlassMxfp8LinearKernel(Mxfp8LinearKernel):
|
||||
def is_supported(
|
||||
cls, compute_capability: int | None = None
|
||||
) -> tuple[bool, str | None]:
|
||||
if current_platform.has_device_capability(100):
|
||||
return True, None
|
||||
return False, "requires >=sm_100 (Blackwell)"
|
||||
if not (
|
||||
current_platform.is_cuda() and current_platform.has_device_capability(100)
|
||||
):
|
||||
return False, "requires >=sm_100 (Blackwell)"
|
||||
if not has_flashinfer():
|
||||
return False, "requires FlashInfer"
|
||||
return True, None
|
||||
|
||||
@classmethod
|
||||
def can_implement(cls, c: Mxfp8LinearLayerConfig) -> tuple[bool, str | None]:
|
||||
|
||||
@@ -177,8 +177,9 @@ def _mxfp8_e4m3_quantize_impl(
|
||||
alignment: int = 0,
|
||||
) -> tuple[torch.Tensor, torch.Tensor]:
|
||||
from vllm.platforms import current_platform
|
||||
from vllm.utils.flashinfer import has_flashinfer
|
||||
|
||||
if current_platform.has_device_capability(100):
|
||||
if current_platform.has_device_capability(100) and has_flashinfer():
|
||||
from flashinfer import mxfp8_quantize as flashinfer_mxfp8_quantize
|
||||
|
||||
x_q, x_scales = flashinfer_mxfp8_quantize(
|
||||
|
||||
Reference in New Issue
Block a user