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

Manually merged
github merged 3 commits from github-bot/gh-370 into gh-pr/370/base 2026-12-03 01:04:18 +00:00 AGit
Owner

@⁠Androtim on GitHub · 2026-12-03 00:38 UTC · original
Androtim:fix/audio-sweep-bloom-regressions → main · +717 −208 · 9 files · 3 commits · merged 2026-12-03 00:59 UTC

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

**@⁠Androtim** on GitHub · 2026-12-03 00:38 UTC · [original](https://github.com/Androtim/MiniVI/pull/370) `Androtim:fix/audio-sweep-bloom-regressions` → `main` · +717 −208 · 9 files · 3 commits · merged 2026-12-03 00:59 UTC ## 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
github-bot locked as GitHub sync and limited conversation to collaborators 2026-12-03 00:41:44 +00:00
github-bot force-pushed github-bot/gh-370 from df9965d772 to fc67b157b8 2026-12-03 00:52:47 +00:00 Compare
github-bot changed target branch from main to gh-pr/370/base 2026-12-03 01:04:15 +00:00
github manually merged commit fc67b157b8 into gh-pr/370/base 2026-12-03 01:04:18 +00:00
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!370
No description provided.