shaders(emit): preserve console lanes on mask-data v_cndmask_b32 selects #66

Manually merged
github merged 1 commit from gh-pr/66/head into gh-pr/66/base 2026-12-01 20:06:11 +00:00
Owner

@⁠Androtim on GitHub · 2026-11-28 19:25 UTC · original
Androtim:feat/iter80-select-mask-data-lanes → main · +36 −0 · 2 files · 1 commits · merged 2026-11-29 04:14 UTC

Summary

Preserves console wave lanes when a compute shader executes v_cndmask_b32 selecting on a scalar mask held as data (!st.masks.contains_key):

  • Adds selects_on_mask_data(st, i) in crates/victory-shader/src/emit/lower.rs and includes it in console_lanes detection inside Lower::new. Without this, reads_mask_as_data skipped v_cndmask_b32, causing shaders without another cross-lane instruction to lower without a required wave size (reading wrong lane bits on mismatched waves in release and asserting in cross_lane in debug).
  • Adds regression test emit::wave64_tests::a_select_on_a_mask_held_as_a_number_keeps_the_consoles_lanes (crates/victory-shader/src/emit/wave64_tests.rs).

Upstream reference: trustno1-coder/VIctory-NVIDIA@ed998ea (PR #52).

Rig Specs Tested On

  • CPU: Intel Core i7-13700F
  • GPU & VRAM: NVIDIA GeForce RTX 4060 Ti (8 GiB VRAM)
  • System RAM: 32 GiB
  • OS & GPU Driver: Windows 11 Build 26300, NVIDIA driver 32.0.16.2124

Run Settings & Profile

  • Build & Commit SHA: release & diagnostics @ 784c17a
  • Console Profile & Internal Resolution / Scale: series-s — quality (0.6666667, 540p internal / 960x540 captured frames)
  • Ray Tracing: off
  • Upscaling: DLSS quality (Streamline 2.14.16)
  • Frame Generation: off
  • Launcher Command / Preset & Extra VICTORY_* Overrides: verify-world.ps1 (WorldSeconds=75, AutoNudgeMenu, VICTORY_CACHE_DIR=D:\victory-data\cache-minivi)
  • Scene / Area & Session Length: Open-world exterior + character deck scene (first_world_frame=8703, 75s in-world / 15 windows, up to 11638 draws/frame)

Measurements & Verification

  • Base FPS (without Frame Gen): 11.0 fps median (9.68 fps mean, 0.1 fps min, 90.9 ms median frame time, 0.9 ms median GPU; +2.10 fps vs 8.9 fps baseline)
  • Frame-Gen FPS (if enabled): N/A (framegen=false)
  • VRAM / RAM Usage: 5766 MB peak (5748.5 MB median) / 6884 MB min budget (0 MB over budget; -98 MB vs 5864 MB baseline)
  • Texture Streaming & Pipeline Drops: 44307 uploaded, 2056 final waiting (-5065 vs 7121 baseline); 264 median pipeline drops (261.0 baseline); mapped() rate 34.23 ms/s (longest 29.8 ms); 11/11 gates PASS on first run, visually verified 16/24 lit frames (luma=103.57, edge_energy=7.13, 0.0% near-black/magenta; inspected frame-8735.png & frame-9567.png).
  • Crashes / DRED Resets: 0 (no_host_texture_errors=0, untranslated_shaders=2)
  • Automated Checks:
    • cargo +1.98.1-x86_64-pc-windows-gnu run -p xtask -- policy (299 files ok)
    • cargo +1.98.1-x86_64-pc-windows-gnu test -p xtask --locked (6 passed; 0 failed)
    • cargo +1.98.1-x86_64-pc-windows-gnu clippy --workspace --all-targets --locked -- -D warnings
    • cargo +1.98.1-x86_64-pc-windows-gnu clippy --workspace --all-targets --features diagnostics --locked -- -D warnings
    • cargo +1.98.1-x86_64-pc-windows-gnu test -p victory-shader --lib wave64_tests --locked -- --test-threads=1 (14 passed; 0 failed)
    • cargo +1.98.1-x86_64-pc-windows-gnu build --release -p victory --bin victory --locked + objdump -p (Windows system DLLs only)
**@⁠Androtim** on GitHub · 2026-11-28 19:25 UTC · [original](https://github.com/Androtim/MiniVI/pull/66) `Androtim:feat/iter80-select-mask-data-lanes` → `main` · +36 −0 · 2 files · 1 commits · merged 2026-11-29 04:14 UTC ## Summary Preserves console wave lanes when a compute shader executes `v_cndmask_b32` selecting on a scalar mask held as data (`!st.masks.contains_key`): - Adds `selects_on_mask_data(st, i)` in `crates/victory-shader/src/emit/lower.rs` and includes it in `console_lanes` detection inside `Lower::new`. Without this, `reads_mask_as_data` skipped `v_cndmask_b32`, causing shaders without another cross-lane instruction to lower without a required wave size (reading wrong lane bits on mismatched waves in release and asserting in `cross_lane` in debug). - Adds regression test `emit::wave64_tests::a_select_on_a_mask_held_as_a_number_keeps_the_consoles_lanes` (`crates/victory-shader/src/emit/wave64_tests.rs`). Upstream reference: `trustno1-coder/VIctory-NVIDIA@ed998ea` (PR #52). ## Rig Specs Tested On - **CPU:** Intel Core i7-13700F - **GPU & VRAM:** NVIDIA GeForce RTX 4060 Ti (8 GiB VRAM) - **System RAM:** 32 GiB - **OS & GPU Driver:** Windows 11 Build 26300, NVIDIA driver 32.0.16.2124 ## Run Settings & Profile - **Build & Commit SHA:** `release` & `diagnostics` @ `784c17a` - **Console Profile & Internal Resolution / Scale:** `series-s` — `quality` (`0.6666667`, 540p internal / 960x540 captured frames) - **Ray Tracing:** `off` - **Upscaling:** `DLSS quality` (Streamline 2.14.16) - **Frame Generation:** `off` - **Launcher Command / Preset & Extra `VICTORY_*` Overrides:** `verify-world.ps1` (`WorldSeconds=75`, `AutoNudgeMenu`, `VICTORY_CACHE_DIR=D:\victory-data\cache-minivi`) - **Scene / Area & Session Length:** Open-world exterior + character deck scene (`first_world_frame=8703`, 75s in-world / 15 windows, up to `11638` draws/frame) ## Measurements & Verification - **Base FPS (without Frame Gen):** `11.0 fps` median (`9.68 fps` mean, `0.1 fps` min, `90.9 ms` median frame time, `0.9 ms` median GPU; `+2.10 fps` vs `8.9 fps` baseline) - **Frame-Gen FPS (if enabled):** N/A (`framegen=false`) - **VRAM / RAM Usage:** `5766 MB` peak (`5748.5 MB` median) / `6884 MB` min budget (`0 MB` over budget; `-98 MB` vs `5864 MB` baseline) - **Texture Streaming & Pipeline Drops:** `44307` uploaded, `2056` final waiting (`-5065` vs `7121` baseline); `264` median pipeline drops (`261.0` baseline); `mapped()` rate `34.23 ms/s` (longest `29.8 ms`); `11/11` gates PASS on first run, visually verified `16/24` lit frames (`luma=103.57`, `edge_energy=7.13`, `0.0%` near-black/magenta; inspected `frame-8735.png` & `frame-9567.png`). - **Crashes / DRED Resets:** `0` (`no_host_texture_errors=0`, `untranslated_shaders=2`) - **Automated Checks:** - [x] `cargo +1.98.1-x86_64-pc-windows-gnu run -p xtask -- policy` (`299 files ok`) - [x] `cargo +1.98.1-x86_64-pc-windows-gnu test -p xtask --locked` (`6 passed; 0 failed`) - [x] `cargo +1.98.1-x86_64-pc-windows-gnu clippy --workspace --all-targets --locked -- -D warnings` - [x] `cargo +1.98.1-x86_64-pc-windows-gnu clippy --workspace --all-targets --features diagnostics --locked -- -D warnings` - [x] `cargo +1.98.1-x86_64-pc-windows-gnu test -p victory-shader --lib wave64_tests --locked -- --test-threads=1` (`14 passed; 0 failed`) - [x] `cargo +1.98.1-x86_64-pc-windows-gnu build --release -p victory --bin victory --locked` + `objdump -p` (Windows system DLLs only)
Adds selects_on_mask_data in crates/victory-shader/src/emit/lower.rs and checks it alongside reads_mask_as_data when determining console_lanes in Lower::new, ensuring compute shaders whose only cross-lane use is v_cndmask_b32 selecting on a scalar bitmask held as data keep the console's wave size. Adds wave64_tests::a_select_on_a_mask_held_as_a_number_keeps_the_consoles_lanes. Adapted from trustno1-coder/VIctory-NVIDIA@ed998ea (PR #52). Verified with wave64_tests (14/14) and 75s open-world GPU check (11/11 gates PASS).
github-bot locked as GitHub sync and limited conversation to collaborators 2026-12-01 20:06:10 +00:00
github manually merged commit 784c17aa63 into gh-pr/66/base 2026-12-01 20:06:11 +00:00
Author
Owner

@⁠Androtim on GitHub · 2026-11-28 20:03 UTC · original

Automated triage for the maintainers (not an approval).

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

Review Summary

  • Change: Adds selects_on_mask_data(st, i) in crates/victory-shader/src/emit/lower.rs and includes it in console_lanes detection inside Lower::new, plus a regression unit test a_select_on_a_mask_held_as_a_number_keeps_the_consoles_lanes in crates/victory-shader/src/emit/wave64_tests.rs.
  • Correctness: reads_mask_as_data intentionally excludes v_cndmask_b32, so a compute shader whose only lane-dependent operation is v_cndmask_b32 reading a scalar mask not tracked in st.masks (e.g., a constant bitmask or loaded value) was lowered without console_lanes / s.wave_size. Checking v.src.get(2) for Operand::Scalar { code, .. } with i.read(Reg::S(code)).is_some_and(|m| !st.masks.contains_key(&m)) cleanly closes that gap without false-matching non-SGPR operands. On wave64 shaders lowered to wave == 32 on 32-lane hosts, halves is already allocated whenever wave == 32 && x.native.wave64 without needing cross-half LDS exchange, so keeping selects_on_mask_data out of crosses is consistent with the existing lowering structure.
  • Minor note (non-blocking): reads_mask_as_data also skips _co_ci_ instructions (v_add_co_ci_u32 / v_sub_co_ci_u32); if carry-in masks held as raw scalar data ever appear in title shaders, they would need the same treatment in a follow-up.
  • CI & Scope: CI is passing, the diff is tightly scoped, and no duplicate open PRs were found. Because this changes compute shader wave-size / lane-preservation lowering, a local real-GPU smoke test is recommended before merging.

Generated with Antigravity CLI (agy).

**@⁠Androtim** on GitHub · 2026-11-28 20:03 UTC · [original](https://github.com/Androtim/MiniVI/pull/66#issuecomment-7245001829) <!-- minivi-triage v1 head=784c17aa6328364d0cd32cc5dd740dcb01cb9a39 verdict=needs-gpu-test ci=passing at=2026-11-28T20:03:49Z --> Automated triage for the maintainers (not an approval). **Verdict:** `needs-gpu-test` · **CI (`check`):** `passing` ### Review Summary - **Change:** Adds `selects_on_mask_data(st, i)` in `crates/victory-shader/src/emit/lower.rs` and includes it in `console_lanes` detection inside `Lower::new`, plus a regression unit test `a_select_on_a_mask_held_as_a_number_keeps_the_consoles_lanes` in `crates/victory-shader/src/emit/wave64_tests.rs`. - **Correctness:** `reads_mask_as_data` intentionally excludes `v_cndmask_b32`, so a compute shader whose only lane-dependent operation is `v_cndmask_b32` reading a scalar mask not tracked in `st.masks` (e.g., a constant bitmask or loaded value) was lowered without `console_lanes` / `s.wave_size`. Checking `v.src.get(2)` for `Operand::Scalar { code, .. }` with `i.read(Reg::S(code)).is_some_and(|m| !st.masks.contains_key(&m))` cleanly closes that gap without false-matching non-SGPR operands. On `wave64` shaders lowered to `wave == 32` on 32-lane hosts, `halves` is already allocated whenever `wave == 32 && x.native.wave64` without needing cross-half LDS `exchange`, so keeping `selects_on_mask_data` out of `crosses` is consistent with the existing lowering structure. - **Minor note (non-blocking):** `reads_mask_as_data` also skips `_co_ci_` instructions (`v_add_co_ci_u32` / `v_sub_co_ci_u32`); if carry-in masks held as raw scalar data ever appear in title shaders, they would need the same treatment in a follow-up. - **CI & Scope:** CI is passing, the diff is tightly scoped, and no duplicate open PRs were found. Because this changes compute shader wave-size / lane-preservation lowering, a local real-GPU smoke test is recommended before merging. --- _Generated with Antigravity CLI (`agy`)._
This discussion has been locked. Commenting is limited to contributors.
No reviewers
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.

Dependencies

No dependencies set

Reference
github/Androtim--MiniVI!66
No description provided.