Shaders: count threads of wave64 builder programs on 32-lane hosts (NVIDIA) #66
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!66
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-66"
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?
@Mumogg on GitHub · 2026-11-26 01:22 UTC · original
Mumogg:nvidia-partial-dispatch→main· +188 −16 · 2 files · 1 commits · merged 2026-11-26 08:17 UTCSummary
On 32-lane hosts (NVIDIA),
counted_in_threadsskips the structure builder's one-dimensional wave64 programs (!parts.native.wave64 || host_max_wave() >= 64), because their console waves run as two host waves that exchange through group barriers, and lanes cannot leave at entry. The lanes past the dispatch's thread count (USER_DISPATCH_THREADS_X) therefore run: they count in wave ops (s_bcnt1 exec, reductions, ballots) and store.This keeps those lanes alive for the barriers and leaves them out instead (
partial_active): memory accesses (global, flat, buffer, image, LDS), EXEC ballots, wave reductions,scctests and the halves' exchange. Shuffles (ds_swizzle,ds_(b)permute) keep the plain guard, because they read other lanes, not memory. AMD and other 64-lane hosts are unchanged (they still take the early return).Together with the first-lane fix from fxceless/victory-fork#497 (
54f3815,3e36c41: the builder's prefix scans), this brings the ray-tracing structure builder to 53/53 host pipelines on an RTX 5070 Ti, andVICTORY_BVH_BUILDER=1turns on in game. That fix is not part of this PR.Test
partial_dispatch_with_a_cross_half_wave_op_runs_in_32_lane_waves(adapted from fxceless/victory-fork#646's test): a spilled 64-thread wave64 program readss_bcnt1_i32_b64(exec)on entry, takes a whole-wave OR of1 << (lane >> 1)(which crosses the halves), and stores both for every lane. It is lowered throughlower::loweron a 32-lane host, so it goes throughcounted_in_threadsas the game's programs do. It must take 32-lane waves and give exact results for counts 45, 1, 33 and 0.USER_DISPATCH_THREADS_Xis never read).victory-shader --features hostsuite on this branch: 278 passed, 1 failed (stub_pipeline_is_created, which also fails without this change: vkd3d-proton does not check the DXIL digest).Tested on Linux only: RTX 5070 Ti, Wine 11.22 + vkd3d-proton, DXC 1.9.2609 validator. Not tested on Windows or AMD yet. In-game testing on NVIDIA/Linux is still in progress; I will post updates here.
No game data, code or assets are included.
AI-assisted: the change, the test and this text were made with Claude Code at my request.
🤖 Generated with Claude Code
@MoonYueya on GitHub · 2026-11-26 05:28 UTC · original
Tested on an RTX 3080 10 GB, driver 32.0.16.1742, Ryzen 7 7700, 31.1 GB RAM, Windows 11 26300, merged into MoonYueya/VIctory-Kira
a3de053on top ofe2a28ectogether with the other open NVIDIA PRs (#47 #48 #24 #23 #78 #42 #66 #18 #10 #4 #58 #17).cargo test --workspace --locked --no-fail-fast -- --test-threads=1: 925 passed, 0 failed, 45 ignored after this PR was merged (never below the count before it; the branch started at 923).counted_in_threadsused to skip the structure builder's programs outright. Its spill test passes here.What this does not show: the PR was not run in the game on its own, so this is unit tests plus a combined run, not an in-game verification of this PR by itself; nothing here is about picture quality.
AI-assisted.
@avatarmanz on GitHub · 2026-11-26 07:56 UTC · original
Merged into main in the next push (tests pass); thanks.