Shaders: a full-LDS wave64 program that reserves slots with an LDS atomic lowers to wave32 (6b82bc7d22016cb5) #822
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!822
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-822"
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?
@henriazz10 on GitHub · 2026-11-28 07:09 UTC · original
henriazz10:fix/wave32-lds-atomic-alloc→main· +249 −30 · 2 files · 4 commits · openSummary
On a 32-lane host (
VICTORY_HOST_WAVE=32, every NVIDIA card) the compute program6b82bc7d22016cb5did not translate ("no wave32 lowering for this wave64 program"), so its dispatches were dropped.docs/findings.md(800dada) lists it among the 22 wave64 programs without a wave32 lowering, created in play on an RTX 5080. It is a 1024-thread group that uses the whole 32 KiB of LDS and reserves slots with an LDS atomic (ds_add_rtn_u32) in the allocation idiom. This change lets the local-waves lowering take it. One more program (6832a9da15c2e584) translates as a side effect. Nothing that translated before changes.Cause
wave_localaccepted only buffer atomics (buffer_atomic_*) as the allocation idiom's reservation. The same reservation done with an LDS atomic (ds_*_rtn_*) was refused.halvesdword past the program's LDS. With a program that already uses all 8192 dwords, this went over the host's 32 KiB.lds_order's "unordered" set was only computed for pair meetings. Without it,lds_meetingsrefused an LDS read and an LDS atomic in one lane-branch region.Change (
crates/victory-shader/src/emit/lower.rs)wave_localtakesds_*_rtn_*(not GDS) as the reservation, like the buffer atomics:ds_add_rtn_u32forbuffer_atomic_add, and so on.halvesdwords are reserved as before when the LDS has room. They are left out only when the program's LDS is full, so every program that translated before keeps its layout.console_lanereturns the host lane in local mode only when there is nohalvesdword. Otherwise it keeps upstream's rule (halves.is_none() && exchange.is_none()).crates/victory-shader/src/emit/wave64_tests.rs, built by our own code; nothing from the title is in them:full_lds_local_wave_lds_atomic_allocation_lowers_to_wave32: refused before the change. Now it lowers to wave32, validates, and runs on the GPU, where 75 of 128 active threads take unique slots in a full 32 KiB of LDS.local_waves_console_lane_keeps_upper_half_when_lds_has_room: the upper host wave keeps console lanes 32..63 when the LDS has room.Evidence
Offline translation of every compute program in the title's
shaders.rpfwithVICTORY_HOST_WAVE=32, comparingorigin/main63b902fwith this branch:6b82bc7d22016cb5,6832a9da15c2e5846b82bc7d22016cb5is emitted and passesdxil.dllvalidation (translate --validate).Checks
cargo test -p victory-shader --locked: 295 passed, 0 failed.git diff --check origin/main: clean.cargo xtask policy: 294 files ok.cargo clippy -p victory-shader --all-targets --locked -- -D warningswith the local Rust 1.98: one finding,let_and_returnatemit/mod.rs:2768. It is already on main in an untouched file; CI's toolchain does not report it.Environment: Windows 11 (build 26300), RTX 5080, driver 616.92, AMD Ryzen 9 5950X.
Not tested
CS_CollectTriangles_Meshlets), so it may not be what draws the water's rectangular patches. #742 by @xss3009 addresses the water light's tile slots. The two changes combine: we merged both locally, and resolved the one-lineconsole_laneoverlap as(local && halves.is_none()) || (exchange.is_none() && halves.is_none() && twin.is_none()).AI-assisted. Gemini 4 Hydrogen (Antigravity CLI) wrote the change and ran the checks; Claude Code reviewed it.
🤖 Generated with Claude Code
@Aniseto on GitHub · 2026-11-28 07:15 UTC · original
Ran the full-LDS allocation tests at
9ee31f0on 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.Both new synthetic tests pass on a genuine 32-lane host: the 1024-thread full-32 KiB LDS program with the
ds_add_rtn_u32reservation now lowers to wave32, and the upper-half console lane keeps its value when LDS has room. They are translation tests; I did not run the title's6b82bc7d22016cb5program or a dispatch. The PR has no comments yet, so this is the first datapoint in the thread and the first from an RTX 5070 Ti.Not tested: the title's shader/dispatch, 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.
@KruIN689 on GitHub · 2026-11-28 10:24 UTC · original
I tested this PR on an RTX 5080 (driver 621.24, Windows 11) with my own copy of the title. I built the PR's head (
9ee31f0) and used its base,63b902f, as "before".Offline (
victory translate --list,VICTORY_HOST_WAVE=32, the title'sshaders.rpf):6b82bc7d22016cb5and6832a9da15c2e584now emit.63b902f. Nothing else changed.Tests:
victory-shaderlib suite pass (295 passed) on the RTX 5080 and WARP.cargo clippy -p victory-shader --all-targets -- -D warnings: one error, atmod.rs:2768. It is in a file this PR doesn't touch, and it is already on63b902f.In game (short, about 1 minute in the world):
6b82bc7d22016cb5translates, and its pipeline is made at first use.Two review notes:
s.lds_dwords + n < HOST_LDS_DWORDS(exchange) ands.lds_dwords < HOST_LDS_DWORDS(halves):<they are now left out, so that program's layout changes.<=would keep the old layout. No program in this title hits it, so it may be moot.u32::MAX. It is guarded only bydebug_assert!inexchange_dwordandexchange_pair. A release build that still reached them would address LDS atu32::MAX. Returning an error there might be safer.Not tested: what the effect itself looks like, and AMD hardware.
AI use: Claude Code (Claude Opus 5.5) ran these checks and drafted this comment. I read it before posting.
@henriazz10 on GitHub · 2026-11-28 12:51 UTC · original
Thanks @Aniseto, @johnthemistaker and @KruIN689. johnthemistaker's log line is exactly the refusal this PR removes, and KruIN689 now has it working in the game.
@KruIN689, both review notes are addressed in
177ac8a:<=, so a program whose LDS plus the exchange dwords comes to exactly 8192 keeps its old layout. Thehalvescheck was already right:lds_dwords < 8192is the same aslds_dwords + 1 <= 8192.exchange_dword/exchange_pair(a lane read across host waves, and the console-wave pair exchange) now refuse the program with an error. Before, only adebug_assert!stood between a release build and an LDS address ofu32::MAX.Checks:
cargo test -p victory-shader --lockedgives 295 passed. A full offline translation of the title'sshaders.rpfwithVICTORY_HOST_WAVE=32gives the same 25,669 emitted programs, with the same input and output hashes as9ee31f0. So in this title neither change is reached, as you expected.🤖 Generated with Claude Code
@nick0451 on GitHub · 2026-11-28 17:24 UTC · original
Works in play on Ampere (RTX 3090, 32-lane waves).
RTX 3090 24 GB (driver 610.88), i9-14900K, 32 GB, Windows 11. A release build of this PR merged onto main at
63b902f. Series S, DLSS Performance, frame generation off. Every run used the same frozen save, outdoors on a balcony by the water (about 5,900 draws a frame), standing still. One warm-up start per build, then main and four PR builds were run in turn, three rounds each. Each run is 40 s to settle, 60 s measured, then a screenshot. An A/A run of main against itself in this setup differs by 2-3%.shader does not translate; its pipelines' draws are dropped ... hash=6b82bc7d22016cb5 ... no wave32 lowering for this wave64 programin all 3 runs.6b82bc7d22016cb5in any run, and its pipeline is built in all 3. Shaders that do not translate in this scene go from 7 to 6 a run (21 to 18 over three runs).cargo test -p victory-shader --lib(merged onto63b902f, this PC): 295 passed. No crash, device loss orERRORline in the game.Tested with an AI assistant (Claude Code); results are from this PC.
@henriazz10 on GitHub · 2026-11-28 19:41 UTC · original
Thanks @nick0451, this closes the last open question for this PR: it works in play on Ampere too, not only on Blackwell (KruIN689's RTX 5080).
Your runs show what the PR is meant to do.
6b82bc7d22016cb5translates and its pipeline is built in all three runs, the shaders that don't translate go from 7 to 6 a run, and the picture is the same as main. The speed difference (23.9 against 24.6 fps median) is inside the 2-3 % your A/A run shows, so I read it as no change, which is what we expected from one compute shader that used to be dropped.🤖 Generated with Claude Code
@nick0451 on GitHub · 2026-11-28 20:57 UTC · original
A note for the rebase: on current main (
923e38c),6b82bc7d22016cb5fails to translate again in play (no wave32 lowering for this wave64 program, every run on my RTX 3090), as on63b902fbefore this PR. So this PR is still needed after the newer wave64 work. #1450 does not cover this program: with it applied,6b82bc7d22016cb5still fails, while five other programs translate again.Tested with an AI assistant (Claude Code); results are from this PC.
0x8007000E, Wave64→Wave32 Failure, Unimplemented Pipeline Slots & 1M View Heap Cap #1798View 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.