LDS analysis: a region one thread runs, and per-thread footprints over the threads that run it (#1435; on #2358 and #1773) #3441

Open
Lyrnc wants to merge 2 commits from upstream-pr/3441 into main
Lyrnc commented 2026-11-29 23:23:00 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by Lyrnc on 2026-11-29T23:23:00Z.


Part of #1435, not all of it. Built on #2358 (nidea1) and #1773 (Remorce): their commits come first here, with their authorship kept. Once both are on main, this branch rebases to the third commit alone.

Rebased onto main 7995b81b (#2358 and #1773 are both still open, so all three commits stay): 80b451ec, 8bac5b63 and a5ae2928 below are now f0a43745, 934475bf and 66da0fef, with the same patches (git range-diff shows no change). The archive and synthetic measurements below were made on the 829188e9 base; the cargo test results are on 66da0fef.

What it changes

What was wrong. On a 32-lane host, #43's lds::analyze lets a wave64 compute program run as two host waves only when it can prove that the program's lane-branch regions need no order between the halves. Without a proof the program falls back to another form. On 829188e9 the first retry is the folded form. On main since 5c262d7b and 05d1c564, the plain retries and the local-wave idiom run first, and folding comes before the wave-wide and approximate forms. 5c262d7b measured what folded programs cost in card time.

On the title's shader archive at 829188e9 (2,682 compute programs, VICTORY_HOST_WAVE=32), the analysis refuses 181 programs: 179 are folded and 2 take the wave-wide form. Two common shapes had no proof:

  • a region that only one thread runs (if (tid == 0) { ... }), whatever it reads or writes;
  • a region where each thread of a subset uses its own bytes. if (tid < 16) { lds[28 + 12 t] = ...; lds[220 + 12 t] = ...; } overlaps over the whole group, because thread 16's first slot is thread 0's second. It does not overlap over threads 0..15, which are the only threads that run it.

These were refused as "an LDS read and write in one lane-branch region" or "unproven LDS writes in one lane-branch region".

What this does. a5ae2928 adds two proofs to crates/victory-shader/src/emit/lds.rs:

  • Refinement D (AddrCtx::one_thread): at most one thread of the group runs the region's LDS instructions, and it is the same thread at each of them. One thread sits in one host wave and makes its accesses in program order, so the halves cannot see each other's order.
  • Refinement E (AddrCtx::thread_footprints): over the threads that may run each access, no two threads touch the same byte where one of them writes. A dword access takes its whole dwords. The check refuses the region when it goes past 65,536 spans, 1,024 open spans or 1 MiB of offset.
  • Which threads may run an LDS instruction (site_threads, may_hold): the check runs once per thread and looks at the block's reach and the instruction's guard. A lane compare whose operands are known per thread (constants and thread ids) takes that thread's outcome, and a constant mask gives the thread's bit. Any other atom stays free. The decision diagram is walked with a memo and a node budget, and past the budget the answer is "may run". Free atoms can only add threads, so both proofs err towards refusing. Groups of more than 1,024 threads are not looked at.
  • Both proofs are tried last, after the existing ones, in the read-write check and in the write-only check. A region that an earlier proof accepted takes the same path as before. There is no new switch. VICTORY_LDS_WRITE_ONLY_OK and VICTORY_LDS_LAST_RESORT are unchanged: the write-only shortcut stays off by default, and the last resort keeps its default list of one program.
  • One shape is left refused on purpose: a lane-branch region where lanes of one host half read what other lanes of the same half wrote, with no barrier in between (a wave reduction under tid < 32). The console wave saw those writes in lockstep, but the host has no order between its lanes there. That case needs a lowering with a wave-level sync, not a proof, and a test checks that it stays refused.

Six tests are added to emit::lds::tests:

  • one thread at tid 0, 40 and 63, under a branch and under v_cmpx;
  • two threads refused, and an 8 x 8 group's column refused;
  • footprints accepted for 16 threads and refused for 17;
  • a read of the next thread's slot refused, across the halves and within one half;
  • one or two atomic families in a lane loop (#2358's proof).

Credit:

  • 80b451ec is #2358 by nidea1, cherry-picked unchanged. Its git patch-id matches the PR's diff. It adds Refinement C: commutative non-returning 32-bit integer LDS atomics.
  • 8bac5b63 is #1773 by Remorce (commit author name "Walking Sim Game"). It covers values made under the write's own lane mask, one constant per dword, and loop counters stepping by the group. It was cherry-picked onto #2358 with its Access fields (data_const, strided, ds_off) merged next to #2358's atomic_alg. git range-diff against the PR's commit 82221d1 shows only that merge. #2358 and #1773 conflict with each other in lds.rs, and each applies to main on its own. Whichever lands second needs the same small resolution.
  • Both build on #43 (Vladimir-Human).
  • Only a5ae2928 is new in this pull request.

How it was tested

  • GPU and profile: no game run. Two kinds of checks were done:

    • offline translation of the title's shader archive with VICTORY_HOST_WAVE=32;
    • 13 hand-written wave64 cases (our own instructions, nothing from the title), dispatched on the RTX 5080 (32-lane waves) and on the Ryzen 7 9800X3D's integrated Radeon (RDNA 2, gfx1036). Windows 11, 32 GB.
  • Archive, per compute program. The command was VICTORY_HOST_WAVE=32 VICTORY_WAVE_WHY=1 victory translate --list --jobs 1 <archive>, with a local print (not in this branch) of each program's hash ahead of its WAVE lines. A program counts as refused when a WAVE64-WHY ... lds=true line is printed. Its form is the last WAVE64-RETRY line, or the split form when there is none.

    829188e9 + #2358 + #1773 (tree of 8bac5b63) + a5ae2928 (this branch)
    refused by the LDS analysis 181 162 139
    of those, folded 179 160 137
    of those, another fallback form 2 wave-wide 2 wave-wide the same 2, "without early-outs" retry
    folded compute programs in all 266 255 232 (computed, see below)
  • Before: the 829188e9 column above.

  • After, #2358 + #1773: 19 programs are no longer refused by the LDS analysis.

    • 11 of them now take the split form instead of the folded one.
    • The other 8 stay folded for reasons that are not about LDS: lane masks read as data, v_mbcnt, v_readlane.
    • Over the whole listing (26,084 programs, 2,681 of 2,682 compute emitted in both builds), exactly 11 emitted outputs change. Every other line is identical. The same 11 change in a --jobs 8 run on empty caches.
    • In those --jobs 8 runs, VICTORY_WAVE_WIDE_FALLBACK=0 VICTORY_LDS_LAST_RESORT=0 VICTORY_LDS_WRITE_ONLY_OK=0 gives the same listing as the defaults, and no run prints no wave32 lowering.
  • After, a5ae2928: this run covered only the 162 programs that #2358 + #1773 still refuse (VICTORY_TRANSLATE_ONLY, 162 translated, 162 compute programs emitted).

    • 23 more programs leave the folded form and take the split form. On 829188e9, 7 of them were refused as "an LDS read and write in one lane-branch region" and 16 as "unproven LDS writes in one lane-branch region".
    • The 2 wave-wide programs take the earlier "without early-outs" retry instead.
    • The other programs were not translated again on this branch. The new proofs only run where the earlier ones fail, so they should not change, but that comes from reading the code, not from a measurement. The 232 above is 255 less the 23.
  • All three commits together: 42 programs are no longer refused by the LDS analysis (181 to 139). Of those, 34 leave the folded form.

    • #1435's own list: of the 10 hashes in the issue, 0e366d15868e17bd and 5964b734c70b91eb leave the folded form, both through #1773. The other 8 are still refused on this branch: 6 for a read and write in one region, 1 for a shared write in a loop, 1 for an atomic-only region.
    • futurepro62's list: of the 75 programs posted in the issue, 13 leave the folded form (8 through #2358 + #1773, 5 through a5ae2928).
  • Synthetic cases, against wave64 hardware:

    • The cases are 13 hand-written wave64 bodies, one 64-thread group each: 4 for #2358's atomics, 4 for #1773's proofs, 4 for Refinement D (tid 0, 40, 63, and v_cmpx inside a wider branch) and 1 for Refinement E (16 threads with interleaved slots).
    • Each was translated for a 32-lane host, passed dxil.dll's validator, and was dispatched on both cards. The 16 outputs x 64 lanes were compared with the same bodies run natively in wave64 on the gfx1036 iGPU through a local harness.
    • Command: cargo test -p victory-shader --lib local_lds1435 -- --ignored --nocapture with VICTORY_ADAPTER=NVIDIA or Radeon, VICTORY_WAVE_WIDE_FALLBACK=0 and VICTORY_WAVE_WHY=1. local_lds1435 is a local test module that is not in this branch.
    • Result: 13 of 13 exact on the RTX 5080 and 13 of 13 exact on the Radeon. All 13 take the split form (no WAVE64-RETRY).
    • The same harness at 829188e9 folds 11 of the 13 cases, and with #2358 + #1773 it folds 5 (the D and E cases). The folded results are exact too. So these cases show that the new proofs give the console's answer. They do not show that the old form was wrong.
  • For shader changes, the wave sizes tested: wave64 console programs on 32-lane host waves (the case this analysis is for), on NVIDIA and AMD. The reference is native wave64 on the AMD iGPU. 64-lane hosts were not run.

  • cargo test passed for the crates it touches: yes, apart from 3 tests that fail on main in the same way. On 66da0fef (main 7995b81b + the three commits), RTX 5080:

    • cargo test -p victory-shader --lib lds: 51 passed, 0 failed, 1 ignored (430 filtered out). The 32 tests of emit::lds::tests are among them.
    • cargo test -p victory-shader --lib -- --test-threads=6: 470 passed, 3 failed, 9 ignored. The 3 failures are emit::barycentric_tests::first_half_values_render_on_hardware_and_warp, emit::rect::tests::rectangles_are_drawn_whole and emit::rect::tests::the_rectangle_stage_is_a_geometry_shader, all with Container part 'Pipeline State Validation' does not match expected for module from the local DXIL validator. The same 3 fail the same way on main 7995b81b without this branch.
    • cargo clippy -p victory-shader --all-targets -- -D warnings: fails on main's own code (unused imports in emit/lower/analysis.rs:6 and emit/lower.rs:594, while_immutable_condition in emit/lower/analysis.rs:467, too_many_arguments in native.rs:1655). None is in lds.rs.
    • For reference: the tip has 32 tests in emit::lds::tests and 482 #[test] functions in the crate's sources. #2358's description reports 23 passed in emit::lds::tests at its head, and steven-seagull27 reported 24 passed at #1773's head. Neither result covers this branch.
  • Not tested:

    • No in-game check: no frame rate and no picture comparison.
    • The archive counts and the synthetic cases were not run again on a5ae2928 or 66da0fef (only cargo test was). They come from a build of the working tree before the commit, with local debug prints. The commit adds rustfmt formatting, doc comments and the 1,024-open-span bound in the footprint check, which can only refuse more.
    • Not measured on main (fbe3dc20 or 7995b81b). There folding is off by default and comes after the plain retries and the local-wave idiom, so what the 34 programs take on main without this branch is not known from these runs.
    • The archive runs used --list without --validate (0 validated). The new DXIL of the 34 programs was emitted but not validated, and no pipeline was made from it. Only the 13 synthetic cases went through the validator and the cards.
    • Inherited from #1773: Melow-code's review found that counter_bits takes exponential time on a deeply shared OR chain. steven-seagull27's d6f46fd memoises it, and Remorce left it out of #1773 for now. This branch carries #1773 as it is. The new walk in may_hold is memoised and has a node budget.
  • In game: pending. An earlier in-game A/B is void: its build reused a stale victory-shader from a shared target dir. It is being redone and the result will be posted here.

Checked for overlap

  • I searched the open pull requests for the same issue and for the files this touches. Upstream: no commit in 829188e9..7995b81b touches lds.rs, and the three commits apply to 7995b81b unchanged. 5c262d7b and 05d1c564 change when folding runs (fold.rs, emit/mod.rs). git merge-tree --write-tree vnv/main on this branch is clean at fbe3dc20. Related:
    • #2358 (open): commit 1 here, unchanged.
    • #1773 (open): commit 2 here, with its fields merged next to #2358's. The two conflict with each other.
    • #733 (open, conflicting): a separate emit::lds_exact module behind VICTORY_LDS_EXACT=1, tried after every other form. It also has a one-thread proof (entry edges on v_cmp_eq(thread id, k), 1-D groups) and a check that read and written ranges do not meet. This branch works inside #43's lds::analyze, on by default. It handles 1-, 2- and 3-D groups up to 1,024 threads and checks per-thread footprints over the threads that run each access.
    • #1590 (closed) and #1575 (open): the write-only shortcut as a last try, or on by default. In #1435, trustno1-coder reported wrong pictures and high GPU time with the shortcut. This branch adds proofs only and leaves the shortcut off.
    • #2917 (open): one line in lds.rs (with_last_resort through lower::with_flag), far from these hunks, with no overlap in what it does.
    • #2261 (open, conflicting): the order of folding against the exact retries in emit/mod.rs. It is not an LDS proof, and 05d1c564 has since changed that order.
    • #822 and #388 (open): 6b82bc7d22016cb5 through lower.rs, which this branch does not take.
    • #2001 (open): the paired Wave64 fallback for programs that no wave32 form takes. It is a different form and does not overlap with this one.

AI use

Claude Code (Claude Opus 5.5) wrote a5ae2928 (Refinements D and E and their tests). It cherry-picked #2358's and #1773's commits with their authorship kept, and merged #1773's Access fields next to #2358's. It also wrote the 13 synthetic cases and the local harness, ran the archive counts and the comparisons on both cards, and wrote this description. The first two commits are nidea1's and Remorce's own work.

🤖 Generated with Claude Code

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:issue:5556268831 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/3441). Originally posted by [Lyrnc](https://github.com/Lyrnc) on 2026-11-29T23:23:00Z. --- Part of #1435, not all of it. Built on #2358 (nidea1) and #1773 (Remorce): their commits come first here, with their authorship kept. Once both are on main, this branch rebases to the third commit alone. Rebased onto main 7995b81b (#2358 and #1773 are both still open, so all three commits stay): 80b451ec, 8bac5b63 and a5ae2928 below are now f0a43745, 934475bf and 66da0fef, with the same patches (`git range-diff` shows no change). The archive and synthetic measurements below were made on the 829188e9 base; the `cargo test` results are on 66da0fef. ## What it changes **What was wrong.** On a 32-lane host, #43's `lds::analyze` lets a wave64 compute program run as two host waves only when it can prove that the program's lane-branch regions need no order between the halves. Without a proof the program falls back to another form. On 829188e9 the first retry is the folded form. On main since 5c262d7b and 05d1c564, the plain retries and the local-wave idiom run first, and folding comes before the wave-wide and approximate forms. 5c262d7b measured what folded programs cost in card time. On the title's shader archive at 829188e9 (2,682 compute programs, `VICTORY_HOST_WAVE=32`), the analysis refuses 181 programs: 179 are folded and 2 take the wave-wide form. Two common shapes had no proof: - a region that only one thread runs (`if (tid == 0) { ... }`), whatever it reads or writes; - a region where each thread of a subset uses its own bytes. `if (tid < 16) { lds[28 + 12 t] = ...; lds[220 + 12 t] = ...; }` overlaps over the whole group, because thread 16's first slot is thread 0's second. It does not overlap over threads 0..15, which are the only threads that run it. These were refused as "an LDS read and write in one lane-branch region" or "unproven LDS writes in one lane-branch region". **What this does.** a5ae2928 adds two proofs to `crates/victory-shader/src/emit/lds.rs`: - **Refinement D** (`AddrCtx::one_thread`): at most one thread of the group runs the region's LDS instructions, and it is the same thread at each of them. One thread sits in one host wave and makes its accesses in program order, so the halves cannot see each other's order. - **Refinement E** (`AddrCtx::thread_footprints`): over the threads that may run each access, no two threads touch the same byte where one of them writes. A dword access takes its whole dwords. The check refuses the region when it goes past 65,536 spans, 1,024 open spans or 1 MiB of offset. - **Which threads may run an LDS instruction** (`site_threads`, `may_hold`): the check runs once per thread and looks at the block's reach and the instruction's guard. A lane compare whose operands are known per thread (constants and thread ids) takes that thread's outcome, and a constant mask gives the thread's bit. Any other atom stays free. The decision diagram is walked with a memo and a node budget, and past the budget the answer is "may run". Free atoms can only add threads, so both proofs err towards refusing. Groups of more than 1,024 threads are not looked at. - Both proofs are tried last, after the existing ones, in the read-write check and in the write-only check. A region that an earlier proof accepted takes the same path as before. There is no new switch. `VICTORY_LDS_WRITE_ONLY_OK` and `VICTORY_LDS_LAST_RESORT` are unchanged: the write-only shortcut stays off by default, and the last resort keeps its default list of one program. - One shape is left refused on purpose: a lane-branch region where lanes of one host half read what other lanes of the same half wrote, with no barrier in between (a wave reduction under `tid < 32`). The console wave saw those writes in lockstep, but the host has no order between its lanes there. That case needs a lowering with a wave-level sync, not a proof, and a test checks that it stays refused. Six tests are added to `emit::lds::tests`: - one thread at tid 0, 40 and 63, under a branch and under `v_cmpx`; - two threads refused, and an 8 x 8 group's column refused; - footprints accepted for 16 threads and refused for 17; - a read of the next thread's slot refused, across the halves and within one half; - one or two atomic families in a lane loop (#2358's proof). Credit: - 80b451ec is #2358 by nidea1, cherry-picked unchanged. Its `git patch-id` matches the PR's diff. It adds Refinement C: commutative non-returning 32-bit integer LDS atomics. - 8bac5b63 is #1773 by Remorce (commit author name "Walking Sim Game"). It covers values made under the write's own lane mask, one constant per dword, and loop counters stepping by the group. It was cherry-picked onto #2358 with its `Access` fields (`data_const`, `strided`, `ds_off`) merged next to #2358's `atomic_alg`. `git range-diff` against the PR's commit 82221d1 shows only that merge. #2358 and #1773 conflict with each other in `lds.rs`, and each applies to main on its own. Whichever lands second needs the same small resolution. - Both build on #43 (Vladimir-Human). - Only a5ae2928 is new in this pull request. ## How it was tested - GPU and profile: no game run. Two kinds of checks were done: - offline translation of the title's shader archive with `VICTORY_HOST_WAVE=32`; - 13 hand-written wave64 cases (our own instructions, nothing from the title), dispatched on the RTX 5080 (32-lane waves) and on the Ryzen 7 9800X3D's integrated Radeon (RDNA 2, gfx1036). Windows 11, 32 GB. - Archive, per compute program. The command was `VICTORY_HOST_WAVE=32 VICTORY_WAVE_WHY=1 victory translate --list --jobs 1 <archive>`, with a local print (not in this branch) of each program's hash ahead of its `WAVE` lines. A program counts as refused when a `WAVE64-WHY ... lds=true` line is printed. Its form is the last `WAVE64-RETRY` line, or the split form when there is none. | | 829188e9 | + #2358 + #1773 (tree of 8bac5b63) | + a5ae2928 (this branch) | |---|---|---|---| | refused by the LDS analysis | 181 | 162 | 139 | | of those, folded | 179 | 160 | 137 | | of those, another fallback form | 2 wave-wide | 2 wave-wide | the same 2, "without early-outs" retry | | folded compute programs in all | 266 | 255 | 232 (computed, see below) | - Before: the 829188e9 column above. - After, #2358 + #1773: 19 programs are no longer refused by the LDS analysis. - 11 of them now take the split form instead of the folded one. - The other 8 stay folded for reasons that are not about LDS: lane masks read as data, `v_mbcnt`, `v_readlane`. - Over the whole listing (26,084 programs, 2,681 of 2,682 compute emitted in both builds), exactly 11 emitted outputs change. Every other line is identical. The same 11 change in a `--jobs 8` run on empty caches. - In those `--jobs 8` runs, `VICTORY_WAVE_WIDE_FALLBACK=0 VICTORY_LDS_LAST_RESORT=0 VICTORY_LDS_WRITE_ONLY_OK=0` gives the same listing as the defaults, and no run prints `no wave32 lowering`. - After, a5ae2928: this run covered only the 162 programs that #2358 + #1773 still refuse (`VICTORY_TRANSLATE_ONLY`, 162 translated, 162 compute programs emitted). - 23 more programs leave the folded form and take the split form. On 829188e9, 7 of them were refused as "an LDS read and write in one lane-branch region" and 16 as "unproven LDS writes in one lane-branch region". - The 2 wave-wide programs take the earlier "without early-outs" retry instead. - The other programs were not translated again on this branch. The new proofs only run where the earlier ones fail, so they should not change, but that comes from reading the code, not from a measurement. The 232 above is 255 less the 23. - All three commits together: 42 programs are no longer refused by the LDS analysis (181 to 139). Of those, 34 leave the folded form. - #1435's own list: of the 10 hashes in the issue, `0e366d15868e17bd` and `5964b734c70b91eb` leave the folded form, both through #1773. The other 8 are still refused on this branch: 6 for a read and write in one region, 1 for a shared write in a loop, 1 for an atomic-only region. - futurepro62's list: of the 75 programs posted in the issue, 13 leave the folded form (8 through #2358 + #1773, 5 through a5ae2928). - Synthetic cases, against wave64 hardware: - The cases are 13 hand-written wave64 bodies, one 64-thread group each: 4 for #2358's atomics, 4 for #1773's proofs, 4 for Refinement D (tid 0, 40, 63, and `v_cmpx` inside a wider branch) and 1 for Refinement E (16 threads with interleaved slots). - Each was translated for a 32-lane host, passed `dxil.dll`'s validator, and was dispatched on both cards. The 16 outputs x 64 lanes were compared with the same bodies run natively in wave64 on the gfx1036 iGPU through a local harness. - Command: `cargo test -p victory-shader --lib local_lds1435 -- --ignored --nocapture` with `VICTORY_ADAPTER=NVIDIA` or `Radeon`, `VICTORY_WAVE_WIDE_FALLBACK=0` and `VICTORY_WAVE_WHY=1`. `local_lds1435` is a local test module that is not in this branch. - Result: 13 of 13 exact on the RTX 5080 and 13 of 13 exact on the Radeon. All 13 take the split form (no `WAVE64-RETRY`). - The same harness at 829188e9 folds 11 of the 13 cases, and with #2358 + #1773 it folds 5 (the D and E cases). The folded results are exact too. So these cases show that the new proofs give the console's answer. They do not show that the old form was wrong. - For shader changes, the wave sizes tested: wave64 console programs on 32-lane host waves (the case this analysis is for), on NVIDIA and AMD. The reference is native wave64 on the AMD iGPU. 64-lane hosts were not run. - `cargo test` passed for the crates it touches: yes, apart from 3 tests that fail on main in the same way. On 66da0fef (main 7995b81b + the three commits), RTX 5080: - `cargo test -p victory-shader --lib lds`: 51 passed, 0 failed, 1 ignored (430 filtered out). The 32 tests of `emit::lds::tests` are among them. - `cargo test -p victory-shader --lib -- --test-threads=6`: 470 passed, 3 failed, 9 ignored. The 3 failures are `emit::barycentric_tests::first_half_values_render_on_hardware_and_warp`, `emit::rect::tests::rectangles_are_drawn_whole` and `emit::rect::tests::the_rectangle_stage_is_a_geometry_shader`, all with `Container part 'Pipeline State Validation' does not match expected for module` from the local DXIL validator. The same 3 fail the same way on main 7995b81b without this branch. - `cargo clippy -p victory-shader --all-targets -- -D warnings`: fails on main's own code (unused imports in `emit/lower/analysis.rs:6` and `emit/lower.rs:594`, `while_immutable_condition` in `emit/lower/analysis.rs:467`, `too_many_arguments` in `native.rs:1655`). None is in `lds.rs`. - For reference: the tip has 32 tests in `emit::lds::tests` and 482 `#[test]` functions in the crate's sources. #2358's description reports 23 passed in `emit::lds::tests` at its head, and steven-seagull27 reported 24 passed at #1773's head. Neither result covers this branch. - Not tested: - No in-game check: no frame rate and no picture comparison. - The archive counts and the synthetic cases were not run again on a5ae2928 or 66da0fef (only `cargo test` was). They come from a build of the working tree before the commit, with local debug prints. The commit adds rustfmt formatting, doc comments and the 1,024-open-span bound in the footprint check, which can only refuse more. - Not measured on main (fbe3dc20 or 7995b81b). There folding is off by default and comes after the plain retries and the local-wave idiom, so what the 34 programs take on main without this branch is not known from these runs. - The archive runs used `--list` without `--validate` (0 validated). The new DXIL of the 34 programs was emitted but not validated, and no pipeline was made from it. Only the 13 synthetic cases went through the validator and the cards. - Inherited from #1773: Melow-code's review found that `counter_bits` takes exponential time on a deeply shared OR chain. steven-seagull27's d6f46fd memoises it, and Remorce left it out of #1773 for now. This branch carries #1773 as it is. The new walk in `may_hold` is memoised and has a node budget. - In game: pending. An earlier in-game A/B is void: its build reused a stale victory-shader from a shared target dir. It is being redone and the result will be posted here. ## Checked for overlap - [x] I searched the open pull requests for the same issue and for the files this touches. Upstream: no commit in `829188e9..7995b81b` touches `lds.rs`, and the three commits apply to 7995b81b unchanged. 5c262d7b and 05d1c564 change when folding runs (`fold.rs`, `emit/mod.rs`). `git merge-tree --write-tree vnv/main` on this branch is clean at fbe3dc20. Related: - #2358 (open): commit 1 here, unchanged. - #1773 (open): commit 2 here, with its fields merged next to #2358's. The two conflict with each other. - #733 (open, conflicting): a separate `emit::lds_exact` module behind `VICTORY_LDS_EXACT=1`, tried after every other form. It also has a one-thread proof (entry edges on `v_cmp_eq(thread id, k)`, 1-D groups) and a check that read and written ranges do not meet. This branch works inside #43's `lds::analyze`, on by default. It handles 1-, 2- and 3-D groups up to 1,024 threads and checks per-thread footprints over the threads that run each access. - #1590 (closed) and #1575 (open): the write-only shortcut as a last try, or on by default. In #1435, trustno1-coder reported wrong pictures and high GPU time with the shortcut. This branch adds proofs only and leaves the shortcut off. - #2917 (open): one line in `lds.rs` (`with_last_resort` through `lower::with_flag`), far from these hunks, with no overlap in what it does. - #2261 (open, conflicting): the order of folding against the exact retries in `emit/mod.rs`. It is not an LDS proof, and 05d1c564 has since changed that order. - #822 and #388 (open): `6b82bc7d22016cb5` through `lower.rs`, which this branch does not take. - #2001 (open): the paired Wave64 fallback for programs that no wave32 form takes. It is a different form and does not overlap with this one. ## AI use Claude Code (Claude Opus 5.5) wrote a5ae2928 (Refinements D and E and their tests). It cherry-picked #2358's and #1773's commits with their authorship kept, and merged #1773's `Access` fields next to #2358's. It also wrote the 13 synthetic cases and the local harness, ran the archive counts and the comparisons on both cards, and wrote this description. The first two commits are nidea1's and Remorce's own work. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Lyrnc commented 2026-11-30 18:59:14 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by Lyrnc on 2026-11-30T18:59:14Z.


Rebased onto main 84bd61e2 (v2026.11.30.02) and force-pushed (now eccfe32c).

#1773 is on main (d611fccb), so its commit dropped out of this branch. Two commits are left:

  • #2358's commit (nidea1, author kept), with the same small lds.rs merge against #1773 that #2358 itself will need when it lands;
  • this PR's commit, with the same patch as before (git range-diff: =).

lds.rs at the new tip is byte for byte the same as at the old tip, 66da0fef. Once #2358 is merged, this PR is one commit.

Checks on eccfe32c (Windows 11, rustc 1.98.1, its own target dir): cargo check -p victory-shader passes. cargo test -p victory-shader --lib -- emit::lds: 33 passed, 1 ignored, among them this PR's one-thread and footprint tests and #2358's atomics tests.

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:comment:7288667821 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/3441#issuecomment-7288667821). Originally posted by [Lyrnc](https://github.com/Lyrnc) on 2026-11-30T18:59:14Z. --- Rebased onto main 84bd61e2 (v2026.11.30.02) and force-pushed (now eccfe32c). #1773 is on main (d611fccb), so its commit dropped out of this branch. Two commits are left: - #2358's commit (nidea1, author kept), with the same small `lds.rs` merge against #1773 that #2358 itself will need when it lands; - this PR's commit, with the same patch as before (`git range-diff`: `=`). `lds.rs` at the new tip is byte for byte the same as at the old tip, 66da0fef. Once #2358 is merged, this PR is one commit. Checks on eccfe32c (Windows 11, rustc 1.98.1, its own target dir): `cargo check -p victory-shader` passes. `cargo test -p victory-shader --lib -- emit::lds`: 33 passed, 1 ignored, among them this PR's one-thread and footprint tests and #2358's atomics tests.
nidea1 commented 2026-12-01 03:14:14 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by nidea1 on 2026-12-01T03:14:14Z.


@Lyrnc Heads up that #2358 is now rebased cleanly onto current main (b103b428, MERGEABLE) whenever you rebase #3441.

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:comment:7299491005 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/3441#issuecomment-7299491005). Originally posted by [nidea1](https://github.com/nidea1) on 2026-12-01T03:14:14Z. --- @Lyrnc Heads up that #2358 is now rebased cleanly onto current `main` (`b103b428`, `MERGEABLE`) whenever you rebase #3441.
Lyrnc commented 2026-12-01 03:52:40 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by Lyrnc on 2026-12-01T03:52:40Z.


Thanks @nidea1. Rebased onto #2358's new head and force-pushed: this PR is now b103b428 + bb731ece.

  • #2358's commit is b103b428 itself, unchanged (nidea1 as author), so once #2358 is merged this PR is one commit.
  • This PR's commit is the same patch. The only conflict was the order of the checks in safe: #2358 now lists strided-private before commutative atomics, and this PR's two checks follow them. Apart from that order and #2358's field order, lds.rs is the same as at the old tip.

Checks on bb731ece (Windows 11, rustc 1.98.1, its own target dir):

  • cargo test -p victory-shader --lib -- emit::lds: 33 passed, 1 ignored. Among them are this PR's one-thread and footprint tests and #2358's atomics tests.
  • cargo clippy -p victory-shader --all-targets -- -D warnings: clean.

AI use: Claude Code (Claude Opus 5.5) did the rebase, ran the checks and wrote this.

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:comment:7300153816 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/3441#issuecomment-7300153816). Originally posted by [Lyrnc](https://github.com/Lyrnc) on 2026-12-01T03:52:40Z. --- Thanks @nidea1. Rebased onto #2358's new head and force-pushed: this PR is now b103b428 + bb731ece. - #2358's commit is b103b428 itself, unchanged (nidea1 as author), so once #2358 is merged this PR is one commit. - This PR's commit is the same patch. The only conflict was the order of the checks in `safe`: #2358 now lists strided-private before commutative atomics, and this PR's two checks follow them. Apart from that order and #2358's field order, `lds.rs` is the same as at the old tip. Checks on bb731ece (Windows 11, rustc 1.98.1, its own target dir): - `cargo test -p victory-shader --lib -- emit::lds`: 33 passed, 1 ignored. Among them are this PR's one-thread and footprint tests and #2358's atomics tests. - `cargo clippy -p victory-shader --all-targets -- -D warnings`: clean. AI use: Claude Code (Claude Opus 5.5) did the rebase, ran the checks and wrote this.
This pull request cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'upstream-pr/3441:upstream-pr/3441'
git switch 'upstream-pr/3441'

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch 'main'
git merge --no-ff 'upstream-pr/3441'
git switch 'upstream-pr/3441'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/3441'
git switch 'upstream-pr/3441'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/3441'
git switch 'main'
git merge --squash 'upstream-pr/3441'
git switch 'main'
git merge --ff-only 'upstream-pr/3441'
git switch 'main'
git merge 'upstream-pr/3441'
git push origin 'main'
Sign in to join this conversation.
No reviewers
No labels
No milestone
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
trustno1-coder/VIctory-NVIDIA!3441
No description provided.