shader: retry wave32 emit without loops_wave to recover compute shader 926c46bab3b86bd6 #24

Closed
Androtim wants to merge 0 commits from upstream-pr/24 into main
Androtim commented 2026-11-28 07:40:31 +00:00 (Migrated from github.com)

Imported from Androtim/MiniVI. Originally posted by Androtim on 2026-11-28T07:40:31Z.


Summary

Port the loops_wave fallback retry from trustno1-coder/VIctory-NVIDIA (8fc2254) into crates/victory-shader/src/emit/mod.rs:

  • Splits emit() into emit() and emit_once().
  • If emit_once() returns ShaderError::Unsupported { .. } while loops_wave(native) was enabled, retries once under RAII-guarded LOOPS_OFF (with_loops_off) so loops_wave() returns false.
  • Recovers compute shader 926c46bab3b86bd6 (underwater/water compute pass) on 32-lane NVIDIA hosts, reducing untranslated world shaders from 2 to 1 and creating its host D3D12 PSO (host pipeline shaders=[compute 926c46bab3b86bd6]).
  • Adds unit test emit::atomic_tests::loops_wave_disabled_inside_with_loops_off_and_restored.

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), NVIDIA Driver 32.0.16.2124

Run Settings & Profile

  • Build & Commit SHA: release / victory --features diagnostics @ 87d486b
  • Console Profile & Internal Resolution / Scale: series-s (default verify-world.ps1 baseline profile)
  • Ray Tracing: off
  • Upscaling: DLSS quality (-DlssMode quality)
  • Frame Generation: off
  • Launcher Command / Preset & Extra VICTORY_* Overrides: D:\victory-build\verify-tools\verify-world.ps1 -Exe 'D:\victory-build\verify-bins\pr24-diag.exe' -GoldenDataDir 'D:\victory-data\golden-data-minivi' -OutDir 'D:\victory-data\verify-runs\pr24-loops-fallback-warm' -WorldSeconds 95 -MaxBootSeconds 240 -BaselineJson 'D:\victory-data\verify-runs\baseline-main\summary.json' -AutoNudgeMenu
  • Scene / Area & Session Length: Mission-1 autosave dock transition through wide balcony scene (draws >= 500, max 11533 draws/frame), 95s in-world (following an initial 75s cold-cache run pr24-loops-fallback reaching frame 8150)

Measurements & Verification

  • Base FPS (without Frame Gen):
    • Warm-cache 95s run (pr24-loops-fallback-warm): ALL 11/11 verifier gates PASS, median 10.15 fps (98.7 ms, 18 windows, min 1.2 fps during dock compile, vs baseline 8.9 fps = +1.25 fps), preparing 50.15 ms, GPU 0.8 ms, copyback 7.8 ms.
    • Steady balcony tail (5658–6145 draws/frame, last 8 windows): 10.8–11.5 fps (86.8–92.4 ms/frame, 0 pipelines being made).
    • Shader translation: hash=926c46bab3b86bd6 logged "shader translated" (user_data=2 samplers=6) and "host pipeline shaders=[compute 926c46bab3b86bd6]"; untranslated=1 (6b82bc7d22016cb5 remains; down from 2).
    • Visuals: 24 PNGs (lit=19/24, luma 102.55, edge energy 7.2, 0.0% magenta); inspected frame-8984.png & frame-8992.png (wide balcony shadows, sunlight, ocean reflections, HUD notification).
  • Frame-Gen FPS (if enabled): N/A (off)
  • VRAM / RAM Usage: used_max=5915 MB / budget_min=6887 MB (over=0 MB, copystat peak 6044 MB VRAM / 5293 MB shared PC RAM), final_waiting=3502 (vs baseline 7121)
  • Crashes / DRED Resets: 0 (crashes=0, no_host_texture_errors=0)
  • Automated Checks:
    • cargo +1.98.1-x86_64-pc-windows-gnu run -p xtask -- policy (asset 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)
    • Targeted victory-shader tests after final edit: emit::atomic_tests::loops_wave_disabled_inside_with_loops_off_and_restored (1 passed; 0 failed), emit::wave64_tests (12 passed; 0 failed) (Note: prior full cargo test -p victory-shader --lib run passed 287 tests and failed 3 pre-existing PSV0 validator tests against local Windows SDK 10.0.22000.0 dxil.dll 101.6.2104.33: first_half_values_render_on_hardware_and_warp, the_rectangle_stage_is_a_geometry_shader, rectangles_are_drawn_whole; full CI victory-shader suite runs below)
    • Plain release & diagnostics --release builds (objdump -p: 0 non-system MinGW DLLs)
<!-- greyfinch-sync:Androtim/MiniVI:issue:5537985577 --> Imported from [Androtim/MiniVI](https://github.com/Androtim/MiniVI/pull/24). Originally posted by [Androtim](https://github.com/Androtim) on 2026-11-28T07:40:31Z. --- ## Summary Port the `loops_wave` fallback retry from `trustno1-coder/VIctory-NVIDIA` (`8fc2254`) into `crates/victory-shader/src/emit/mod.rs`: - Splits `emit()` into `emit()` and `emit_once()`. - If `emit_once()` returns `ShaderError::Unsupported { .. }` while `loops_wave(native)` was enabled, retries once under RAII-guarded `LOOPS_OFF` (`with_loops_off`) so `loops_wave()` returns `false`. - Recovers compute shader `926c46bab3b86bd6` (underwater/water compute pass) on 32-lane NVIDIA hosts, reducing untranslated world shaders from `2` to `1` and creating its host D3D12 PSO (`host pipeline shaders=[compute 926c46bab3b86bd6]`). - Adds unit test `emit::atomic_tests::loops_wave_disabled_inside_with_loops_off_and_restored`. ## 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), NVIDIA Driver 32.0.16.2124 ## Run Settings & Profile - **Build & Commit SHA:** `release` / `victory --features diagnostics` @ `87d486b` - **Console Profile & Internal Resolution / Scale:** `series-s` (default `verify-world.ps1` baseline profile) - **Ray Tracing:** `off` - **Upscaling:** `DLSS quality` (`-DlssMode quality`) - **Frame Generation:** `off` - **Launcher Command / Preset & Extra `VICTORY_*` Overrides:** `D:\victory-build\verify-tools\verify-world.ps1 -Exe 'D:\victory-build\verify-bins\pr24-diag.exe' -GoldenDataDir 'D:\victory-data\golden-data-minivi' -OutDir 'D:\victory-data\verify-runs\pr24-loops-fallback-warm' -WorldSeconds 95 -MaxBootSeconds 240 -BaselineJson 'D:\victory-data\verify-runs\baseline-main\summary.json' -AutoNudgeMenu` - **Scene / Area & Session Length:** Mission-1 autosave dock transition through wide balcony scene (`draws >= 500`, max `11533` draws/frame), `95s` in-world (following an initial `75s` cold-cache run `pr24-loops-fallback` reaching frame 8150) ## Measurements & Verification - **Base FPS (without Frame Gen):** - Warm-cache 95s run (`pr24-loops-fallback-warm`): **ALL 11/11 verifier gates PASS**, median **`10.15 fps`** (`98.7 ms`, 18 windows, min `1.2 fps` during dock compile, vs baseline `8.9 fps` = `+1.25 fps`), preparing `50.15 ms`, GPU `0.8 ms`, copyback `7.8 ms`. - Steady balcony tail (`5658–6145` draws/frame, last 8 windows): **`10.8–11.5 fps`** (`86.8–92.4 ms/frame`, `0` pipelines being made). - Shader translation: `hash=926c46bab3b86bd6` logged `"shader translated"` (`user_data=2 samplers=6`) and `"host pipeline shaders=[compute 926c46bab3b86bd6]"`; `untranslated=1` (`6b82bc7d22016cb5` remains; down from `2`). - Visuals: `24` PNGs (`lit=19/24`, luma `102.55`, edge energy `7.2`, `0.0%` magenta); inspected `frame-8984.png` & `frame-8992.png` (wide balcony shadows, sunlight, ocean reflections, HUD notification). - **Frame-Gen FPS (if enabled):** N/A (`off`) - **VRAM / RAM Usage:** `used_max=5915 MB / budget_min=6887 MB` (`over=0 MB`, `copystat` peak `6044 MB` VRAM / `5293 MB` shared PC RAM), `final_waiting=3502` (vs baseline `7121`) - **Crashes / DRED Resets:** `0` (`crashes=0`, `no_host_texture_errors=0`) - **Automated Checks:** - [x] `cargo +1.98.1-x86_64-pc-windows-gnu run -p xtask -- policy` (`asset 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] Targeted `victory-shader` tests after final edit: `emit::atomic_tests::loops_wave_disabled_inside_with_loops_off_and_restored` (`1 passed; 0 failed`), `emit::wave64_tests` (`12 passed; 0 failed`) *(Note: prior full `cargo test -p victory-shader --lib` run passed 287 tests and failed 3 pre-existing PSV0 validator tests against local Windows SDK `10.0.22000.0` `dxil.dll` `101.6.2104.33`: `first_half_values_render_on_hardware_and_warp`, `the_rectangle_stage_is_a_geometry_shader`, `rectangles_are_drawn_whole`; full CI `victory-shader` suite runs below)* - [x] Plain release & diagnostics `--release` builds (`objdump -p`: `0` non-system MinGW DLLs)
Androtim commented 2026-11-28 08:02:59 +00:00 (Migrated from github.com)

Imported from Androtim/MiniVI. Originally posted by Androtim on 2026-11-28T08:02:59Z.


Automated triage for the maintainers (not an approval).

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

Summary

Clean, tightly scoped change in crates/victory-shader/src/emit/mod.rs that retries emit_once() once with loops_wave disabled when a compute shader fails with ShaderError::Unsupported { .. }.

Code Review

  • Fallback flow (emit / emit_once): Only triggers when emit_once() returns Err(ShaderError::Unsupported { .. }) and loops_wave(native) is true, avoiding overhead on already-translating shaders and preserving the original error if the fallback also fails. emit_once() clears thread-local lower::take_needs() at entry, so state from the first attempt does not leak into the retry.
  • Thread-local guard (LOOPS_OFF / with_loops_off): Uses a thread_local! Cell<bool> with an RAII Drop guard (Reset) that restores the prior value on both normal return and unwind, keeping concurrent shader translation thread-safe.
  • Tests: emit::atomic_tests::loops_wave_disabled_inside_with_loops_off_and_restored verifies stage gating (Ps vs Cs), toggling via with_loops_off, and unwind restoration (with an RAII guard for TEST_HOST_WAVE). Note that it tests the toggle/guard rather than an end-to-end emit() fallback on a synthetic failing shader, which is acceptable here given CI is passing.
  • Overlap note: This PR isolates the 926c46bab3b86bd6 shader recovery that was previously bundled in PR #11.

Verdict

Logic, thread safety, and CI look solid. Because this changes wave32 compute shader translation and brings a previously-dropped underwater/water compute shader (926c46bab3b86bd6) onto the host GPU without loops_wave, a local real-GPU smoke test on a 32-lane (NVIDIA) host is recommended before merging.


Generated with Antigravity CLI (agy).

<!-- greyfinch-sync:Androtim/MiniVI:comment:7236328425 --> Imported from [Androtim/MiniVI](https://github.com/Androtim/MiniVI/pull/24#issuecomment-7236328425). Originally posted by [Androtim](https://github.com/Androtim) on 2026-11-28T08:02:59Z. --- <!-- minivi-triage v1 head=87d486b1163c1c9db0045a75ca6acd5f287d2557 verdict=needs-gpu-test ci=passing at=2026-11-28T08:03:26Z --> Automated triage for the maintainers (not an approval). **Verdict:** `needs-gpu-test` · **CI (`check`):** `passing` ### Summary Clean, tightly scoped change in `crates/victory-shader/src/emit/mod.rs` that retries `emit_once()` once with `loops_wave` disabled when a compute shader fails with `ShaderError::Unsupported { .. }`. ### Code Review - **Fallback flow (`emit` / `emit_once`)**: Only triggers when `emit_once()` returns `Err(ShaderError::Unsupported { .. })` and `loops_wave(native)` is `true`, avoiding overhead on already-translating shaders and preserving the original error if the fallback also fails. `emit_once()` clears thread-local `lower::take_needs()` at entry, so state from the first attempt does not leak into the retry. - **Thread-local guard (`LOOPS_OFF` / `with_loops_off`)**: Uses a `thread_local! Cell<bool>` with an RAII `Drop` guard (`Reset`) that restores the prior value on both normal return and unwind, keeping concurrent shader translation thread-safe. - **Tests**: `emit::atomic_tests::loops_wave_disabled_inside_with_loops_off_and_restored` verifies stage gating (`Ps` vs `Cs`), toggling via `with_loops_off`, and unwind restoration (with an RAII guard for `TEST_HOST_WAVE`). Note that it tests the toggle/guard rather than an end-to-end `emit()` fallback on a synthetic failing shader, which is acceptable here given CI is passing. - **Overlap note**: This PR isolates the `926c46bab3b86bd6` shader recovery that was previously bundled in PR #11. ### Verdict Logic, thread safety, and CI look solid. Because this changes wave32 compute shader translation and brings a previously-dropped underwater/water compute shader (`926c46bab3b86bd6`) onto the host GPU without `loops_wave`, a local real-GPU smoke test on a 32-lane (NVIDIA) host is recommended before merging. --- _Generated with Antigravity CLI (`agy`)._
Androtim commented 2026-11-28 21:18:26 +00:00 (Migrated from github.com)

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


Closing as superseded duplicate of merged PR #11.

<!-- greyfinch-sync:Androtim/MiniVI:comment:7245922215 --> Imported from [Androtim/MiniVI](https://github.com/Androtim/MiniVI/pull/24#issuecomment-7245922215). Originally posted by [Androtim](https://github.com/Androtim) on 2026-11-28T21:18:26Z. --- Closing as superseded duplicate of merged PR #11.

Pull request closed

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!24
No description provided.