Shaders: a select on a lane mask held as a number keeps the console's lanes (port of VIctory-7900XTX #308) #52

Merged
illuminatedfellow merged 1 commit from upstream-pr/52 into main 2026-11-28 19:01:28 +00:00
illuminatedfellow commented 2026-11-27 15:05:42 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by illuminatedfellow on 2026-11-27T15:05:42Z.


Port of compaccount1-coder's fix from avatarmanz/VIctory-7900XTX#308 (still open there), cherry-picked with their authorship; the commit message is theirs.

The bug, on this fork's main: a v_cndmask_b32 select on a lane mask the code holds as a number (a constant bit pattern, or one loaded from memory) is lowered to each lane's own bit of that number. That is the console's bit only with the console's lanes, but the check that sets console_lanes doesn't count such a select. A compute program whose only cross-lane code is one is lowered without them:

  • release builds: no wave size and no relabelling, so each lane takes the bit of whatever host lane it lands in;
  • debug builds: the debug_assert! in cross_lane fires.

The fix: selects_on_mask_data counts toward console_lanes, beside reads_mask_as_data.

How it was found and checked here:

  • Fuzzing this fork's translator on Linux (random and mutated GFX10 programs through ir::build, structure, resources, io and lowering, with debug assertions on): 11 of 480,000 programs hit that assertion, all from this select.
  • The test program (an every-other-lane select, wave32, 64 threads), lowered at a host of 32-lane waves: on main, debug panics on the assertion and release gives wave_size None; on this branch, Some(32) in both.
  • After the fix: 780,000 more programs, including the seeds that crashed, with 0 panics.
  • cargo test -p victory-shader: 205 passed. The test file had changed here, so the new test is written with this fork's lowered_with_wave; it is in wave64_tests.rs, which runs on Windows only, so it hasn't run yet.

Not run on an RTX card or with title shaders.

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:issue:5528823633 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/52). Originally posted by [illuminatedfellow](https://github.com/illuminatedfellow) on 2026-11-27T15:05:42Z. --- Port of compaccount1-coder's fix from avatarmanz/VIctory-7900XTX#308 (still open there), cherry-picked with their authorship; the commit message is theirs. **The bug, on this fork's main:** a `v_cndmask_b32` select on a lane mask the code holds as a number (a constant bit pattern, or one loaded from memory) is lowered to each lane's own bit of that number. That is the console's bit only with the console's lanes, but the check that sets `console_lanes` doesn't count such a select. A compute program whose only cross-lane code is one is lowered without them: - release builds: no wave size and no relabelling, so each lane takes the bit of whatever host lane it lands in; - debug builds: the `debug_assert!` in `cross_lane` fires. **The fix:** `selects_on_mask_data` counts toward `console_lanes`, beside `reads_mask_as_data`. **How it was found and checked here:** - Fuzzing this fork's translator on Linux (random and mutated GFX10 programs through `ir::build`, structure, resources, io and lowering, with debug assertions on): 11 of 480,000 programs hit that assertion, all from this select. - The test program (an every-other-lane select, wave32, 64 threads), lowered at a host of 32-lane waves: on main, debug panics on the assertion and release gives `wave_size` None; on this branch, `Some(32)` in both. - After the fix: 780,000 more programs, including the seeds that crashed, with 0 panics. - `cargo test -p victory-shader`: 205 passed. The test file had changed here, so the new test is written with this fork's `lowered_with_wave`; it is in `wave64_tests.rs`, which runs on Windows only, so it hasn't run yet. Not run on an RTX card or with title shaders.
1tsethan commented 2026-11-27 23:00:39 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by 1tsethan on 2026-11-27T23:00:39Z.


Independent Windows validation of PR #52.

Tested commit: e399f154c639fd561625c80e2b5e9259834bac33.

cargo test --locked -p victory-shader a_select_on_a_mask_held -- --nocapture --test-threads=1

Exit: 0.

  • test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 292 filtered out; finished in 0.00s

This ran the mask-select lowering regression. It does not establish shader execution/output parity on the physical RTX adapter.

Independent verification with OpenAI Codex assistance. Windows 11 Pro build 26200; Rust 1.98.1 MSVC; Windows SDK libraries from Microsoft.Windows.SDK.CPP.x64 10.0.28000.2957. Test harness used an RTX 3070 Ti / AMD integrated-GPU host; adapter identity was not captured for every test. These are focused checks on the stated PR commit, not gameplay, FPS, or a merged-main integration result.

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:comment:7229798086 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/52#issuecomment-7229798086). Originally posted by [1tsethan](https://github.com/1tsethan) on 2026-11-27T23:00:39Z. --- Independent Windows validation of PR #52. Tested commit: `e399f154c639fd561625c80e2b5e9259834bac33`. `cargo test --locked -p victory-shader a_select_on_a_mask_held -- --nocapture --test-threads=1` Exit: **0**. - test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 292 filtered out; finished in 0.00s This ran the mask-select lowering regression. It does not establish shader execution/output parity on the physical RTX adapter. Independent verification with OpenAI Codex assistance. Windows 11 Pro build 26200; Rust 1.98.1 MSVC; Windows SDK libraries from Microsoft.Windows.SDK.CPP.x64 10.0.28000.2957. Test harness used an RTX 3070 Ti / AMD integrated-GPU host; adapter identity was not captured for every test. These are focused checks on the stated PR commit, not gameplay, FPS, or a merged-main integration result. <!-- victory-native-validation-20261128 -->
cloph-dsp commented 2026-11-27 23:35:14 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by cloph-dsp on 2026-11-27T23:35:14Z.


Independent local verification of PR #52 (shader select on a lane mask held as a number keeps the console's lanes).

  • Windows, Rust 1.100.0/MSVC (Scoop rust-msvc, no rustup/clippy), cargo test --locked, synthetic inputs only.
  • Head e399f154c639fd561625c80e2b5e9259834bac33, merge base d12eb1b23da4cad2f551a3dd49e82a87e564122a, worktree-local CARGO_TARGET_DIR.
  • Command: cargo test --locked -p victory-shader --lib -- emit::wave64_tests::a_select_on_a_mask_held_as_a_number_keeps_the_consoles_lanes --exact --test-threads=1 --quiet → test result: ok. 1 passed; 0 failed; 292 filtered out, exit 0.
  • Negative control: git grep -F a_select_on_a_mask_held_as_a_number_keeps_the_consoles_lanes d12eb1b2 -- crates/victory-shader/src/emit/wave64_tests.rs → exit 1 (test absent on base).
  • git diff --check d12eb1b2 HEAD clean; diff 2 files, +36 (lower.rs + wave64_tests.rs).

Only the named test was replayed; full suite not run. GPU/driver N/A (CPU-side lowering test). AI-assisted (Hy4 flash). No game data, assets, extracted shaders, DRM or decrypt.

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:comment:7230254160 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/52#issuecomment-7230254160). Originally posted by [cloph-dsp](https://github.com/cloph-dsp) on 2026-11-27T23:35:14Z. --- Independent local verification of PR #52 (shader select on a lane mask held as a number keeps the console's lanes). - Windows, Rust 1.100.0/MSVC (Scoop rust-msvc, no rustup/clippy), `cargo test --locked`, synthetic inputs only. - Head `e399f154c639fd561625c80e2b5e9259834bac33`, merge base `d12eb1b23da4cad2f551a3dd49e82a87e564122a`, worktree-local `CARGO_TARGET_DIR`. - Command: `cargo test --locked -p victory-shader --lib -- emit::wave64_tests::a_select_on_a_mask_held_as_a_number_keeps_the_consoles_lanes --exact --test-threads=1 --quiet` → `test result: ok. 1 passed; 0 failed; 292 filtered out`, exit 0. - Negative control: `git grep -F a_select_on_a_mask_held_as_a_number_keeps_the_consoles_lanes d12eb1b2 -- crates/victory-shader/src/emit/wave64_tests.rs` → exit 1 (test absent on base). - `git diff --check d12eb1b2 HEAD` clean; diff 2 files, +36 (lower.rs + wave64_tests.rs). Only the named test was replayed; full suite not run. GPU/driver N/A (CPU-side lowering test). AI-assisted (Hy4 flash). No game data, assets, extracted shaders, DRM or decrypt.
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
trustno1-coder/VIctory-NVIDIA!52
No description provided.