Assign unique compute thread IDs on tiled wave32 GPUs #18
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!18
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-18"
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?
@gomeaw on GitHub · 2026-11-25 23:37 UTC · original
gomeaw:fix/compute-wave32-thread-ids→main· +366 −92 · 3 files · 1 commits · openFix
Native wave32 compute shaders that use lane operations currently derive a logical wave base by rounding the first hardware thread ID down. NVIDIA can tile a wave across rows. In a 32 × 2 group, for example, the two waves can start at 0 and 16, so both get logical IDs 0–31. Stores from the second logical wave are lost.
This adapts the wave ticket from Marvisak/VIctory#2126 by 0xkn0wh3r3 to this fork’s existing wave64-to-wave32 lowering. One physical thread initializes the shared counter and one lane of each full wave increments it. A partial wave takes the last range regardless of arrival order. The XYZ components share one remapped flat ID. Native one-dimensional and single-wave groups keep the fast path. Native wave32 shaders already using all 32 KiB of group-shared memory keep their existing lowering.
Verification
The Windows SDK validator accepted the translated wave32 and split-wave64 fixtures. The same ticket prologue wrote exactly one value to every ID in three WARP dispatches, including full and partial waves. The tests also ran with shader optimization enabled. Windows validation
The original PR measured the tiled layout on RTX hardware. To test this port on a 32-lane GPU, run
cargo test --locked -p victory-shader --lib wave_ticket_counters_cover_every_id_on_wave32_hardware -- --nocapture. It runs 11 synthetic shapes and checks both ID coverage and the console lane value at each ID. Gameplay and frame-time impact are still open.A separate Windows 11 test on a physical RTX 3080 Ti 12 GB at preview
bfd9ef8passed all 11 translated group shapes. The test checked the console lane value and exact ID coverage. Independent Ampere resultAI-assisted with Codex. The fixtures are synthetic.
@spook40 on GitHub · 2026-11-26 00:15 UTC · original
Tested PR #18 on NVIDIA GeForce RTX 3060 Ti (8 GB VRAM) (
pr-18branch,diagprofile with--features diagnostics,VICTORY_TEXTURE_MAX=512):cargo test --locked -p victory-shader --lib wave_ticket_counters_cover_every_id_on_wave32_hardware -- --nocapturepassed (all 11 translated group shapes wrote each console ID once on 32-lane hardware).273560526-byte host pipeline library (early=2567,made=271,loaded=1361,started_early=2291). Frame pacing in thisdiagrun was ~1.0 fps(1013.2 ms/frame,3899 draws/frame, GPU ~26% busy), mostly limited by CPU list/pipeline/memory-tracking overhead rather than the wave ticket change itself.AI-assisted with Gemini.
@j-fuxa on GitHub · 2026-11-26 01:40 UTC · original
Results from before the change, in case they help judge where the prologue is needed. RTX 4060 Laptop 8 GB and Radeon 780M iGPU, both 32-lane, Windows 11. Small compute programs storing each thread's console id with the old rounding (
waveReadLaneFirst(flat id)rounded down to the wave size, plus the lane). Ids stored of total, the same on both GPUs:12x12 and 24x8 did not create a pipeline on the RTX 4060 in our harness ("Not enough memory resources"); on the 780M they stored 96 / 144 and 128 / 192. So this is not NVIDIA-only: both GPUs fill 2-D groups from 16x2 tiles, and a host wave is not an aligned run of flat ids.
The ticket here is the design we ended up with too (zeroed counter, barrier, each full wave's first lane takes a block of wave-size ids, the partial wave takes the last block). In the title's shader archive 221 compute programs take it in our tree; three were wrong without it (all 32x2, ambient-map sky). The visible gain is small and the cost, a barrier and an LDS dword, falls on the other 218, so the single-wave and 1-D fast path matters.
Both versions assume at most one partial host wave per group. We have not seen more, and did not try to prove there cannot be. A form without that assumption: each wave's first lane does
atomicAdd(counter, WaveActiveCountBits(true))and lanes usebase + WavePrefixCountBits(true). Ids stay unique but are no longer wave-aligned, so code usingid & 63as the console lane would still need it.Caveat: synthetic programs on two GPUs, not the title; the 221 / 3 counts come from translating the archive, not running it.
@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: 928 passed, 0 failed, 45 ignored after this PR was merged (never below the count before it; the branch started at 923).lane_order_testspasses on this adapter. It conflicted with #66 (self.halves.is_some()becameself.split_wave, the same rename this PR makes elsewhere).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:36 UTC · original
Left open: rewrites the thread-ID relabelling outside the 32-lane path too; needs a shader check and an in-game check on AMD and NVIDIA first.
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.