Levels on demand that takes effect, a shader cache key for ray tracing, a hang on the present's fallback; a bus bench and an audit #1470

Manually merged
github merged 8 commits from github-bot/gh-1470 into main 2026-11-29 08:21:02 +00:00 AGit
Owner

@⁠banaanpapa on GitHub · 2026-11-28 20:24 UTC · original
banaanpapa:audit/phase-0-1 → main · +1780 −45 · 13 files · 8 commits · merged 2026-11-29 08:16 UTC

Three fixes, one measurement tool and an audit. Each is a commit of its own and can be taken alone. None of it was run in the title: there is no dump on the PC this was made on.

1. Levels on demand never took effect with the texture pool on

What was wrong. host_texture_as(.., reserved = true) tried the pool of 64 MiB blocks before it looked at reserved, and the pool takes every texture the title fills, which is every texture levels on demand asks for. The texture came back placed in a block, Tiled::make found no tiles in it, and the old kind was made. VICTORY_TEXTURE_POOL is on by default, so VICTORY_LEVELS_ON_DEMAND=1 changed nothing for those textures.

The change. !reserved on the pool branch (resource.rs).

Shown by. a_texture_asked_for_without_memory_is_not_cut_from_a_block asks for a BC7 1024x1024 chain without memory and has the card cut it into tiles. On an RTX 5080 it failed before the change and passes after.

Bears on #1411, which turns levels on demand on by itself for budgets up to 8 GiB: without this it would turn on something that does nothing. The launchers still set the switch to 0, so nothing changes for a player until someone measures it.

2. Ray tracing on and off shared a shader cache key

What was wrong. victory play sets VICTORY_BVH_MISS=1 in every run. The F1 menu's RAY TRACING sets VICTORY_BVH_BUILDER=1 beside it, which turns the misses off inside the translator (intersect.rs bvh_miss). The key held the switch's value, 1 in both runs, so:

  • a run with RAY TRACING on was served the shaders cached without it: every ray missing structures that were now built;
  • a run with it off again was served what the run with it had translated: walks of memory nothing built.

The change. Where the switch is set, the key says which of the two the translator does (victory_shader::emit::bvh_miss). A start of victory.exe translates its shaders once more.

Also. Six switches the translator reads were in no key: VICTORY_LOOPS_WAVE, VICTORY_LDS_FIRST_INIT, VICTORY_LDS_INIT_HOIST, VICTORY_HDR_CLAMP, VICTORY_DEFRAG, VICTORY_SAMPLED_MARKS. VICTORY_DEFRAG=0 in particular did nothing wherever the program it leaves out was cached already. They are keyed only while set, so caches made without them stay valid. #1437 adds the first two to the always-keyed list; either way works, and they would conflict in a few lines.

A new test fails for any switch the translator's source reads that no list of the key names. Rebased onto 923e38c it found the last three of the six by itself.

Shown by. the_builder_beside_bvh_miss_changes_the_shader_cache_key (five settings, each in a process of its own), switches_keyed_when_set_change_the_shader_cache_key, every_switch_of_the_translator_is_keyed_or_known_not_to_matter.

3. A hang on the fallback paths of present_planes

What was wrong. Where the two-plane composer cannot be made, or cannot record, present_planes shows the base plane alone by calling itself. It dropped presenter first, which is a reference into the guard of Host::presenter, not the guard. The guard lived on and the call locked the same mutex again, which waits for ever. Clippy names all three places (drop of a reference does nothing).

The change. The guard is dropped.

Not run. The path needs a composer that fails. It compiles and the crate's tests pass.

4. A free lets go of what is in place there

title_memory_freed did not tell crate::inplace; only remaps did. The tables forget it now. This is half a fix: the heap itself goes when the last list and slot that hold it do, and until then the title's VirtualFree fails as it did. Nothing turns VICTORY_INPLACE on by default. No test of its own.

5. A bench of what the bus costs (host/bus.rs)

An ignored test, no title files:

cargo test -p victory-gpu --release --lib host::bus -- --ignored --nocapture

Shaders read and store a 256 MiB buffer in each placement between two timestamps of the card. RTX 5080, Ryzen 9 9950X3D, two runs within 1 %:

Where the buffer lies Shaders read Shaders store CPU copies in CPU copies out
The PC's memory (shared_buffer, pool L0) 32 GB/s 2.0 GB/s 31 GB/s 10 GB/s
The card's memory (uav_buffer) 932 GB/s 300 GB/s
Card memory the CPU maps (mapped_card_buffer) 940 GB/s 301 GB/s 32 GB/s 0.09 GB/s

The figures for the card's memory are lower bounds. It would be useful to have the same from other cards, AMD above all.

6. docs/unified-memory-audit.md

An audit of the tree at 32ecacf against the five-track plan of Marvisak/VIctory issue 3703, with what other trees measured of the ways round the bridge, the waits that are left on the submitting thread, textures, the PC's memory, shaders and pipelines, and a road in phases. Its line numbers are of 32ecacf; 205 commits have landed since, so check before relying on one. It makes no frame rate claim.

7. Small things

  • Clippy findings that 32ecacf had: shadow.rs, descriptor.rs, gameinput.rs, and one in victory-shader's tests.
  • Comments that said "off by default" for VICTORY_RELAY, VICTORY_LATE_WAIT, VICTORY_WIDE_BACK and VICTORY_ASK_ONCE, which are on; tiles.rs named a function that is called card_writes.

Tested

Windows 11 26300, RTX 5080 16 GB, driver 617.42, Rust 1.98.1, on 923e38c.

  • cargo test --workspace --locked: every test passes but xtask's repository_passes_policy, which fails on main the same way (emit/lower.rs: 667523 bytes exceeds the 655360-byte limit). victory-gpu 554 passed, 44 ignored; victory-shader 348 passed.
  • cargo clippy --workspace --all-targets --locked -- -D warnings does not pass, on main or here: two findings in emit/lower.rs and some dozen in victory-gpu, all from commits since 32ecacf, none in a line this changes.

Not verified

  • Nothing was run in the title. No frame rate, memory or picture claim is made for any of this.
  • Change 3 was not exercised; change 4 has no test.
  • The on-card run of levels_on_demand_on_the_card did not happen: it wants the D3D12 debug layer, which is not installed here. It passes on the software adapter.

🤖 Generated with [Claude Code]

**@⁠banaanpapa** on GitHub · 2026-11-28 20:24 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/1470) `banaanpapa:audit/phase-0-1` → `main` · +1780 −45 · 13 files · 8 commits · merged 2026-11-29 08:16 UTC Three fixes, one measurement tool and an audit. Each is a commit of its own and can be taken alone. None of it was run in the title: there is no dump on the PC this was made on. ## 1. Levels on demand never took effect with the texture pool on **What was wrong.** `host_texture_as(.., reserved = true)` tried the pool of 64 MiB blocks before it looked at `reserved`, and the pool takes every texture the title fills, which is every texture levels on demand asks for. The texture came back placed in a block, `Tiled::make` found no tiles in it, and the old kind was made. `VICTORY_TEXTURE_POOL` is on by default, so `VICTORY_LEVELS_ON_DEMAND=1` changed nothing for those textures. **The change.** `!reserved` on the pool branch (`resource.rs`). **Shown by.** `a_texture_asked_for_without_memory_is_not_cut_from_a_block` asks for a BC7 1024x1024 chain without memory and has the card cut it into tiles. On an RTX 5080 it failed before the change and passes after. **Bears on #1411**, which turns levels on demand on by itself for budgets up to 8 GiB: without this it would turn on something that does nothing. The launchers still set the switch to 0, so nothing changes for a player until someone measures it. ## 2. Ray tracing on and off shared a shader cache key **What was wrong.** `victory play` sets `VICTORY_BVH_MISS=1` in every run. The F1 menu's RAY TRACING sets `VICTORY_BVH_BUILDER=1` beside it, which turns the misses off inside the translator (`intersect.rs` `bvh_miss`). The key held the switch's value, `1` in both runs, so: - a run with RAY TRACING on was served the shaders cached without it: every ray missing structures that were now built; - a run with it off again was served what the run with it had translated: walks of memory nothing built. **The change.** Where the switch is set, the key says which of the two the translator does (`victory_shader::emit::bvh_miss`). A start of `victory.exe` translates its shaders once more. **Also.** Six switches the translator reads were in no key: `VICTORY_LOOPS_WAVE`, `VICTORY_LDS_FIRST_INIT`, `VICTORY_LDS_INIT_HOIST`, `VICTORY_HDR_CLAMP`, `VICTORY_DEFRAG`, `VICTORY_SAMPLED_MARKS`. `VICTORY_DEFRAG=0` in particular did nothing wherever the program it leaves out was cached already. They are keyed only while set, so caches made without them stay valid. #1437 adds the first two to the always-keyed list; either way works, and they would conflict in a few lines. A new test fails for any switch the translator's source reads that no list of the key names. Rebased onto `923e38c` it found the last three of the six by itself. **Shown by.** `the_builder_beside_bvh_miss_changes_the_shader_cache_key` (five settings, each in a process of its own), `switches_keyed_when_set_change_the_shader_cache_key`, `every_switch_of_the_translator_is_keyed_or_known_not_to_matter`. ## 3. A hang on the fallback paths of `present_planes` **What was wrong.** Where the two-plane composer cannot be made, or cannot record, `present_planes` shows the base plane alone by calling itself. It dropped `presenter` first, which is a reference into the guard of `Host::presenter`, not the guard. The guard lived on and the call locked the same mutex again, which waits for ever. Clippy names all three places (`drop` of a reference does nothing). **The change.** The guard is dropped. **Not run.** The path needs a composer that fails. It compiles and the crate's tests pass. ## 4. A free lets go of what is in place there `title_memory_freed` did not tell `crate::inplace`; only remaps did. The tables forget it now. This is half a fix: the heap itself goes when the last list and slot that hold it do, and until then the title's `VirtualFree` fails as it did. Nothing turns `VICTORY_INPLACE` on by default. No test of its own. ## 5. A bench of what the bus costs (`host/bus.rs`) An ignored test, no title files: ``` cargo test -p victory-gpu --release --lib host::bus -- --ignored --nocapture ``` Shaders read and store a 256 MiB buffer in each placement between two timestamps of the card. RTX 5080, Ryzen 9 9950X3D, two runs within 1 %: | Where the buffer lies | Shaders read | Shaders store | CPU copies in | CPU copies out | |---|---|---|---|---| | The PC's memory (`shared_buffer`, pool L0) | 32 GB/s | 2.0 GB/s | 31 GB/s | 10 GB/s | | The card's memory (`uav_buffer`) | 932 GB/s | 300 GB/s | | | | Card memory the CPU maps (`mapped_card_buffer`) | 940 GB/s | 301 GB/s | 32 GB/s | 0.09 GB/s | The figures for the card's memory are lower bounds. It would be useful to have the same from other cards, AMD above all. ## 6. `docs/unified-memory-audit.md` An audit of the tree at `32ecacf` against the five-track plan of Marvisak/VIctory issue 3703, with what other trees measured of the ways round the bridge, the waits that are left on the submitting thread, textures, the PC's memory, shaders and pipelines, and a road in phases. Its line numbers are of `32ecacf`; 205 commits have landed since, so check before relying on one. It makes no frame rate claim. ## 7. Small things - Clippy findings that `32ecacf` had: `shadow.rs`, `descriptor.rs`, `gameinput.rs`, and one in `victory-shader`'s tests. - Comments that said "off by default" for `VICTORY_RELAY`, `VICTORY_LATE_WAIT`, `VICTORY_WIDE_BACK` and `VICTORY_ASK_ONCE`, which are on; `tiles.rs` named a function that is called `card_writes`. ## Tested Windows 11 26300, RTX 5080 16 GB, driver 617.42, Rust 1.98.1, on `923e38c`. - `cargo test --workspace --locked`: every test passes but `xtask`'s `repository_passes_policy`, which fails on `main` the same way (`emit/lower.rs: 667523 bytes exceeds the 655360-byte limit`). `victory-gpu` 554 passed, 44 ignored; `victory-shader` 348 passed. - `cargo clippy --workspace --all-targets --locked -- -D warnings` does **not** pass, on `main` or here: two findings in `emit/lower.rs` and some dozen in `victory-gpu`, all from commits since `32ecacf`, none in a line this changes. ## Not verified - Nothing was run in the title. No frame rate, memory or picture claim is made for any of this. - Change 3 was not exercised; change 4 has no test. - The on-card run of `levels_on_demand_on_the_card` did not happen: it wants the D3D12 debug layer, which is not installed here. It passes on the software adapter. 🤖 Generated with [Claude Code]
host_texture_as tried the pool of 64 MiB blocks before it looked at reserved, and the pool takes every texture the title fills: all that levels on demand asks for. The texture came back placed in a block, Tiled::make found no tiles in it, and the old kind was made. With VICTORY_TEXTURE_POOL on, which is the default, VICTORY_LEVELS_ON_DEMAND=1 changed nothing for those textures.

The test asks for a BC7 1024x1024 chain without memory and has the card cut it into tiles. On an RTX 5080 it failed before this ("one placed in a block has none") and passes with it. The launchers still set the switch to 0: what it does in the title is now there to be measured.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
victory play sets VICTORY_BVH_MISS=1 in every run, and the menu's RAY TRACING sets VICTORY_BVH_BUILDER=1 beside it, which turns the misses off in the translator (intersect.rs bvh_miss). The key held the switch's value, 1 in both runs: a run with the builder was served the translations of the runs without it (every ray missing structures that were built), and the other way round. Where the switch is set the key now says which of the two the translator does. Such a start translates its shaders once more.

Six switches the translator reads were in no key: VICTORY_LOOPS_WAVE, VICTORY_LDS_FIRST_INIT, VICTORY_LDS_INIT_HOIST, VICTORY_HDR_CLAMP, VICTORY_DEFRAG, VICTORY_SAMPLED_MARKS. A run with one of them set was served what a run without it had cached (VICTORY_DEFRAG=0 did nothing where the program it leaves out was cached already). They are in the key while set, so the caches made without them stay.

A test fails for any switch the translator's source reads that no list of the key's names (victory_shader::emit::switches): it found the last three of the six by itself when this was moved onto 923e38c.

Also the let_and_return clippy names in emit/mod.rs's tests.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
title_memory_freed did not tell crate::inplace, which only remaps did: after the title's VirtualFree a heap opened on the old memory still answered for the address. The tables forget it now. The heap itself goes when the last list and slot that hold it do; until then the title's call fails as it did. Nothing turns VICTORY_INPLACE on by default.

Also watch.rs's comment on VICTORY_ASK_ONCE, which is on by default.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
An ignored test: shaders read and store a 256 MiB buffer in the PC's memory (a host copy, pool L0), in the card's, and in card memory the CPU maps, between two timestamps of the card; and the CPU copies into and out of the two mappings.

RTX 5080, Ryzen 9 9950X3D: the PC's memory 32 GB/s read and 2.0 GB/s stored; the card's 932 and 300; card memory the CPU maps 940 and 301, with the CPU copying into it at 32 GB/s and out of it at 0.09.

Also host.rs's comments on VICTORY_LATE_WAIT and VICTORY_RELAY, which are on by default.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
shadow.rs and descriptor.rs (manual_is_multiple_of), gameinput.rs (a filter on Some): each as the lint asks; nothing the code does changes. (CI's clippy step does not pass with these alone: 923e38c has findings of its own, in victory-shader's emit/lower.rs and in victory-gpu, which are left to whoever merged them.)

Comments: VICTORY_RELAY and VICTORY_WIDE_BACK are on by default; the card's reference of a copy is a hash of each piece, not its bytes; tiles.rs names card_writes. scripts/play.ps1 says what the other launchers set beyond it.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
Where this tree stands against the five-track plan of upstream issue 3703, what the bridge between the title's memory and the card's costs and what other trees measured of the ways around it, the submitting thread, textures, the PC's memory, shaders and pipelines, and a road in phases. With what was run on an RTX 5080: the workspace's tests, the repository's own benches and the bus bench.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
Where the composer of two planes cannot be made, or cannot record, present_planes shows the base plane alone by calling itself. It dropped presenter first, which is a reference into the guard of Host::presenter and not the guard: the guard lived on and the call locked the same mutex again, which waits for ever. The guard is dropped now, in the three places clippy named (drop of a reference does nothing).

Not run: the path needs a composer that fails.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
The audit's synthetic frame, with a timer round each phase for one run: 117 us asking the write watch and 253 us in the flushes of each of the 29 small submissions, and neither moves with the helpers kept awake or with one thread.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-28 20:28:43 +00:00
github manually merged commit 7139a68342 into main 2026-11-29 08:21:02 +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/trustno1-coder--VIctory-NVIDIA!1470
No description provided.