Three opt-in levers for the layer's own frame time: VICTORY_FILL_HOT, VICTORY_SHADOW_CACHE, VICTORY_BURY_ASIDE (all off by default) #1224

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

@⁠Steenax6 on GitHub · 2026-11-26 00:34 UTC · original
Steenax6:pr/submit-thread → main · +302 −18 · 3 files · 3 commits · open

What

Three small levers from a larger piece of work in Steenax6/VIctory-NVID (2e21055, which took the layer's submit thread from about 195 to about 47 ms a frame on an RTX 4070 Ti). Each is one commit, each is off by default and does nothing without its switch.

  1. VICTORY_FILL_HOT=1: only reads of the 64 KiB a flight changed under a fill wait for flights. Today the first such fill makes every later read wait (one WAIT flag). In our tree two fills a frame waited 54 ms.
  2. VICTORY_SHADOW_CACHE=1: recording threads remember which host copy a title address range has; the buffer table becomes a read/write lock, read shared only with the switch on. In our tree the table's mutex cost 32 ms a frame of the recording threads.
  3. VICTORY_BURY_ASIDE=1: host objects that waited for a flight are released off the landing thread. In our tree 0.9 + 2 ms a frame of the relay thread.

What this is not

It is not the 195 -> 47 ms. Most of that came from things this tree has since built its own way (VICTORY_INDIRECT_GATHER, VICTORY_COPY_PLAIN, VICTORY_CARD_HASH_WIDE, VICTORY_LIGHT_REFRESH, cardmeter.rs) or from changes that sit on our rewritten watch journal and descriptor locking and cannot be brought over in isolation (4 KiB tracking and refresh in parts, striped slot locks, the fine card compare). I left those out rather than port them on guesses about lifetimes. If one of them is of interest, say which and I will look at it against this tree.

What I can and cannot say for this tree

  • Compiled and linted on 4aa6e8c: both clippy runs of the CI give exactly the warnings main gives, none new. cargo test --workspace --locked: all suites pass except xtask repository_passes_policy, which objects to two files under diagnostics/ that are on main.
  • Not run with the title on this base. The numbers above are per-lever notes from our tree, measured before this tree's last 32 commits; whether the waits they remove still exist here in that size is exactly what a run with each switch would show.
  • With the switches off the three paths are the code as it is on main (bury byte for byte; the shadow table exclusive on every lookup, as now).

🤖 Generated with Claude Code

**@⁠Steenax6** on GitHub · 2026-11-26 00:34 UTC · [original](https://github.com/fxceless/victory-fork/pull/1224) `Steenax6:pr/submit-thread` → `main` · +302 −18 · 3 files · 3 commits · open ## What Three small levers from a larger piece of work in Steenax6/VIctory-NVID ([2e21055](https://github.com/Steenax6/VIctory-NVID/commit/2e21055), which took the layer's submit thread from about 195 to about 47 ms a frame on an RTX 4070 Ti). Each is one commit, each is **off by default** and does nothing without its switch. 1. **`VICTORY_FILL_HOT=1`**: only reads of the 64 KiB a flight changed under a fill wait for flights. Today the first such fill makes every later read wait (one `WAIT` flag). In our tree two fills a frame waited 54 ms. 2. **`VICTORY_SHADOW_CACHE=1`**: recording threads remember which host copy a title address range has; the buffer table becomes a read/write lock, read shared only with the switch on. In our tree the table's mutex cost 32 ms a frame of the recording threads. 3. **`VICTORY_BURY_ASIDE=1`**: host objects that waited for a flight are released off the landing thread. In our tree 0.9 + 2 ms a frame of the relay thread. ## What this is not It is not the 195 -> 47 ms. Most of that came from things this tree has since built its own way (`VICTORY_INDIRECT_GATHER`, `VICTORY_COPY_PLAIN`, `VICTORY_CARD_HASH_WIDE`, `VICTORY_LIGHT_REFRESH`, `cardmeter.rs`) or from changes that sit on our rewritten watch journal and descriptor locking and cannot be brought over in isolation (4 KiB tracking and refresh in parts, striped slot locks, the fine card compare). I left those out rather than port them on guesses about lifetimes. If one of them is of interest, say which and I will look at it against this tree. ## What I can and cannot say for this tree - Compiled and linted on 4aa6e8c: both clippy runs of the CI give exactly the warnings `main` gives, none new. `cargo test --workspace --locked`: all suites pass except `xtask` `repository_passes_policy`, which objects to two files under `diagnostics/` that are on `main`. - **Not run with the title on this base.** The numbers above are per-lever notes from our tree, measured before this tree's last 32 commits; whether the waits they remove still exist here in that size is exactly what a run with each switch would show. - With the switches off the three paths are the code as it is on `main` (`bury` byte for byte; the shadow table exclusive on every lookup, as now). 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Fills of upload memory that read title memory flights may write go ahead
of the flights and are checked when those land (fill_ahead). The first
fill that had read bytes a flight then changed turned the waiting back on
for every fill, for the rest of the run. With VICTORY_FILL_HOT=1 the
64 KiB pieces of title memory that fill read are remembered instead, and
only fills and buffer copies that read one of those pieces wait; the
others keep reading ahead and stay checked as before. Without the switch
nothing changes.

The frame line that counts fills read ahead names the number of such
pieces.

Numbers, measured in another tree (Steenax6/VIctory-NVID, commit 2e21055,
RTX 4070 Ti 12 GB, Ryzen 7 9800X3D), in the title's opening scene: one
fill of 2,048 bytes of a small buffer shaders write every frame turned
the waiting on, and from then on two fills a frame waited 54 ms for
flights; 1,229 of those waits were looked at, each for 480 bytes of
per-draw constants elsewhere, and the bytes were the same after the wait
1,229 times. That commit as a whole (this and other changes together)
took the submit thread from about 195 to about 47 ms a frame there; no
figure for this change alone was taken beyond the 54 ms above.

On this base the change was compiled and linted only, not run.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
Every view of every draw asks shadow::lookup for the host copy of a range
of title memory, on every recording thread, and each ask took the mutex
of the table of title buffers. The table is now behind a read/write lock.
Without the switch every ask takes it exclusive and looks in the table,
as before. With VICTORY_SHADOW_CACHE=1:

- an ask whose buffer has its copy already reads the table shared;
- each thread remembers, by ask, the copy it was answered with (512
  answers, held weakly), and answers from there while a counter of the
  table's changes stands where it stood. The counter is bumped, under the
  exclusive lock, by everything that can change such an answer: a buffer
  registered or unregistered, a copy in place taken out
  (in_place_let_go). Those are all the places that change the table.

Only answers from a buffer's copy are remembered; windows outside buffers
(loose) are looked up as before. A test walks the cache through a buffer
added inside another and taken out again.

Numbers, measured in another tree (Steenax6/VIctory-NVID, commit 2e21055,
RTX 4070 Ti 12 GB, Ryzen 7 9800X3D): as a mutex the table was 32 ms a
frame of the recording threads, 15 of them waiting. That is time of the
title's recording threads, not of the submit thread. No frame time was
taken for this change alone.

On this base the change was compiled and linted only, not run; the new
unit test passes.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
Objects retired while submissions run (host::retire) are dropped by the
thread that finishes the submission they waited for. With the relay that
is the thread that lands flights, and every landing took the whole list
apart and put the part that still waits back (a partition that moves
every entry), then released the others there.

With VICTORY_BURY_ASIDE=1 the relay's landing takes only the entries that
are done with out of the list, where they lie, and hands them to a thread
of its own (victory-bury) that drops them. Dropping later is always
allowed: these objects only wait for the card, and Retired is already
dropped on whatever thread finishes the submission. If the thread cannot
be started they are dropped in the landing. Without the switch, and on
the two other paths that finish submissions, nothing changes.

Numbers, measured in another tree (Steenax6/VIctory-NVID, commit 2e21055,
RTX 4070 Ti 12 GB, Ryzen 7 9800X3D), from a sampling profile: the
partition 0.9 ms a frame and the releases 2 ms a frame of the landing
thread. That is the relay thread's time, not the submit thread's.

On this base the change was compiled and linted only, not run.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 03:59:51 +00:00
Author
Owner

@⁠UwUCammie on GitHub · 2026-11-26 01:39 UTC · original

I tried VICTORY_SHADOW_CACHE on the RX 7900 XT with FILL_HOT and BURY_ASIDE both off. Four pairs in the first room gave 515 presents in 77.99 s (6.60 FPS) off and 508 in 76.86 s (6.61 FPS) on. The enabled blocks counted 106.7 million cache hits; the four differences were +0.48, −0.08, −0.43 and +0.06 FPS. A low-priority build overlapped the last eight seconds of the fourth pair. I don't see a consistent change in this scene on my machine. Build and method

**@⁠UwUCammie** on GitHub · 2026-11-26 01:39 UTC · [original](https://github.com/fxceless/victory-fork/pull/1224#issuecomment-7179990805) I tried `VICTORY_SHADOW_CACHE` on the RX 7900 XT with `FILL_HOT` and `BURY_ASIDE` both off. Four pairs in the first room gave 515 presents in 77.99 s (6.60 FPS) off and 508 in 76.86 s (6.61 FPS) on. The enabled blocks counted 106.7 million cache hits; the four differences were +0.48, −0.08, −0.43 and +0.06 FPS. A low-priority build overlapped the last eight seconds of the fourth pair. I don't see a consistent change in this scene on my machine. [Build and method](https://github.com/UwUCammie/victory-amd/blob/dc52b4b/benchmarks/README.md#profiling-after-the-comparison)
Author
Owner

@⁠Garu667 on GitHub · 2026-11-26 10:48 UTC · original

Data point for VICTORY_FILL_HOT (same idea, independently written here before we found this PR): RTX 3080, f6a09d3 + #799's programs running, boat mission. The block caught is the 2 KiB at 0xdc07eab00 (as in #1205 / #1256). Only 1 piece of 64 KiB caught in 3 min; submit thread's waits on the card 24.3 → 10.9 ms/frame, world fps 8.6 → 9.6. Note #1205: the first stale fill is visible (the café oval), so this pairs well with making that one block wait from the start.

**@⁠Garu667** on GitHub · 2026-11-26 10:48 UTC · [original](https://github.com/fxceless/victory-fork/pull/1224#issuecomment-7189855104) Data point for `VICTORY_FILL_HOT` (same idea, independently written here before we found this PR): RTX 3080, `f6a09d3` + #799's programs running, boat mission. The block caught is the 2 KiB at `0xdc07eab00` (as in #1205 / #1256). Only 1 piece of 64 KiB caught in 3 min; submit thread's waits on the card 24.3 → 10.9 ms/frame, world fps 8.6 → 9.6. Note #1205: the first stale fill is visible (the café oval), so this pairs well with making that one block wait from the start.
This pull request has changes conflicting with the target branch.
  • crates/victory-gpu/src/shadow.rs
View command line instructions

Manual merge helper

Use this merge commit message when completing the merge manually.

Checkout

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

Merge

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