[Bugfix][Quantization] Fix MXFP8 startup crash on layers below mm_mxfp8 shape limits (#54223)

Signed-off-by: samuelkim7 <samuelmwkim@gmail.com>
Signed-off-by: mgoin <mgoin64@gmail.com>
Co-authored-by: mgoin <mgoin64@gmail.com>
This commit is contained in:
Samuel Kim
2026-09-25 02:54:11 +00:00
committed by GitHub
co-authored by mgoin
parent 6936e77ba4
commit f55419c43c
16 changed files with 221 additions and 57 deletions
@@ -3,6 +3,10 @@
import torch
from vllm.model_executor.layers.quantization.utils.mxfp8_utils import (
MXFP8_BLOCK_SIZE,
)
from .Mxfp8LinearKernel import Mxfp8LinearKernel, Mxfp8LinearLayerConfig
@@ -23,6 +27,16 @@ class MarlinMxfp8LinearKernel(Mxfp8LinearKernel):
@classmethod
def can_implement(cls, c: Mxfp8LinearLayerConfig) -> tuple[bool, str | None]:
N, K = c.weight_shape
if N <= 0 or K <= 0:
return False, f"Marlin MXFP8 requires positive N and K, got N={N}, K={K}."
if K % MXFP8_BLOCK_SIZE != 0:
return (
False,
f"Marlin MXFP8 requires K to be divisible by {MXFP8_BLOCK_SIZE}, "
f"got K={K}.",
)
# Tile misalignment is fixed by zero-padding at weight prep.
return True, None
def process_weights_after_loading(self, layer: torch.nn.Module) -> None: