Repository navigation
Conversation
Triton's tl.dot has no tensor-core path on Volta (0.2 TFLOPS) and the shared FP8 and bf16 extensions need sm_80, so the Qwen3.8-27B MLX 4-bit weights get their own kernels, with the row-invariance contract kept: - Decode: mma.m8n8k4 from registers, one weight column a thread, weights repacked once at load (Tiled), rows scaled by a power of two so every bf16 value is an exact fp16, fp32 sums; the K split is a function of the weight's shape and its slices add in order, so a row never depends on the row count. Rows reach the kernel in its fragment order. - Prompts: a dense fp16 copy of each weight and one cuBLASLt algorithm pinned per weight shape (split-K off), so a row's chain over K is the same at every row count and any chunking. - Extensions declare Volta with need=VOLTA; the FP8 and sm_80 builds keep their clear refusal. - The Volta-only tests skip elsewhere; sm_80-only modules skip on Volta with their reasons. Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
- Tree attention (attention_volta.cu): attention.py's chunk partials on mma.m8n8k4, one per-warp routine under two kernels (chunks wholly below the committed keys with every window row in one block; the rest per row with its path keys). A row's partial never depends on its warp mates and a key on a path gives the same bits as the same key committed, so drafted rows equal serial ones. - Prompt attention: PyTorch's memory-efficient (CUTLASS) attention in fp16, one key head at a time with its query heads on the batch axis and its keys and values broadcast without a copy; query rows pad back to a 128-aligned position so a row's tile never moves with chunking. - DFlash2's block attention (draft_attention_volta.cu), with its shape and shared-memory limits checked. Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
The Qwen3.8 engine states its own capability floor at admission (the MLX checkpoint runs on sm_70; EXL3 and NVFP4 packs are refused by name there), and both planners count the fp16 key and value staging of the prompt attention. README, the recipe's V100 section with measurements, the family's kernel map and a changelog entry. Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
…p16 activations) An NVFP4 checkpoint's three kinds of projection (NVFP4, FP8, bf16) get an sm_70 linear, VoltaLinear, on the mma.m8n8k4 skeleton of the 4-bit Volta decode kernel. Weights expand in registers to exact fp16 values (e2m1 code times e4m3 block scale, e4m3, or bf16 scaled by a power of two a column) and one fp32 factor a column is applied last; rows are prep884's power-of-two-scaled fp16 rows. One kernel and one K split, chosen from the weight's shape, serve every row count, and the last K slice adds the slices in slice order, so a row never depends on how many rows share the launch. Prompt rows take a dense fp16 copy of the same values through the pinned cuBLASLt GEMM (chunk invariant); the bf16 head prompts on the decode kernel. The bf16 embedding stays in page-locked host memory and the GPU gathers its rows through the mapped address (HostRows), so admission counts it as no device bytes. nvfp4_load builds these linears on sm_70; the engine admits NVFP4 there (EXL3 is still refused) with two staging copies instead of three. test_qwen27_nvfp4's synthetic model runs on sm_70 with the new linears; tests/cuda/test_qmmf_volta.py checks row-count invariance, the stored values and chunk invariance.
…he CUDA engine's 4-bit/64 rule check() refused every checkpoint but MLX 4-bit in groups of 64 on every host. On a Mac the family decodes through the dense family's row decoder, which reads per-module affine widths and groups, so oQ-style mixed checkpoints were refused although they load and decode exactly. On a Mac the check is now the row decoder's own refusal; CUDA keeps its 4-bit/64 rule.
A ModelOpt export such as nvidia/Qwen3.6-35B-A3B-NVFP4 now serves on the CUDA engine: - FP8 attention and DeltaNet projections load through the 27B's NVFP4 loader, which gains an MLP hook; - routed and shared experts (weight-only NVFP4) run on the grouped NVFP4 kernel, the shared expert last; - layers ModelOpt declares W4A16 keep bf16 activations under checkpoint math; - the bf16 MTP layer (ModelOpt leaves mtp* unquantized) drafts in W4A16 NVFP4, its draft head the lm_head's rows of the draft ids as stored. Admission sizes the prompt staging from the widest MoE projection.
VoltaExperts runs a ModelOpt checkpoint's routed NVFP4 experts on the decode kernel's mma.m8n8k4 chain: items of up to eight (row, slot) pairs of one expert are gathered and staged a 64-input group at a time, gate and up of a column sit side by side with SwiGLU in the epilogue, and down returns fp32 (bf16 in prompts). The K split comes from the shape and the last slice adds the slices in order, so a pair's bits depend only on its row and expert, and the grouping plan (one block) may order an expert's pairs freely. On sm_70 the router rows run as a 16-bit VoltaLinear (fp32 logits); the MTP layer's draft-only NVFP4 linears and experts and the NVFP4 draft head take the Volta forms; the MoE engine admits NVFP4 there. Expert scratch that a CUDA graph capture outgrew is kept rather than freed, since the earlier graph still writes into it. The MLX-affine Qwen3.6 MoE suite skips on sm_70, whose experts kernel needs sm_80; tests/cuda/test_experts_volta.py covers the new kernel.
This was referenced Oct 4, 2026
Owner
|
Thank you, @gilby. Making each routed pair's bits depend only on its own row and expert, so the grouping plan can order an expert's pairs freely, is the property that lets an expert kernel batch rows without changing a reply. Keeping the scratch an earlier captured graph still writes into, instead of freeing it, was a good catch too. The Python engine is frozen (#286), so this won't merge. On the Zig engine it waits for two things: an sm_70 target in Zig CUDA, which builds only for GB10 today, and Qwen3.6 MoE as a Zig family. When both exist, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this changes
Part of #313. Stacked on #264, #374 (
VoltaLinear) and #345 (Qwen3.6 ModelOpt NVFP4 on CUDA). The earlier commits on this branch are #374's (#264's three commits replayed onto v0.6.5, see our note on #264, and #374's own) and same-patch copies of #344's and #345's commits. This pull request is the last commit. A ModelOpt NVFP4 Qwen3.6 MoE checkpoint(
nvidia/Qwen3.6-35B-A3B-NVFP4,ornith-ai/Ornith-1.5-35B-A3B-NVFP4) now serves on one Tesla V100 with its own MTPhead: the routed NVFP4 experts run on a new sm_70 grouped kernel (
VoltaExperts), and the router, the MTP layer'sdraft-only NVFP4 linears and experts, and the NVFP4 draft head take the Volta forms.
experts884_kernel: items of up to eight (row, slot) pairs routed to one expert, their rows gathered and staged a64-input group at a time in the decode kernel's fragment order, the same
mma.m8n8k4chain and fp32 sums. gate andup of a column sit side by side with SwiGLU in the epilogue; down writes fp32 (bf16 in prompts). The K split comes
from the shape and the last slice adds the slices in order. A pair's bits depend only on its own row and expert, so
the one-block grouping plan may order an expert's pairs freely.
VoltaLinear(fp32 logits);moe.moedispatches toVoltaExperts.tests/cuda/test_experts_volta.pychecks pair independence and the fp32 reference.
Bits: as #374, W4A16 with fp16 activations and fp32 sums, the stored weights exactly; drafted equals this engine's
serial decoding, and the bits differ from the sm_80+ engine's.
Receipt
V100-PCIE-32GB (sm_70), one card, in a VM, 200 W cap; PyTorch 2.10.0+cu128, Triton 3.6, CUDA 12.8.
nvidia/Qwen3.6-35B-A3B-NVFP4andornith-ai/Ornith-1.5-35B-A3B-NVFP4, own MTP heads. Our own numbers below were measured on 0.6.2 + Qwen3.8-27B on Tesla V100 (sm_70): Volta kernels #264's0.6.2 commits + the local equivalents of feat(volta): Qwen3.8-27B NVFP4 checkpoints on sm_70 (W4A16 / W8A16, fp16 activations) #374, feat(qwen3.6 cuda): read ModelOpt NVFP4 checkpoints #345 and this change. On this branch: the test suites (the v0.6.5 line below) and one served check (the v0.6.5 check).
tools/bench_concurrent.py --alone --serialortoken_shaagainst"draft": false: our own A/Bscript: drafted ==
"draft": false(3 prompts), N=2/N=4 == serial, for both checkpoints. Not yet run with upstream's tool on this PR alone.tools/bench_openai.py: before is a refusal (no MoE NVFP4 on Volta). Ours(512-token greedy replies):
nvidia/Qwen3.6-35B-A3B-NVFP4184.6 tok/s single stream, N=2 134–148, N=4 182–196,N=8 372–390 aggregate; Ornith 163–165 single (concurrent rows noisy). Not yet run with upstream's tool on this PR alone.
tools/prefill_cold.py: ours: 4,017 tok/s (Qwen3.6) and 4,005 (Ornith) on a ~6Knonce prompt. Not yet run with upstream's tool.
test_flashnext_nvfp4_loader, which skips on sm_70 from feat(volta): Qwen3.8-Flash-Next NVFP4 checkpoints on sm_70, one GPU or four ranks #380);test_experts_voltaandtest_qmmf_voltapass andtest_qwen36_moeskips on sm_70. No serve receipt on this PR alone.test_experts_volta.pypassed, 334 passed / 40 skipped over the 27B and new suites.tests/cuda -k qwen36on an sm_80+ card was not run.nvidia/Qwen3.6-35B-A3B-NVFP4with its own MTP head,--context 32768 --parallel 1(startup 25.36 GiB of 27.43): fresh == resumed (2,254 of 2,259 tokens from the prompt cache) =="draft": false,token_sha3193472defb8; 19 × 23 drafted =="draft": false006f69232d31. New tests on Tesla V100s, this branch's test files copied into the parent's tree, then here:tests/cuda/test_experts_volta.py+tests/cuda/test_qwen36_moe.pyfail to import; here 5 passed, 1 skipped. Prompt speed on a checkpoint v0.6.5 serves,RadixArk/Qwen3.8-27B-NVFP4-BF16-LMHead+z-lab/Qwen3.8-27B-DFlash2on one DGX Spark (GB10),tools/prefill_cold.py(2k / 8k / 16k, 3 reps, median tok/s; runs v0.6.5, this, this, v0.6.5, each side the mean of its two), v0.6.5 → the top of this stack (feat(volta): Qwen3.8-Flash-Next NVFP4 checkpoints on sm_70, one GPU or four ranks #380's tree): 2,591 → 2,606 / 2,840 → 2,855 / 2,731 → 2,751 (the sm_70 code is gated onbuild.volta(), so GB10 does not run it).tools/bench_concurrent.pyandtools/bench_openai.pyon this PR alone (the concurrent receipts are on feat(volta): Qwen3.8-27B NVFP4 checkpoints on sm_70 (W4A16 / W8A16, fp16 activations) #374 and feat(volta): Qwen3.8-Flash-Next NVFP4 checkpoints on sm_70, one GPU or four ranks #380), and an sm_80+ card. Platforms: CUDA sm_70 (Tesla V100-PCIE-32GB) only; the sm_80+path is unchanged except
make_experts'volta()branch, not re-run here. Metal untouched.Checklist
"draft": false, a resumed prompt equals a fresh one, and concurrent equals solo. (Served alone on one V100: drafted =="draft": falseand resumed == fresh (see the v0.6.5 check); concurrent == solo was not run on this PR alone (see feat(volta): Qwen3.8-27B NVFP4 checkpoints on sm_70 (W4A16 / W8A16, fp16 activations) #374 and feat(volta): Qwen3.8-Flash-Next NVFP4 checkpoints on sm_70, one GPU or four ranks #380).)RadixArk/Qwen3.8-27B-NVFP4-BF16-LMHeadon one DGX Spark (GB10), the top of this stack is within noise of v0.6.5 (+0.5 to +0.7%); see the v0.6.5 check.)test_experts_volta.pyskips off sm_70 at module level.)The three #264 commits carried here are RoscoeTT's as replayed onto v0.6.5; their Co-Authored-By trailers are his.