No reviewers
Labels
No labels
AMD
audio
bug
confirmed
crash
cutscene
dlss
documentation
duplicate
enhancement
fixed-on-main
frame-generation
good first issue
help wanted
input
INTEL
invalid
lighting
linux-proton
memory
needs-info
needs-logs
needs-rebase
NVIDIA
performance
pr-diagnostics
pr-docs
pr-feature
pr-fix
pr-performance
pr-refactor
pr-tests
question
RAYTRACING
rendering
report
series-s
shaders
spam
startup
upstream
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/trustno1-coder--VIctory-NVIDIA!3441
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-3441"
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?
@Lyrnc on GitHub · 2026-11-29 23:23 UTC · original
Lyrnc:fix/lds-proofs-1435→main· +730 −23 · 1 files · 2 commits · openPart 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 nowf0a43745,934475bfand66da0fef, with the same patches (git range-diffshows no change). The archive and synthetic measurements below were made on the829188e9base; thecargo testresults are on66da0fef.What it changes
What was wrong. On a 32-lane host, #43's
lds::analyzelets 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. On829188e9the first retry is the folded form. On main since5c262d7band05d1c564, the plain retries and the local-wave idiom run first, and folding comes before the wave-wide and approximate forms.5c262d7bmeasured 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:if (tid == 0) { ... }), whatever it reads or writes;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: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.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.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.VICTORY_LDS_WRITE_ONLY_OKandVICTORY_LDS_LAST_RESORTare unchanged: the write-only shortcut stays off by default, and the last resort keeps its default list of one program.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:v_cmpx;Credit:
git patch-idmatches the PR's diff. It adds Refinement C: commutative non-returning 32-bit integer LDS atomics.Accessfields (data_const,strided,ds_off) merged next to #2358'satomic_alg.git range-diffagainst the PR's commit82221d1shows only that merge. #2358 and #1773 conflict with each other inlds.rs, and each applies to main on its own. Whichever lands second needs the same small resolution.How it was tested
GPU and profile: no game run. Two kinds of checks were done:
VICTORY_HOST_WAVE=32;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 itsWAVElines. A program counts as refused when aWAVE64-WHY ... lds=trueline is printed. Its form is the lastWAVE64-RETRYline, or the split form when there is none.829188e9Before: the
829188e9column above.After, #2358 + #1773: 19 programs are no longer refused by the LDS analysis.
v_mbcnt,v_readlane.--jobs 8run on empty caches.--jobs 8runs,VICTORY_WAVE_WIDE_FALLBACK=0 VICTORY_LDS_LAST_RESORT=0 VICTORY_LDS_WRITE_ONLY_OK=0gives the same listing as the defaults, and no run printsno 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).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".All three commits together: 42 programs are no longer refused by the LDS analysis (181 to 139). Of those, 34 leave the folded form.
0e366d15868e17bdand5964b734c70b91ebleave 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.Synthetic cases, against wave64 hardware:
v_cmpxinside a wider branch) and 1 for Refinement E (16 threads with interleaved slots).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.cargo test -p victory-shader --lib local_lds1435 -- --ignored --nocapturewithVICTORY_ADAPTER=NVIDIAorRadeon,VICTORY_WAVE_WIDE_FALLBACK=0andVICTORY_WAVE_WHY=1.local_lds1435is a local test module that is not in this branch.WAVE64-RETRY).829188e9folds 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 testpassed for the crates it touches: yes, apart from 3 tests that fail on main in the same way. On66da0fef(main7995b81b+ the three commits), RTX 5080:cargo test -p victory-shader --lib lds: 51 passed, 0 failed, 1 ignored (430 filtered out). The 32 tests ofemit::lds::testsare among them.cargo test -p victory-shader --lib -- --test-threads=6: 470 passed, 3 failed, 9 ignored. The 3 failures areemit::barycentric_tests::first_half_values_render_on_hardware_and_warp,emit::rect::tests::rectangles_are_drawn_wholeandemit::rect::tests::the_rectangle_stage_is_a_geometry_shader, all withContainer part 'Pipeline State Validation' does not match expected for modulefrom the local DXIL validator. The same 3 fail the same way on main7995b81bwithout this branch.cargo clippy -p victory-shader --all-targets -- -D warnings: fails on main's own code (unused imports inemit/lower/analysis.rs:6andemit/lower.rs:594,while_immutable_conditioninemit/lower/analysis.rs:467,too_many_argumentsinnative.rs:1655). None is inlds.rs.emit::lds::testsand 482#[test]functions in the crate's sources. #2358's description reports 23 passed inemit::lds::testsat its head, and steven-seagull27 reported 24 passed at #1773's head. Neither result covers this branch.Not tested:
66da0fef(onlycargo testwas). 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.fbe3dc20or7995b81b). 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.--listwithout--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.counter_bitstakes 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 inmay_holdis 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
829188e9..7995b81btoucheslds.rs, and the three commits apply to7995b81bunchanged.5c262d7band05d1c564change when folding runs (fold.rs,emit/mod.rs).git merge-tree --write-tree vnv/mainon this branch is clean atfbe3dc20. Related:emit::lds_exactmodule behindVICTORY_LDS_EXACT=1, tried after every other form. It also has a one-thread proof (entry edges onv_cmp_eq(thread id, k), 1-D groups) and a check that read and written ranges do not meet. This branch works inside #43'slds::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.lds.rs(with_last_resortthroughlower::with_flag), far from these hunks, with no overlap in what it does.emit/mod.rs. It is not an LDS proof, and05d1c564has since changed that order.6b82bc7d22016cb5throughlower.rs, which this branch does not take.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
Accessfields 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
66da0fef3btoeccfe32c51@Lyrnc on GitHub · 2026-11-30 18:59 UTC · original
Rebased onto main
84bd61e2(v2026.11.30.02) and force-pushed (noweccfe32c).#1773 is on main (
d611fccb), so its commit dropped out of this branch. Two commits are left:lds.rsmerge against #1773 that #2358 itself will need when it lands;git range-diff:=).lds.rsat 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-shaderpasses.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 on GitHub · 2026-12-01 03:14 UTC · original
@Lyrnc Heads up that #2358 is now rebased cleanly onto current
main(b103b428,MERGEABLE) whenever you rebase #3441.eccfe32c51tobb731ece8b@Lyrnc on GitHub · 2026-12-01 03:52 UTC · original
Thanks @nidea1. Rebased onto #2358's new head and force-pushed: this PR is now
b103b428+bb731ece.b103b428itself, unchanged (nidea1 as author), so once #2358 is merged this PR is one commit.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.rsis 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.
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.