Repository navigation
cuda exl3: the grouped baseline control's word indices once a warp on sm_120 and sm_121 - #5262
Merged
Merged
Conversation
Bizuayeu
force-pushed
the
pr/exl3-plain-once
branch
from
November 26, 2026 22:42
24a5cdd to
9822aca
Compare
Bizuayeu
marked this pull request as ready for review
November 27, 2026 03:17
ashhart
force-pushed
the
pr/exl3-plain-once
branch
from
November 27, 2026 09:43
9822aca to
f7962d7
Compare
8 tasks done
ashhart
force-pushed
the
pr/exl3-plain-once
branch
from
November 28, 2026 02:44
f7962d7 to
d1f7489
Compare
… sm_120 and sm_121 Gate 3 holds tf_exl3_grouped_* (a tile read ahead from sm_120 on) bit-equal to main's loop, which contract_controls keeps as tf_ctl_exl3_grouped_old_*: grouped_body with LOAD == PLAIN. sm_120 and sm_121 build PLAIN only there, as the served images read ahead. With nvcc 13.3 on a GB10, identical compiles of contract_controls_set.cu at compute_120 and 121 gave three and two PTX forms, which differ only in those entries: where the k loop's invariant index work (the lane's word indices (word + i) % TW, the decode's per-lane addresses) sits, before the loop or in it, block by block; the .text of tf_ctl_exl3_grouped_old_0 differs between them. There, warp_tiles now works out the lane's word indices once, before the loop, and reads each tile's words through them (ldg_at): the same words, in the same order, into the same decode. Other SMs and the other loads build as before, so every served image is unchanged. The records of the three controls at sm_120 and sm_121 follow: 13.0's 128, 127 and 126 registers, and 13.3's 128 for old_0. Their static shared bytes, already stale on main, become the 32896 that kernel-contract-limits and the driver give at every SM with both releases (32832 recorded), so the controls' live limits pass.
ashhart
force-pushed
the
pr/exl3-plain-once
branch
from
November 28, 2026 19:15
d1f7489 to
028057e
Compare
Owner
|
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. |
ashhart
added a commit
that referenced
this pull request
Nov 28, 2026
ashhart
added a commit
that referenced
this pull request
Nov 28, 2026
ashhart
added a commit
to jschmied/TensorFold
that referenced
this pull request
Nov 28, 2026
ashhart
added a commit
that referenced
this pull request
Nov 28, 2026
ashhart
added a commit
that referenced
this pull request
Nov 28, 2026
ashhart
added a commit
that referenced
this pull request
Nov 28, 2026
7 tasks
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
On sm_120 and sm_121, the grouped EXL3 baseline controls (
tf_ctl_exl3_grouped_old_0,_1and_2incontract_controls) work out each lane's word indices once, before the k loop, and read each tile's words through them. These controls aregrouped_bodywithLOAD == PLAIN, main's loop, which gate 3 holds the load-ahead kernels (tf_exl3_grouped_*) to bit for bit. The served kernels read ahead from sm_120 on, so PLAIN is built at sm_120 and sm_121 only for these controls. Every other SM and load builds as before, and the served images are unchanged.This is the fix I said I would look into separately on #5123 (#5123 (comment)). With nvcc 13.3.73 on a GB10, identical compiles of
contract_controls_set.cugive the controls more than one PTX form at compute_120 and 121. The forms differ only in these three entries: where the k loop's invariant index work sits, before the loop or inside it, block by block. That covers the lane's word indices(word + i) % TWand the decode's per-lane addresses. The.textoftf_ctl_exl3_grouped_old_0differs between the forms (141,568 against 141,696 bytes at sm_120). Turning address randomization off, as the SASS identity check does since #5170, does not remove this. Main then repeats one form in a given environment, but a longer source path gave the other form.contract_controls_set.cu, nvcc 13.3.73, one GB10eff4e5b754setarch -R, 4 environments × 8 (short and long source path, 1 KiB and 4 KiB of extra environment)67ae36c4dc, whose EXL3 sources are these)In the GB10 runs below, on this change's kernel sources on main
eff4e5b754and on main91dbadce65, the same 40 compiles gave one PTX form at each of compute_120 and 121, andcuda_sass_compare.pyoncontract_controlsfinds only these three entries changed at sm_120 and sm_121 (754 of 760 functions equal).How:
warp_tileskeepsat[LW], the lane's word indices in a tile (lane_start, then(word + l) % TW), computed before the loop whenLOAD == PLAINand__CUDA_ARCH__ >= 1200.ldg_atreadstile + at[l]for each l. These are the same words in the same order asldg_lane_words, into the samedecode_laneand the samemma16816calls.tf_exl3_grouped_*SASS at all five SMs with both releases (4 to 8 KB of.text), which would need speed receipts, so it is limited to the control.Records: the three controls' sm_120 and sm_121 usage in
exl3_grouped_records.zig(nvcc 13.0) is now 128, 127 and 126 registers, where it was 127, 128 and 128. Inmeasurements/pending_133.zig(nvcc 13.3),old_0is now 128, where it was 127. The three controls' static shared bytes are now 32,896 at all five SMs in both files, where they were 32,832. That was already stale on main:kernel-contract-limitsgives 32,896 for them at every SM with both releases, and on a GB10kernel-contracton the grouped EXL3 kernels fails main's three controls on their live limits (3 limit problems, the driver also gives 32,896). The kernels' shared memory itself is unchanged, with no stack and no spills.207edac2c4, as rebased here:3bc2b4f218(this commit, its records lines) andf7962d76c7(theexl3_grouped.cuhandpending_133.ziglines, adapted to main). Together they change the same lines ase80490eb1b, my rebuild of this commit on main91dbadce65(main'sexl3_grouped.cuhis the same at both), but for the CHANGELOG line. Before that it was one commit, 4 files, on maineff4e5b754.atc overlap --json: atc 0.9.4 withATC_READ_ONLY=1, run in this tree on 2026-11-26 22:38 UTC with--base eff4e5b754:complete: false(otherPullRequestsLimit,pullFilesUnavailable,pullRequestsLimit,timeLimit), 12 pull requests in its working tree's rows, 8clean, 2conflictsand 2unknown.conflict_delta: each open pull request merged bygit merge-treewith main and with this head, and the conflicting files and hunks compared. Over the 405 open pull requests on 2026-11-26 at 22:19 UTC, none that merges cleanly with main conflicts with this head. Of the 23 that already conflict with main, 16 gain a hunk only inpending_133.zig, and H3 video and audio: native Zig VAE decoders and one-run re-voice #5194 one more inCHANGELOG.md. Six gain one inexl3_grouped.cuh(four of them inpending_133.zigtoo): Inkling-2-Small: Add grouped-expert and vision kernels #4127, Inkling-2-Small: Add DSpark drafter kernels #4128, Inkling-2-Small: Serve on two GB10s from an EXL3 pack #4841, Inkling-2: Add DSpark kernels that draft all streams in one pass #4858, Inkling-2-Mini: Serve on two GB10s with images and 1M context window #5059 and inkling2 cuda: serve Mini from a stock EXL3 pack (stacked on #4841) #4966, which add an MT parameter towarp_tiles. Their PLAIN branch is main's, and their served kernels still read ahead at sm_120, so either order rebases by text alone.Checks on this head
f7962d76c7Adapt grouped EXL3 lane precomputation to main, above3bc2b4f218(see the base line). The first GB10 run below is one80490eb1b, the same lines on main91dbadce65; the other receipts were taken on24a5cdd60fon maineff4e5b754, which differs from9822acad4a, the head before the rebase, only in the CHANGELOG line's pull request number. Three of them, the SASS comparisons, the PTX forms and the fatbins against main's, ran on the commit before24a5cdd60f, which differs from it only in the two records files: the samezig/kernels, and24a5cdd60f's build gave fatbins byte-equal to that commit's, every one with nvcc 13.0.88 andcontract_controlswith 13.3.73.tools/pr_check.py --base eff4e5b754 --pr 5262,24a5cdd60fagainst its main): 123 problems on both, 0 new; 0 errors. The 123 are inherited from main.e80490eb1bwith main91dbadce65beside it, each from an empty global cache at the five SMs with nvcc 13.0.88 and 13.3.73:kernel-contract-limitsgives 178 problems against main's 191 with 13.0.88 (main's 15 more are the three controls' records at five SMs; this tree's 2 more aretf_nemo_router_tilesat sm_80 and sm_89, the router entries CUDA build: nvcc 13.0.88 gives the router-tiles entries different PTX between identical compiles, about one in ten #5123 is about, which this change does not reach), and 806 against 821 with 13.3.73 (the same 15).kernel-contract "exl3 grouped" exl3_grouped:(filtered) SUMMARY 5 kernels: 5 pass gates 1-4, 0 fail, 0 known findings; 2 controls: 2 red as planted, 0 missed; 0 limit problems, exit 0; main's the same with3 limit problems, exit 1. Main'scuda_sass_compare.pywith nvcc 13.0.88 on the reached images butcontract_controls(dsv41_x3ld_epi,exl3_experts):SUMMARY PASS images=2 functions=440 scope=explicit; oncontract_controls, 754 of 760 functions equal, the other six being the three controls at sm_120 and sm_121. The fatbins that differ from main's:contract_controlsandnemotron_route(the router entries again) with 13.0.88;contract_controls,dsv41_lin2,qmmandqmm_group(images the change does not reach) with 13.3.73. 40 compiles ofcontract_controls_set.cuwith 13.3.73: one PTX form at each of compute_120 and 121, where main's gave one at 120 and two at 121 (39 and 1).24a5cdd60f(maineff4e5b754): with nvcc 13.0.88 from an empty global cache at sm_80, 86, 89, 120 and 121,zig build compile-cuda-tests fatbins kernel-contract-fatbins.kernel-contract-limits: the three controls' records current at all five SMs; 171 problems, each also among main's 186 (the 15 fewer are these records); with nvcc 13.3.73's fatbins, 791 against main's 806 the same way.kernel-contract "exl3 grouped" exl3_grouped(the grouped EXL3 kernels, gate 3's two planted faults and the controls' live limits): exit 0, with theSUMMARYbelow; main's runner on main's build gives the same gates and controls and3 limit problems, exit 1. On the commit before (see the head line), main'scuda_sass_compare.pywith nvcc 13.0.88 on the reached images butcontract_controls(dsv41_x3ld_epi,exl3_experts):SUMMARY PASS images=2 functions=430 scope=explicit; oncontract_controlsalone, 754 of 760 functions equal, the other six beingtf_ctl_exl3_grouped_old_0,_1and_2at sm_120 and sm_121. There, every nvcc 13.0.88 fatbin butcontract_controlsis byte-equal to main's. With nvcc 13.3.73, the two builds from this head's kernel sources gave the samecontract_controlsfatbin, while five images the change does not reach (dsv41_lin2,inkling2_ops,qmm,qmm_group,train) differed between them, as between main's build and this head's.24a5cdd60f:zig fmt --checkandzig ast-checkon the 2 changed Zig files;zig build compile-cuda-tests12 of 12 steps;test-gradient-serving4 of 4 steps;test-kernel-contract46 of 46 steps, 342 of 342 tests;pr_check0 errors.24a5cdd60f:git diff --checkclean;zig build compile-cuda-tests12 of 12 steps;test-gradient-serving4 of 4 steps;test-kernel-contract342 of 342 tests;tools/zig/check_cuda_sources.pywith clang++ onexl3_experts.cu,contract_controls_set.cu,inkling2/experts.cuandexl3_block/x3ld_epi.cu: 24 of 24; and on this tree and on main,host_tests_testOK and CI's pytest from the root (-q -rs) 856 passed, 116 skipped, 827 subtests passed, with the same skips.cuda_sass_compare.py --plan-onlylists the images the change reaches:contract_controls,dsv41_x3ld_epiandexl3_experts.nvcc -cubin -Xptxas -vin WSL 2, at the five SMs, on this tree and on main: the three controls' registers above, andtf_ctl_exl3_grouped_skipand_staleunchanged.fmt,pytest,zig-macos-dev-tools,release-paths (ubuntu-24.04)and bothbenchmark-clientsjobs passed;zigfailed attools/zig/env_names.pyon files this pull request does not touch (docs/environment-names.md:TF_INKLING2_DRAFT_HEAD_Q4has no row; nine names inzig/src/server/confidential.zig);zig-b,zig-windowsandcomfyui-moss-installerwere still running.9822acad4a:fmt,zig,zig-b,zig-windows,zig-macos-dev-tools,pytest(857 passed, 115 skipped, 827 subtests passed; the run in WSL 2 above has 856 and 116, and the CI log does not print skip reasons),release-paths (ubuntu-24.04),comfyui-moss-installerand bothbenchmark-clientsjobs passed;host-nightly-linuxandhost-nightly-macoswere skipped. The annotations are GitHub's Node.js 20 deprecation warnings and a macOS runner queue notice.Receipt
cuda_sass_compare.pyfinds the served images the change reaches equal to main's, function by function (440 functions on main91dbadce65, 430 oneff4e5b754). Oneff4e5b754every nvcc 13.0.88 fatbin butcontract_controlsis byte-equal to main's; on91dbadce65,nemotron_routediffered too, the router entries CUDA build: nvcc 13.0.88 gives the router-tiles entries different PTX between identical compiles, about one in ten #5123 is about, which the change does not reach.e80490eb1bon main91dbadce65and24a5cdd60fon maineff4e5b754; Zig 0.17.0, nvcc 13.0.88 (the build) and 13.3.73 (the forms and its records); one GB10 (sm_121); no checkpoint.tools/bench_concurrent.py --alone --serialortoken_shaagainst"draft": false: n/a (no served path changes).tools/bench_openai.py: n/a (the served images are main's).Kernel contract, only when a GPU kernel is new or changed
tf_ctl_exl3_grouped_old_0,_1and_2change their sm_120 and sm_121 code, and their records follow.reads tile i + 2,decodes stale words on the last tile) are red as planted againsttf_ctl_exl3_grouped_old_2.SUMMARYline and exit status: CUDA on one GB10 (sm_121), filtered to"exl3 grouped" exl3_grouped: one80490eb1b,(filtered) SUMMARY 5 kernels: 5 pass gates 1-4, 0 fail, 0 known findings; 2 controls: 2 red as planted, 0 missed; 0 limit problems, exit 0 (3 kernels on24a5cdd60f, the same otherwise). Main: the same with3 limit problems, exit 1.Checklist
"draft": false, a resumed prompt equals a fresh one, and concurrent equals solo (no served path changes).--drafter, no slower than without it, greedy and sampled (the served images are main's).