Shaders: wave64 LDS regions that need no order between the halves (VICTORY_LDS_EXACT=1, off by default) #733
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!733
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-733"
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?
@OtavMacedo on GitHub · 2026-11-28 04:38 UTC · original
OtavMacedo:vn/wave64-lds-exact→main· +1294 −103 · 6 files · 3 commits · openWhat and why
On a host whose waves have 32 lanes (NVIDIA), a console wave64 compute program runs as two host waves per console wave. When the group holds several console waves and has LDS, the two halves only meet (group barrier) on the edges of each lane-branch region. A region that both reads and writes LDS is refused ("an LDS read and write in one lane-branch region"), and the program stays at 64 lanes, which the host refuses.
One such program is
6b82bc7d22016cb5: groups of 1,024 threads, all 32 KiB of LDS. No current form takes it. It fails on three things:ds_add_rtn_u32on an LDS counter, which the allocation idiom ofwith_local_wavesdoes not recognise (it only knowsbuffer_atomic_*);wave_basecounter would put it past D3D12's 32 KiB.Two kinds of region need no order between the halves, and the new
emit::lds_exactmodule proves them:v_cmp_eq(thread id, k)in a 1-D group, or comes from a block that thread alone runs. Loop masks joined by a phi are followed.Also:
wave_localtakes an LDS atomic (ds_add_u32and the others, with or without_rtn) as the first lane's reservation, in those forms only.Off by default. Even with
VICTORY_LDS_EXACT=1, these forms are tried after every other form, so a program that translates today keeps its form. WithVICTORY_WAVE_WHY=1, aWAVE64-LDS-REGIONline gives each refused region's code offsets and the reason.Files
crates/victory-shader/src/emit/lds_exact.rs(new): the region proofs. It also takes over the meeting analysis, which waslower.rs'slds_meetings. It still leaves out the accesses thatLdsOrderfinds unordered, and pair meetings are unchanged. Moving it also rejoins its doc comment, which an earlier insertion had split aroundLdsOrder.crates/victory-shader/src/emit/lower.rs: the idiom's LDS reservation,NO_COUNTERfor a full 32 KiB, and the 32 KiB refusal in the last forms.crates/victory-shader/src/emit/mod.rs: the last forms inemit, each whole and as local waves (idiom). Alsoemit::lds_exact().crates/victory-gpu/src/shader_cache.rs: the cache key includes the switch while it is on, the same way asVICTORY_EARLY_DEPTH.crates/victory-shader/src/emit/lds_exact_tests.rs(new), pluswhole_uavinwave64_tests.rs: hand-written 128-thread fixtures with no game data.Results (offline,
translate --list --jobs 1,VICTORY_HOST_WAVE=32)VICTORY_LDS_EXACT=16b82bc7d22016cb5(1,024 threads, 32 KiB LDS)02384a60fda6f2d0(128 threads)The emitted DXIL was not checked by
dxil.dllhere (no validator in this environment), and no pipeline was created.Tests
cargo test -p victory-shader -p xtask: 213 + 6 pass.lds_exacttests pass. They did not run on a GPU because no SM 6.6 device was available there.cargo clippy --workspace --all-targets(with and without--all-features, Windows target): no warnings in the changed files. Warnings elsewhere were already onmain.Validated on hardware (RTX 3070 8 GB, driver 32.0.16.2124, Windows 11). The same change, in VItoria Spark's tree (its PR #71), was run on that PC:
VICTORY_LDS_EXACT=1,6b82bc7d22016cb5gets a pipeline ("pipeline created"). With it plusVICTORY_WAVE_PAIR=1and02384a60fda6f2d0inVICTORY_WAVE_WIDE_ONLY, both programs that the card used to refuse are made.victory translateand the tests below). It is a hand port of the same code, so a run here with and without the switch is still worth doing.What to watch in the game. Run with
VICTORY_LDS_EXACT=1on an NVIDIA card. The program above should get a pipeline instead of being dropped. Look for wrong or missing geometry where its output is used, and compare against a run with the switch off.Credits. Port of the mandy project's commit 1855daf98 by NotRexed (and its tests, a7557be81), by way of VItoria Spark PR #71, adapted by hand to VIctory-NVIDIA's lowering.
🤖 Generated with Claude Code
@OtavMacedo on GitHub · 2026-11-28 04:38 UTC · original
Heads-up on CI: the Clippy step is already red on
main(63b902fe) from older code:let_and_returnin a test helper near the end ofemit/mod.rsandmanual_is_multiple_ofinvictory-gpu/src/shadow.rs. If this PR shows the same failure, that is where it comes from; the changed code adds no new clippy warnings (checked with and without--all-features, Windows target).@Dukestar69 on GitHub · 2026-11-28 04:45 UTC · original · approved these changes
LGTM — verified on Windows (RTX 5090):
cargo test -p victory-shader --lib lds_exact -- --nocapturepassed (6/6, including all 4 hardware execution tests on RTX 5090)cargo test -p victory-gpu --lib shader_cache::passed (2/2)cargo xtask policypassed (296 files ok)Synthetic tests only (no game files used). AI-assisted (Gemini 4 Neon).
@Aniseto on GitHub · 2026-11-28 07:08 UTC · original
Ran the exact-LDS-region tests at
e0a4f4don an NVIDIA Blackwell desktop part:Environment: Windows 11 Pro build 26200 x64, NVIDIA GeForce RTX 5070 Ti (Blackwell, 32-lane waves only, 16 GB) driver 32.0.16.2124, Intel Core i5-12400F, 64 GB RAM, Rust 1.98.1 (pinned by
rust-toolchain.toml), MSVC 14.44.35207, DXC 1.9.2609.5 (shared env), debug build.All six tests pass on a host with no 64-lane waves. They cover the region proof, the LDS-atomic allocation idiom, a single thread reading/writing its own LDS, the 32 KiB limit and the loop-allocation case. The thread's only new comment is about CI Clippy on
main, not a hardware run. I did not run the title's6b82bc7d22016cb5program or enableVICTORY_LDS_EXACT=1in a real session.Not tested: the title's shaders, a paired smoke run, the full workspace suite, release profile, AMD and Intel GPUs, native wave64 hosts, Wine, game data.
AI-assisted (OpenCode), model: DeepSeek V4.1 Flash Free - checked out the PR's head commit in a detached worktree, built it, ran the tests, wrote this report; the worktree was not modified; no game data was used.
github-bot referenced this pull request2026-11-30 08:12:06 +00:00
View command line instructions
Manual merge helper
Use this merge commit message when completing the merge manually.
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.