d3d12-shader: one-thread LDS regions before the split form without skips (D3D12-LDS-EXACT-FIRST) #3126
Closed
enlight3d wants to merge 1 commit from
upstream-pr/3126 into main
pull from: upstream-pr/3126
merge into: ProjectLeonida:main
ProjectLeonida:main
ProjectLeonida:claude/loop-total
ProjectLeonida:claude/pops-collision-seed
ProjectLeonida:claude/dstorage-hold-page-reads
ProjectLeonida:claude/host-image-copy-switch
ProjectLeonida:feat/gdk-lifecycle-window-hook
ProjectLeonida:claude/d16s8-uav-nvidia-fallback
ProjectLeonida:feat/mfplat-offline-shim
ProjectLeonida:claude/gameinput-slow-reader
ProjectLeonida:fix/rt-null-barrier-clear
ProjectLeonida:claude/depth-resolve-sample-positions
ProjectLeonida:integration/palmetto-parity
ProjectLeonida:claude/valu-literal-sext
ProjectLeonida:claude/slot74-pool-handle
ProjectLeonida:claude/rgb9e5-uint-alias-view
ProjectLeonida:claude/fssm-root-layout-tables
ProjectLeonida:feat/gdk-speech-display-lifecycle
ProjectLeonida:asset-audio-skip-current
ProjectLeonida:qemmhd/old-9940-rectangle-quad-lists
ProjectLeonida:feat/ws2-offline-shim
ProjectLeonida:qemmhd/rt-d16-unorm-uav
ProjectLeonida:feat/xs-device-stops-7-9
ProjectLeonida:qemmhd/rt-depth-same-base-shapes
ProjectLeonida:qemmhd/rt-lazy-attachment-variant
ProjectLeonida:feat/acphal-xma2-decoder
ProjectLeonida:asset-audio-skip
ProjectLeonida:codex/coord-claim-check-20261124-7e48
ProjectLeonida:feat/xs-frame-pacing-presentx
ProjectLeonida:feat/xs-device-vm-options
ProjectLeonida:old-pr/9844
ProjectLeonida:old-pr/9978
ProjectLeonida:old-pr/9815
ProjectLeonida:old-pr/10057
ProjectLeonida:old-pr/9874
ProjectLeonida:old-pr/9965
ProjectLeonida:old-pr/9863
ProjectLeonida:old-pr/10068
ProjectLeonida:old-pr/10066
ProjectLeonida:old-pr/10067
ProjectLeonida:old-pr/10007
ProjectLeonida:old-pr/10061
ProjectLeonida:old-pr/10065
ProjectLeonida:old-pr/10059
ProjectLeonida:old-pr/10063
ProjectLeonida:old-pr/10055
ProjectLeonida:old-pr/10062
ProjectLeonida:old-pr/10042
ProjectLeonida:old-pr/10041
ProjectLeonida:old-pr/10049
ProjectLeonida:old-pr/10047
ProjectLeonida:old-pr/10046
ProjectLeonida:old-pr/10045
ProjectLeonida:old-pr/10056
ProjectLeonida:old-pr/10043
ProjectLeonida:old-pr/10036
ProjectLeonida:old-pr/10034
ProjectLeonida:old-pr/9984
ProjectLeonida:old-pr/10052
ProjectLeonida:old-pr/10038
ProjectLeonida:old-pr/10033
ProjectLeonida:old-pr/10028
ProjectLeonida:old-pr/10050
ProjectLeonida:old-pr/9891
ProjectLeonida:old-pr/9889
ProjectLeonida:old-pr/10051
ProjectLeonida:old-pr/10019
ProjectLeonida:old-pr/10027
ProjectLeonida:old-pr/10029
ProjectLeonida:old-pr/10031
ProjectLeonida:old-pr/10026
ProjectLeonida:old-pr/9941
ProjectLeonida:old-pr/10030
ProjectLeonida:old-pr/10040
ProjectLeonida:old-pr/9990
ProjectLeonida:old-pr/10021
ProjectLeonida:old-pr/9962
ProjectLeonida:old-pr/10022
ProjectLeonida:old-pr/10020
ProjectLeonida:old-pr/10015
ProjectLeonida:old-pr/10025
ProjectLeonida:old-pr/9886
ProjectLeonida:old-pr/10048
ProjectLeonida:old-pr/10014
ProjectLeonida:old-pr/10011
ProjectLeonida:old-pr/9861
ProjectLeonida:old-pr/10010
ProjectLeonida:old-pr/10008
ProjectLeonida:old-pr/9860
ProjectLeonida:old-pr/10006
ProjectLeonida:old-pr/9920
ProjectLeonida:old-pr/9995
ProjectLeonida:old-pr/10000
ProjectLeonida:old-pr/10016
ProjectLeonida:old-pr/10004
ProjectLeonida:old-pr/10023
ProjectLeonida:old-pr/9982
ProjectLeonida:old-pr/9981
ProjectLeonida:old-pr/9983
ProjectLeonida:old-pr/9970
ProjectLeonida:old-pr/9969
ProjectLeonida:old-pr/9968
ProjectLeonida:old-pr/9971
ProjectLeonida:old-pr/9972
ProjectLeonida:old-pr/9942
ProjectLeonida:old-pr/9963
ProjectLeonida:old-pr/9960
ProjectLeonida:old-pr/9964
ProjectLeonida:old-pr/9985
ProjectLeonida:old-pr/9973
ProjectLeonida:old-pr/9862
ProjectLeonida:old-pr/9953
ProjectLeonida:old-pr/10017
ProjectLeonida:old-pr/9952
ProjectLeonida:old-pr/9955
ProjectLeonida:old-pr/9946
ProjectLeonida:old-pr/9954
ProjectLeonida:old-pr/9938
ProjectLeonida:old-pr/9956
ProjectLeonida:old-pr/9856
ProjectLeonida:old-pr/9947
ProjectLeonida:old-pr/9924
ProjectLeonida:old-pr/9961
ProjectLeonida:old-pr/9927
ProjectLeonida:old-pr/9979
ProjectLeonida:old-pr/10032
ProjectLeonida:old-pr/9926
ProjectLeonida:old-pr/5237
ProjectLeonida:old-pr/9951
ProjectLeonida:old-pr/9931
ProjectLeonida:old-pr/9902
ProjectLeonida:old-pr/9921
ProjectLeonida:old-pr/9994
ProjectLeonida:old-pr/9775
ProjectLeonida:old-pr/9768
ProjectLeonida:old-pr/9905
ProjectLeonida:old-pr/9936
ProjectLeonida:old-pr/9901
ProjectLeonida:old-pr/9904
ProjectLeonida:old-pr/9906
ProjectLeonida:old-pr/9988
ProjectLeonida:old-pr/9908
ProjectLeonida:old-pr/9909
ProjectLeonida:old-pr/9911
ProjectLeonida:old-pr/9912
ProjectLeonida:old-pr/9913
ProjectLeonida:old-pr/9887
ProjectLeonida:old-pr/9916
ProjectLeonida:old-pr/9919
ProjectLeonida:old-pr/9925
ProjectLeonida:old-pr/9933
ProjectLeonida:old-pr/9935
ProjectLeonida:old-pr/9918
ProjectLeonida:old-pr/9879
ProjectLeonida:old-pr/9880
ProjectLeonida:old-pr/9881
ProjectLeonida:old-pr/9996
ProjectLeonida:old-pr/9876
ProjectLeonida:old-pr/9892
ProjectLeonida:old-pr/9899
ProjectLeonida:old-pr/9915
ProjectLeonida:old-pr/9914
ProjectLeonida:old-pr/9872
ProjectLeonida:old-pr/9869
ProjectLeonida:old-pr/9866
ProjectLeonida:old-pr/9819
ProjectLeonida:old-pr/10012
ProjectLeonida:old-pr/9857
ProjectLeonida:old-pr/9893
ProjectLeonida:old-pr/9897
ProjectLeonida:old-pr/9928
ProjectLeonida:old-pr/9868
ProjectLeonida:old-pr/9917
ProjectLeonida:old-pr/9940
ProjectLeonida:old-pr/9873
ProjectLeonida:old-pr/9816
ProjectLeonida:old-pr/10009
ProjectLeonida:old-pr/9900
ProjectLeonida:old-pr/9966
ProjectLeonida:old-pr/9859
ProjectLeonida:old-pr/9843
ProjectLeonida:old-pr/9991
ProjectLeonida:old-pr/10058
ProjectLeonida:old-pr/9883
ProjectLeonida:old-pr/9838
ProjectLeonida:old-pr/9835
ProjectLeonida:old-pr/9959
ProjectLeonida:old-pr/9895
ProjectLeonida:old-pr/9837
ProjectLeonida:old-pr/9858
ProjectLeonida:old-pr/9865
ProjectLeonida:old-pr/9864
ProjectLeonida:old-pr/9840
ProjectLeonida:old-pr/9820
ProjectLeonida:old-pr/4669
ProjectLeonida:old-pr/9848
ProjectLeonida:old-pr/9850
ProjectLeonida:old-pr/9810
ProjectLeonida:old-pr/9799
ProjectLeonida:old-pr/9853
ProjectLeonida:old-pr/9875
ProjectLeonida:old-pr/9831
ProjectLeonida:old-pr/9796
ProjectLeonida:old-pr/9801
ProjectLeonida:old-pr/9813
ProjectLeonida:old-pr/9794
ProjectLeonida:old-pr/7417
ProjectLeonida:old-pr/9781
ProjectLeonida:old-pr/9806
ProjectLeonida:old-pr/9958
ProjectLeonida:old-pr/9809
ProjectLeonida:old-pr/9791
ProjectLeonida:old-pr/9792
ProjectLeonida:old-pr/10053
ProjectLeonida:old-pr/9784
ProjectLeonida:old-pr/9789
ProjectLeonida:old-pr/9849
ProjectLeonida:old-pr/9846
ProjectLeonida:old-pr/9773
ProjectLeonida:old-pr/9785
ProjectLeonida:old-pr/9803
ProjectLeonida:old-pr/9826
ProjectLeonida:old-pr/9839
ProjectLeonida:old-pr/9922
ProjectLeonida:old-pr/9948
ProjectLeonida:old-pr/7189
ProjectLeonida:old-pr/9957
ProjectLeonida:old-pr/9823
ProjectLeonida:old-pr/9807
ProjectLeonida:old-pr/9851
ProjectLeonida:old-pr/9774
ProjectLeonida:old-pr/9830
ProjectLeonida:old-pr/9836
ProjectLeonida:old-pr/9822
ProjectLeonida:old-pr/9783
ProjectLeonida:old-pr/9833
ProjectLeonida:old-pr/9890
ProjectLeonida:old-pr/9770
ProjectLeonida:old-pr/9769
ProjectLeonida:old-pr/9772
ProjectLeonida:old-pr/9787
ProjectLeonida:old-pr/9852
ProjectLeonida:old-pr/9834
ProjectLeonida:old-pr/9845
ProjectLeonida:old-pr/9871
ProjectLeonida:old-pr/9771
ProjectLeonida:old-pr/9776
ProjectLeonida:old-pr/10005
ProjectLeonida:old-pr/9949
ProjectLeonida:old-pr/9923
ProjectLeonida:old-pr/9805
ProjectLeonida:old-pr/9829
ProjectLeonida:old-pr/9790
ProjectLeonida:old-pr/9827
ProjectLeonida:old-pr/9929
ProjectLeonida:old-pr/9855
ProjectLeonida:old-pr/9934
ProjectLeonida:old-pr/9907
ProjectLeonida:old-pr/9910
ProjectLeonida:old-pr/9779
ProjectLeonida:old-pr/9780
ProjectLeonida:old-pr/9885
ProjectLeonida:old-pr/9882
ProjectLeonida:old-pr/9877
ProjectLeonida:old-pr/9998
ProjectLeonida:old-pr/4251
ProjectLeonida:old-pr/9987
ProjectLeonida:old-pr/9989
ProjectLeonida:old-pr/9950
ProjectLeonida:old-pr/9777
ProjectLeonida:old-pr/10044
ProjectLeonida:old-pr/9884
ProjectLeonida:old-pr/2906
ProjectLeonida:old-pr/5076
ProjectLeonida:old-pr/9937
ProjectLeonida:old-pr/9986
ProjectLeonida:old-pr/3014
ProjectLeonida:old-pr/9943
ProjectLeonida:old-pr/9939
ProjectLeonida:old-pr/4682
ProjectLeonida:old-pr/4765
No reviewers
Labels
Clear labels
No items
No labels
Milestone
Clear milestone
No items
No milestone
Assignees
Clear assignees
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".
No due date set.
Reference
ProjectLeonida/mandy!3126
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/3126"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from ubiquitarianism/leonida. Originally posted by enlight3d on 2026-12-02T12:43:58Z.
Claimed in the coordination issue as: D3D12-LDS-EXACT-FIRST (first claimed as D3D12-SPLIT-LDS-STORE-RUNS: https://github.com/ProjectLeonida/mandy/issues/2570#issuecomment-7331196821)
What and why
A console wave64 compute program runs on a host of 32-lane waves as two host waves per console wave. Where its LDS regions are taken only by the form without skips (
ir::without_skips), every thread of the group walks a region that one thread runs on the console, with EXEC off, a group barrier before each LDS access in it, and an exchange of the halves for each first-lane read. Programs that clear group memory with thread 0 and then scan it in a loop of that thread pay for that in every pass: the two costliest compute programs of this form in the title carry 417 and 427 group barriers in the translated code where the console code has 3 and 2, and all 1,024 threads of the group run them for one thread's loads and stores. Skipping those two programs in a measured run (picture wrong meanwhile, so a ceiling only) took 1.64 ± 0.09 ms of card time a frame.This change (
d3d12/crates/leonida-shader/src/emit/):mod.rs: where the form without skips takes a program, the forms before it (without early-outs, then as it is) are tried first with the lane-branch regions one thread runs (lds_exact::with_exact_first), and kept when they translate whole. Such a region has no barrier inside; the halves still meet on its way in and out (lds_meetings), so what came before reaches it and what it writes reaches the code after it.lds_exact.rs: in that attempt only the first kind of region is taken (one thread runs it), not the second (reads and writes that cannot meet), which leans on the shortcut that two writes of a region do not meet. The thread must be picked by a constant or by a scalar the program starts with: a scalar a loop changes picks another thread each round, and the lanes a loop lets out one by one gather at its exit.lower.rs: in that attempt only, in a block one thread of the group runs, av_readfirstlanewith no guard of its own is that thread's value: the console wave's first lane is the only lane there, and the other host wave has none. With a guard EXEC may be empty and the console reads lane 0, so that case keeps the exchange (and is refused there). The split form took the program, so the skip around the region is one the code after it cannot see, and no scalar the region makes is read past it.LEONIDA_LDS_EXACT_FIRST(on unless0):=0gives the translation as before. The name joins the shader cache key through the translator's build script, andd3d12/docs/switches.mdis regenerated (tools/d3d12_switches.py --out, then--check; only the new row and the count line).d3d12/docs/findings.md: the rule, how it was confirmed, and what it does not cover (EXEC widened inside a region to lanes that never entered it, hand-written code only, which no lane-branch form follows).Not in this pull request: the first plan of the claim (dropping the barrier between stores of a run at constant addresses). The 400 stores of those programs sit in a region thread 0 runs, which this change takes whole, so that rule would gain nothing here.
Tested
Offline, over the 2,734 compute programs of a pipeline book, with the NVIDIA host settings (waves of 32), on this branch against
main40ac04183: 10 change form, all from the split form without skips to the one-thread regions of the form without early-outs; none is refused and none newly translated, and all 10 make compute pipelines on the card in both forms. WithLEONIDA_LDS_EXACT_FIRST=0all 2,734 are byte-identical tomain. (Counted first on393901a5b, the base before the rebase, and again on the rebased branch: the same 10 programs, the same DXIL bytes.) Translating the 10 takes about a quarter longer (220 ms against 178 ms for the 10, three runs each), while making their pipelines on the card takes far less (the costliest: 68 against 294 ms).main/ this branchmain/ this branchThe other eight: five programs of 64 threads go from 7 to 5 barriers, one of 64 threads keeps 6 (DXIL 66.8 to 53.6 KB), and two twins of the costliest pair (1,024 threads) go as the pair (417 to 14, 427 to 24).
Hand-written console code (
wave64_tests.rs), red before and green after:s_barriers, one before each access every thread makes, the meetings on the region's edges), against 12 and 16 in the split form;Guard rails, which keep the split form byte for byte, each having reached the attempt: a column of a 2-D group, a first-lane read under a guard of its own, two threads reading and writing one dword, a thread id rewritten before the compare, and two threads in two host waves reading a first lane.
On the card (
one_thread_regions_store_the_consoles_bytes_and_every_group_ends): the clear-and-scan with lanes leaving early and the region's thread in either host wave and either console wave (s0, s1 = 128, 0; 128, 40; 128, 127; 100, 64; 100, 100; 32, 31), and a one-wave running sum through first-lane reads by threads 0, 31, 32 and 63, store the console's bytes in both forms, three times each; each dispatch runs in a thread with a 60 s limit (a group stuck at a barrier). WARP was tried and skipped: its waves have 4 lanes, so it takes no program in waves of 32.Mutations, each built and run against the targeted tests, are each caught: the switch inverted; the guard check dropped; the one-thread proof ignored; the early attempt taking the second kind of region; a scalar a loop changes accepted as picking one thread; a thread id rewritten before the compare taken as the thread id; the meetings on the edges of a one-thread region dropped. One is not caught: the first-lane rule also outside the early attempt (in the last-resort exact forms). No fixture reaches those forms with such a read (the approximate local-wave form takes them first), so it is kept as a guard by construction only.
Rust, on
1d08f28a9(this branch, rebased onmain40ac04183), fromd3d12/,--target x86_64-pc-windows-msvc:cargo test -p leonida-shader --lib -- one_thread first_lane_read_ keeps_its_formcargo test -p leonida-shadercargo test -p leonida-shader --features diagnosticscargo clippy -p leonida-shader --all-targets(and with--features diagnostics)valu_tests.rs, none in this changepython -I tools/d3d12_switches.py --check d3d12/docs/switches.mdThe rebase onto
40ac04183had one conflict, in the field list of the lowering's state inlower.rs(mainadded the ray-query fields beside the new one), andswitches.mdwas regenerated; no line of the change itself differs (git range-diffshows only those context lines). The executable measured in game below was built from the commit before the rebase,1bc00fe25.How red was shown: the new tests use two test hooks (
lds_exact::TEST_EXACT_FIRST,census::TEST_CENSUS), so they were first run on a seam that added only those hooks and the switch, unused; each failed for the reason it states (a first-lane read refused; 12 against 16 barriers).In-game
RTX 3090, NVIDIA 621.40, Series S settings, standing at the save, exe of
1bc00fe25(this change before the rebase; the rebase changed none of its lines, see Tested).LEONIDA_LDS_EXACT_FIRST=0)LEONIDA_GPU_TIMING=1, two shortened runs, ±30 %)How the cost in the frame was measured: in each arm, one run of 600 s with
LEONIDA_AB=10,LEONIDA_SKIP_TRY_Askipping the two programs every other 10 s (the picture is wrong while they are skipped), the first 60 s after reaching the world left out, 22 cycles; the cost is the card time a frame with them minus without them. This was chosen over comparing whole runs because two whole runs of the same executable differ from each other by 0.4 to 2 ms of card time a frame, more than the effect.Another card (OreoFR: RTX 4070 Laptop 8 GB, NVIDIA 621.40, Series S settings, moving, four parts of 450 s off/on/on/off, one shader folder per arm): 25.16 frames/s off against 25.23 on. No effect on the frame rate there: that card is limited by the submitting thread. No crash.
Stability, as observed: with this executable, 4 of 7 runs between 05:11 and 06:09 UTC ended in a crash, in both arms (including
=0, whose translation is byte for byte that ofmain), with three different signatures; then 0 crashes in 4 runs with a clean rebuild of the same commit (byte-identical executable), and 0 in 7 runs with an executable ofmainbuilt the same way on the same day. Not reproduced, and not attributed to this change. Offline, each of the 19,104 programs of the pipeline book translates on a thread of the runtime's default stack (2 MiB) with at most 68 KiB of stack, the same onmainand on this branch, with the switch on or off.GPUs tested: NVIDIA GeForce RTX 3090, driver 621.40, Windows 11 Pro (build 26300): the dispatch test, the pipelines of the 10 programs, the Rust suites and the in-game runs above. NVIDIA GeForce RTX 4070 Laptop 8 GB, driver 621.40 (run by OreoFR): the in-game A/B above.
AI-assisted: yes (Claude Code, Claude Opus 5.5; reviews by two independent agents, Claude Opus 5.5 and Claude Fable)
Checklist
mainand merges cleanly (a conflicting pull request is labeledneeds rebase).docs/design.md, with how it was confirmed. (That table describes the SPIR-V translator; the DX12 translator's rules are ind3d12/docs/findings.md, where this one is added with how it was confirmed.)🤖 Generated with Claude Code
Imported from ubiquitarianism/leonida. Originally posted by Kal0s-design on 2026-12-02T14:35:16Z.
Ran natively on Windows 11, head
1d08f28a9merged into currentmain(d0bf821fa, clean merge, no commit), fromd3d12/with the pinned toolchain and--locked. Machine shared with other builds, so the suite times are slow; nothing flaked.Suite and lint on the merge
cargo test -p leonida-shader --libcargo test -p leonida-shader --lib -- one_thread first_lane_read_ keeps_its_form --nocapture --test-threads=1cargo clippy -p leonida-shader --all-targetsvalu_tests.rs, none in files this PR touchesFrom the
--nocaptureoutput:group barriers: 6 with the switch, 12 and 16 without, the same numbers as the PR body.one_thread_regions_store_the_consoles_bytes_and_every_group_endsran on the card: "20 cases stored the console's bytes three times each". WARP reports "waves of 4..4 lanes" and skips both programs, as the PR says. So the dispatch part ran on one NVIDIA card here, not on WARP. The validator was present, sochain_resultvalidated every shader it built.Red on the merge. I reverse-applied only the behaviour hunks (the
mod.rsblock that callswith_exact_first, and thelower.rschanges) and kept the test hooks inlds_exact.rs/census.rs, so the tests still compile:a_first_lane_read_where_one_thread_runs_is_that_threads_ownErr("... a first-lane read where not every lane runs is not supported")againstOk(Some(32))a_one_thread_region_costs_no_group_barrier_per_accessa_program_with_no_one_thread_region_keeps_its_formone_thread_regions_store_the_consoles_bytes_and_every_group_endsAfter I put the hunks back, the diff against
mainwas again 7 files, +742/−6, the tree on which the 12 had passed.Extra shapes I tried (throwaway tests, not committed). Each one was translated with
LEONIDA_LDS_EXACT_FIRSTon and off throughemit, and where it builds, dispatched on the card 3 times per (s0, s1) in both forms and compared with the console result computed by hand. The "off" form is main's translation, so it is the control for my expected values.s_cbranch_execzaround the regionsone_wave_scanwithouts_cbranch_execzaround its regionone_wave_scan, extra threads 1, 33, 62, 63clear_and_scan(4)in a 96-thread group (second console wave half full); s1 = 0, 63, 64, 70, 95, and s0 = 80 with s1 = 79 / 90clear_and_scan(4), 128 threads, s1 = 63, 64, 95, 96, 200, and s0 = 64 with s1 = 63 / 64, and s0 = 0xFFFFFFFFone_wave_scanwiths_add_u32 s1, s1, 0before the compare (s1 no longer the input value)That makes 228 dispatches with 0 mismatches. The cross-half cases (31,32), (32,31), (0,63) and (63,0) are consistent with the meetings on the regions' edges ordering a write by one host wave before a first-lane read by the other. The last row shows that the input-only rule for the picking scalar is conservative: a scalar that is changed outside any loop also keeps the split form. That is a missed case, not a wrong one. Without the skip branch the program never reaches the split form, so this change does not touch it.
Not checked: the corpus counts (2,734 programs, the 10 that change form, byte identity with
=0);--features diagnostics; the in-game numbers; AMD or other cards; a region whose EXEC is widened inside it (the case the findings note leaves out).GPUs tested: one NVIDIA desktop card (WARP tried, skips these programs: 4-lane waves).
AI-assisted: yes (Claude Code).
Imported from ubiquitarianism/leonida. Originally posted by lixonik on 2026-12-02T15:01:28Z.
Verified PR #3126 (
1d08f28a9) merged cleanly ontomain(acc350745) on Windows 10 x64 (Rust 1.98.1):python -I scripts/check_no_game_data.pyPASS.python -I tools/d3d12_switches.py --check d3d12/docs/switches.mdPASS.LEONIDA_DXIL=none):cargo test -p leonida-shader --lib --locked wave64_tests::-- 38 passed, 0 failed (3.56 s), including all 7 new tests (a_first_lane_read_where_one_thread_runs_is_that_threads_own,a_first_lane_read_under_a_guard_of_its_own_still_asks_the_other_half,a_first_lane_read_in_a_two_dimensional_group_is_not_taken_as_one_threads,a_one_thread_region_costs_no_group_barrier_per_access(group barriers: 6 with the switch, 12 and 16 without),a_program_with_no_one_thread_region_keeps_its_form,a_first_lane_read_whose_value_leaves_its_region_is_not_taken_as_one_threads, andone_thread_regions_store_the_consoles_bytes_and_every_group_ends).dxil.dllis10.0.19041.0(predates SM 6.6) and the test binary runs against inbox D3D12 (SM 0x65 / WARP 0x62 without Agility SDK alongside the test executable), sodxil.dllvalidation and live SM 6.6 GPU dispatch insideone_thread_regions_store_the_consoles_bytes_and_every_group_endswere skipped; IR/lowering/barrier-count assertions all passed.Verdict: PASS (CPU/IR/lowering unit tests; SM 6.6
dxil.dll+ GPU dispatch not exercised on this Win10 test runner).AI-assisted: yes (Antigravity).
Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-12-02T18:13:59Z.
Ran the crate's portable tests on Linux. The new tests are Windows-only (
#[cfg(all(test, windows))] mod wave64_tests), so red/green cannot be shown here. The Windows runs by Kal0s-design and lixonik are on this same head.python -I scripts/red_green.py pr/3126 --base origin/main --no-fetch --json(cargo test -p leonida-shader):So on Linux this shows that the merge builds and the 255 portable
leonida-shadertests stay green. It says nothing about the new behaviour.python -I tests/test_d3d12_switches.pyLEONIDA_LDS_EXACT_FIRSTis on the page)python -I tests/test_docs_*.py(links, repo paths, encoding, repeated lines, list items, env vars, design rows)python -I scripts/check_no_game_data.pyon the 7 filesRead in the diff:
emit/mod.rsnow tries "exact LDS regions" before the "without skips" form, both on the base form and "as it is", underlds_exact::with_exact_first.early()limits that pass to one-thread regions, andlower.rs::one_thread_blocklets areadfirstlaneinside such a block return the thread's own value.LEONIDA_LDS_EXACT_FIRSTis on by default (is_none_or(|v| v != "0")), so the translation of every program that used to reach "without skips" can change.Points for the author
Verdict: ready, given the two Windows runs, with an in-game run requested.
AI-assisted verification: Claude Opus (Claude Code), separate agent per batch.
Generated by Claude Code
Imported from ubiquitarianism/leonida. Originally posted by fiestorra on 2026-12-02T23:24:08Z.
VERIFY-3126 — Windows nativo:
red then greenen la forma de un solo hilo1d08f28a9—emit/lds_exact.rs(+59),emit/lower.rs(+31),emit/mod.rs,emit/bitcode/census.rsRan at the head
Negative control (synthetic): I made
early()false, so the one-thread-region form is never taken, rebuilt and ran:All three bite, and the message is the measurement: the region's group barrier count is what the form changes.
What the change is: when
emitwould otherwise keep a program in the split form without its skips, it now tries the one-thread-region form first (LEONIDA_LDS_EXACT_FIRST, on unless0). Inside a region one thread runs, av_readfirstlanewith no guard of its own is that thread's value — because on the console the wave's first lane is the only lane there — and the form drops the group barrier before every LDS access it would otherwise need. The tests are the three sides of that decision: the barrier count, the console bytes written, and a program with no such region keeping its form (the "no regression by default" case).Why I trust the control here more than usual: the failing assertion names the number of barriers, which is the property the commit claims to remove — a test that would still pass with the form disabled would have been measuring something else.
What I could not test
Written with an AI assistant.
Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-12-03T07:01:20Z.
This pull request has a merge conflict with current
main(d9b618f10), so it can't be run in game or merged as it is. Could you merge the latestmaininto it (or rebase onto it) and resolve the conflict? Once the head is updated, the in-game gate run can be done on the new head.AI-assisted (Claude Code).
Imported from ubiquitarianism/leonida. Originally posted by fiestorra on 2026-12-03T09:23:15Z.
Rebasadas contra
d9b618f10, con el recuento calculado y no elegidoLas tres chocaban en la misma línea de
d3d12/docs/switches.md, y las tres están resueltas contando el fichero en vez de copiando el número demain(porque las tres añaden filas, o sea que la cabecera cambia):Ramas
pr-3009-rebased,pr-3126-rebasedypr-3140-rebasedempujadas al fork, y las tres con el árbol verificado:Y el detalle que conviene mirar antes de fusionar:
#3009toca 9 ficheros.rscon 1851 líneas y#3126toca 5 con 742 — y las dos dejanleonida-gpuen715, igual quemain. O sea que ninguna de las dos añade un solo test al crate. No es un fallo de ellas (pueden ser cambios de runtime que el juego ejercita), pero es la diferencia con#3225, que trae dos, y con#3306, que trae cinco. Quien fusione debería saber que estas dos se van sin red.Lo que no verifiqué: el comportamiento en el juego, que es donde se ejercitan las dos.
Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-12-03T18:02:51Z.
Thanks for the work on this. This pull request has a merge conflict with the current
mainand has had no new commit, comment or review for more than 5 hours, so I am closing it to keep the list of open pull requests manageable. This is not a judgement of the change. Whenever you like, merge the latestmaininto your branch, resolve the conflict, and reopen it (or open a new pull request that links this one). Please re-run the relevant tests on the new head; a reviewer will look at it when time allows, with no guarantee of timing or outcome.Generated by Claude Code
Pull request closed