Ray tracing: builder within a wait budget, recycled ray pages; opt-in descriptor-slot, ray-walker and water switches; counters and bench script #1046

Closed
ldanyyl wants to merge 12 commits from upstream-pr/1046 into main
ldanyyl commented 2026-11-28 12:07:47 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by ldanyyl on 2026-11-28T12:07:47Z.


Fixes for the title's own ray tracing (VICTORY_BVH_BUILDER=1), new opt-in switches for the descriptor slots, ray walkers and water light, counters, and a benchmark script. With every new switch off, the default path is VIctory-NVIDIA's, except for counters and log lines; the two ray-tracing budgets only act with VICTORY_BVH_BUILDER=1.

Part of this is fxceless's work (credited with Co-authored-by on those commits).

Ray tracing (only with VICTORY_BVH_BUILDER=1)

  • Structure builder programs are made by the pipeline workers within a per-frame wait budget, instead of on the title's thread. Before this, a cold cache could hold the title's thread long enough for its own 30 s watchdog to end the run.
    • VICTORY_BVH_BUILDER_WAIT_MS, default 2000: on by default, against the switch rule, because the old path ends the run.
    • VICTORY_BVH_BUILDER_ON_THE_SPOT=1 restores the old behaviour.
  • Pages made for the ray programs are a recycled budget, not a limit for the whole run (memory.rs).

New switches, all off by default (on with =1)

Switch What it does
VICTORY_DYNAMIC_WAIT A draw that finds no free dynamic descriptor slot waits for the next landing without holding the submission lock (alt: on and off in turns, for A/B)
VICTORY_THIN_GATE A list's translation pauses while dynamic slots are short
VICTORY_TABLES_ONCE One copy of a descriptor table for every length, reused by the other stages of the list
VICTORY_MEMORY_NEAR Ray-walking shaders reuse an earlier load's look in the memory directory (in the shader cache key)
VICTORY_WATER_TILE_SLOTS On 32-lane hosts the water light's tile lists take a slot a lane, matched by program hash (in the shader cache key)

The documentation is in docs/fork-ray-tracing.md and in comments where each switch is read.

Counters and diagnostics

  • Ownerless views evicted, and lookups that found them gone.
  • Uploads served from the process heap; a failed upload pool reservation is logged.
  • Diagnostics builds only: draw time by what was recorded with it, windows of title memory, and F9 to save a frame together with every texture its passes wrote.

Benchmark

scripts/bench.ps1 is based on PR #617. It runs the diagnostics build unattended through victory play with chosen switches. It writes:

  • median fps, p99, and 1 % / 0.1 % low, from a new framelog: frame times line built from the frame meter's intervals;
  • GPU busy share, VRAM and memory samples;
  • a summary in markdown and json.

Options: -RayTracing, -Dlss, -FrameGen, -Switches, -Seconds, -Warmup, -CaptureEvery, -Compare.

Also

  • Clippy lints from toolchain 1.98 (is_multiple_of, checked_div, explicit precedence), with no change in behaviour.

Tests

On Windows (toolchain from rust-toolchain.toml):

  • cargo clippy --workspace --all-targets --locked -- -D warnings: clean
  • cargo test -p victory-gpu --lib --locked -- --test-threads=1: 465 passed
  • cargo test -p victory-shader --locked: 295 passed
  • cargo test -p victory --locked: passed
  • cargo xtask policy: ok

In game, on a Ryzen 5 9600X with 32 GB and an RTX 5060 Ti 16 GB: Series X profile, 2560x1440, DLSS and frame generation off, diagnostics build of this branch, 4-minute windows with scripts/bench.ps1.

Run Median fps p99 frame time 1 % low Crashes / device loss
Ray tracing off (default) 17.6 126.9 ms 7.9 fps none
VICTORY_BVH_BUILDER=1 8.7 532.1 ms 1.9 fps none (the builder ran without tripping the title's watchdog)

These are single runs on one machine; the new switches were not A/B-measured on this base.

🤖 Generated with Claude Code

https://claude.ai/code/session_01Hw2UBhLdHXyf9znVoP6cYo

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:issue:5539960164 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/1046). Originally posted by [ldanyyl](https://github.com/ldanyyl) on 2026-11-28T12:07:47Z. --- Fixes for the title's own ray tracing (`VICTORY_BVH_BUILDER=1`), new opt-in switches for the descriptor slots, ray walkers and water light, counters, and a benchmark script. **With every new switch off, the default path is VIctory-NVIDIA's**, except for counters and log lines; the two ray-tracing budgets only act with `VICTORY_BVH_BUILDER=1`. Part of this is fxceless's work (credited with `Co-authored-by` on those commits). ## Ray tracing (only with `VICTORY_BVH_BUILDER=1`) - **Structure builder programs are made by the pipeline workers within a per-frame wait budget, instead of on the title's thread.** Before this, a cold cache could hold the title's thread long enough for its own 30 s watchdog to end the run. - `VICTORY_BVH_BUILDER_WAIT_MS`, default 2000: on by default, against the switch rule, because the old path ends the run. - `VICTORY_BVH_BUILDER_ON_THE_SPOT=1` restores the old behaviour. - **Pages made for the ray programs are a recycled budget, not a limit for the whole run** (`memory.rs`). ## New switches, all off by default (on with `=1`) | Switch | What it does | |---|---| | `VICTORY_DYNAMIC_WAIT` | A draw that finds no free dynamic descriptor slot waits for the next landing without holding the submission lock (`alt`: on and off in turns, for A/B) | | `VICTORY_THIN_GATE` | A list's translation pauses while dynamic slots are short | | `VICTORY_TABLES_ONCE` | One copy of a descriptor table for every length, reused by the other stages of the list | | `VICTORY_MEMORY_NEAR` | Ray-walking shaders reuse an earlier load's look in the memory directory (in the shader cache key) | | `VICTORY_WATER_TILE_SLOTS` | On 32-lane hosts the water light's tile lists take a slot a lane, matched by program hash (in the shader cache key) | The documentation is in `docs/fork-ray-tracing.md` and in comments where each switch is read. ## Counters and diagnostics - Ownerless views evicted, and lookups that found them gone. - Uploads served from the process heap; a failed upload pool reservation is logged. - Diagnostics builds only: draw time by what was recorded with it, windows of title memory, and F9 to save a frame together with every texture its passes wrote. ## Benchmark `scripts/bench.ps1` is based on PR #617. It runs the diagnostics build unattended through `victory play` with chosen switches. It writes: - median fps, p99, and 1 % / 0.1 % low, from a new `framelog: frame times` line built from the frame meter's intervals; - GPU busy share, VRAM and memory samples; - a summary in markdown and json. Options: `-RayTracing`, `-Dlss`, `-FrameGen`, `-Switches`, `-Seconds`, `-Warmup`, `-CaptureEvery`, `-Compare`. ## Also - Clippy lints from toolchain 1.98 (`is_multiple_of`, `checked_div`, explicit precedence), with no change in behaviour. ## Tests On Windows (toolchain from `rust-toolchain.toml`): - `cargo clippy --workspace --all-targets --locked -- -D warnings`: clean - `cargo test -p victory-gpu --lib --locked -- --test-threads=1`: 465 passed - `cargo test -p victory-shader --locked`: 295 passed - `cargo test -p victory --locked`: passed - `cargo xtask policy`: ok In game, on a Ryzen 5 9600X with 32 GB and an RTX 5060 Ti 16 GB: Series X profile, 2560x1440, DLSS and frame generation off, diagnostics build of this branch, 4-minute windows with `scripts/bench.ps1`. | Run | Median fps | p99 frame time | 1 % low | Crashes / device loss | |---|---|---|---|---| | Ray tracing off (default) | 17.6 | 126.9 ms | 7.9 fps | none | | `VICTORY_BVH_BUILDER=1` | 8.7 | 532.1 ms | 1.9 fps | none (the builder ran without tripping the title's watchdog) | These are single runs on one machine; the new switches were not A/B-measured on this base. 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01Hw2UBhLdHXyf9znVoP6cYo
ballsimulation commented 2026-11-28 13:17:33 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by ballsimulation on 2026-11-28T13:17:33Z.


@ldanyyl, thanks for scripts/bench.ps1. I've opened #1099 with your bench commit (7756cd98) on its own, so it can land without waiting for this PR's ray-tracing changes. The commit is unchanged and still yours as author. On top of it, #1099 adds -Route, a scripted walk that starts at the world's first frame (#1098).

I tried it on main 63b902fe from the free-roam save in #332. It worked unattended from the boot screens to the summary. Two runs loaded 6 s apart and still ended the route at the same spot.

If #1099 lands first, this PR can drop its copy of the script. If you'd rather keep it here, tell me and I'll close #1099.

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:comment:7239831987 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/1046#issuecomment-7239831987). Originally posted by [ballsimulation](https://github.com/ballsimulation) on 2026-11-28T13:17:33Z. --- @ldanyyl, thanks for `scripts/bench.ps1`. I've opened #1099 with your bench commit (7756cd98) on its own, so it can land without waiting for this PR's ray-tracing changes. The commit is unchanged and still yours as author. On top of it, #1099 adds `-Route`, a scripted walk that starts at the world's first frame (#1098). I tried it on main `63b902fe` from the free-roam save in #332. It worked unattended from the boot screens to the summary. Two runs loaded 6 s apart and still ended the route at the same spot. If #1099 lands first, this PR can drop its copy of the script. If you'd rather keep it here, tell me and I'll close #1099.
trustno1-coder commented 2026-11-28 19:23:14 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by trustno1-coder on 2026-11-28T19:23:14Z.


Thanks for this. I'm closing it without merging because it conflicts with the current main in several places (main has moved a lot since it was opened, with about 100 pull requests merged today), and I can't resolve that safely on your behalf. If you'd still like it in, please rebase it on the current main and open a new pull request.

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:comment:7244505484 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/1046#issuecomment-7244505484). Originally posted by [trustno1-coder](https://github.com/trustno1-coder) on 2026-11-28T19:23:14Z. --- Thanks for this. I'm closing it without merging because it conflicts with the current main in several places (main has moved a lot since it was opened, with about 100 pull requests merged today), and I can't resolve that safely on your behalf. If you'd still like it in, please rebase it on the current main and open a new pull request.

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
trustno1-coder/VIctory-NVIDIA!1046
No description provided.