Repository navigation
gemma4 CUDA: Gemma 4 E4B (NVIDIA Nemotron 3.5 Bolt E4B), per-layer inputs and shared KV - #2230
Conversation
|
Thanks @jschmied. On your two questions: |
|
A few things before this leaves draft, @jschmied. Shared layers that only project q and read their owner's cache through one
|
|
Thanks for the review. All five points are in
BF16 per-layer linears are left for a follow-up, as you said. |
|
Thanks @jschmied, all five are in, and the margins table makes the three misses easy to judge. Main has moved under it, so it needs a rebase. Then it can come out of draft and land after the cut. |
e413a38 to
102d431
Compare
|
Rebased onto main Re-run on the rebased head, GB10:
Out of draft now. |
|
Thanks @jschmied. The rebase is clean, the E4B hashes match the pre-rebase ones, and the 12B and 31B are level against main with byte-equal forced logits, so all five points hold. Ready to land after the 1.2.3 cut. |
102d431 to
03ac62e
Compare
…ut.zig's steps, bit-equal on the GPU (ashhart#1222)
…nputs and blocks, shared layers on their owner's cache (ashhart#1222) Layers 24-41 alias the caches of 22 and 23, compute q only and write nothing; the pool, openBytes and the snapshots count and copy the 24 owning layers. Global layers load their own v_proj, the sliding window comes from the geometry. load still refuses the E-series; loadESeries admits it with affine per-layer linears.
…layer linears (ashhart#1222) Receipts on NVIDIA-Nemotron-3.5-Bolt-E4B (mlx_lm.convert 4/64): forced logits against transformers on the same weights, 236 of 239 top-1 (3 near ties), KL mean 0.0013; greedy replies repeat, 2 and 4 streams equal alone, a resumed prompt equals the fresh one. Pages alias shared layers; TF_KV_SHARE still refuses them.
… E4B, logits for gemma4_e4b_compare.py (ashhart#1222)
…ted by the contract (ashhart#1222) tf_gemma4_ple_rows leaves act_rows. Its contract test checks a float64 reference within a derived bound and the host steps' bits, plants two controls (no norm, no token scale), and kernel-contract takes words that filter the kernels and their live limits.
… comment names load
…ry (E4B, 12B, 31B)
…ract_after.zig, gemma4_ple's registration in its own file
03ac62e to
570a61b
Compare
|
Thank you @jschmied. This is merged into main with your commits under your own name, so you're listed as a TensorFold contributor. It ships in the next release, credited to you in the changelog and the release notes. |
Step: test-gradient-serving. Old pins: e166f3f. New base: 063d881 (origin/main). Sets the hash of the 46 changed entries in gradient-serving.tsv to 063d881's bytes; paths, modes (all raw) and note columns are unchanged. pocket-serving-approved.tsv needs no edit: its entries for these files have prefix 0, so they never read the manifest hash. No code changes; 1/1 test passes. Recorded, as merged and reviewed: - #1784 (cf63ff6): Flash Next at --tp 2 splits dense output columns with exact FP32 gathers. - #1784 (cde4fe7): the BF16 prompt tile folds a pinned (cut) weight's whole K-slice order. - #1942 (15f118a): a shared round's DeltaNet steps run as one launch over its lanes. - #1792 (52b9f90): the whole shared expert's down writes straight into its output slot. - #2160 (a54748a): beside another open stream a greedy chain stops at 0.6 a draft; wide rounds draft 6 deep. - #2246 (4294752): at --parallel 1 on one GPU a prompt pass takes 8,192 rows. - #2214 (e4d7f13): kept prompt states with drafts across ranks. - #2230 (1f2c993): Gemma 4's PLE kernel in its own image; controls and blob constant. - #2103 (a3962b4, 194115d): synchronous downloads stage through a pinned bounce, on integrated devices only, and the bounce counts in memory use. - #2289 (e9ee738): the remaining synchronous readbacks use that staging; close() releases it. - #2127 (b2c277a): the lane host's KV ledger counts the paged pool's promises. - 4fb2f65, 60d80da, 8cc6ac4, 36a87df, 41ff25d, efdf28f, fcb1529, f3bcb78, ecef17d, 2ebc3c2, 42d3461, a86c31c, 1913a46, 80218cd: comments, verbatim moves, test-block imports, exports, and opt-in or off-by-default paths only.
|
Thanks @jschmied! This is in TensorFold 1.2.4, out now: https://github.com/ashhart/TensorFold/releases/tag/v1.2.4 |
What this changes
The CUDA half of #1222, on the Gemma 4 CUDA family:
Per-layer inputs. Once per forward after the embedding:
per_layer_model_projectionthrough the existingprojections, the token table gathered by
embed_rows, and one launch in Gemma's own image,tf_gemma4_ple_rowsingemma4_ple.cu, for the scale,the 256-wide norm, the sum with the table row and the mix. Per layer after the MLP: the gate on the residual, GeGLU
with the layer's slice, the projection, then one
addRmsTailwith the post norm and the layer scalar. The steps arelayer_input.zig's.Shared KV. Layers 24-41 alias the caches of 22 and 23, compute q only and write nothing. Global layers load their
own
v_proj; the window comes from the geometry (512). The pool,openBytesandcuda_snap.zigcount and copy the24 owning layers only.
TF_KV_SHAREstill refuses shared layers.Admission.
loadadmits the E-series with affine per-layer linears and refuses BF16 ones by name.Issue: Refs Gemma 4 E4B (NVIDIA Nemotron 3.5 Bolt E4B): per-layer inputs and shared KV, Intel Arc first #1222 (the CUDA half; the Metal half stays with @Mirrdhyn).
Stacked on: main
e166f3f79, eight commits (393f33423toe413a3804).atc overlap --json: no conflicts against open pull requests.The kernel contract gates
tf_gemma4_ple_rows(tests/cuda/contract_ple.zig): float64 within a derived bound and the host steps' bits, non-finite, repeats, fp32 sums, two planted controls.kernel-contracttakes words to run one family's kernels.Checks on this head
e413a3804.zig build testRC 0, 0 errors; the no-GPU CI set RC 0;git diff --checkclean. On a GB10:tf-cuda-test gemma4-ple,gemma4-e4b-forceandgemma4-pages(12B and 31B) pass. Filtered contract:(filtered) SUMMARY 16 kernels: 16 pass gates 1-4, 0 fail, 0 known findings; 2 controls: 2 red as planted, 0 missed; 0 limit problems. 12B and 31B, main against branch (fresh server an arm, page cache dropped): served greedytoken_shaequal on 3 prompts each, forced logits byte-equal on every row; decode 12B main 31.87 tok/s median (spread 0.63 over 6 runs), branch 31.92 (0.64); 31B main 12.71 (0.14), branch 12.71 (0.13). Per round (AB, then BA): 12B branch both (+0.05, +0.04), 31B main then branch (-0.01, +0.03): no difference.Receipt
nvidia/NVIDIA-Nemotron-3.5-Bolt-E4B-BF16at49843eed8db1, every file checked against the publisher's hashes, converted withmlx_lm.convert -q --q-bits 4 --q-group-size 64(mlx 0.32.4, mlx-lm 0.32.2).tf_gemma4_ple_rows: 1 to 512 rows of 42 parts bit-equal to the host steps (tf-cuda-test gemma4-ple).tf-cuda-test gemma4-e4b-force,gemma4_e4b_compare.py), 5 prompts, 239 positions:prefix (2,940 cached) equals the fresh reply.
604 ms for 2,943 tokens cold and 39 ms resumed.
gemma4-pages).