[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
@@ -50,7 +50,9 @@ def test_flashinfer_trtllm_mxfp8_linear_numerics(
x = torch.randn((m, k), dtype=torch.bfloat16, device="cuda")
weight = torch.randn((n, k), dtype=torch.bfloat16, device="cuda")
layer = _make_layer(weight)
kernel = FlashInferTrtllmMxfp8LinearKernel(Mxfp8LinearLayerConfig())
kernel = FlashInferTrtllmMxfp8LinearKernel(
Mxfp8LinearLayerConfig(weight_shape=(n, k))
)
kernel.process_weights_after_loading(layer)
output = kernel.apply_weights(layer, x)
@@ -69,7 +71,9 @@ def test_flashinfer_trtllm_mxfp8_custom_ops() -> None:
x = torch.randn((7, 512), dtype=torch.bfloat16, device="cuda")
weight = torch.randn((256, 512), dtype=torch.bfloat16, device="cuda")
layer = _make_layer(weight)
kernel = FlashInferTrtllmMxfp8LinearKernel(Mxfp8LinearLayerConfig())
kernel = FlashInferTrtllmMxfp8LinearKernel(
Mxfp8LinearLayerConfig(weight_shape=(256, 512))
)
kernel.process_weights_after_loading(layer)
torch.library.opcheck(
@@ -104,7 +108,9 @@ def test_flashinfer_trtllm_mxfp8_linear_cuda_graph() -> None:
m, n, k = 7, 130, 512
weight = torch.randn((n, k), dtype=torch.bfloat16, device="cuda")
layer = _make_layer(weight)
kernel = FlashInferTrtllmMxfp8LinearKernel(Mxfp8LinearLayerConfig())
kernel = FlashInferTrtllmMxfp8LinearKernel(
Mxfp8LinearLayerConfig(weight_shape=(n, k))
)
kernel.process_weights_after_loading(layer)
static_x = torch.randn((m, k), dtype=torch.bfloat16, device="cuda")