d3d12-shader: one-thread LDS regions before the split form without skips (D3D12-LDS-EXACT-FIRST) #3126
Closed
leonida/mandy
enlight3d wants to merge 0 commits from
lds-exact-first-pr into main
pull from: lds-exact-first-pr
merge into: leonida:main
leonida:main
leonida:github-pr/3295
leonida:beta
leonida:docs/changelog-3483-3500
leonida:github-pr/3294
leonida:github-pr/2975
leonida:github-pr/2815
leonida:feat/gate-driver-start
leonida:feat/skip-pipelines-release
leonida:perf/lazy-compare
leonida:perf/mwaitx-wait
leonida:test/prio-ceiling-main
leonida:fix/ab-cpu-stdout
leonida:fix/gate-old-crashes
leonida:diag/ab-cpu
leonida:test/main-0312
leonida:github-pr/3291
leonida:diag/indirect-clamp-census
leonida:feat/barrier-enhanced
leonida:perf/texture-frame-ceiling
leonida:perf/dstorage-threads
leonida:fix/console-queue-dma-tables
leonida:fix/port-descriptors-record-parts
leonida:fix/frame-waits-fence
leonida:fix/console-sampler-words
leonida:fix/graphics-userdata-spill
leonida:fix/xg-reserved-layout-rotation
leonida:fix/barrier-console-flags
leonida:fix/switches-wait-test-child
leonida:test/list-value-waits
leonida:test/lot-gxdk-0412
leonida:fix/bvh-compacted-size
leonida:docs/i18n-quickstarts
leonida:feat/native-pipeline-slots
leonida:fix/clippy-leonida-gpu
leonida:fix/list-value-producers
leonida:fix/descriptor-page-straddle
leonida:fix/xmem-low-window
leonida:fix/ffx-jitter-never-zero
leonida:fix/run-stdout-closed
leonida:github-pr/2892
leonida:github-pr/2896
leonida:feat/warm-save-every
leonida:github-pr/2980
leonida:github-pr/2994
leonida:github-pr/3005
leonida:github-pr/3010
leonida:github-pr/3136
leonida:github-pr/3303
leonida:github-pr/3220
leonida:github-pr/3143
leonida:github-pr/3330
leonida:github-pr/3226
leonida:github-pr/3187
leonida:carry/3395
leonida:github-pr/2946
leonida:github-pr/2947
leonida:github-pr/2945
leonida:github-pr/2983
leonida:github-pr/3001
leonida:github-pr/3372
leonida:github-pr/3128
leonida:github-pr/3296
leonida:github-pr/2588
leonida:github-pr/3119
leonida:github-pr/3378
leonida:fix/crash-diagnostics
leonida:feat/dlss-mip-bias
leonida:fix/retired-out-of-order
leonida:fix/dxr-postbuild-barrier
leonida:fix/amd-relay-default
leonida:fix/removed-report-wait
leonida:feat/heap-twin
leonida:feat/vram-margin
leonida:github-pr/2472
leonida:github-pr/3123
leonida:github-pr/3088
leonida:assets/annonce-v1
leonida:github-pr/2794
leonida:github-pr/3300
leonida:github-pr/3304
leonida:github-pr/3308
leonida:github-pr/3367
leonida:github-pr/3369
leonida:fix/launcher-dlss-diagnostics
leonida:github-pr/3269
leonida:github-pr/2957
leonida:github-pr/3205
leonida:fix/crash-zero-guard
leonida:github-pr/3185
leonida:github-pr/3099
leonida:github-pr/3104
leonida:github-pr/3348
leonida:github-pr/3379
leonida:github-pr/3377
leonida:perf/darner-title-priority-ceiling
leonida:github-pr/3376
leonida:gh-readonly-queue/main/pr-3311-b5c45b663dbc5a9c3532bb3f307e5f81b32faefa
leonida:gh-readonly-queue/main/pr-3088-af22e7847ff5808f72d1a1881c24be2fafd20b54
leonida:gh-readonly-queue/main/pr-3123-7f3fa026a94c6646e89244f28e1ce22290361867
leonida:github-pr/3373
leonida:github-pr/3368
leonida:github-pr/3198
leonida:gh-readonly-queue/main/pr-3354-637baa0b77ba47222e7280b17c1a59c6a1781d57
leonida:gh-readonly-queue/main/pr-3365-d7a0e0196a43834813014b4bd3aa5502a8263b14
leonida:gh-readonly-queue/main/pr-3361-5dfe8bbd05ed12fb2f2e1718d9af77a7c5f46fd8
leonida:gh-readonly-queue/main/pr-3366-8da9148204e9d12c585efa9ac2b7cc1ab08c7682
leonida:github-pr/3346
leonida:github-pr/3375
leonida:github-pr/2958
leonida:github-pr/3151
leonida:github-pr/3307
leonida:github-pr/3278
leonida:github-pr/3374
leonida:fix/runtime-test-conservative-fixtures
leonida:github-pr/3366
leonida:ci/shard-semantic-linux
leonida:github-pr/3354
leonida:docs/fg-limit-fps-switch
leonida:github-pr/3365
leonida:fix/read-file-hard-link
leonida:github-pr/3364
leonida:fix/book-slot-heap-never-read
leonida:github-pr/3361
leonida:github-pr/3263
leonida:github-pr/3360
leonida:github-pr/3353
leonida:github-pr/3331
leonida:fix/alias-later-queued-submissions
leonida:github-pr/3352
leonida:github-pr/3228
leonida:github-pr/3349
leonida:claude/gallant-sagan-aamatr
leonida:github-pr/3200
leonida:github-pr/3132
leonida:github-pr/3323
leonida:github-pr/3332
leonida:github-pr/3340
leonida:github-pr/3311
leonida:github-pr/3334
leonida:github-pr/3297
leonida:github-pr/3256
leonida:github-pr/2567
leonida:github-pr/2851
leonida:d3d12/agility-sdk-621
leonida:github-pr/3164
leonida:github-pr/3114
leonida:github-pr/3050
leonida:github-pr/3113
leonida:github-pr/3326
leonida:github-pr/3144
leonida:github-pr/2642
leonida:github-pr/3072
leonida:github-pr/2789
leonida:github-pr/2643
leonida:github-pr/3009
leonida:github-pr/3035
leonida:github-pr/3031
leonida:github-pr/2686
leonida:github-pr/2834
leonida:github-pr/3321
leonida:github-pr/3325
leonida:github-pr/3290
leonida:github-pr/3324
leonida:github-pr/3130
leonida:claude/fervent-curie-m19lnr
leonida:github-pr/3309
leonida:github-pr/3305
leonida:github-pr/3306
leonida:github-pr/3302
leonida:github-pr/3301
leonida:github-pr/3345
leonida:github-pr/3211
leonida:github-pr/3027
leonida:github-pr/3286
leonida:github-pr/3235
leonida:github-pr/3265
leonida:github-pr/3275
leonida:codex/skip-no-hit-ray-passes
leonida:github-pr/2823
leonida:github-pr/2911
leonida:github-pr/3262
leonida:github-pr/3125
leonida:github-pr/3206
leonida:github-pr/3250
leonida:github-pr/3238
leonida:github-pr/3188
leonida:github-pr/2952
leonida:github-pr/3217
leonida:github-pr/3168
leonida:t3/preserve-fsr-sdk-restart-path
leonida:t3/propagate-host-failure-hresult
leonida:github-pr/3209
leonida:t3/launcher-custom-parameters
leonida:github-pr/3207
leonida:github-pr/3183
leonida:github-pr/3160
leonida:github-pr/3201
leonida:ci/less-to-run
leonida:github-pr/2930
leonida:github-pr/2797
leonida:github-pr/2999
leonida:perf/native-compute-shader-forms
leonida:github-pr/3191
leonida:github-pr/3011
leonida:github-pr/3019
leonida:github-pr/2996
leonida:gh-readonly-queue/main/pr-2789-45dc41f95c1cd0dcc29c2c50582e0e9af8a77259
leonida:claude/blissful-franklin-ukp7ag
leonida:github-pr/3141
leonida:github-pr/3156
leonida:github-pr/3150
leonida:github-pr/3153
leonida:github-pr/3163
leonida:github-pr/3142
leonida:github-pr/3139
leonida:github-pr/2841
leonida:github-pr/3069
leonida:github-pr/3098
leonida:github-pr/3107
leonida:github-pr/3071
leonida:github-pr/2774
leonida:github-pr/2889
leonida:github-pr/3075
leonida:github-pr/2661
leonida:github-pr/3064
leonida:github-pr/3054
leonida:github-pr/3049
leonida:github-pr/2855
leonida:github-pr/2943
leonida:github-pr/3016
leonida:github-pr/2887
leonida:github-pr/3006
leonida:github-pr/3003
leonida:github-pr/2993
leonida:notes/card-time-and-plant-flicker
leonida:github-pr/2989
leonida:feat/vulkan-rs
leonida:github-pr/2985
leonida:github-pr/2951
leonida:github-pr/2982
leonida:github-pr/752
leonida:github-pr/792
leonida:github-pr/2877
leonida:github-pr/2654
leonida:github-pr/2893
leonida:github-pr/2948
leonida:github-pr/2944
leonida:github-pr/2919
leonida:github-pr/2915
leonida:archive/ci/less-to-run/20261202T1121Z
leonida:github-pr/2800
leonida:github-pr/2822
leonida:github-pr/2833
leonida:github-pr/2840
leonida:github-pr/2831
leonida:github-pr/2832
leonida:github-pr/2801
leonida:github-pr/2890
leonida:github-pr/2891
leonida:github-pr/2664
leonida:github-pr/2807
leonida:rt-call-trace
leonida:github-pr/2755
leonida:perf/ahead-split
leonida:github-pr/2587
leonida:github-pr/2698
leonida:github-pr/2609
leonida:github-pr/3219
leonida:docs/readme-runtime-proposal
leonida:github-pr/2017
leonida:github-pr/1741
leonida:github-pr/1667
leonida:codex/coord-claim-check-20261124-7e48
No reviewers
Assignees
Clear assignees
No assignees
Labels
Clear labels
bug
Something isn't working
dependencies
Pull requests that update a dependency file
documentation
Improvements or additions to documentation
enhancement
New feature or request
missing claim
Needs a claim in #14
needs rebase
Conflicts with the base branch: rebase it on main
needs-triage
Needs maintainer evaluation before the next triage state
question
Further information is requested
ready-for-agent
Fully specified and ready for an AFK agent
submodules
Pull requests that update submodules code
No labels
bug
dependencies
documentation
enhancement
missing claim
needs rebase
needs-triage
question
ready-for-agent
submodules
Projects
Clear projects
No items
No project
Milestone
Clear milestone
No items
No milestone
Dependencies
No dependencies set
Notifications
1 participant
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".
No due date set.
Reference
leonida/mandy!3126
Loading…
Reference in a new issue
No description provided.
Delete branch "lds-exact-first-pr"
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?
Pull request closed
This pull request cannot be reopened because the branch was deleted.
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
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).
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).
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
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.
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).
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.
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