shader/lower: take mask lane bit by console lane in halves mode #33

Merged
Androtim merged 1 commit from upstream-pr/33 into main 2026-11-28 18:44:27 +00:00
Androtim commented 2026-11-28 10:04:27 +00:00 (Migrated from github.com)

Imported from Androtim/MiniVI. Originally posted by Androtim on 2026-11-28T10:04:27Z.


Summary

Port rustno1-coder/VIctory-NVIDIA c1d8179 (Shaders: take a mask's lane bit by console lane in halves mode):

  • In crates/victory-shader/src/emit/lower.rs, include self.halves.is_some() alongside self.exchange in console_lane() and lane_bit() so console wave64 shaders lowered as two 32-lane host waves select bit (lane - 32) of the high mask dword for lanes 32–63 rather than reading bits 0–31 from the low dword via their host lane index.
  • In crates/victory-shader/src/emit/wave64_tests.rs, factor dispatched_words out of dispatched and add lanes_past_32_take_the_high_dword_of_a_mask_held_as_a_number verifying all 64 lanes across (0x5555_0F0F, 0xA0F0_1234), (u32::MAX, 0), and (0, u32::MAX) directly on D3D12 hardware.

Rig Specs Tested On

  • CPU: 13th Gen Intel(R) Core(TM) i7-13700F
  • GPU & VRAM: NVIDIA GeForce RTX 4060 Ti (8 GiB VRAM)
  • System RAM: 32 GiB
  • OS & GPU Driver: Windows 11 Home (Build 26300) / Driver 32.0.16.2124

Run Settings & Profile

  • Build & Commit SHA:
    elease @ $sha (static/lowering + D3D12 hardware wave64_tests on RTX 4060 Ti + CI full workspace suite; no separate live game capture for this targeted halves-mode lane-index bugfix)
  • Console Profile & Internal Resolution / Scale: N/A (hardware wave64 compute shader verification; full ictory-shader + ictory-gpu suite verified via CI)
  • Ray Tracing: N/A
  • Upscaling: N/A
  • Frame Generation: N/A
  • Launcher Command / Preset & Extra VICTORY_ Overrides:* N/A
  • Scene / Area & Session Length: N/A

Measurements & Verification

  • Base FPS (without Frame Gen): N/A (shader halves-mode lowering fix)
  • Frame-Gen FPS (if enabled): N/A
  • VRAM / RAM Usage: N/A
  • Crashes / DRED Resets: N/A
  • Automated Checks:
    • cargo +1.98.1-x86_64-pc-windows-gnu test -p victory-shader --lib emit::wave64_tests -- --nocapture (13 passed; 0 failed; 281 filtered out, confirming lanes_past_32_take_the_high_dword_of_a_mask_held_as_a_number executed on the RTX 4060 Ti without skipping)
    • cargo +1.98.1-x86_64-pc-windows-gnu run -p xtask -- policy (sset policy: 294 files ok)
    • cargo +1.98.1-x86_64-pc-windows-gnu test -p xtask (6 passed; 0 failed)
    • cargo +1.98.1-x86_64-pc-windows-gnu clippy --workspace --all-targets -- -D warnings (0 warnings)
    • cargo +1.98.1-x86_64-pc-windows-gnu clippy --workspace --all-targets --features victory-gpu/diagnostics -- -D warnings (0 warnings)
    • cargo +1.98.1-x86_64-pc-windows-gnu build --release -p victory + objdump -p check (0 non-system MinGW DLLs)
    • Full ictory-shader + ictory-gpu test suite via GitHub Actions CI (local SDK dxil.dll 101.6.2104.33 fails 3 pre-existing PSV0 validator tests unrelated to halves lowering)
<!-- greyfinch-sync:Androtim/MiniVI:issue:5539017369 --> Imported from [Androtim/MiniVI](https://github.com/Androtim/MiniVI/pull/33). Originally posted by [Androtim](https://github.com/Androtim) on 2026-11-28T10:04:27Z. --- ## Summary Port rustno1-coder/VIctory-NVIDIA c1d8179 (Shaders: take a mask's lane bit by console lane in halves mode): - In crates/victory-shader/src/emit/lower.rs, include self.halves.is_some() alongside self.exchange in console_lane() and lane_bit() so console wave64 shaders lowered as two 32-lane host waves select bit (lane - 32) of the high mask dword for lanes 32–63 rather than reading bits 0–31 from the low dword via their host lane index. - In crates/victory-shader/src/emit/wave64_tests.rs, factor dispatched_words out of dispatched and add lanes_past_32_take_the_high_dword_of_a_mask_held_as_a_number verifying all 64 lanes across (0x5555_0F0F, 0xA0F0_1234), (u32::MAX, 0), and (0, u32::MAX) directly on D3D12 hardware. ## Rig Specs Tested On - **CPU:** 13th Gen Intel(R) Core(TM) i7-13700F - **GPU & VRAM:** NVIDIA GeForce RTX 4060 Ti (8 GiB VRAM) - **System RAM:** 32 GiB - **OS & GPU Driver:** Windows 11 Home (Build 26300) / Driver 32.0.16.2124 ## Run Settings & Profile - **Build & Commit SHA:** elease @ $sha (static/lowering + D3D12 hardware wave64_tests on RTX 4060 Ti + CI full workspace suite; no separate live game capture for this targeted halves-mode lane-index bugfix) - **Console Profile & Internal Resolution / Scale:** N/A (hardware wave64 compute shader verification; full ictory-shader + ictory-gpu suite verified via CI) - **Ray Tracing:** N/A - **Upscaling:** N/A - **Frame Generation:** N/A - **Launcher Command / Preset & Extra VICTORY_* Overrides:** N/A - **Scene / Area & Session Length:** N/A ## Measurements & Verification - **Base FPS (without Frame Gen):** N/A (shader halves-mode lowering fix) - **Frame-Gen FPS (if enabled):** N/A - **VRAM / RAM Usage:** N/A - **Crashes / DRED Resets:** N/A - **Automated Checks:** - [x] cargo +1.98.1-x86_64-pc-windows-gnu test -p victory-shader --lib emit::wave64_tests -- --nocapture (13 passed; 0 failed; 281 filtered out, confirming lanes_past_32_take_the_high_dword_of_a_mask_held_as_a_number executed on the RTX 4060 Ti without skipping) - [x] cargo +1.98.1-x86_64-pc-windows-gnu run -p xtask -- policy (sset policy: 294 files ok) - [x] cargo +1.98.1-x86_64-pc-windows-gnu test -p xtask (6 passed; 0 failed) - [x] cargo +1.98.1-x86_64-pc-windows-gnu clippy --workspace --all-targets -- -D warnings (0 warnings) - [x] cargo +1.98.1-x86_64-pc-windows-gnu clippy --workspace --all-targets --features victory-gpu/diagnostics -- -D warnings (0 warnings) - [x] cargo +1.98.1-x86_64-pc-windows-gnu build --release -p victory + objdump -p check (0 non-system MinGW DLLs) - [ ] Full ictory-shader + ictory-gpu test suite via GitHub Actions CI (local SDK dxil.dll 101.6.2104.33 fails 3 pre-existing PSV0 validator tests unrelated to halves lowering)
Androtim commented 2026-11-28 11:03:46 +00:00 (Migrated from github.com)

Imported from Androtim/MiniVI. Originally posted by Androtim on 2026-11-28T11:03:46Z.


Automated triage for the maintainers (not an approval).

Verdict: needs-gpu-test · CI (check): passing

Review Summary

The fix is minimal, well-targeted, and logically sound:

  • crates/victory-shader/src/emit/lower.rs:
    • Lower::console_lane previously fell back to self.lane_index() whenever self.exchange.is_none(), even when self.halves.is_some() (console wave64 lowered as two 32-lane host waves). Because Lower::wave_base already supports self.halves.or(self.ticket) and Lower::console_thread uses it to compute the relabelled console thread index (base + rank), gating the fallback on self.exchange.is_none() && self.halves.is_none() ensures console_lane() returns console_thread() & 63 (0..63) in halves mode as well.
    • Lower::lane_bit now checks self.exchange.is_some() || self.halves.is_some() so lanes 32–63 select the hi mask dword (lane < 32 false) and shift by lane & 31 (lane - 32), instead of erroneously indexing lo with their 0–31 host lane index.
  • crates/victory-shader/src/emit/wave64_tests.rs:
    • Cleanly extracts dispatched_words from dispatched and adds lanes_past_32_take_the_high_dword_of_a_mask_held_as_a_number, which exercises v_cndmask_b32 with an untracked 64-bit mask in halves mode (lowered_on(..., 32)) across all 64 lanes.

Local GPU Verification Needed

CI is passing, but wave64_tests skips the D3D12 hardware dispatch when no SM 6.6 device is present. Because this modifies shader lowering for 32-lane host waves, please confirm the new hardware test runs and passes locally on a real GPU before merging.


Generated with Antigravity CLI (agy).

<!-- greyfinch-sync:Androtim/MiniVI:comment:7238301768 --> Imported from [Androtim/MiniVI](https://github.com/Androtim/MiniVI/pull/33#issuecomment-7238301768). Originally posted by [Androtim](https://github.com/Androtim) on 2026-11-28T11:03:46Z. --- <!-- minivi-triage v1 head=7394c6e33ba62e16531cf80286f18bc56288977d verdict=needs-gpu-test ci=passing at=2026-11-28T11:04:13Z --> Automated triage for the maintainers (not an approval). **Verdict:** `needs-gpu-test` · **CI (`check`):** `passing` ### Review Summary The fix is minimal, well-targeted, and logically sound: - **`crates/victory-shader/src/emit/lower.rs`**: - `Lower::console_lane` previously fell back to `self.lane_index()` whenever `self.exchange.is_none()`, even when `self.halves.is_some()` (console wave64 lowered as two 32-lane host waves). Because `Lower::wave_base` already supports `self.halves.or(self.ticket)` and `Lower::console_thread` uses it to compute the relabelled console thread index (`base + rank`), gating the fallback on `self.exchange.is_none() && self.halves.is_none()` ensures `console_lane()` returns `console_thread() & 63` (0..63) in halves mode as well. - `Lower::lane_bit` now checks `self.exchange.is_some() || self.halves.is_some()` so lanes 32–63 select the `hi` mask dword (`lane < 32` false) and shift by `lane & 31` (`lane - 32`), instead of erroneously indexing `lo` with their 0–31 host lane index. - **`crates/victory-shader/src/emit/wave64_tests.rs`**: - Cleanly extracts `dispatched_words` from `dispatched` and adds `lanes_past_32_take_the_high_dword_of_a_mask_held_as_a_number`, which exercises `v_cndmask_b32` with an untracked 64-bit mask in halves mode (`lowered_on(..., 32)`) across all 64 lanes. ### Local GPU Verification Needed CI is passing, but `wave64_tests` skips the D3D12 hardware dispatch when no SM 6.6 device is present. Because this modifies shader lowering for 32-lane host waves, please confirm the new hardware test runs and passes locally on a real GPU before merging. --- _Generated with Antigravity CLI (`agy`)._
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
Androtim/MiniVI!33
No description provided.