Repository navigation
cuda contract: NVFP4_NZ5's stress fill holds +5s, read as 5 by the float64 reference - #3543
Conversation
|
Thanks @Bizuayeu, this is exactly the follow up point 1 asked for. The stress fill holding fives among its fours and sixes with the sums still exact in any order, the reference reading No asks. We will run the contract entry once on a GB10 to see the two controls red as planted, and then this queues.
|
|
Thanks @Bizuayeu. The stress fill holding fives among its fours and sixes, the reference reading the nz5 code as five, and the second planted control that goes red only with the stress call are exactly what the review point asked for. Showing No asks remain. We will run the contract entry on our side before this lands.
|
a9b1134 to
8b368ef
Compare
|
Thanks @Bizuayeu. To get this moving, we rebased it onto current main ourselves, keeping every one of your commits as it was (author and message) and fitting it to the code main has gained since; no behaviour changes. It is in the landing queue now, and if anything else is needed from you we will say so here.
|
|
I ran the filtered contract independently on an RTX 5090 Laptop GPU (SM 120), using Zig 0.17.0 and CUDA 13.1.115. The trial merge of zig build compile-cuda-tests -Dnvcc=/usr/local/cuda/bin/nvcc \
-Dsm=120 -Doptimize=ReleaseFast -j6 --summary all
tf-cuda-test kernel-contract NVFP4_NZ5The build passed all 175 steps. All five kernels passed gates 1–4, and both controls went red at their intended gates: the original at shapes and the new stress control at sums, 35.8× over the exact-sum bound at K=4096. The filtered run exited 0 with no missed controls or limit problems. This adds SM 120 device coverage to the author's SM 121 receipt. Igor Lessio - AIFLOW LABS |
|
Thanks @Bizuayeu. Nothing has changed in the code since our last review: the rebased head The independent SM 120 run posted here, at this head, shows both controls red at their intended gates, the new one at There are no asks for you. It lands after CI is green at
|
Thanks for running it on SM 120, and for checking both controls go red at their gates. |
…oat64 reference plant put NVFP4_NZ5's +5s only into the random fill, so gate 4 (sums) and the non-finite gate never saw one on the nz5 kinds, and each +5 stood alone in its group at a power-of-two scale. The stress fill now holds +5s among its 4s and 6s. NVFP4_NZ5 has no -5 to mirror one, so they come two on equal inputs, mirrored by a -4 and a -6: the sums stay exact in any order and the result as small as before. The float64 reference reads nz's codes, 0b1000 as 5, under block 32's scales, which on the random and non-finite fills is the value block 16's reading gave. The non-finite fill plants +5s as the random fill does, and E2M1's entry on the stress fill's codes is a second planted control, red at gate 4. The fills and the weight live in contract_nvfp4_nz5.zig, plant moved there unchanged, so contract_nvfp4_fact.zig stays within 600 lines.
8b368ef to
5b7bb38
Compare
|
Thank you @Bizuayeu. 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. |
#2894's review, point 1:
plantput NVFP4_NZ5's+5s only into the random fill, so gate 4 (sums) and the non-finite gate never saw one on the nz5 kinds, and each+5stood alone in its group at a power-of-two scale. Here gate 4's stress fill holds+5s among its 4s and 6s, the float64 reference reads0b1000as 5, and a second planted control shows that gate 4 now reads them.tf-cuda-test kernel-contract NVFP4_NZ5, GB10 (sm_121)693cee1496)nz5.stressPASSlinesPASSlinesnz5_control, E2M1's entry on the nz5 codesshapes, as plantedshapes, as plantednz5_sums_control, E2M1's entry on the stress fill's codessums, as planted:35.8x over its exact-sum bound at k 4096CONTROL MISSED:sums did not go redFAIL kernel-contract: 0 gate failures, 1 controls missed, 0 limit problemsThe right column is a tree built only for this table and never pushed.
What this changes
zig/tests/cuda/contract_nvfp4_nz5.zig, new: NVFP4_NZ5's codes incontract_nvfp4_fact.zig's fills, and the float64 weight its block 32 entries read.stress: in K's first half, each group of 32 gets a pair of equal inputs, at an even offset from 2 to 30 so never input 0, which has no mirror. The mirror half gets the same pair. Each column then holds one of three in each group: the stress fill's own mirror;+5,+5against-4,-6in the mirror; or the halves swapped. NVFP4_NZ5 has no-5to mirror a+5, but 5x + 5x - 4x - 6x = 0, so the sums stay exact in any order and the result is as small as before.weight:nz's nibble,0b1000as 5, under its group of 32's e4m3 scale (basesandoffsets). On the random and non-finite fills this is the value block 16's reading gave.plant, moved fromcontract_nvfp4_fact.zigunchanged, so that file stays within 600 lines (581).contract_nvfp4_fact.zig: the non-finite fill plants+5s as the random fill does, and the stress fill callsnz5.stress. The reference reads the nz5 kinds throughnz5.weight.nz5_sums_controlis a second planted control: E2M1's entry (tf_nvfp4_decode32_swiglu) on the stress fill's codes, each+5read as-0, red at gate 4.docs/kernel-contract.md: NVFP4_NZ5's sentence says what gate 4's stress fill holds and names the second control.Issue: Refs glm cuda: NVFP4_NZ5 checkpoints, block 32's experts with E2M1's code 0b1000 read as +5 #2894, its review's point 1, which the review said could be a follow-up.
Stacked on:
main(e7e24243d6), which has glm cuda: NVFP4_NZ5 checkpoints, block 32's experts with E2M1's code 0b1000 read as +5 #2894.atc overlap --json:complete: false(timeLimit), with no pull request listed; its fourworktreeOverlapsrows are other local working trees of this checkout, not pull requests. By the file lists of the 422 open pull requests, none touches either contract test file.docs/kernel-contract.mdis shared with 74 of them, each adding its own paragraph; this changes NVFP4_NZ5's sentence alone. The branch merges without conflicts intomainat08f1de5941, 20 commits past its base, none of them in these three files.Checks on this head
a9b1134415. Over693cee1496it changes CHANGELOG.md alone, and every run here is of693cee1496. Besides that line, three files: two of the CUDA contract's test files anddocs/kernel-contract.md. No kernel, engine or served binary changes.python3 tools/zig/lean_check.py, on the base and on this head: 337 problems on both, 0 new (lean_new.py).python3 tools/pr_check.py --base origin/main: on this branch and on it merged intomainat08f1de5941, 0 errors, 0 warnings with--pr, 4 changed files, lean 337 against 337 with 0 new.693cee1496:zig fmt --check build.zig zig;zig build compile-cuda-tests, 10 of 10 steps;zig build test-cuda-host, 6,807 of 6,841 with 34 skipped and 0 failed (408 of 408 steps);python3 tools/zig/cuda_common_check.py; and pytest as CI runs it (python -m pytest -q -rsfrom the root, with clang++ and Zig 0.17.0 on PATH), 516 passed, 86 skipped, 0 failed, 616 subtests. CI's pytest onmainat this base gave 518 passed and 84 skipped: the two more skips here aretools/zig/test_nfkd_tables.py's two tests (this interpreter has Unicode 15.0.0). On one GB10 (sm_121):tf-cuda-test kernel-contract NVFP4_NZ5on693cee1496and on the tree without the call (the table), and the whole contract,zig build kernel-contract, onmainand on693cee1496(under Kernel contract below).a9b1134415: fmt, zig, zig-b, zig-windows, zig-macos-dev-tools, pytest, benchmark-clients on Ubuntu and Windows, and release-paths. host-nightly-linux and host-nightly-macos were skipped.docs/kernel-contract.md.zig build test, the full host suite: nothing underzig/srcchanges. Any CUDA chip but GB10.Receipt
n/a: only the contract's fills, its float64 reference and one control change. No kernel changes, nor anything that builds or serves a model, so this cannot reach inference.
Kernel contract, only when a GPU kernel is new or changed
No kernel is new or changed. The table above and this section are the contract's own output on the changed fills.
tf_nvfp4_nz5_*), each bit-equal to the block 16 instance it replaces on the same values.tf_nvfp4_decode32_swigluon NZ5's codes) still goes red atshapes, and the newnz5_sums_controlgoes red atsums. Without the call tonz5.stressthe new control isCONTROL MISSED(the table's right column).SUMMARYline and exit status: CUDA on one GB10 each, nvcc 13.0, Zig 0.17.0, each tree built with an empty Zig global cache.main(e7e24243d6):SUMMARY 657 kernels: 657 pass gates 1-4, 0 fail, 8 known findings; 420 controls: 420 red as planted, 0 missed; 186 limit problems; …693cee1496):SUMMARY 657 kernels: 657 pass gates 1-4, 0 fail, 8 known findings; 421 controls: 421 red as planted, 0 missed; 186 limit problems; …FAIL,KNOWN,CONTROLandlimitslines, with timings masked, this head adds the new control'sFAIL sumsandCONTROLlines. The one other line that differs is the atomic-add control's first differing byte (4 onmain, 0 here), which moves from run to run (docs/kernel-contract.md: "its order changes from run to run"). The 186 limit problems are the same lines on both: 183 launches withno compiled usage recordedat one SM and threeFAIL limits livelines (fn_row_topk,tf_exl3_prompt_gu,tf_exl3_prompt_down), none of them innvfp4_experts32. Both runs end inFAIL kernel-contract: 0 gate failures, 0 controls missed, 186 limit problems, exit status 1.Checklist
a9b1134415, two commits onmainate7e24243d6:693cee1496, which every run here is of, and CHANGELOG.md's line.)nz5_sums_control: red atsumson this head, andCONTROL MISSEDon the same tree without its call tonz5.stress, the table's right column. It runs insidetf-cuda-test kernel-contract, on a GPU; no host test is new.)