Shaders: a mask read as a number takes lanes 32-63 from its high dword in halves mode #108
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/108"
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?
Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by Caasares on 2026-11-27T18:15:09Z.
Bug
A console wave64 compute program that the translator runs as two host waves of 32 ("halves"; used when the host's waves hold at most 32 lanes, as NVIDIA's do) reads a 64-bit lane mask held as a number with the wrong lanes. Lanes 32-63 take bits of the low dword instead of the high one.
Impact
Per-lane results are wrong for lanes 32-63 of such a program, for example a
v_cndmask_b32whose mask is an SGPR pair the program does not track.Root cause
thread_idnumbers the lanes of a halved program throughconsole_thread().console_lane()andlane_bit()only do the same whenexchangeis set. Otherwiselane_bittakeswaveGetLaneIndex, which is 0-31 in each host wave, solane < 32is always true and the high dword is never chosen.Fix
In halves mode
console_lane()givesconsole_thread() & 63, andlane_bit()uses it, as exchange mode already does.Testing
wave64_tests::lanes_past_32_take_the_high_dword_of_a_mask_held_as_a_number. A DPP move makes the program take the console's lanes, so it runs in halves. Thenv_cndmask_b32readss[2:3]as the mask. The test checks all 64 lanes for three masks, on the hardware device when one takes waves of 32, and skips otherwise.mainat lane 32 (maska0f0123455550f0f) and passes with this change.cargo test -p victory-shader --locked: 289 passed, 0 failed, 4 ignored (already ignored onmain).cargo clippy -p victory-shader --all-targets --locked -- -D warnings, and the same with--all-features: clean.lower.rsandwave64_tests.rsalready had rustfmt differences onmainand the number is unchanged.Workspace-wide clippy and fmt already fail on
mainin code this PR does not touch (victory-formats/src/texture.rs:1346,apps/victory).Related
#52 makes a select on a mask held as a number count toward
console_lanes. This PR does not depend on it: its test reaches halves mode with a DPP move. With #52 applied, a wave64 program with such a select does reach halves mode, and this change is what numbers its lanes correctly there. I have not run #52's branch on the card.Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by cloph-dsp on 2026-11-28T00:36:17Z.
Independent local verification of PR #108 (lanes past 32 take the high dword of a mask held as a number).
cargo test --locked, synthetic inputs only; CPU interpreter (Host::new(false)), no GPU.245cb85145bfd083e3df6769adf68dbdbb670340, merge base29d8dbf7d9892ceb8bec378a9dbc3c4f2931b745, worktree-localCARGO_TARGET_DIR.cargo test --locked -p victory-shader --lib -- emit::wave64_tests::lanes_past_32_take_the_high_dword_of_a_mask_held_as_a_number --exact --test-threads=1 --quiet→test result: ok. 1 passed; 0 failed; 292 filtered out, exit 0.git grep -F lanes_past_32_take_the_high_dword_of_a_mask_held_as_a_number 29d8dbf7 -- crates/victory-shader/src/emit/wave64_tests.rs→ exit 1 (test absent on base).git diff --check 29d8dbf7 HEADclean; diff 2 files, +48/−5.Only the named test was replayed; full suite not run. GPU/driver N/A (CPU interpreter). AI-assisted (Hy4 flash). No game data, assets, extracted shaders, DRM or decrypt.
Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by trustno1-coder on 2026-11-28T02:49:11Z.
Merged into main (
8fc2254) and shipped in v2026.11.27.10. The commit keeps you as its author, so it counts toward the contributors list. GitHub shows this as closed rather than merged only because the commits were applied on top of the newest main (new commit IDs). Thank you!Pull request closed