Iter 25: Support MASK_ELSEWHERE on native console-wave compute shaders (5/5 TraceShadowRays) #10

Merged
Androtim merged 1 commit from upstream-pr/10 into main 2026-11-28 21:17:15 +00:00
Androtim commented 2026-11-28 03:10:56 +00:00 (Migrated from github.com)

Imported from Androtim/MiniVI. Originally posted by Androtim on 2026-11-28T03:10:56Z.


Summary

Supports MASK_ELSEWHERE ("a lane mask holding lanes elsewhere read as data") on native console-wave compute shaders (self.exchange.is_none() && self.halves.is_none() && self.console_lanes && self.mask_data == MaskData::Console, such as Wave32-on-Wave32 on NVIDIA or Wave64-on-Wave64 on AMD).

Previously, Lower::mask_dword only checked whole and recorded need(made) when self.exchange.is_some() (console wave64 split into two 32-lane waves), and emit() did not retry widen() on MASK_ELSEWHERE for native-wave compute shaders. Combined with PR #7 (SLOT_VIEW_ADDRESSES), this unlocks the 5th and final shadowmask:CS_TraceShadowRays_* ray-traced shadow shader end-to-end:

  • shadowmask:CS_TraceShadowRays_FullAdaptive_ae7b9cf0_Wrapped (#dbdbf36298727135): emitted (1dd2b030515bd84f), validated (dxil.dll 10.0.22000.0), and D3D12 compute PSO created on RTX 4060 Ti (WAVE64-WIDE 3 branches taken wave-wide: [B721(s_cbranch_execz), B801(s_cbranch_execz), B802(s_cbranch_scc1)]).

Changes

  • crates/victory-shader/src/emit/lower.rs:
    • Factored lane_regions_for(st, group, loops) and all_lane_blocks_for(st, group, loops) so all_lane_blocks_native and branches_around_native treat per-lane loop-latch blocks as conditional on later iterations (loops = true) without altering existing paths (PAIR_MEETINGS.get()).
    • Updated Lower::mask_dword so native_console shaders compute whole via all_lane_blocks_native and record need(made) when returning Err(MASK_ELSEWHERE) inside a per-lane branch.
    • Added unit tests native_wave32_mask_elsewhere_in_all_lanes_block_translates_and_runs, native_wave32_mask_elsewhere_in_divergent_branch_widens_and_runs, and native_wave32_all_lane_blocks_excludes_per_lane_loop_latch.
  • crates/victory-shader/src/emit/mod.rs:
    • Extended compute widen() retry to MASK_ELSEWHERE when !(native.wave64 && lower::host_max_wave() == 32).
    • Routed native-wave widen() region discovery through lower::branches_around_native so self-loop latches defining non-active masks can also be widened.

Rig Specs Tested On

  • CPU: Intel Core i7-13700F (13th Gen)
  • GPU & VRAM: NVIDIA GeForce RTX 4060 Ti (8 GiB VRAM)
  • System RAM: 32 GiB (33,304,932 KiB)
  • OS & GPU Driver: Windows 11 Home 10.0.26300 / NVIDIA Driver 32.0.16.2124

Run Settings & Profile

  • Build & Commit SHA: diag & release (RUSTFLAGS='-C link-self-contained=yes') @ 101f08a (feat/iter25-native-wave-mask-elsewhere)
  • Console Profile & Internal Resolution / Scale: series-s (unattended launch smoke test via verify-live.ps1)
  • Ray Tracing: Offline verification on real CS_TraceShadowRays_FullAdaptive (#dbdbf36298727135) tested in a scratch worktree combining PR #7 (aa0e88f) + Iter 25 with VICTORY_HOST_MAX_WAVE=32 VICTORY_WAVE_WHY=1; interactive open-world RT shadow gameplay has not been playtested yet.
  • Upscaling: DLSS quality (VICTORY_DLSS=1, VICTORY_DLSS_MODE=quality, Streamline loaded)
  • Frame Generation: off
  • Launcher Command / Preset & Extra VICTORY_* Overrides:
    • Unattended smoke test: D:\victory-build\minivi\diag\victory.exe run --execute --console series-s ... via verify-live.ps1 (menu/intro telemetry only).
    • Offline real shader check (scratch PR #7 + Iter 25): victory.exe translate ... --validate --pipelines --list with VICTORY_HOST_MAX_WAVE=32 VICTORY_WAVE_WHY=1.
  • Scene / Area & Session Length: Unattended 34s menu/intro smoke test (11 draws/frame, 3 active windows) + hardware D3D12 unit test dispatches + offline shader validation/PSO creation.

Measurements & Verification

  • Base FPS (without Frame Gen): 30.0 fps (33.3 ms/frame) in unattended menu smoke test (11 draws/frame, 0 dropped)
  • Frame-Gen FPS (if enabled): N/A (off)
  • VRAM / RAM Usage: Unattended smoke test (585 indexed textures / 181 MB uploaded, 0 passed over unmapped)
  • Crashes / DRED Resets: 0 (verify-live.ps1 7/7 [PASS], non_system_mingw_dlls=0 on diag, --features diagnostics --release, and release)
  • Automated Checks:
    • cargo +1.98.1-x86_64-pc-windows-gnu run -p xtask -- 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 diagnostics -- -D warnings (0 warnings)
    • cargo +1.98.1-x86_64-pc-windows-gnu test -p victory-shader -- --test-threads=1 lower::tests (18 passed; 0 failed; 1 ignored — includes all 3 new Wave32 MASK_ELSEWHERE tests with dxil.dll validation + RTX 4060 Ti dispatches)
    • cargo +1.98.1-x86_64-pc-windows-gnu test -p victory-shader -- --test-threads=1 wave64_tests (12 passed; 0 failed)
    • cargo +1.98.1-x86_64-pc-windows-gnu test -p victory-gpu -- --test-threads=1 (448 passed; 0 failed; 36 ignored)
    • Full victory-shader run (left to GitHub Actions CI due to pre-existing local Windows SDK 10.0.22000.0\x64\dxil.dll PSV0 issue on 3 untouched tests)
<!-- greyfinch-sync:Androtim/MiniVI:issue:5536105896 --> Imported from [Androtim/MiniVI](https://github.com/Androtim/MiniVI/pull/10). Originally posted by [Androtim](https://github.com/Androtim) on 2026-11-28T03:10:56Z. --- ## Summary Supports `MASK_ELSEWHERE` ("a lane mask holding lanes elsewhere read as data") on native console-wave compute shaders (`self.exchange.is_none() && self.halves.is_none() && self.console_lanes && self.mask_data == MaskData::Console`, such as Wave32-on-Wave32 on NVIDIA or Wave64-on-Wave64 on AMD). Previously, `Lower::mask_dword` only checked `whole` and recorded `need(made)` when `self.exchange.is_some()` (console wave64 split into two 32-lane waves), and `emit()` did not retry `widen()` on `MASK_ELSEWHERE` for native-wave compute shaders. Combined with PR #7 (`SLOT_VIEW_ADDRESSES`), this unlocks the 5th and final `shadowmask:CS_TraceShadowRays_*` ray-traced shadow shader end-to-end: - `shadowmask:CS_TraceShadowRays_FullAdaptive_ae7b9cf0_Wrapped` (`#dbdbf36298727135`): emitted (`1dd2b030515bd84f`), validated (`dxil.dll 10.0.22000.0`), and D3D12 compute PSO created on RTX 4060 Ti (`WAVE64-WIDE 3 branches taken wave-wide: [B721(s_cbranch_execz), B801(s_cbranch_execz), B802(s_cbranch_scc1)]`). ### Changes - `crates/victory-shader/src/emit/lower.rs`: - Factored `lane_regions_for(st, group, loops)` and `all_lane_blocks_for(st, group, loops)` so `all_lane_blocks_native` and `branches_around_native` treat per-lane loop-latch blocks as conditional on later iterations (`loops = true`) without altering existing paths (`PAIR_MEETINGS.get()`). - Updated `Lower::mask_dword` so `native_console` shaders compute `whole` via `all_lane_blocks_native` and record `need(made)` when returning `Err(MASK_ELSEWHERE)` inside a per-lane branch. - Added unit tests `native_wave32_mask_elsewhere_in_all_lanes_block_translates_and_runs`, `native_wave32_mask_elsewhere_in_divergent_branch_widens_and_runs`, and `native_wave32_all_lane_blocks_excludes_per_lane_loop_latch`. - `crates/victory-shader/src/emit/mod.rs`: - Extended compute `widen()` retry to `MASK_ELSEWHERE` when `!(native.wave64 && lower::host_max_wave() == 32)`. - Routed native-wave `widen()` region discovery through `lower::branches_around_native` so self-loop latches defining non-active masks can also be widened. ## Rig Specs Tested On - **CPU:** Intel Core i7-13700F (13th Gen) - **GPU & VRAM:** NVIDIA GeForce RTX 4060 Ti (8 GiB VRAM) - **System RAM:** 32 GiB (`33,304,932` KiB) - **OS & GPU Driver:** Windows 11 Home `10.0.26300` / NVIDIA Driver `32.0.16.2124` ## Run Settings & Profile - **Build & Commit SHA:** `diag` & `release` (`RUSTFLAGS='-C link-self-contained=yes'`) @ `101f08a` (`feat/iter25-native-wave-mask-elsewhere`) - **Console Profile & Internal Resolution / Scale:** `series-s` (unattended launch smoke test via `verify-live.ps1`) - **Ray Tracing:** Offline verification on real `CS_TraceShadowRays_FullAdaptive` (`#dbdbf36298727135`) tested in a scratch worktree combining PR #7 (`aa0e88f`) + Iter 25 with `VICTORY_HOST_MAX_WAVE=32 VICTORY_WAVE_WHY=1`; interactive open-world RT shadow gameplay has **not** been playtested yet. - **Upscaling:** `DLSS quality` (`VICTORY_DLSS=1`, `VICTORY_DLSS_MODE=quality`, `Streamline` loaded) - **Frame Generation:** `off` - **Launcher Command / Preset & Extra `VICTORY_*` Overrides:** - Unattended smoke test: `D:\victory-build\minivi\diag\victory.exe run --execute --console series-s ...` via `verify-live.ps1` (menu/intro telemetry only). - Offline real shader check (scratch PR #7 + Iter 25): `victory.exe translate ... --validate --pipelines --list` with `VICTORY_HOST_MAX_WAVE=32 VICTORY_WAVE_WHY=1`. - **Scene / Area & Session Length:** Unattended 34s menu/intro smoke test (`11 draws/frame`, 3 active windows) + hardware D3D12 unit test dispatches + offline shader validation/PSO creation. ## Measurements & Verification - **Base FPS (without Frame Gen):** `30.0 fps` (`33.3 ms/frame`) in unattended menu smoke test (`11 draws/frame`, `0 dropped`) - **Frame-Gen FPS (if enabled):** N/A (`off`) - **VRAM / RAM Usage:** Unattended smoke test (`585` indexed textures / `181 MB` uploaded, `0` passed over unmapped) - **Crashes / DRED Resets:** `0` (`verify-live.ps1` `7/7 [PASS]`, `non_system_mingw_dlls=0` on `diag`, `--features diagnostics --release`, and `release`) - **Automated Checks:** - [x] `cargo +1.98.1-x86_64-pc-windows-gnu run -p xtask -- 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 diagnostics -- -D warnings` (`0 warnings`) - [x] `cargo +1.98.1-x86_64-pc-windows-gnu test -p victory-shader -- --test-threads=1 lower::tests` (`18 passed; 0 failed; 1 ignored` — includes all 3 new Wave32 `MASK_ELSEWHERE` tests with `dxil.dll` validation + RTX 4060 Ti dispatches) - [x] `cargo +1.98.1-x86_64-pc-windows-gnu test -p victory-shader -- --test-threads=1 wave64_tests` (`12 passed; 0 failed`) - [x] `cargo +1.98.1-x86_64-pc-windows-gnu test -p victory-gpu -- --test-threads=1` (`448 passed; 0 failed; 36 ignored`) - [ ] Full `victory-shader` run (left to GitHub Actions CI due to pre-existing local Windows SDK `10.0.22000.0\x64\dxil.dll` PSV0 issue on 3 untouched tests)
Androtim commented 2026-11-28 03:15:15 +00:00 (Migrated from github.com)

Imported from Androtim/MiniVI. Originally posted by Androtim on 2026-11-28T03:15:15Z.


CI passed cleanly: https://github.com/Androtim/MiniVI/actions/runs/46101607646

Verified checks on 101f08a:

  • GitHub Actions CI: check SUCCESS
  • xtask policy (294 files ok) & xtask test (6 passed)
  • clippy default & diagnostics (0 warnings)
  • victory-shader: lower::tests (18 passed, including 3 new Wave32 hardware-validated/dispatched tests) & wave64_tests (12 passed)
  • victory-gpu (448 passed; 0 failed)
  • Standalone diag, diagnostics --release, and release builds (non_system_mingw_dlls=0)
  • Offline combined check (PR #7 + Iter 25 scratch worktree): CS_TraceShadowRays_FullAdaptive (#dbdbf36298727135) emitted, validated with dxil.dll, and built D3D12 PSO on RTX 4060 Ti (5/5 TraceShadowRays_* unlocked)
  • Unattended menu smoke test (verify-live.ps1): 7/7 [PASS], 30.0 fps, 0 dropped, 0 DRED
<!-- greyfinch-sync:Androtim/MiniVI:comment:7232921957 --> Imported from [Androtim/MiniVI](https://github.com/Androtim/MiniVI/pull/10#issuecomment-7232921957). Originally posted by [Androtim](https://github.com/Androtim) on 2026-11-28T03:15:15Z. --- CI passed cleanly: https://github.com/Androtim/MiniVI/actions/runs/46101607646 Verified checks on `101f08a`: - GitHub Actions CI: `check` **SUCCESS** - `xtask policy` (294 files ok) & `xtask test` (6 passed) - `clippy` default & `diagnostics` (0 warnings) - `victory-shader`: `lower::tests` (18 passed, including 3 new Wave32 hardware-validated/dispatched tests) & `wave64_tests` (12 passed) - `victory-gpu` (448 passed; 0 failed) - Standalone `diag`, `diagnostics --release`, and `release` builds (`non_system_mingw_dlls=0`) - Offline combined check (PR #7 + Iter 25 scratch worktree): `CS_TraceShadowRays_FullAdaptive` (`#dbdbf36298727135`) emitted, validated with `dxil.dll`, and built D3D12 PSO on RTX 4060 Ti (5/5 `TraceShadowRays_*` unlocked) - Unattended menu smoke test (`verify-live.ps1`): 7/7 `[PASS]`, 30.0 fps, 0 dropped, 0 DRED
Androtim commented 2026-11-28 04:03:24 +00:00 (Migrated from github.com)

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


Automated triage for the maintainers (not an approval).

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

Review Summary

Logic and safety checks look solid, and CI is passing. The PR cleanly extends MASK_ELSEWHERE handling and widen() retries to native console-wave compute shaders without altering existing wave64-on-wave32 (exchange) or non-compute paths.

Verified Changes

  • crates/victory-shader/src/emit/lower.rs:
    • Factored lane_regions_for, all_lane_blocks_for, and branches_around_for with an explicit loops: bool parameter so all_lane_blocks_native and branches_around_native pass loops = true while preserving PAIR_MEETINGS.get() for existing callers.
    • Guarded native_console in Lower::mask_dword on self.exchange.is_none() && self.halves.is_none() && self.console_lanes && self.mask_data == MaskData::Console, ensuring waveActiveBallot is only treated as whole when host lanes match console lanes 1:1 and all_lane_blocks_native confirms all lanes execute made.
    • Records need(made.unwrap_or(0)) before returning Err(MASK_ELSEWHERE) for native_console, feeding widen().
    • Adds three focused unit tests (native_wave32_mask_elsewhere_in_all_lanes_block_translates_and_runs, native_wave32_mask_elsewhere_in_divergent_branch_widens_and_runs, native_wave32_all_lane_blocks_excludes_per_lane_loop_latch) with HostWaveGuard cleanup.
  • crates/victory-shader/src/emit/mod.rs:
    • Extends the compute widen() retry in emit() to lower::MASK_ELSEWHERE when !(native.wave64 && lower::host_max_wave() == 32).
    • Routes widen()'s region lookup to lower::branches_around_native for native-wave programs (while keeping lower::branches_around for wave64-on-wave32), which pairs cleanly with lower::needs_every_lane(MASK_ELSEWHERE) == true.

Minor Observation (Non-Blocking)

  • Lower::mask_dword recomputes all_lane_blocks_native(self.x.st) per call on native_console shaders rather than caching it on Lower. This is unlikely to be hot in practice, but caching it alongside all_lanes would avoid repeated post-dominator computation if a shader reads many non-active masks.

Why needs-gpu-test

This PR changes compute shader wave-widening and ballot lowering in victory-shader (targeting CS_TraceShadowRays_FullAdaptive and other native-wave compute shaders), and interactive RT shadow gameplay has not yet been smoke-tested on real GPU hardware. Recommend a local real-GPU test (including RT shadows once combined with PR #7) before merging.


Generated with Antigravity CLI (agy).

<!-- greyfinch-sync:Androtim/MiniVI:comment:7233639985 --> Imported from [Androtim/MiniVI](https://github.com/Androtim/MiniVI/pull/10#issuecomment-7233639985). Originally posted by [Androtim](https://github.com/Androtim) on 2026-11-28T04:03:24Z. --- <!-- minivi-triage v1 head=101f08a1bfe4cdf1a36cb86022345fbcdf369ffb verdict=needs-gpu-test ci=passing at=2026-11-28T04:03:51Z --> Automated triage for the maintainers (not an approval). **Verdict:** `needs-gpu-test` · **CI (`check`):** `passing` ### Review Summary Logic and safety checks look solid, and CI is passing. The PR cleanly extends `MASK_ELSEWHERE` handling and `widen()` retries to native console-wave compute shaders without altering existing wave64-on-wave32 (`exchange`) or non-compute paths. #### Verified Changes - **`crates/victory-shader/src/emit/lower.rs`**: - Factored `lane_regions_for`, `all_lane_blocks_for`, and `branches_around_for` with an explicit `loops: bool` parameter so `all_lane_blocks_native` and `branches_around_native` pass `loops = true` while preserving `PAIR_MEETINGS.get()` for existing callers. - Guarded `native_console` in `Lower::mask_dword` on `self.exchange.is_none() && self.halves.is_none() && self.console_lanes && self.mask_data == MaskData::Console`, ensuring `waveActiveBallot` is only treated as `whole` when host lanes match console lanes 1:1 and `all_lane_blocks_native` confirms all lanes execute `made`. - Records `need(made.unwrap_or(0))` before returning `Err(MASK_ELSEWHERE)` for `native_console`, feeding `widen()`. - Adds three focused unit tests (`native_wave32_mask_elsewhere_in_all_lanes_block_translates_and_runs`, `native_wave32_mask_elsewhere_in_divergent_branch_widens_and_runs`, `native_wave32_all_lane_blocks_excludes_per_lane_loop_latch`) with `HostWaveGuard` cleanup. - **`crates/victory-shader/src/emit/mod.rs`**: - Extends the compute `widen()` retry in `emit()` to `lower::MASK_ELSEWHERE` when `!(native.wave64 && lower::host_max_wave() == 32)`. - Routes `widen()`'s region lookup to `lower::branches_around_native` for native-wave programs (while keeping `lower::branches_around` for wave64-on-wave32), which pairs cleanly with `lower::needs_every_lane(MASK_ELSEWHERE) == true`. #### Minor Observation (Non-Blocking) - `Lower::mask_dword` recomputes `all_lane_blocks_native(self.x.st)` per call on `native_console` shaders rather than caching it on `Lower`. This is unlikely to be hot in practice, but caching it alongside `all_lanes` would avoid repeated post-dominator computation if a shader reads many non-active masks. #### Why `needs-gpu-test` This PR changes compute shader wave-widening and ballot lowering in `victory-shader` (targeting `CS_TraceShadowRays_FullAdaptive` and other native-wave compute shaders), and interactive RT shadow gameplay has not yet been smoke-tested on real GPU hardware. Recommend a local real-GPU test (including RT shadows once combined with PR #7) before merging. --- _Generated with Antigravity CLI (`agy`)._
Androtim commented 2026-11-28 21:11:21 +00:00 (Migrated from github.com)

Imported from Androtim/MiniVI. Originally posted by Androtim on 2026-11-28T21:11:21Z.


Real-GPU Playtest Report (Combined Build 1 Stack — RT ON)

Tested in combined Build 1 (origin/main + Build 1 PRs including #3, #4, #7, #10) on NVIDIA GeForce RTX 4060 Ti (8 GB), Windows, Series S (quality-720p, DLSS Quality, -RayTracing):

  • Duration & Stability: 7-minute RT-ON open-world session (1c-build1-rt.log) — 0 crashes, 0 DRED resets, clean exit.
  • Performance: 7.6 fps (132.2 ms/frame, 4,022 draws/frame).
  • RT / Memory Telemetry:
    • Active RT/BVH builds (12,653 pages / 790 MB across 13 arenas, 98 build dispatches/frame).
    • 0 "a shader reads view addresses without a view heap set" warnings.
    • 1,374 DLSS upscalings (0 failed); VRAM stayed bounded (6,460 MB in use, 554 MB free across 27 texture blocks).
<!-- greyfinch-sync:Androtim/MiniVI:comment:7245835970 --> Imported from [Androtim/MiniVI](https://github.com/Androtim/MiniVI/pull/10#issuecomment-7245835970). Originally posted by [Androtim](https://github.com/Androtim) on 2026-11-28T21:11:21Z. --- ### Real-GPU Playtest Report (Combined Build 1 Stack — RT ON) Tested in combined Build 1 (`origin/main` + Build 1 PRs including `#3, #4, #7, #10`) on **NVIDIA GeForce RTX 4060 Ti (8 GB), Windows, Series S (`quality-720p`, DLSS Quality, `-RayTracing`)**: - **Duration & Stability:** **7-minute** RT-ON open-world session (`1c-build1-rt.log`) — **0 crashes, 0 DRED resets**, clean exit. - **Performance:** `7.6 fps` (`132.2 ms/frame`, `4,022` draws/frame). - **RT / Memory Telemetry:** - Active RT/BVH builds (`12,653` pages / `790 MB` across `13` arenas, `98` build dispatches/frame). - `0` `"a shader reads view addresses without a view heap set"` warnings. - `1,374` DLSS upscalings (`0` failed); VRAM stayed bounded (`6,460 MB` in use, `554 MB` free across `27` texture blocks).
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!10
No description provided.