Preserve LDS atomic ordering between divergent half-waves #204
No reviewers
Labels
No labels
accessibility
already-solved
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
merged
needs-decision
needs-game-run
needs-rebase
not-merged
nvidia
obsolete
question
security
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/avatarmanz--VIctory-7900XTX!204
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-204"
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?
@feanorsun on GitHub · 2026-11-26 11:29 UTC · original
feanorsun:fix/order-divergent-lds-atomics→main· +115 −8 · 1 files · 1 commits · openRefs #182
The Wave32 lowering analysis for divergent regions classified every non-read LDS operation as write-only. An atomic minimum followed by an atomic add can therefore get synchronization only at the region boundaries. In a 64-lane wave with 33 active lanes, all lanes first clear one shared word and then increment it. The CPU reference ends at 33. If one half finishes before the other clears the word, the result can be 1 or 32.
Account for the read side of LDS read-modify-write instructions, including operations without a return register. A region containing just one kind of commuting, non-returning integer reduction can still take the existing lowering. The existing flag proof remains available.
The synthetic regression exercises both returning and non-returning adds. On upstream
0dec5dcc228bthe original control flow was incorrectly accepted for Wave32. After the change, the public emitter uses the existing EXEC-skip rewrite for the mixed operations and emits Wave32 with the operations in blocks all lanes reach. Two identical non-returning adds still take the direct Wave32 path.Tested on Windows with a CPU reference and the in-memory shader emitter. The new exact test failed before the fix. It and the existing positive and negative flag-region tests passed afterwards. The three tests were listed individually, then run with
cargo test --offline --locked -j 1 -p victory-shader --lib <test> -- --exact --test-threads=1.The 128- and 1024-thread programs discussed in #37 use LDS atomics. This test addresses an ordering hazard when lowering that class of operation. It does not reproduce the four reported shader binaries, establish why those particular programs were refused, or measure rendering on the RTX 3070. No GPU or driver validation was run locally.
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.