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]>
The Nemotron CUDA engine admits Volta for its MLX 4-bit checkpoint: - Routed and shared experts (cuda/experts_volta.cu): mma.m8n8k4 over the blocks experts.py packs for the sm_80 kernels, one weight column a thread, each group expanded to fp16(q * s + b), rows scaled by a power of two so every bf16 value is an exact fp16, fp32 sums over K in group order. A pair's bits never depend on the other pairs of its call; decode and prompt items take the same kernel. The plan kernels move to experts_plan.cu, shared by both builds. - Prompt matmuls take the dense fp16 cuBLASLt path of qmm_volta; the Mamba scan extension declares Volta; the two-rank vocabulary split slices the stored layout when the head is in Volta's tiles. - test_experts.py compares the Volta sums with float64 at fp16 weight precision.
|
Thank you, @RoscoeTT. Nemotron on a V100 with a grouped expert kernel whose pairs never depend on each other, and a description that says exactly which sums change on sm_70, is careful work. The Python engine is frozen (#286), so this won't merge. Nemotron does run on Zig CUDA, but only on GB10 at sm_121 and from the command line, so V100s wait for Zig CUDA to take an sm_70 target. When it does, your expert kernel is the starting point, with your credit. By default the Zig engine keeps stored weights exact, so its kernel would keep the 4-bit codes apart from the scales until the fp32 sums, as the sm_80 kernel does. Your kernel rounds each dequantized weight to fp16 before the products, which is why the expert test moved from 1e-5 to 1e-3, so that path would come along as an opt-in mode, off by default. |
What this changes
Nemotron 3.5 Lightning (the MLX 4-bit checkpoint with its MTP head) on Tesla V100s, compute capability 7.0. It sits on #264, which adds the Volta engine for Qwen3.8-27B: this pull request's one commit is the last on its branch, and the three before it are #264's. Volta has no
ldmatrix, no bf16mmaand nocp.async, so the grouped expert kernels get an sm_70 version. Everything else Nemotron needs on Volta already runs there, or reuses #264's paths.cuda/experts_volta.cu):mma.m8n8k4over the same blocksexperts.pypacks for the sm_80 kernels. One weight column a thread, each 64-input group expanded to fp16(q * s + b), each row scaled by a power of two so every bf16 value is an exact fp16, and fp32 sums over K in group order. A (row, slot) pair's bits never depend on the other pairs of its call. Decode and prompt items take the same kernel. The plan kernels move unchanged fromexperts.cutoexperts_plan.cu, which both builds compile.qmm_volta.prompt_matmul).need=VOLTA; it is plain CUDA), the engine admits Volta, and the two-rank vocabulary split slices the stored layout when the head is in Volta's tiles.Which sums change on sm_70: the expert weights are fp16(q * s + b) with fp32 sums over K, not the sm_80 kernel's exact nibble products scaled per group. So the bits are this engine's own, as with #264, and
test_experts.pychecks the Volta sums against float64 at fp16 weight precision (1e-3 of the largest output instead of 1e-5). The sm_80 path is unchanged: the same sources apart from the moved plan kernels.Receipt
TensorFold/NVIDIA-Nemotron-3.5-Lightning-30B-A3B-MLX-4bit. The server ran--context 240000for the cold-prompt and needle runs and--context 26000for the other runs.tools/bench_concurrent.py --levels 1,2,4 --alone --serialon code and chat at temperatures 1.0 and 0. Every row has 0 unequal and 0 failed: 84 concurrent replies equal their solo runs, and 30 solo runs equal"draft": false.tools/bench_openai.py, median tok/s): fibonacci-raw 206.8 at temperature 1.0 and 226.9 at 0; gpu-chat-no-think 169.3 at 1.0 and 228.2 at 0. Underbench_concurrent, 2 and 4 streams hold the single-stream rate (Nemotron's CUDA requests take turns). There is no "before": this model did not start on Volta.tools/prefill_cold.py, tok/s, the median of 3 cold prompts): 3,410 at 2k, 3,322 at 8k, 3,181 at 16k, 2,930 at 32k and 2,517 at 64k. Again there is no "before" on this GPU, and the sm_80 prompt path is untouched.test_experts.py, all fivetest_nemotron_*CUDA modules and the three host Nemotron modules: 60 passed and 11 skipped. The skips are the MLX-only host modules and the real-checkpoint tests.TF_NEMOTRON_MODELset, the real-checkpoint tests also pass when each module runs alone (test_nemotron_app.py6 of 6, and the checkpoint test intest_nemotron_forward.py). Run in one session, the modules' fixtures each hold the 18 GB model and run out of a 32 GB card's memory.tests/tree, run on Qwen3.8-27B on Tesla V100 (sm_70): Volta kernels #264's branch and on upstream 0.6.3 on the same V100 and diffed: no test fails only on the branch.experts.cu,experts_prefill.cu,experts_pack.cu,experts_plan.cu) compile for sm_89.test_nemotron_tp.pyon one card, not two V100s. Only V100 PCIe 32 GB cards were used.How it compares with llama.cpp
Same card, same client and prompts, greedy, thinking off,
--context 26000, and every request with a fresh prefix. llama.cpp is b11115 onggml-org/NVIDIA-Nemotron-3.5-Lightning-30B-A3B-GGUFQ4_0 (about 4.5 bits a weight, as for the MLX checkpoint), with its MTP head at 2 and 4 drafts and-ub 2048. Each cell is the median of 1 to 3 requests.--no-draftsWhere it is not faster: