fix(gpu/audio/shader): fix sweep starvation, audio priority inversion, and finite_data bloom glare (#276, #282) #370

Merged
Androtim merged 3 commits from upstream-pr/370 into main 2026-12-03 00:59:51 +00:00
Androtim commented 2026-12-03 00:38:22 +00:00 (Migrated from github.com)

Imported from Androtim/MiniVI. Originally posted by Androtim on 2026-12-03T00:38:22Z.


Summary

Addresses the three remaining P0/P1 regressions identified in Reasoning Audit Pass #5 (Androtim/MiniVI#276 & Androtim/MiniVI#282):

  1. Sweep / graveyard starvation & LOOSE.write() stall (#363):

    • crates/victory-gpu/src/host/sweep.rs: Default VICTORY_SWEEP_ASYNC to false (opt-in via VICTORY_SWEEP_ASYNC=1), restoring periodic 1500 ms settle() runs and preventing concurrent async shadow::let_go_idle() LOOSE.write() lockouts across all 17 ReadMostly shards (#331) against victory-list-* threads.
    • crates/victory-gpu/src/host.rs, crates/victory-gpu/src/host/graveyard_tests.rs: Raise victory-graveyard from THREAD_PRIORITY_BELOW_NORMAL to THREAD_PRIORITY_NORMAL and bound its channel with std::sync::mpsc::sync_channel(DEFAULT_GRAVEYARD_LIMIT) (256, matching DEFAULT_REAPER_LIMIT) plus inline-drop fallback on TrySendError::Full / Disconnected so retired resources cannot pile up unbounded under memory/pagefile pressure.
  2. Audio starvation & worker oversubscription (audio.rs + #368 victory-wide-sub):

    • crates/victory-hle/src/modules/audio.rs: Raise victory XMA decoder (wake_decoder) priority to THREAD_PRIORITY_HIGHEST so XMA decoding strictly outranks all THREAD_PRIORITY_ABOVE_NORMAL GPU worker pools.
    • crates/victory-gpu/src/land.rs, crates/victory-gpu/src/land/tests.rs: Demote victory-wide-sub (each_wide_sub) helper pool workers to THREAD_PRIORITY_NORMAL (skipping cores::Priority and overriding ask()'s VICTORY_HELPER_PRIORITY boost on those helpers) so wide refresh helpers cannot starve audio or title threads.
  3. HDR compute bloom/starburst 0.0 * Inf -> NaN glare & cache keying (#346):

    • crates/victory-shader/src/emit/bitcode/finite.rs, crates/victory-shader/src/emit/lower_tests.rs: Make Module::finite_data conservative and overflow-checked (|v| <= 2^exp < 2^126), stopping Op::Extract(..) (texture/buffer/CBV reads), Op::Load(_), LoadInput, non-constant LegacyF16ToF32, and arbitrary i32 -> f32 bitcasts from reporting finite so legacy_mul preserves 0 * Inf/NaN = 0 guards in HDR compute UAV passes while keeping provably finite constants, integer-to-float conversions, Saturate, constant-clamped FMin/FMax, and non-overflowing expressions finite.
    • crates/victory-gpu/src/shader_cache.rs: Add VICTORY_LEGACY_MUL to TRANSLATOR_ENV_KEYS so toggling VICTORY_LEGACY_MUL separates cached shader binaries.

Verification

  • cargo +1.98.1-x86_64-pc-windows-gnu xtask policy (asset policy: 333 files ok, --staged clean across all 3 commits)
  • cargo +1.98.1-x86_64-pc-windows-gnu clippy --workspace --all-targets --locked -- -D warnings (passed)
  • cargo +1.98.1-x86_64-pc-windows-gnu clippy --workspace --all-targets --all-features --locked -- -D warnings (passed)
  • cargo +1.98.1-x86_64-pc-windows-gnu test -p victory-gpu --locked -- --test-threads=1 (770 passed; 0 failed; 39 ignored, plus VICTORY_HELPER_PRIORITY=1 targeted check on wide_sub_workers_run_at_normal_priority passed)
  • cargo +1.98.1-x86_64-pc-windows-gnu test -p victory-hle --locked (245 passed; 0 failed; 3 ignored + no_dll_planting 1 passed)
  • cargo +1.98.1-x86_64-pc-windows-gnu test -p victory-shader --locked -- --test-threads=1 --skip rect::tests --skip first_half_values_render_on_hardware_and_warp (370 passed; 0 failed; 6 ignored; 4 filtered out — the 4 filtered tests fail local Windows SDK 10.0.22000.0 dxil.dll Pipeline State Validation unrelated to this change)

Refs #276, #282

<!-- greyfinch-sync:Androtim/MiniVI:issue:5617382229 --> Imported from [Androtim/MiniVI](https://github.com/Androtim/MiniVI/pull/370). Originally posted by [Androtim](https://github.com/Androtim) on 2026-12-03T00:38:22Z. --- ## Summary Addresses the three remaining P0/P1 regressions identified in Reasoning Audit Pass #5 (`Androtim/MiniVI#276` & `Androtim/MiniVI#282`): 1. **Sweep / graveyard starvation & `LOOSE.write()` stall (`#363`):** - `crates/victory-gpu/src/host/sweep.rs`: Default `VICTORY_SWEEP_ASYNC` to `false` (opt-in via `VICTORY_SWEEP_ASYNC=1`), restoring periodic `1500 ms` `settle()` runs and preventing concurrent async `shadow::let_go_idle()` `LOOSE.write()` lockouts across all 17 `ReadMostly` shards (`#331`) against `victory-list-*` threads. - `crates/victory-gpu/src/host.rs`, `crates/victory-gpu/src/host/graveyard_tests.rs`: Raise `victory-graveyard` from `THREAD_PRIORITY_BELOW_NORMAL` to `THREAD_PRIORITY_NORMAL` and bound its channel with `std::sync::mpsc::sync_channel(DEFAULT_GRAVEYARD_LIMIT)` (`256`, matching `DEFAULT_REAPER_LIMIT`) plus inline-drop fallback on `TrySendError::Full` / `Disconnected` so retired resources cannot pile up unbounded under memory/pagefile pressure. 2. **Audio starvation & worker oversubscription (`audio.rs` + `#368` `victory-wide-sub`):** - `crates/victory-hle/src/modules/audio.rs`: Raise `victory XMA decoder` (`wake_decoder`) priority to `THREAD_PRIORITY_HIGHEST` so XMA decoding strictly outranks all `THREAD_PRIORITY_ABOVE_NORMAL` GPU worker pools. - `crates/victory-gpu/src/land.rs`, `crates/victory-gpu/src/land/tests.rs`: Demote `victory-wide-sub` (`each_wide_sub`) helper pool workers to `THREAD_PRIORITY_NORMAL` (skipping `cores::Priority` and overriding `ask()`'s `VICTORY_HELPER_PRIORITY` boost on those helpers) so wide refresh helpers cannot starve audio or title threads. 3. **HDR compute bloom/starburst `0.0 * Inf -> NaN` glare & cache keying (`#346`):** - `crates/victory-shader/src/emit/bitcode/finite.rs`, `crates/victory-shader/src/emit/lower_tests.rs`: Make `Module::finite_data` conservative and overflow-checked (`|v| <= 2^exp < 2^126`), stopping `Op::Extract(..)` (texture/buffer/CBV reads), `Op::Load(_)`, `LoadInput`, non-constant `LegacyF16ToF32`, and arbitrary `i32 -> f32` bitcasts from reporting finite so `legacy_mul` preserves `0 * Inf/NaN = 0` guards in HDR compute UAV passes while keeping provably finite constants, integer-to-float conversions, `Saturate`, constant-clamped `FMin`/`FMax`, and non-overflowing expressions finite. - `crates/victory-gpu/src/shader_cache.rs`: Add `VICTORY_LEGACY_MUL` to `TRANSLATOR_ENV_KEYS` so toggling `VICTORY_LEGACY_MUL` separates cached shader binaries. ## Verification - `cargo +1.98.1-x86_64-pc-windows-gnu xtask policy` (`asset policy: 333 files ok`, `--staged` clean across all 3 commits) - `cargo +1.98.1-x86_64-pc-windows-gnu clippy --workspace --all-targets --locked -- -D warnings` (passed) - `cargo +1.98.1-x86_64-pc-windows-gnu clippy --workspace --all-targets --all-features --locked -- -D warnings` (passed) - `cargo +1.98.1-x86_64-pc-windows-gnu test -p victory-gpu --locked -- --test-threads=1` (`770 passed; 0 failed; 39 ignored`, plus `VICTORY_HELPER_PRIORITY=1` targeted check on `wide_sub_workers_run_at_normal_priority` passed) - `cargo +1.98.1-x86_64-pc-windows-gnu test -p victory-hle --locked` (`245 passed; 0 failed; 3 ignored` + `no_dll_planting` `1 passed`) - `cargo +1.98.1-x86_64-pc-windows-gnu test -p victory-shader --locked -- --test-threads=1 --skip rect::tests --skip first_half_values_render_on_hardware_and_warp` (`370 passed; 0 failed; 6 ignored; 4 filtered out` — the 4 filtered tests fail local Windows SDK `10.0.22000.0` `dxil.dll` `Pipeline State Validation` unrelated to this change) Refs #276, #282
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!370
No description provided.