Skip to content

Nemotron 3.5 Lightning on Tesla V100 (sm_70), on #264 - #292

Closed
RoscoeTT wants to merge 4 commits into
ashhart:mainfrom
RoscoeTT:nemotron-v100-sm70
Closed

RoscoeTT wants to merge 4 commits into
ashhart:mainfrom
RoscoeTT:nemotron-v100-sm70

Conversation

@RoscoeTT

@RoscoeTT RoscoeTT commented Oct 3, 2026

Copy link
Copy Markdown

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 bf16 mma and no cp.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.

  • Experts (cuda/experts_volta.cu): mma.m8n8k4 over the same blocks experts.py packs 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 from experts.cu to experts_plan.cu, which both builds compile.
  • Prompt matmuls take Qwen3.8-27B on Tesla V100 (sm_70): Volta kernels #264's dense fp16 cuBLASLt path (qmm_volta.prompt_matmul).
  • Small changes: the Mamba prompt scan declares Volta (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.
  • Unchanged on Volta: the Triton attention, Mamba conv and recurrent kernels, router and norms all run there as they are.

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.py checks 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

  • Environment: this branch (0.6.3 plus Qwen3.8-27B on Tesla V100 (sm_70): Volta kernels #264), PyTorch 2.14.1 with CUDA 12.6, one Tesla V100 PCIe 32 GB at 250 W, and the checkpoint TensorFold/NVIDIA-Nemotron-3.5-Lightning-30B-A3B-MLX-4bit. The server ran --context 240000 for the cold-prompt and needle runs and --context 26000 for the other runs.
  • Exactness: tools/bench_concurrent.py --levels 1,2,4 --alone --serial on 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.
  • Decode (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. Under bench_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.
  • Prompt speed (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.
  • Long context: the startup estimate admits a 247,792-token window on one card. At 240,000, a needle in the middle of a 117,398-token prompt was found (57 s to fill, then 72 tok/s), and one in a 231,786-token prompt too (160 s, then 43 tok/s).
  • Tests: on the V100:
    • test_experts.py, all five test_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.
    • With TF_NEMOTRON_MODEL set, the real-checkpoint tests also pass when each module runs alone (test_nemotron_app.py 6 of 6, and the checkpoint test in test_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.
    • The whole 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.
    • The sm_80+ expert sources (experts.cu, experts_prefill.cu, experts_pack.cu, experts_plan.cu) compile for sm_89.
  • Not run, and why: no sm_89+ GPU here (the 3090s are sm_86, which TensorFold refuses), so the sm_80 expert path is compiled but not executed. There is no Metal, as the change is CUDA only. Two ranks were exercised only through test_nemotron_tp.py on 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 on ggml-org/NVIDIA-Nemotron-3.5-Lightning-30B-A3B-GGUF Q4_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.

decode, tok/s chat code 3k document 15k document
llama.cpp, no drafts 133 132 129 128
llama.cpp, MTP (best of 2 and 4) 196 243 207 233
TensorFold, --no-drafts 115 116 113
TensorFold, MTP 197 266 237 172
prompt, tok/s 3k 15k
llama.cpp 1,924 2,218
TensorFold 3,323 3,179

Where it is not faster:

  • Serial decoding is about 13% slower than llama.cpp's (115 against 132 tok/s). The fp16 expert kernel reads each group once a column and is not tuned yet.
  • Drafting pays on short, predictable replies: even on chat, and 9 to 15% ahead on code and the 3k document. At 15k llama.cpp's MTP is 26% faster, and that column is one request per engine.
  • Prompts fill 1.4 to 1.7 times faster.

RoscoeTT and others added 4 commits October 2, 2026 20:20
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.
@ashhart

ashhart commented Oct 3, 2026

Copy link
Copy Markdown
Owner

Thank you, @RoscoeTT. Same tier as #264, which this is stacked on: community-supported and experimental. We review it after #264 lands, starting with its sm_70 grouped expert kernel.

@ashhart

ashhart commented Oct 6, 2026

Copy link
Copy Markdown
Owner

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.

@ashhart ashhart closed this Oct 6, 2026
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