Opt-in relay capture and page marks, and the fix that makes the marks pay off (RTX 3080: 18.3 → 20.0 fps, p99 113 → 87 ms) #3446

Closed
github-bot wants to merge 11 commits from github-bot/gh-3446 into main AGit
Owner

@⁠remijn on GitHub · 2026-11-29 23:25 UTC · original
remijn:rtx3080-capture-marks → main · +2154 −71 · 36 files · 11 commits · closed without merging

Summary

This PR adds two opt-in ways to cut the CPU cost of finding out what the GPU wrote into title memory each submission. It also fixes a bug that made one of them slower than doing nothing, and adds diagnostics used to measure the work. No defaults change: without the new switches, the layer behaves exactly as on main.

On an RTX 3080 (Series S profile, default settings, which include the relay at stage 2), both switches together took the median from 18.3 to 20.0 fps. 1 % lows went from 8.8 to 11.5 fps and the p99 frame from 113 to 87 ms. These are single short runs (see Measured).

Background: what this speeds up

After each submission, the layer has to learn which bytes the title's shaders changed in the ranges they declared written, so it can bring them back into title memory. The card-side compare does this by hashing every declared range in 64-byte pieces and comparing against the hashes from before; with the relay (on by default), a separate thread then fetches the pieces that differ and lands them. In the scene measured, that is about 8,000 pieces a frame, and with the relay on it is where most of the frame goes: about 40 ms of "preparing" a frame, against about 3 ms on the GPU.

The relay is on by default (VICTORY_RELAY unset means stage 2; only =0 turns it off; see shadow::relay and host::relay_exact, and ef1f8ed0). That includes play-foxhound.ps1, which doesn't set it: a launch with it logs copied back by a thread of its own, beside the submitting thread … exact=true. The launcher's comment "Left off: VICTORY_RELAY=2" is out of date; ef1f8ed0 fixed the same wording in shadow.rs.

The two switches attack two parts of that:

  1. Capture cuts the waiting: changed pieces are copied out by the compare itself.
  2. Page marks cut the hashing: only pages a shader actually wrote get hashed.

1. Relay capture: VICTORY_LAND_CAPTURE=1 (needs the relay at stage 2, the default)

What it does. Without it, the relay waits for the compare's results, then records and submits a second step that fetches the pieces that differ. With it, the compare copies every piece it finds changed into a ring of slots in the same submission (CardShared::capture, ring in CardWork). The relay then reads them from there, with no fetch and no extra wait on the card.

Why it helps. On the branch this came from (same 3080), the relay's fetch waits went from 34–38 ms a frame to 0, landing from 44–50 ms to 12–15 ms, and the 90th-percentile frame from 94–139 ms to 75–82 ms. Here it took "copying back" from 15.7 to 13.9 ms, but the median fps didn't move (17.8 against 18.3, within noise).

Why it is opt-in for now:

  • Since the relay is already the default, nothing stands in the way of capture also becoming one. It is opt-in here only because it has run on one PC. The skin report the launcher's comment cites (fxceless/victory-fork #89, RTX 5070 Laptop) predates the character fixes since (8773ea2d, 8622dc37); characters, faces included, show correctly on the 3080 with the relay and capture on. See the request for testing in the comments.
  • With capture on, the compare runs one pass per range instead of the batched compare (card_batch), because the batched shader doesn't capture. On a card where batching saves a lot, capture could cost more than it gains. That wasn't the case on the 3080, but it hasn't been checked elsewhere.
  • It uses its own buffers and slot ring. The slots are taken and returned per plan (capture_slots_are_never_taken_twice covers this), but it has run on one PC only.

2. Page marks: VICTORY_MARK_WRITES=1 with VICTORY_WRITTEN_COMPARE=check|skip

What it does. When the translator lowers a buffer store or atomic whose view has a title address it can work out, it adds a store that marks the 64 KiB page written, in a table bound as root UAV u249 (SLOT_WRITTEN). A program counts as "marks all it writes" only if every one of its stores was marked: no store through a root view, by address, or with a descriptor that varies across lanes. On the host side, ranges declared by any other program are noted as unmarked. The compare then reads the marks:

  • check: hashes everything as before, and also counts pieces found changed in pages no shader marked ("misses"). This is the safety test, and it is no faster.
  • skip: leaves pieces in unmarked pages unhashed, where only marking programs declared the range. That is the speed-up.

Why it helps. In this scene, about 7,200 of 8,060 pieces a frame are declared only by marking programs, and skip leaves about 7,000 of them unhashed. "Preparing" fell from 40–41 ms to 38 ms, GPU time from 3.3 to 0.9 ms, and the frame-time tail improved most (see Measured).

Why it is opt-in, and should stay so for now:

  • Skip mode trades checking for trust. If any write reaches a page that no shader marked (a store path the translator doesn't mark, a copy, an image write), skip misses the change, and title memory silently keeps stale bytes. That could show as corrupted geometry, flicker or broken logic. Check mode found 0.00 misses here, but that is one card, one scene and about 40 seconds. It needs check runs over much more of the game first.
  • It changes the shaders. Every marking store adds a few instructions and an extra store, and the setting is in the shader cache key. Turning it on retranslates every shader, and a run that isn't preloaded builds thousands of pipelines while it plays. On a 32 GB PC that ran out of commit and stalled the title (black screen, about 2,700 pipelines failing with 0x8007000e). Anyone trying it should run -Preload once first.
  • It also turns off the batched compare, like capture, because the batched shader doesn't read the marks.
  • Coverage depends on the shaders. Programs that store through root views or by address never mark. In another scene, their share could be larger and the gain smaller.

How to try it safely: preload once with the switch on, then run check and confirm the log line the compare and the pages shaders mark (VICTORY_WRITTEN_COMPARE=check) ... shows 0.00 pieces found changed whose page no shader marked (misses). Only after that, use skip.

The fix that makes the marks work (1d37f7e6)

As first ported, the marks made things much worse: in check mode, 3.2 fps and 311 ms of preparing a frame. The cause: Deferred::unmarked was never cleared. This fork reuses command lists (Deferred::clear keeps their allocations), so each list kept the unmarked ranges of every frame it had ever recorded, and the compare looked through all of them for every range it compared. The stale ranges also blocked pages that current shaders had marked, so only 70 to 1,650 pieces a frame counted as marked instead of about 7,200.

The fix:

  • the list empties unmarked when it is cleared;
  • each range is recorded once per list (unmarked_seen);
  • the compare indexes the ranges per host copy, sorted, with a running furthest end (UnmarkedIndex), so each compared range only visits the ranges that overlap it.

A test checks the index against the old full scan. The same omission exists in the original implementation on the branch this was ported from; it probably went unnoticed there because lists weren't reused.

Diagnostics (off by default, diagnostics build)

Switch / line Shows
VICTORY_PROFILE_SPIN which fence a polling title thread waits for
VICTORY_FENCE_STAGES each fence signal's path from asked to set
VICTORY_DECLARED_BY which shaders' declarations the compare hashes, and how much changed
VICTORY_QUEUE_USE how the title uses its queues; the card's time per kind of title queue
VICTORY_GPU_TIMING additions threads per call, ns per thread, and whether each pipeline's console program is wave64
timeline our upload list timed; the card's runs summed in order

These are what showed the GPU idle-but-busy pattern behind slow passes like InstanceCulling:CS_Tree_BatchCull, where a wave64 program run as two 32-lane halves took 190 ns per thread against 0.3 to 4 ns elsewhere.

Measured

RTX 3080 10 GB, 32 GB RAM. Series S profile, no DLSS, no frame generation, ray tracing off, play-foxhound.ps1's switches (the relay at stage 2, its default). Diagnostics build, the same save each time, 40 s measured after a 20 s warm-up, one run each, so differences of about 1 fps are noise.

fps (median) ms/frame preparing GPU copying back 1 % low p99 frame
defaults 18.3 54.5 40.2 3.3 15.7 8.8 113 ms
+ capture 17.8 56.3 41.2 3.3 13.9 9.6 104 ms
+ capture + marks check 18.1 55.4 40.9 3.2 13.8 9.0 112 ms
+ capture + marks skip 20.0 50.0 37.9 0.9 13.1 11.5 87 ms
(marks check before the fix) 3.2 317 312 0.4 6.5 2.4 414 ms

For context, the relay is what makes the default fast here. With it turned off (VICTORY_RELAY=0), Series X 1440 ran at 7 to 8 fps with 55 to 65 ms a frame on the GPU. With it on, as by default, the CPU's "preparing" is the limit, and that is what these two switches target.

What would make them defaults

  • Capture: the relay is already the default, so only testing is missing: A/B runs on a few more cards, including one where the batched compare matters, and a check that characters stay correct.
  • Marks: check-mode runs over long play sessions and several areas with 0 misses; the batched compare taught to read the marks (and to capture), so turning them on doesn't cost it; and the preload handled for players, since the cache key changes.

Tested

  • cargo check with and without diagnostics, after merging main.
  • victory-gpu tests for the marks, compare and capture: 52 pass, including the new unmarked_index_finds_the_overlapping_ranges_of_the_copy, and the marking translator test (its DXIL validates).
  • The three hardware_card_compare_* tests on the RTX 3080.

shader_cache::tests::every_switch_of_the_translator_is_in_the_key already fails on main because of the stale VICTORY_SCALAR_SPLITS (#3210 removes it). The two marks settings are listed in its ELSEWHERE.

Notes for review

  • The marks use u249 because u252 is this fork's SLOT_MEET.
  • mark_written is in emit/descriptor_data.rs. A view the translator can't place leaves the program unmarked rather than refused.
  • The shader cache stores marks_writes as one more word (an empty entry is 44 bytes) and keys VICTORY_MARK_WRITES and VICTORY_MARK_WHY only while marking is on.
  • The unmarked ranges and the declared-by data travel in CardTake too, so a plan made later by the sending thread (publish) has them.
  • 41f2923a and main's 41adb551 fix the same diagnostics build errors; the merge keeps main's version.

🤖 Generated with Claude Code

**@⁠remijn** on GitHub · 2026-11-29 23:25 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/3446) `remijn:rtx3080-capture-marks` → `main` · +2154 −71 · 36 files · 11 commits · closed without merging ## Summary This PR adds two opt-in ways to cut the CPU cost of finding out what the GPU wrote into title memory each submission. It also fixes a bug that made one of them slower than doing nothing, and adds diagnostics used to measure the work. **No defaults change:** without the new switches, the layer behaves exactly as on `main`. On an RTX 3080 (Series S profile, default settings, which include the relay at stage 2), both switches together took the median from 18.3 to 20.0 fps. 1 % lows went from 8.8 to 11.5 fps and the p99 frame from 113 to 87 ms. These are single short runs (see Measured). ## Background: what this speeds up After each submission, the layer has to learn which bytes the title's shaders changed in the ranges they declared written, so it can bring them back into title memory. The card-side compare does this by hashing every declared range in 64-byte pieces and comparing against the hashes from before; with the relay (on by default), a separate thread then fetches the pieces that differ and lands them. In the scene measured, that is about 8,000 pieces a frame, and with the relay on it is where most of the frame goes: about 40 ms of "preparing" a frame, against about 3 ms on the GPU. The relay is on by default (`VICTORY_RELAY` unset means stage 2; only `=0` turns it off; see `shadow::relay` and `host::relay_exact`, and ef1f8ed0). That includes `play-foxhound.ps1`, which doesn't set it: a launch with it logs `copied back by a thread of its own, beside the submitting thread … exact=true`. The launcher's comment "Left off: VICTORY_RELAY=2" is out of date; ef1f8ed0 fixed the same wording in `shadow.rs`. The two switches attack two parts of that: 1. **Capture** cuts the waiting: changed pieces are copied out by the compare itself. 2. **Page marks** cut the hashing: only pages a shader actually wrote get hashed. ## 1. Relay capture: `VICTORY_LAND_CAPTURE=1` (needs the relay at stage 2, the default) **What it does.** Without it, the relay waits for the compare's results, then records and submits a second step that fetches the pieces that differ. With it, the compare copies every piece it finds changed into a ring of slots in the same submission (`CardShared::capture`, ring in `CardWork`). The relay then reads them from there, with no fetch and no extra wait on the card. **Why it helps.** On the branch this came from (same 3080), the relay's fetch waits went from 34–38 ms a frame to 0, landing from 44–50 ms to 12–15 ms, and the 90th-percentile frame from 94–139 ms to 75–82 ms. Here it took "copying back" from 15.7 to 13.9 ms, but the median fps didn't move (17.8 against 18.3, within noise). **Why it is opt-in for now:** - Since the relay is already the default, nothing stands in the way of capture also becoming one. It is opt-in here only because it has run on one PC. The skin report the launcher's comment cites (fxceless/victory-fork #89, RTX 5070 Laptop) predates the character fixes since (8773ea2d, 8622dc37); characters, faces included, show correctly on the 3080 with the relay and capture on. See the request for testing in the comments. - With capture on, the compare runs one pass per range instead of the batched compare (`card_batch`), because the batched shader doesn't capture. On a card where batching saves a lot, capture could cost more than it gains. That wasn't the case on the 3080, but it hasn't been checked elsewhere. - It uses its own buffers and slot ring. The slots are taken and returned per plan (`capture_slots_are_never_taken_twice` covers this), but it has run on one PC only. ## 2. Page marks: `VICTORY_MARK_WRITES=1` with `VICTORY_WRITTEN_COMPARE=check|skip` **What it does.** When the translator lowers a buffer store or atomic whose view has a title address it can work out, it adds a store that marks the 64 KiB page written, in a table bound as root UAV `u249` (`SLOT_WRITTEN`). A program counts as "marks all it writes" only if every one of its stores was marked: no store through a root view, by address, or with a descriptor that varies across lanes. On the host side, ranges declared by any other program are noted as unmarked. The compare then reads the marks: - `check`: hashes everything as before, and also counts pieces found changed in pages no shader marked ("misses"). This is the safety test, and it is no faster. - `skip`: leaves pieces in unmarked pages unhashed, where only marking programs declared the range. That is the speed-up. **Why it helps.** In this scene, about 7,200 of 8,060 pieces a frame are declared only by marking programs, and skip leaves about 7,000 of them unhashed. "Preparing" fell from 40–41 ms to 38 ms, GPU time from 3.3 to 0.9 ms, and the frame-time tail improved most (see Measured). **Why it is opt-in, and should stay so for now:** - **Skip mode trades checking for trust.** If any write reaches a page that no shader marked (a store path the translator doesn't mark, a copy, an image write), skip misses the change, and title memory silently keeps stale bytes. That could show as corrupted geometry, flicker or broken logic. Check mode found 0.00 misses here, but that is one card, one scene and about 40 seconds. It needs check runs over much more of the game first. - **It changes the shaders.** Every marking store adds a few instructions and an extra store, and the setting is in the shader cache key. Turning it on retranslates every shader, and a run that isn't preloaded builds thousands of pipelines while it plays. On a 32 GB PC that ran out of commit and stalled the title (black screen, about 2,700 pipelines failing with `0x8007000e`). Anyone trying it should run `-Preload` once first. - **It also turns off the batched compare,** like capture, because the batched shader doesn't read the marks. - **Coverage depends on the shaders.** Programs that store through root views or by address never mark. In another scene, their share could be larger and the gain smaller. **How to try it safely:** preload once with the switch on, then run `check` and confirm the log line `the compare and the pages shaders mark (VICTORY_WRITTEN_COMPARE=check) ...` shows `0.00 pieces found changed whose page no shader marked (misses)`. Only after that, use `skip`. ## The fix that makes the marks work (1d37f7e6) As first ported, the marks made things much worse: in check mode, 3.2 fps and 311 ms of preparing a frame. The cause: `Deferred::unmarked` was never cleared. This fork reuses command lists (`Deferred::clear` keeps their allocations), so each list kept the unmarked ranges of every frame it had ever recorded, and the compare looked through all of them for every range it compared. The stale ranges also blocked pages that current shaders had marked, so only 70 to 1,650 pieces a frame counted as marked instead of about 7,200. The fix: - the list empties `unmarked` when it is cleared; - each range is recorded once per list (`unmarked_seen`); - the compare indexes the ranges per host copy, sorted, with a running furthest end (`UnmarkedIndex`), so each compared range only visits the ranges that overlap it. A test checks the index against the old full scan. The same omission exists in the original implementation on the branch this was ported from; it probably went unnoticed there because lists weren't reused. ## Diagnostics (off by default, diagnostics build) | Switch / line | Shows | |---|---| | `VICTORY_PROFILE_SPIN` | which fence a polling title thread waits for | | `VICTORY_FENCE_STAGES` | each fence signal's path from asked to set | | `VICTORY_DECLARED_BY` | which shaders' declarations the compare hashes, and how much changed | | `VICTORY_QUEUE_USE` | how the title uses its queues; the card's time per kind of title queue | | `VICTORY_GPU_TIMING` additions | threads per call, ns per thread, and whether each pipeline's console program is wave64 | | timeline | our upload list timed; the card's runs summed in order | These are what showed the GPU idle-but-busy pattern behind slow passes like `InstanceCulling:CS_Tree_BatchCull`, where a wave64 program run as two 32-lane halves took 190 ns per thread against 0.3 to 4 ns elsewhere. ## Measured RTX 3080 10 GB, 32 GB RAM. Series S profile, no DLSS, no frame generation, ray tracing off, `play-foxhound.ps1`'s switches (the relay at stage 2, its default). Diagnostics build, the same save each time, 40 s measured after a 20 s warm-up, one run each, so differences of about 1 fps are noise. | | fps (median) | ms/frame | preparing | GPU | copying back | 1 % low | p99 frame | |---|---|---|---|---|---|---|---| | defaults | 18.3 | 54.5 | 40.2 | 3.3 | 15.7 | 8.8 | 113 ms | | + capture | 17.8 | 56.3 | 41.2 | 3.3 | 13.9 | 9.6 | 104 ms | | + capture + marks `check` | 18.1 | 55.4 | 40.9 | 3.2 | 13.8 | 9.0 | 112 ms | | **+ capture + marks `skip`** | **20.0** | **50.0** | **37.9** | **0.9** | **13.1** | **11.5** | **87 ms** | | (marks `check` before the fix) | 3.2 | 317 | 312 | 0.4 | 6.5 | 2.4 | 414 ms | For context, the relay is what makes the default fast here. With it turned off (`VICTORY_RELAY=0`), Series X 1440 ran at 7 to 8 fps with 55 to 65 ms a frame on the GPU. With it on, as by default, the CPU's "preparing" is the limit, and that is what these two switches target. ## What would make them defaults - **Capture:** the relay is already the default, so only testing is missing: A/B runs on a few more cards, including one where the batched compare matters, and a check that characters stay correct. - **Marks:** check-mode runs over long play sessions and several areas with 0 misses; the batched compare taught to read the marks (and to capture), so turning them on doesn't cost it; and the preload handled for players, since the cache key changes. ## Tested - `cargo check` with and without `diagnostics`, after merging `main`. - `victory-gpu` tests for the marks, compare and capture: 52 pass, including the new `unmarked_index_finds_the_overlapping_ranges_of_the_copy`, and the marking translator test (its DXIL validates). - The three `hardware_card_compare_*` tests on the RTX 3080. `shader_cache::tests::every_switch_of_the_translator_is_in_the_key` already fails on `main` because of the stale `VICTORY_SCALAR_SPLITS` (#3210 removes it). The two marks settings are listed in its `ELSEWHERE`. ## Notes for review - The marks use `u249` because `u252` is this fork's `SLOT_MEET`. - `mark_written` is in `emit/descriptor_data.rs`. A view the translator can't place leaves the program unmarked rather than refused. - The shader cache stores `marks_writes` as one more word (an empty entry is 44 bytes) and keys `VICTORY_MARK_WRITES` and `VICTORY_MARK_WHY` only while marking is on. - The unmarked ranges and the declared-by data travel in `CardTake` too, so a plan made later by the sending thread (`publish`) has them. - 41f2923a and `main`'s 41adb551 fix the same diagnostics build errors; the merge keeps `main`'s version. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
With the relay (VICTORY_RELAY=2), the compare of a flight's ranges also
copies each piece it finds differing into a slot of the plan's, in the
same submission, and the thread that lands merges those pieces without a
fetch. Pieces past the plan's slots are fetched as before.

Why: the relay read the compare's results once the flight had run, then
fetched the flagged pieces with a list of its own: a second trip to the
card, which on the drawing queue ran behind everything sent meanwhile.
On an RTX 3080 (Belobug's nvidia-3080, relay on): the relay's fetch waits
34-38 -> 0 ms a frame, landing 44-50 -> 12-15 ms, median frame 70-75 ->
68-69 ms, p90 94-139 -> 75-82 ms. 128 MiB of PC memory
(VICTORY_LAND_CAPTURE_MB).

Here: the capture's buffers are CardShared's, its ring and counter
CardWork's; a plan with slots is compared in single passes (the batched
compare does not capture). Off by default, as the relay is in
play-foxhound.ps1. The compare tests set every root constant and
parameter (a card may drop a dispatch that leaves one out). Ported from
Belobug's a95dc90a.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
With the diagnostics feature victory-gpu did not compile: a local
`timing` (the submission's timing) shadowed `timing()` (VICTORY_GPU_TIMING)
in Host::submit's timed groups, and the memory line's windows-cut-nearer
part used an `mb` it never made.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
VICTORY_PROFILE_SPIN=<module>+<from>-<to>: samples whose innermost frame
is in that loop are named by the fence they poll (the address in RDI and
the value awaited in RSI, read as the thread is stopped): which queue's
signal it is, how far that queue is, and where the signal stands
(fence::describe_wait). With it the title's frame-pacing waits on the RTX
3080 were seen to be its ring of two frames in flight, not the card.

The sampler reads the two registers in the stack-copying unwinder
(stacks::frames_and_registers_of). Ported from Belobug's cbf7a785
(VICTORY_PROFILE_EXIT was already here).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
For the fences the title signals most, each value's way from the title's
Signal to the value set, in stages: waiting for our submitting thread,
preparing the submission it stands behind (queue::behind), on the card
(sent behind it: host::late_signal; found done by the relay), and landing
until told (fence::set). Medians and 90th percentiles on the frame-rate
line. Stages are keyed by the fence object (FenceRef::as_this here).
Ported from Belobug's 8648bb69.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The list that sends what changed on the copies' CPU sides to their card
sides goes to the card between timestamps of its own, and the timeline
names it "ours: title bytes up to the card" apart from the title's
submissions. The report sums the card's runs ordered by when they began on
the card, not by when they were recorded (a run recorded later and run
earlier was counted against the wrong gap).

(Here the compare of copies in the card's memory goes inside the title's
submission, so it stays counted with it.) Ported from Belobug's 37915275.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
VICTORY_DECLARED_BY=1 (off by default): each shader's declarations of
what it may write are kept in the list that records them, go to its
submission's card plan (here through the take, when the thread that sends
makes the plan), and when the flight lands each piece the compare hashed
is counted for every shader whose declarations reach it. The frame-rate
line names the 15 shaders whose declarations cost the most hashing, how
much of it found nothing changed, and the pieces no shader of a list
declared. It is what showed that most of the compare hashes pages no
shader wrote. Ported from Belobug's a642ac8c.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The compare of copies in the card's memory hashes every piece of every
range shaders declare they may write, and most of it is unchanged: the
skinning passes declare a 147 MiB heap view written and change 1-3% of it
(VICTORY_DECLARED_BY). With VICTORY_MARK_WRITES=1 each buffer store and
atomic to title memory through a view whose title address the host gives
(a table's view at a fixed place, or one picked from the heap) also stores
1 at its 64 KiB page's dword in a table of pages (root UAV u249,
SLOT_WRITTEN). A program that marks every such write says so
(HostShader::marks_writes); one with a typed store, a store by address or
a view whose address is not known does not, and what it declares is
hashed whole. VICTORY_MARK_WHY=1 says why, per shader.

VICTORY_WRITTEN_COMPARE=skip: the pieces of spans every declaration of
came from a shader that marks are hashed only where their page was
marked; =check hashes as before and counts the pieces found changed whose
page no shader marked (misses). The marks are cleared after the
submission's compares. With either the compare runs in single passes (the
batched compare reads no marks).

On an RTX 3080 (Belobug's nvidia-3080, check): 0 misses; skip: about 455
MB a frame of hashing left out, 7,066 of 7,168 pieces marked, median frame
72.1 -> 64.6 ms (one run each). Off by default here.

Here: mark_written sits with view_address and heap_view_address in
descriptor_data.rs (a view not picked from the heap is not marked, not
refused); the slot is u249 (u252 is SLOT_MEET); the ranges declared
unmarked go through the take for a published submission; the line is
printed with flights sent ahead or not. The shader cache stores the flag
(one more word) and keys the two settings while marking is on. Ported from
Belobug's 009c6f13.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
VICTORY_QUEUE_USE=1 (off by default): per kind of title queue (direct,
compute, copy), the submissions and lists sent, the signals and waits
asked, on the frame-rate line. On an RTX 3080 this showed the title's
compute queue sending about 10 ms of a 69 ms frame's card time, with no
waits between queues.

The timeline's summary of the card's running names the title's
submissions by kind (title direct, title compute, from the run's compute
bit) beside our own lists, and chrome traces name compute submissions so.

The fence stages of 3f55e6ba are kept and logged only with
VICTORY_FENCE_STAGES=1: with every signal of every frame they cost the
title's thread time when nobody reads them. Ported from Belobug's 3a8e59cf.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
A dispatch's note says its group's size and whether the console program
is a wave64 one (`dispatch 182x1x1 of 64x1x1 wave64`), and the timing
run's lines by command give, for dispatches, the threads a call and the
nanoseconds a thread: a call of few threads leaves most of the card idle,
and a wave64 program on a host of 32-lane waves runs as two halves.

On an RTX 3080 this named the slowest passes: InstanceCulling
CS_Tree_BatchCull, 5.85 ms a frame in three calls of about 10,000 threads
at 190 ns a thread, against 0.3-4 ns in the large passes; every pass slow
by the thread was a wave64 one taken in two halves. (Nothing for indirect
calls: their sizes are in card memory.)

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Deferred::unmarked was never cleared. Lists are reused, so each kept the
unmarked ranges of every frame it ever recorded, and the compare looked
through all of them for every range it compared: with VICTORY_MARK_WRITES
on, preparing a frame took 311 ms instead of 41 (RTX 3080, Series S, relay
2), and the stale ranges kept most pages from the marks (70-1,650 of
~8,000 pieces a frame marked instead of ~7,200).

Now the list empties them when it is cleared, records each range once
(unmarked_seen), and the compare indexes them by host copy (UnmarkedIndex)
so a range looks only at the unmarked ranges that overlap it.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
# Conflicts:
#	crates/victory-gpu/src/copystat.rs
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-29 23:27:22 +00:00
github-bot changed title from Relay capture and page marks (opt-in), with a fix that makes the marks pay off on an RTX 3080 to Opt-in relay capture and page marks, and the fix that makes the marks pay off (RTX 3080: 18.3 → 20.0 fps, p99 113 → 87 ms) 2026-11-29 23:38:21 +00:00
Author
Owner

@⁠remijn on GitHub · 2026-11-29 23:51 UTC · original

A correction, and a request for testing

The first version of this description said play-foxhound.ps1 leaves the relay off. It doesn't. The relay runs at stage 2 whenever VICTORY_RELAY is unset (ef1f8ed0 corrected the comments in shadow.rs saying so). The launcher never sets it, and its own logs show the relay thread running with exact=true. Only the launcher's comment ("Left off: VICTORY_RELAY=2 … characters' skin missing", citing fxceless/victory-fork #89) is out of date. I've corrected the description.

That changes the case for capture. Its one precondition, the relay at stage 2, is already met by default, so VICTORY_LAND_CAPTURE could become a default too. It's opt-in in this PR only because it has run on one PC. Before proposing that, it would help to have A/B runs on other hardware:

  1. Capture: the same scene twice, without and with VICTORY_LAND_CAPTURE=1 (default settings otherwise). Compare the frame lines' fps, "copying back", and the p99 / 1 % lows. Cards where the batched compare is a big share of the frame are the most useful, since capture replaces it with single passes.
  2. Characters: with the relay and capture on, check faces and skin (the #89 report). On the 3080 they show correctly; the character fixes since #89 (8773ea2d, 8622dc37) may be why.
  3. Page marks, check mode (optional): VICTORY_MARK_WRITES=1 VICTORY_WRITTEN_COMPARE=check, preloaded first (-Preload; the switch is in the shader cache key). Play a while in different areas and report the log line the compare and the pages shaders mark (VICTORY_WRITTEN_COMPARE=check) ..., especially any non-zero misses. Long check runs with 0 misses are what skip mode needs before it could become a default.

Useful to include: card, driver, RAM, console profile and resolution, DLSS mode, and which build (diag or release).

If capture holds up elsewhere, I'll follow up with a change that makes it the default (VICTORY_LAND_CAPTURE=0 to turn it off) and fixes the launcher's relay comment.

**@⁠remijn** on GitHub · 2026-11-29 23:51 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/3446#issuecomment-7264774534) **A correction, and a request for testing** The first version of this description said `play-foxhound.ps1` leaves the relay off. It doesn't. The relay runs at stage 2 whenever `VICTORY_RELAY` is unset (ef1f8ed0 corrected the comments in `shadow.rs` saying so). The launcher never sets it, and its own logs show the relay thread running with `exact=true`. Only the launcher's comment ("Left off: VICTORY_RELAY=2 … characters' skin missing", citing fxceless/victory-fork #89) is out of date. I've corrected the description. That changes the case for capture. Its one precondition, the relay at stage 2, is already met by default, so `VICTORY_LAND_CAPTURE` could become a default too. It's opt-in in this PR only because it has run on one PC. Before proposing that, it would help to have A/B runs on other hardware: 1. **Capture**: the same scene twice, without and with `VICTORY_LAND_CAPTURE=1` (default settings otherwise). Compare the frame lines' fps, "copying back", and the p99 / 1 % lows. Cards where the batched compare is a big share of the frame are the most useful, since capture replaces it with single passes. 2. **Characters**: with the relay and capture on, check faces and skin (the #89 report). On the 3080 they show correctly; the character fixes since #89 (8773ea2d, 8622dc37) may be why. 3. **Page marks, check mode** (optional): `VICTORY_MARK_WRITES=1 VICTORY_WRITTEN_COMPARE=check`, preloaded first (`-Preload`; the switch is in the shader cache key). Play a while in different areas and report the log line `the compare and the pages shaders mark (VICTORY_WRITTEN_COMPARE=check) ...`, especially any non-zero `misses`. Long check runs with 0 misses are what skip mode needs before it could become a default. Useful to include: card, driver, RAM, console profile and resolution, DLSS mode, and which build (diag or release). If capture holds up elsewhere, I'll follow up with a change that makes it the default (`VICTORY_LAND_CAPTURE=0` to turn it off) and fixes the launcher's relay comment.
Author
Owner

@⁠Heldenkrieger01 on GitHub · 2026-11-29 23:57 UTC · original

Note

🤖 gpt-6.2-sol responding on behalf of Heldenkrieger01

On this RTX 3080, capture eliminated the measured relay fetch wait. Windows commit pressure dominated all four in-game runs, so the reported 18.3 → 20.0 FPS gain remains unverified on this PC. The isolated compare also showed a slowdown for skip on one large span.

Ryzen 9 5900X, RTX 3080 10 GB (driver 621.40), 32 GiB RAM, diagnostic builds 41adb551 and dca5af48. Same Series S save, relay 2, DLSS/FG/RT off, and a 40 s window after 20 s of warm-up. I prewarmed the previously used pipelines for main and the marked build, used two pipeline workers, and disabled speculative prefetch.

In-game configuration Median rendered FPS p99 frame Copy-back ms/frame D3D12 pipeline OOMs
main 0.2 10.12 s 35.6 33
PR + capture 0.2 10.60 s 46.8 36
PR + capture + marks check 0.2 10.42 s 33.0 38
PR + capture + marks skip 0.2 10.26 s 31.1 38

Each run logged eight frame times in the window and spent about 5.0 s per frame waiting on pipelines. Capture-only avoided about 4.9 MB of relay fetches per frame and brought median fetch wait from 4.8 to 0.0 ms/frame. skip left a median 4,652 pieces per frame unhashed. check reported zero misses in its sampled window.

In the smaller test, all modes used the PR’s single-span compare on 4,000 contiguous 64 KiB pages (250 MiB), with 27 timed submissions per mode. At 10% marked, median submit-and-wait time was 0.400 ms hashing all pages, 0.398 ms in check, and 1.987 ms in skip. At 100% marked, all three were 0.395–0.396 ms. The ~5× slowdown applies to the single large dispatch with 90% unmarked pages. The in-game timings above include the full submission and relay workload.

**@⁠Heldenkrieger01** on GitHub · 2026-11-29 23:57 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/3446#issuecomment-7264852222) > [!NOTE] > 🤖 **gpt-6.2-sol responding on behalf of Heldenkrieger01** On this RTX 3080, capture eliminated the measured relay fetch wait. Windows commit pressure dominated all four in-game runs, so the reported 18.3 → 20.0 FPS gain remains unverified on this PC. The isolated compare also showed a slowdown for `skip` on one large span. Ryzen 9 5900X, RTX 3080 10 GB (driver 621.40), 32 GiB RAM, diagnostic builds `41adb551` and `dca5af48`. Same Series S save, relay 2, DLSS/FG/RT off, and a 40 s window after 20 s of warm-up. I prewarmed the previously used pipelines for `main` and the marked build, used two pipeline workers, and disabled speculative prefetch. | In-game configuration | Median rendered FPS | p99 frame | Copy-back ms/frame | D3D12 pipeline OOMs | | --- | ---: | ---: | ---: | ---: | | `main` | 0.2 | 10.12 s | 35.6 | 33 | | PR + capture | 0.2 | 10.60 s | 46.8 | 36 | | PR + capture + marks `check` | 0.2 | 10.42 s | 33.0 | 38 | | PR + capture + marks `skip` | 0.2 | 10.26 s | 31.1 | 38 | Each run logged eight frame times in the window and spent about 5.0 s per frame waiting on pipelines. Capture-only avoided about 4.9 MB of relay fetches per frame and brought median fetch wait from 4.8 to 0.0 ms/frame. `skip` left a median 4,652 pieces per frame unhashed. `check` reported zero misses in its sampled window. In the smaller test, all modes used the PR’s single-span compare on 4,000 contiguous 64 KiB pages (250 MiB), with 27 timed submissions per mode. At 10% marked, median submit-and-wait time was **0.400 ms** hashing all pages, **0.398 ms** in `check`, and **1.987 ms** in `skip`. At 100% marked, all three were **0.395–0.396 ms**. The ~5× slowdown applies to the single large dispatch with 90% unmarked pages. The in-game timings above include the full submission and relay workload.
github-bot closed this pull request 2026-11-30 00:06:04 +00:00
Author
Owner

@⁠remijn on GitHub · 2026-11-30 00:03 UTC · original

Split into two independent PRs: #3498
#3498 (relay capture) and #3499
#3499 (page marks, with the fix that made them pay off). Each builds on main alone.

**@⁠remijn** on GitHub · 2026-11-30 00:03 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/3446#issuecomment-7264937685) Split into two independent PRs: https://git.gtahub.st/github/trustno1-coder--VIctory-NVIDIA/pulls/3498 https://git.gtahub.st/github/trustno1-coder--VIctory-NVIDIA/pulls/3498 (relay capture) and https://git.gtahub.st/github/trustno1-coder--VIctory-NVIDIA/pulls/3499 https://git.gtahub.st/github/trustno1-coder--VIctory-NVIDIA/pulls/3499 (page marks, with the fix that made them pay off). Each builds on main alone.

Pull request closed

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!3446
No description provided.