Skip to content

fix(moe): keep the triton casts in mxfp8 prefill when triton's ptx is older than 9.2 - #955

Merged
jason-fxz merged 1 commit into
FlashML-org:mainfrom
ischencheng:fix/mxfp8-cvt-ptx-version
Nov 26, 2026
Merged

jason-fxz merged 1 commit into
FlashML-org:mainfrom
ischencheng:fix/mxfp8-cvt-ptx-version

Conversation

@ischencheng

Copy link
Copy Markdown
Contributor

The MXFP8 prefill kernel from #954 takes the inline cvt.rn.bf16x2.e4m3x2 path on every sm_100+ GPU, but that instruction needs PTX ISA 9.2 (ptxas 13.2 or later). Triton writes the PTX version its sm_100+ ptxas supports, and importing flashinfer points that ptxas at the one on PATH whenever it is CUDA 13 or later (flashinfer/triton/__init__.py, _patch_triton_ptxas_blackwell). docs/install.md asks for a CUDA 13 toolkit with nvcc on PATH; with 13.0 there, Triton writes .version 9.0, and every MXFP8 expert prefill on sm_120 (RTX 50, RTX PRO 6000) fails in ptxas:

ptxas /tmp/tmp9ktpk8b0.ptx, line 843; error   : Unexpected instruction types specified for 'cvt'
triton.runtime.errors.PTXASError: PTXAS error: Internal Triton PTX codegen error

This keeps the Triton casts unless the PTX Triton writes for sm_100+ is 9.2 or later. The two paths give the same bits (#954 says so, and the table below checks it), so only the speed differs.

No test is added: with a CUDA 13.0 ptxas the existing test_mxfp8_moe_matches_dequant_reference cases are the red and green below.

Results

RTX PRO 6000 Blackwell Server Edition (sm_120), driver 620.70.06, torch 2.14.1+cu130, Triton 3.8.0, flashinfer 0.6.18.post1, CUDA 13.0.88 toolkit on PATH. "system" is Triton's sm_100+ ptxas as flashinfer leaves it (/usr/local/cuda/bin/ptxas, 13.0, PTX 9.0); "bundled" sets TRITON_PTXAS_BLACKWELL_PATH to Triton's own ptxas-blackwell (13.3, PTX 9.3).

pytest tests/kernels/test_mxfp8_linear.py tests/kernels/test_e4m3_compat.py tests/moe/test_mixed_expert_formats.py tests/moe/test_cpu_moe.py -m "not slow":

system bundled
main 3cdcc80 17 failed, 123 passed: all 16 test_mxfp8_moe_matches_dequant_reference cases and test_mixed_layers_decode_and_prefill_through_their_pools 140 passed
this PR 140 passed 140 passed

fused_experts_mxfp8 on Inkling-2-Mini's expert shape (128 experts, top-8, hidden 2304, intermediate 1152), random banks, eager, median of 15 timed runs, us:

tokens Triton casts (system) native cvt (bundled) same bits
64 727.9 725.4 yes
512 796.3 795.2 yes
2048 1407.5 1297.6 yes
8192 4289.4 3953.6 yes

So where Triton's sm_100+ ptxas is older than 13.2, the MXFP8 expert GEMMs take about 8.5% longer at 2048 and 8192 tokens, instead of failing.

No model reader on main emits MXFP8 experts yet; the first is Inkling-2-Mini in #942. On #942 (908cf43), with the container's CUDA 13.0 ptxas, LLM("thinkingmachines/Inkling-2-Mini", moe_strategy="fused", max_running_req=2, max_seq_len_override=8192, memory_ratio=0.9, cuda_graph_max_bs=2, moe_collect_stats=True) fails in the warmup prefill with the ptxas error above. With this commit on top of #942's 3314730 it loads (expert banks: mxfp8 / triton on 4 of 24 MoE layers), and the free-running parity against the transformers reference on four prompts (26 to 3993 tokens, one with an image; LLM("thinkingmachines/Inkling-2-Mini", moe_strategy="fused", max_running_req=2, max_seq_len_override=16384, cuda_graph_max_bs=2)) gives the same per-layer errors, logits and greedy tokens as with Triton's own ptxas. The 3993-token prompt's TTFT is 0.587 s, 0.584 s with Triton's own ptxas in another container. The containers report no CPU model name.

Not run on sm_100, and not with a CUDA 13.1 or 13.2 toolkit.

@jason-fxz
jason-fxz merged commit b840b49 into FlashML-org:main Nov 26, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants