fix(victory): preserve VICTORY_HOST_WAVE and VICTORY_VIEW_LIMIT during shader cache warming #298

Open
github-bot wants to merge 3 commits from github-bot/gh-298 into main AGit
Owner

@⁠mauroalvare on GitHub · 2026-11-26 01:49 UTC · original
mauroalvare:fix/victory-warm-host-overrides → main · +31 −1 · 3 files · 3 commits · open

Change

Fixes victory translate --warm silently ignoring VICTORY_HOST_WAVE and VICTORY_VIEW_LIMIT (base c4c93bdc413191a9dc909998d2d53080a3f0c880).

apps/victory/src/main.rs documents victory translate --warm as an offline cache warmer ("nothing else is done. Set VICTORY_HOST_WAVE and VICTORY_VIEW_LIMIT to what the run's log says of the host") and parses both variables into victory_shader::emit::set_host_max_wave / set_view_heap_limit. However, shader_cache::warm() calls shader_cache::build(), which unconditionally called descriptor::host::probe_view_limit(), which:

  1. Spun up a live D3D12 device (crate::host::host()), violating offline translation warming.
  2. Unconditionally called set_host_max_wave(o1.WaveLaneCountMax) inside Host::create(), overwriting VICTORY_HOST_WAVE.
  3. Unconditionally called set_view_heap_limit(views - 1) inside probe_view_limit(), overwriting VICTORY_VIEW_LIMIT.

As a result, warming a shader cache for another host GPU (e.g. a 64-lane / 2M-view AMD host from an NVIDIA 32-lane / 1M-view PC, or vice versa) clobbered both host facts back to the local adapter and produced 100% cache misses on the target host. In addition, main.rs read VICTORY_HOST_WAVE while translate::run read VICTORY_HOST_MAX_WAVE, so VICTORY_HOST_MAX_WAVE was ignored by translate --warm.

What changed:

  • Export victory_shader::emit::host_max_wave().
  • In Host::create() (crates/victory-gpu/src/host.rs), set host_max_wave from WaveLaneCountMax only when it is still unset (0).
  • In probe_view_limit() (crates/victory-gpu/src/descriptor/host.rs), return immediately if view_heap_limit() is already non-zero.
  • In shader_cache::build() (crates/victory-gpu/src/shader_cache.rs), probe the local D3D12 adapter only for whichever of view_heap_limit / host_max_wave is still 0 — skipping D3D12 device initialization completely when both are supplied.
  • In apps/victory/src/main.rs, accept VICTORY_HOST_WAVE with fallback to VICTORY_HOST_MAX_WAVE (and trim whitespace on both variables).

Normal victory run and victory warm start with both values at 0 and keep the exact same probing behaviour.

Linked issue: N/A

Verification

Host GPU: NVIDIA GeForce RTX 5070 Ti (WaveLaneCountMax = 32, shader-visible view heap capped at 1,000,000 -> null slot 999,999), Windows x64, Ryzen 7 9700X, 32 GB RAM.

Base reproduction (c4c93bd, before the fix):

cargo test --locked -p victory-gpu --test warm_host_facts
-> FAILED. 0 passed; 1 failed (finished in 0.93s)
   assertion `left == right` failed: shader_cache::warm overwrote explicit VICTORY_VIEW_LIMIT
     left: 999999
    right: 2097151

After the fix:

cargo test --locked -p victory-gpu --test warm_host_facts      -> ok. 1 passed; 0 failed; finished in 0.23s
cargo test --locked -p victory-gpu shader_cache                -> ok. 2 passed; 0 failed; 187 filtered out
cargo test --locked -p victory-loader --test load_probe        -> ok. 2 passed; 0 failed
cargo check --locked -p victory                                -> Finished `dev` profile in 15.09s
cargo check --locked -p victory --features diagnostics         -> Finished `dev` profile in 18.03s
cargo xtask policy                                             -> asset policy: 199 files ok
python -m pytest tests/test_lanceur_victory.py -q              -> 25 passed in 7.54s

Oracle and test data

New integration test third_party/victory/crates/victory-gpu/tests/warm_host_facts.rs uses synthetic bytes (b"synthetic") and a temporary cache directory. It verifies both full-override (host_max_wave=64, view_heap_limit=2_097_151 preserved verbatim in translation_fingerprint()) and partial-override (view_heap_limit=0 probed from the RTX 5070 Ti D3D12 device while host_max_wave=64 stays untouched). Fails on base c4c93bd and passes with this change.

Checklist

  • The PR covers a single reviewable behaviour.
  • A test fails without this change and passes with it.
  • The commands and results of each check are given above.
  • An unimplemented function returns an error (E_NOTIMPL), never a fake success.
  • README: the same change in all 9 languages (test_readme_sync.py checks it).
  • No game, console or SDK file, no key, no dump, no download link.
  • Findings drawn from a title: limited to what rule 2 of AGENTS.md allows (names, slots, argument shapes, flag values, HRESULTs, IIDs, counts), with how they were obtained; no address or RVA.
  • Code taken from another project: compatible licence and credit in THIRD_PARTY.md.

Made with AI assistance (Antigravity).

**@⁠mauroalvare** on GitHub · 2026-11-26 01:49 UTC · [original](https://github.com/LooperSalty/AnyXboxX/pull/298) `mauroalvare:fix/victory-warm-host-overrides` → `main` · +31 −1 · 3 files · 3 commits · open ## Change Fixes `victory translate --warm` silently ignoring `VICTORY_HOST_WAVE` and `VICTORY_VIEW_LIMIT` (base `c4c93bdc413191a9dc909998d2d53080a3f0c880`). `apps/victory/src/main.rs` documents `victory translate --warm` as an offline cache warmer (*"nothing else is done. Set `VICTORY_HOST_WAVE` and `VICTORY_VIEW_LIMIT` to what the run's log says of the host"*) and parses both variables into `victory_shader::emit::set_host_max_wave` / `set_view_heap_limit`. However, `shader_cache::warm()` calls `shader_cache::build()`, which unconditionally called `descriptor::host::probe_view_limit()`, which: 1. Spun up a live D3D12 device (`crate::host::host()`), violating offline translation warming. 2. Unconditionally called `set_host_max_wave(o1.WaveLaneCountMax)` inside `Host::create()`, overwriting `VICTORY_HOST_WAVE`. 3. Unconditionally called `set_view_heap_limit(views - 1)` inside `probe_view_limit()`, overwriting `VICTORY_VIEW_LIMIT`. As a result, warming a shader cache for another host GPU (e.g. a 64-lane / 2M-view AMD host from an NVIDIA 32-lane / 1M-view PC, or vice versa) clobbered both host facts back to the local adapter and produced 100% cache misses on the target host. In addition, `main.rs` read `VICTORY_HOST_WAVE` while `translate::run` read `VICTORY_HOST_MAX_WAVE`, so `VICTORY_HOST_MAX_WAVE` was ignored by `translate --warm`. What changed: - Export `victory_shader::emit::host_max_wave()`. - In `Host::create()` (`crates/victory-gpu/src/host.rs`), set `host_max_wave` from `WaveLaneCountMax` only when it is still unset (`0`). - In `probe_view_limit()` (`crates/victory-gpu/src/descriptor/host.rs`), return immediately if `view_heap_limit()` is already non-zero. - In `shader_cache::build()` (`crates/victory-gpu/src/shader_cache.rs`), probe the local D3D12 adapter only for whichever of `view_heap_limit` / `host_max_wave` is still `0` — skipping D3D12 device initialization completely when both are supplied. - In `apps/victory/src/main.rs`, accept `VICTORY_HOST_WAVE` with fallback to `VICTORY_HOST_MAX_WAVE` (and trim whitespace on both variables). Normal `victory run` and `victory warm` start with both values at `0` and keep the exact same probing behaviour. Linked issue: N/A ## Verification Host GPU: NVIDIA GeForce RTX 5070 Ti (`WaveLaneCountMax = 32`, shader-visible view heap capped at `1,000,000` -> null slot `999,999`), Windows x64, Ryzen 7 9700X, 32 GB RAM. Base reproduction (`c4c93bd`, before the fix): ``` cargo test --locked -p victory-gpu --test warm_host_facts -> FAILED. 0 passed; 1 failed (finished in 0.93s) assertion `left == right` failed: shader_cache::warm overwrote explicit VICTORY_VIEW_LIMIT left: 999999 right: 2097151 ``` After the fix: ``` cargo test --locked -p victory-gpu --test warm_host_facts -> ok. 1 passed; 0 failed; finished in 0.23s cargo test --locked -p victory-gpu shader_cache -> ok. 2 passed; 0 failed; 187 filtered out cargo test --locked -p victory-loader --test load_probe -> ok. 2 passed; 0 failed cargo check --locked -p victory -> Finished `dev` profile in 15.09s cargo check --locked -p victory --features diagnostics -> Finished `dev` profile in 18.03s cargo xtask policy -> asset policy: 199 files ok python -m pytest tests/test_lanceur_victory.py -q -> 25 passed in 7.54s ``` ## Oracle and test data New integration test `third_party/victory/crates/victory-gpu/tests/warm_host_facts.rs` uses synthetic bytes (`b"synthetic"`) and a temporary cache directory. It verifies both full-override (`host_max_wave=64`, `view_heap_limit=2_097_151` preserved verbatim in `translation_fingerprint()`) and partial-override (`view_heap_limit=0` probed from the RTX 5070 Ti D3D12 device while `host_max_wave=64` stays untouched). Fails on base `c4c93bd` and passes with this change. ## Checklist - [x] The PR covers a single reviewable behaviour. - [x] A test fails without this change and passes with it. - [x] The commands and results of each check are given above. - [x] An unimplemented function returns an error (`E_NOTIMPL`), never a fake success. - [x] README: the same change in all 9 languages (`test_readme_sync.py` checks it). - [x] No game, console or SDK file, no key, no dump, no download link. - [x] Findings drawn from a title: limited to what rule 2 of `AGENTS.md` allows (names, slots, argument shapes, flag values, HRESULTs, IIDs, counts), with how they were obtained; no address or RVA. - [x] Code taken from another project: compatible licence and credit in `THIRD_PARTY.md`. Made with AI assistance (Antigravity).
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 05:42:21 +00:00
github-bot force-pushed github-bot/gh-298 from 0105b95125 to 37fef1b5d8 2026-11-26 19:50:59 +00:00 Compare
github-bot force-pushed github-bot/gh-298 from 37fef1b5d8 to 613c171da0 2026-11-27 00:36:49 +00:00 Compare
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/298/head:github-bot/gh-298'
git switch 'github-bot/gh-298'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-298'
git switch 'github-bot/gh-298'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-298'
git switch 'github-bot/gh-298'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-298'
git switch 'main'
git merge --squash 'github-bot/gh-298'
git switch 'main'
git merge --ff-only 'github-bot/gh-298'
git switch 'main'
git merge 'github-bot/gh-298'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No description provided.