Turning the camera: a title write flushes and forgets only what it touches (ports #3109's scoped invalidation), and new textures can be filled beside the recording (VICTORY_FILL_AHEAD, opt-in) #4206

Closed
Lyrnc wants to merge 3 commits from upstream-pr/4206 into main
Lyrnc commented 2026-11-30 17:23:14 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by Lyrnc on 2026-11-30T17:23:14Z.


Problem

Users report the frame rate falling hard just from turning the camera (#3443: 28 -> 3.6 fps). Our bench: RTX 5080 + Ryzen 7 9800X3D, 32 GB, Series X 1440p DLSS Quality, standing for 120 s, then the right stick held for 120 s. Eight spin runs (four builds of the 2026-11-29 base, two runs each), world + 30..150 s against world + 150..270 s, means of the per-second lines:

per frame standing right stick held
fps 21.5-23.9 15.3-18.2
the submitting thread, in its submissions 37.6-43.7 ms 48.0-59.9 ms
of it: refreshes of host copies 11.7-13.4 ms 16.9-18.2 ms
flushes of refreshes 44.1-45.2 55.2-57.9
refresh requests (of them known to copy nothing) 7,100-7,190 (5,910-6,000) 7,270-7,480 (6,060-6,180)
the title's buffer copies 7.3-8.0 11.6-12.8
the title's copies at their place 22.0-22.7 32.4-35.0
texture refreshes, all threads 6.7-7.2 ms 9.4-11.9 ms
textures detiled on the PC 20-32 108-159
for copies in the card's memory 6.0-9.3 ms 7.4-12.8 ms
the card busy (by the card's clock line) 63-71 % 46-56 %

(One run of the eight, R_1, was slow in both halves: 16 and 15 fps, the submitting thread 61 and 67 ms, refreshes 35 and 37 ms. The ranges above leave it out; its flush and copy counts are in them.)

The texture pass (textures picked by index, on the threads that translate the lists), from its 5-second lines in the same windows:

per 5 s standing right stick held
the pass in all 459-543 ms 1,188-1,452 ms
passes stopped at their time 12-21 117-166 (of 147-187)
asking whether a host copy holds what memory holds 55-68 ms 180-300 ms
staging uploads 94-127 ms 212-356 ms
before the passes' loops (taking the slots due among them) 35-45 ms 157-221 ms
uploads handed to the copy queue ahead 880-1,330 4,680-8,030
uploads in the pass's list (read and detiled at their submission) 1,420-1,720 5,490-7,340

Root cause

  1. Title writes empty the submission's refreshed state. A title buffer copy (Step::Copy) and a copy at its place (Step::Placed, when free) called Batch::title_written: every pending refresh flushed, then Batch::ahead (what the submission refreshed in front of its steps) and Batch::textures (the textures it checked) emptied. Every refresh and texture check after such a step in the submission was queued and checked again, and each title write after that flushed them. Turning, the title makes about 4 more buffer copies and 11 more copies at their place a frame (it streams). The refresh requests the lists make hardly change (+3 %), but the flushes grow by 11-12 a frame, and the refreshes by 4-5 ms of the submitting thread, which is the frame's bottleneck (the card drops from 63-71 % to 46-56 % busy). Each texture a later list samples is checked again too (the write watch or the guards asked; hashed every eighth frame).
  2. New textures are read and detiled in front of their submission. About half of the pass's uploads go to the copy queue ahead, which reads and detiles them on its own threads. The other half (5,490-7,340 per 5 s turning, 70-90 a frame: another level of a texture a slot already shows, a texture a list used before, or the copy queue's 96 MB on its way) get their staging buffer's first filling (read through the kernel, hashed, detiled) at the submission, in Batch::refresh_front, which the submitting thread waits for.
  3. Not changed here: the texture pass itself runs at its time cap while turning (VICTORY_TEXSPK_PASS_MS=8, doubled on a card over 12 GiB with room: up to 16 ms a frame of a list thread), so cheaper slots there drain the queue faster but do not shorten the frame; and "for copies in the card's memory" grows mostly in send::take's time per MB (49 -> 53 MB a frame, 6 -> 9 ms), which these logs cannot tie to textures.

Fix

  1. Commit 1, author qlfu (#3109's scoped invalidation, ported): Batch::invalidate_written(dst, len, aliases). After a title buffer copy or a copy at its place (free), only the ahead and textures entries whose range meets [dst, dst + len), or a 64 KiB block that shows the same physical pages (watch::elsewhere_blocks, the runtime's views), are forgotten. Batch::textures keeps each staging buffer's title span for it. On current main the copies are joined (VICTORY_JOIN_COPIES), so a joined piece forgets its own range too. Work of ours that may write anywhere (Step::Run) still empties everything. #3109's other parts (the Step::Host/Step::Run split, the AVX2 digest, the lock-free texture checks, the port and prelude trims) are not taken.
  2. Commit 2: VICTORY_SCOPED_WRITES (on; =0 restores the old title_written at those steps exactly).
    • Batch::title_wrote: before such a step, only the pending refreshes whose host copy's span meets the written range (or one of its alias blocks), and the textures due whose memory does, are done (Batch::flush_touching); the others stay pending for a later flush. A copy is judged by its whole span: Shadow::update reads title memory and writes the host copy only inside it, so a copy the write misses gets the same bytes before the write as after it.
    • A joined copy piece does the same for its own range before the joined copy is made.
    • One line every frame-rate line: title writes among the steps per frame (VICTORY_SCOPED_WRITES is on): N; before them R pending refreshes done as they read what is written, L left for a later flush; past them A copies refreshed ahead stood (F forgotten), T textures checked stood (G forgotten), D textures due left for a later flush.
    • Aliases: what watch::elsewhere_blocks names is what watch::wrote notes in the journal after such a write, which is what the refreshes' no-op checks go by already. A page shown at more than 64 addresses, or VICTORY_VIEW_GUARD=0, is outside both, as before.
  3. Commit 3: VICTORY_FILL_AHEAD=1 (off by default). When the texture pass records an upload whose staging buffer was made for that one upload (Staging::once, not uploaded yet, not a bake's, not levels on demand, not detiled on the card), the buffer is handed to two threads of ours (victory-texture-fills-N, at most 512 waiting) that fill it (Staging::refresh_now) beside the frame's recording. The staging buffer's lock orders it with the submission: the submission finds it filled (such a buffer is never read twice), waits while it is being filled, or fills it itself if no thread got to it, and the thread then finds nothing to read. The texture's memory is then read when its upload is recorded, as the copy queue ahead already reads it; a title write in between is found by the pass's looks after the upload (RECHECK_FRAMES) and uploaded again. Line: texture fills ahead per frame (VICTORY_FILL_AHEAD=1): S staging buffers sent to the threads, F filled by them, N with nothing to read (filled by their submission already, or not there), X left to their submission.

Verification

Windows 11, rustc 1.98.1 (the pinned toolchain), RTX 5080 + Ryzen 7 9800X3D, own target directory, on 6a9dcecb (main 84bd61e2 + the three commits):

  • cargo check -p victory-gpu --tests --locked -j 4: passes. Its one warning (Shadow::ranged never used, shadow.rs) is main's.
  • cargo test -p victory-gpu --lib --locked -j 4 -- host:: watch:: shadow:: texture::: 462 passed, 0 failed, 40 ignored (benchmarks, and tests that want a process or a relay of their own).
  • cargo clippy -p victory-gpu --lib --tests --locked -j 4: two warnings, neither on a line this branch adds (main's Shadow::ranged, and seed % 3 in a test of host.rs from 7addcfc7e).
  • cargo xtask policy: fails on crates/victory-shader/src/native.rs (a 560-character hex run), a file this branch does not touch; main has it.
  • New tests (all pass):
    • host::batch::scoped_title_writes_invalidate_only_overlapping_entries (ported from #3109): a write evicts the ahead and textures entries it overlaps and those of an alias block, and keeps the others.
    • host::refresh_tests::a_title_write_flushes_only_the_copies_it_writes: two copies with pending refreshes; a write into one has that one done first (it holds the bytes of before the write), leaves the other pending; after the write a new refresh of the first gets the new bytes, the other gets its unchanged bytes at the last flush.
    • host::refresh_tests::a_title_write_flushes_copies_of_its_pages_at_other_addresses: one section mapped twice and told to the runtime as two views; watch::elsewhere_blocks names the block at the other address, and a write through the first view has the second view's copy refreshed before it.
    • host::refresh_tests::scoped_title_writes_end_as_writes_that_flush_everything: 24 rounds of random submissions (5 copies over write-watched memory, some over one another, copies standing refreshed ahead, 24 random refreshes and title writes), each run twice from the same bytes: the old way and the scoped way end with the same bytes in every copy.
    • texture::fill_ahead_tests::only_a_fresh_one_upload_staging_buffer_is_filled_ahead: which staging buffers fill ahead takes.

NOT tested

  • In game: nothing was run. The spin A/B on the bench, with the same save and the stock launcher settings:
    1. BASE = main c71899d9; ARM A = this branch (scoped writes on, fill ahead off); ARM B = this branch with --set VICTORY_FILL_AHEAD=1; ARM C = this branch with --set VICTORY_SCOPED_WRITES=0 (should match BASE: the switch puts the old steps back).
    2. Each arm twice: enter the world, stand still from world + 30 s to world + 150 s, then hold the right stick (full deflection, one direction) from world + 150 s to world + 270 s, as the LF/KL/S3/R spin runs did.
    3. Compare standing against turning, per arm, from the per-second lines:
      • "preparing per frame, the submitting thread": the total, "refreshes X in N flushes", and "for copies in the card's memory". Expected with A: the turning flushes back near the standing 44-45 and the refreshes' growth (4-5 ms) mostly gone.
      • the new "title writes among the steps" line: L (refreshes left pending) and A (copies refreshed ahead that stood) large against R and F means the scoping works; the counts are per frame.
      • "texture refreshes per frame, all threads" and "texture detiling per frame".
      • with B: the new "texture fills ahead" line (F against N and X), and whether "refreshes" on the submitting thread drop further while "texture refreshes, all threads" stays about the same (the work moves, it does not shrink).
      • fps, frame times (median, p95, over 100 ms), "the card's clock per frame" (busy %), and the long-frame lines' "texture pass" and "resident" parts.
    4. Look at the picture while turning: textures that stay grey or blurred longer, a texture that flickers to an old one, flicker on buffers the title streams (any of these with A or B and not with C is ours).
  • Not run in game with VICTORY_REFRESH_FRONT=0 / without VICTORY_JOIN_PARTS (then refresh_ahead fills ahead; the scoping is the same code), nor with VICTORY_LIGHT_REFRESH=0.
  • Fill ahead was not run at all beyond its unit test of which buffers it takes: its threads and the lock ordering are exercised only in the title.

Overlap

  • #3109 (qlfu, open, conflicting with main): commit 1 is its scoped invalidation, ported with qlfu as the author. If #3109 lands first, commit 1 goes and commit 2 rebases onto its invalidate_written (the same function). Its other changes are not here and do not conflict in intent: its Step::Copy keeps a full flush() before the write, which commit 2 scopes.
  • #2647 (piyonchu, open, conflicting): range-scoped Batch invalidation (title_written_range flushes only the overlapping pending refreshes, fills and textures, and keeps sorted written ranges), with card_steps planning, write-watch scratch and async landing in one +1,619/-576 commit. Same idea as commits 1 and 2 for the Batch part; this branch is the small version on current main. It also scopes the fills, which this branch leaves as they are (all done before any title write).
  • #3524 (Maverick0351a, open, conflicting), part 5: keeps non-overlapping Batch::textures across a title write by their spans; the texture half of commit 1.
  • #2049 (Rixnei, conflicting), #3108 / #2175 (qlfu), #1556, #2504, #3502, #3705, #3332: cheaper refresh checks and flushes; they make each flush or check cheaper, this makes fewer of them. Our own perf/refresh-noops (queue sift in Batch::add) touches Batch::add, flush_one and title_written and would need a small rebase (its same table must drop entries the write overlaps, as invalidate_written drops ahead entries).
  • #3958 (vilaris, conflicting): which pages a refresh copies (write-watch coverage, copy stamps). Other code; composes.
  • #2605 (qlfu): its batched recheck claims are in main already (claim_texture_rechecks). #2608 (nidea1), #2795, #2971, #2509, #2116: merged; this branch is on top of them.
  • Texture pass: #3478 (paales, a backlog's three times the time also on a full card) and VICTORY_DUE_INDEX (in main, off: "taking the slots due" 157-221 ms per 5 s while turning here, against 35-45 standing) are the pass's own budget and queue; not changed here. #2338, #2240, #2797 (card detiling) and #1391 (staging reuse) are the detiling and staging side; fill ahead moves the PC's detiling of the pass's listed uploads, it does not change it.
  • #1925 / our #3703 (long-frame line): the bench's long-frame "texture pass" part is the pass at its cap; unchanged here.

AI use

Claude Code (Claude Opus 5.5) read the bench's spin logs and the submission and texture paths, chose #3109's scoped invalidation to build on and ported it (qlfu as author), wrote the two other commits and their tests, ran the checks above, and wrote this note. Nothing was run in game.

🤖 Generated with Claude Code

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:issue:5570241370 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/4206). Originally posted by [Lyrnc](https://github.com/Lyrnc) on 2026-11-30T17:23:14Z. --- ## Problem Users report the frame rate falling hard just from turning the camera (#3443: 28 -> 3.6 fps). Our bench: RTX 5080 + Ryzen 7 9800X3D, 32 GB, Series X 1440p DLSS Quality, standing for 120 s, then the right stick held for 120 s. Eight spin runs (four builds of the 2026-11-29 base, two runs each), world + 30..150 s against world + 150..270 s, means of the per-second lines: | per frame | standing | right stick held | |---|---|---| | fps | 21.5-23.9 | 15.3-18.2 | | the submitting thread, in its submissions | 37.6-43.7 ms | 48.0-59.9 ms | | of it: refreshes of host copies | 11.7-13.4 ms | 16.9-18.2 ms | | flushes of refreshes | 44.1-45.2 | 55.2-57.9 | | refresh requests (of them known to copy nothing) | 7,100-7,190 (5,910-6,000) | 7,270-7,480 (6,060-6,180) | | the title's buffer copies | 7.3-8.0 | 11.6-12.8 | | the title's copies at their place | 22.0-22.7 | 32.4-35.0 | | texture refreshes, all threads | 6.7-7.2 ms | 9.4-11.9 ms | | textures detiled on the PC | 20-32 | 108-159 | | for copies in the card's memory | 6.0-9.3 ms | 7.4-12.8 ms | | the card busy (by the card's clock line) | 63-71 % | 46-56 % | (One run of the eight, R_1, was slow in both halves: 16 and 15 fps, the submitting thread 61 and 67 ms, refreshes 35 and 37 ms. The ranges above leave it out; its flush and copy counts are in them.) The texture pass (textures picked by index, on the threads that translate the lists), from its 5-second lines in the same windows: | per 5 s | standing | right stick held | |---|---|---| | the pass in all | 459-543 ms | 1,188-1,452 ms | | passes stopped at their time | 12-21 | 117-166 (of 147-187) | | asking whether a host copy holds what memory holds | 55-68 ms | 180-300 ms | | staging uploads | 94-127 ms | 212-356 ms | | before the passes' loops (taking the slots due among them) | 35-45 ms | 157-221 ms | | uploads handed to the copy queue ahead | 880-1,330 | 4,680-8,030 | | uploads in the pass's list (read and detiled at their submission) | 1,420-1,720 | 5,490-7,340 | ## Root cause 1. **Title writes empty the submission's refreshed state.** A title buffer copy (`Step::Copy`) and a copy at its place (`Step::Placed`, when free) called `Batch::title_written`: every pending refresh flushed, then `Batch::ahead` (what the submission refreshed in front of its steps) and `Batch::textures` (the textures it checked) emptied. Every refresh and texture check after such a step in the submission was queued and checked again, and each title write after that flushed them. Turning, the title makes about 4 more buffer copies and 11 more copies at their place a frame (it streams). The refresh requests the lists make hardly change (+3 %), but the flushes grow by 11-12 a frame, and the refreshes by 4-5 ms of the submitting thread, which is the frame's bottleneck (the card drops from 63-71 % to 46-56 % busy). Each texture a later list samples is checked again too (the write watch or the guards asked; hashed every eighth frame). 2. **New textures are read and detiled in front of their submission.** About half of the pass's uploads go to the copy queue ahead, which reads and detiles them on its own threads. The other half (5,490-7,340 per 5 s turning, 70-90 a frame: another level of a texture a slot already shows, a texture a list used before, or the copy queue's 96 MB on its way) get their staging buffer's first filling (read through the kernel, hashed, detiled) at the submission, in `Batch::refresh_front`, which the submitting thread waits for. 3. Not changed here: the texture pass itself runs at its time cap while turning (`VICTORY_TEXSPK_PASS_MS=8`, doubled on a card over 12 GiB with room: up to 16 ms a frame of a list thread), so cheaper slots there drain the queue faster but do not shorten the frame; and "for copies in the card's memory" grows mostly in `send::take`'s time per MB (49 -> 53 MB a frame, 6 -> 9 ms), which these logs cannot tie to textures. ## Fix 1. **Commit 1, author qlfu (#3109's scoped invalidation, ported):** `Batch::invalidate_written(dst, len, aliases)`. After a title buffer copy or a copy at its place (free), only the `ahead` and `textures` entries whose range meets `[dst, dst + len)`, or a 64 KiB block that shows the same physical pages (`watch::elsewhere_blocks`, the runtime's views), are forgotten. `Batch::textures` keeps each staging buffer's title span for it. On current main the copies are joined (`VICTORY_JOIN_COPIES`), so a joined piece forgets its own range too. Work of ours that may write anywhere (`Step::Run`) still empties everything. #3109's other parts (the `Step::Host`/`Step::Run` split, the AVX2 digest, the lock-free texture checks, the port and prelude trims) are not taken. 2. **Commit 2: `VICTORY_SCOPED_WRITES` (on; `=0` restores the old `title_written` at those steps exactly).** - `Batch::title_wrote`: before such a step, only the pending refreshes whose host copy's span meets the written range (or one of its alias blocks), and the textures due whose memory does, are done (`Batch::flush_touching`); the others stay pending for a later flush. A copy is judged by its whole span: `Shadow::update` reads title memory and writes the host copy only inside it, so a copy the write misses gets the same bytes before the write as after it. - A joined copy piece does the same for its own range before the joined copy is made. - One line every frame-rate line: `title writes among the steps per frame (VICTORY_SCOPED_WRITES is on): N; before them R pending refreshes done as they read what is written, L left for a later flush; past them A copies refreshed ahead stood (F forgotten), T textures checked stood (G forgotten), D textures due left for a later flush`. - Aliases: what `watch::elsewhere_blocks` names is what `watch::wrote` notes in the journal after such a write, which is what the refreshes' no-op checks go by already. A page shown at more than 64 addresses, or `VICTORY_VIEW_GUARD=0`, is outside both, as before. 3. **Commit 3: `VICTORY_FILL_AHEAD=1` (off by default).** When the texture pass records an upload whose staging buffer was made for that one upload (`Staging::once`, not uploaded yet, not a bake's, not levels on demand, not detiled on the card), the buffer is handed to two threads of ours (`victory-texture-fills-N`, at most 512 waiting) that fill it (`Staging::refresh_now`) beside the frame's recording. The staging buffer's lock orders it with the submission: the submission finds it filled (such a buffer is never read twice), waits while it is being filled, or fills it itself if no thread got to it, and the thread then finds nothing to read. The texture's memory is then read when its upload is recorded, as the copy queue ahead already reads it; a title write in between is found by the pass's looks after the upload (`RECHECK_FRAMES`) and uploaded again. Line: `texture fills ahead per frame (VICTORY_FILL_AHEAD=1): S staging buffers sent to the threads, F filled by them, N with nothing to read (filled by their submission already, or not there), X left to their submission`. ## Verification Windows 11, rustc 1.98.1 (the pinned toolchain), RTX 5080 + Ryzen 7 9800X3D, own target directory, on 6a9dcecb (main 84bd61e2 + the three commits): - `cargo check -p victory-gpu --tests --locked -j 4`: passes. Its one warning (`Shadow::ranged` never used, `shadow.rs`) is main's. - `cargo test -p victory-gpu --lib --locked -j 4 -- host:: watch:: shadow:: texture::`: **462 passed, 0 failed, 40 ignored** (benchmarks, and tests that want a process or a relay of their own). - `cargo clippy -p victory-gpu --lib --tests --locked -j 4`: two warnings, neither on a line this branch adds (main's `Shadow::ranged`, and `seed % 3` in a test of `host.rs` from 7addcfc7e). - `cargo xtask policy`: fails on `crates/victory-shader/src/native.rs` (a 560-character hex run), a file this branch does not touch; main has it. - New tests (all pass): - `host::batch::scoped_title_writes_invalidate_only_overlapping_entries` (ported from #3109): a write evicts the `ahead` and `textures` entries it overlaps and those of an alias block, and keeps the others. - `host::refresh_tests::a_title_write_flushes_only_the_copies_it_writes`: two copies with pending refreshes; a write into one has that one done first (it holds the bytes of before the write), leaves the other pending; after the write a new refresh of the first gets the new bytes, the other gets its unchanged bytes at the last flush. - `host::refresh_tests::a_title_write_flushes_copies_of_its_pages_at_other_addresses`: one section mapped twice and told to the runtime as two views; `watch::elsewhere_blocks` names the block at the other address, and a write through the first view has the second view's copy refreshed before it. - `host::refresh_tests::scoped_title_writes_end_as_writes_that_flush_everything`: 24 rounds of random submissions (5 copies over write-watched memory, some over one another, copies standing refreshed ahead, 24 random refreshes and title writes), each run twice from the same bytes: the old way and the scoped way end with the same bytes in every copy. - `texture::fill_ahead_tests::only_a_fresh_one_upload_staging_buffer_is_filled_ahead`: which staging buffers fill ahead takes. ## NOT tested - **In game: nothing was run.** The spin A/B on the bench, with the same save and the stock launcher settings: 1. BASE = main c71899d9; ARM A = this branch (scoped writes on, fill ahead off); ARM B = this branch with `--set VICTORY_FILL_AHEAD=1`; ARM C = this branch with `--set VICTORY_SCOPED_WRITES=0` (should match BASE: the switch puts the old steps back). 2. Each arm twice: enter the world, stand still from world + 30 s to world + 150 s, then hold the right stick (full deflection, one direction) from world + 150 s to world + 270 s, as the LF/KL/S3/R spin runs did. 3. Compare standing against turning, per arm, from the per-second lines: - "preparing per frame, the submitting thread": the total, "refreshes X in N flushes", and "for copies in the card's memory". Expected with A: the turning flushes back near the standing 44-45 and the refreshes' growth (4-5 ms) mostly gone. - the new "title writes among the steps" line: L (refreshes left pending) and A (copies refreshed ahead that stood) large against R and F means the scoping works; the counts are per frame. - "texture refreshes per frame, all threads" and "texture detiling per frame". - with B: the new "texture fills ahead" line (F against N and X), and whether "refreshes" on the submitting thread drop further while "texture refreshes, all threads" stays about the same (the work moves, it does not shrink). - fps, frame times (median, p95, over 100 ms), "the card's clock per frame" (busy %), and the long-frame lines' "texture pass" and "resident" parts. 4. Look at the picture while turning: textures that stay grey or blurred longer, a texture that flickers to an old one, flicker on buffers the title streams (any of these with A or B and not with C is ours). - Not run in game with `VICTORY_REFRESH_FRONT=0` / without `VICTORY_JOIN_PARTS` (then `refresh_ahead` fills `ahead`; the scoping is the same code), nor with `VICTORY_LIGHT_REFRESH=0`. - Fill ahead was not run at all beyond its unit test of which buffers it takes: its threads and the lock ordering are exercised only in the title. ## Overlap - **#3109** (qlfu, open, conflicting with main): commit 1 is its scoped invalidation, ported with qlfu as the author. If #3109 lands first, commit 1 goes and commit 2 rebases onto its `invalidate_written` (the same function). Its other changes are not here and do not conflict in intent: its `Step::Copy` keeps a full `flush()` before the write, which commit 2 scopes. - **#2647** (piyonchu, open, conflicting): range-scoped `Batch` invalidation (`title_written_range` flushes only the overlapping pending refreshes, fills and textures, and keeps sorted written ranges), with card_steps planning, write-watch scratch and async landing in one +1,619/-576 commit. Same idea as commits 1 and 2 for the Batch part; this branch is the small version on current main. It also scopes the fills, which this branch leaves as they are (all done before any title write). - **#3524** (Maverick0351a, open, conflicting), part 5: keeps non-overlapping `Batch::textures` across a title write by their spans; the texture half of commit 1. - **#2049** (Rixnei, conflicting), **#3108** / **#2175** (qlfu), **#1556**, **#2504**, **#3502**, **#3705**, **#3332**: cheaper refresh checks and flushes; they make each flush or check cheaper, this makes fewer of them. Our own `perf/refresh-noops` (queue sift in `Batch::add`) touches `Batch::add`, `flush_one` and `title_written` and would need a small rebase (its `same` table must drop entries the write overlaps, as `invalidate_written` drops `ahead` entries). - **#3958** (vilaris, conflicting): which pages a refresh copies (write-watch coverage, copy stamps). Other code; composes. - **#2605** (qlfu): its batched recheck claims are in main already (`claim_texture_rechecks`). **#2608** (nidea1), **#2795**, **#2971**, **#2509**, **#2116**: merged; this branch is on top of them. - Texture pass: **#3478** (paales, a backlog's three times the time also on a full card) and `VICTORY_DUE_INDEX` (in main, off: "taking the slots due" 157-221 ms per 5 s while turning here, against 35-45 standing) are the pass's own budget and queue; not changed here. **#2338**, **#2240**, **#2797** (card detiling) and **#1391** (staging reuse) are the detiling and staging side; fill ahead moves the PC's detiling of the pass's listed uploads, it does not change it. - **#1925** / our **#3703** (long-frame line): the bench's long-frame "texture pass" part is the pass at its cap; unchanged here. ## AI use Claude Code (Claude Opus 5.5) read the bench's spin logs and the submission and texture paths, chose #3109's scoped invalidation to build on and ported it (qlfu as author), wrote the two other commits and their tests, ran the checks above, and wrote this note. Nothing was run in game. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
gabrielecabrini commented 2026-11-30 18:29:26 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by gabrielecabrini on 2026-11-30T18:29:26Z.


Tested on Linux (Proton). Standing still it helps; turning the camera it makes no difference here. VICTORY_FILL_AHEAD=1 gave more stale-texture warnings and some visible glitches.

Setup: RTX 4070 SUPER 12 GB, i5-14600KF (no SSE4a), 31 GB RAM, Arch Linux, NVIDIA 620.73.04, Proton Experimental (11.0-20261123b) via umu-run, VKD3D_CONFIG=no_descriptor_heap. Release build of this branch (6a9dcecb, on main 84bd61e2), victory play --series-s --dlss off. Same save each run: loaded, stood still for about 60 s, then walked and turned the camera along the same route for about 60 s. Runs in order A, B, C, one run each.

  • A: default (scoped writes on, fill ahead off)
  • B: --set VICTORY_SCOPED_WRITES=0
  • C: --set VICTORY_FILL_AHEAD=1

Medians of the 5-second log lines (12 per phase, 10 for C moving):

Run Phase fps ms/frame submitting thread refreshes flushes card idle (nothing of ours queued) draws/frame
A standing 21.6 46.3 39.0 ms 17.5 ms 28 6.2 ms 7286
B standing 18.9 52.8 44.0 ms 20.6 ms 46 13.6 ms 7158
C standing 20.0 50.2 40.4 ms 18.4 ms 29 11.9 ms 7123
A moving 15.9 63.0 53.2 ms 25.8 ms 28 22.6 ms 6554
B moving 15.8 63.2 52.5 ms 26.1 ms 48 23.9 ms 7509
C moving 14.4 69.6 57.9 ms 27.1 ms 29 36.0 ms 5389
  • Standing: scoped writes cut flushes from 46 to 28 a frame and the submitting thread's time by about 5 ms (+14 % fps). The card's idle time behind that thread is halved.
  • Moving: flushes still drop (48 to 28), but frame time and the submitting thread's time don't change. Here the frame is set by the rest of that thread's work: list steps, about 13-14 ms asking the write watch (Wine), and the relay.
  • Your line, run A standing (mid-sample): title writes among the steps per frame: 27.3; ... 11.7 left for a later flush; past them 3633.8 copies refreshed ahead stood (20.3 forgotten), 704.8 textures checked stood (0.0 forgotten).
  • VICTORY_FILL_AHEAD=1: 0.6 staging buffers sent to the threads, 0.6 filled by them per frame, so almost nothing goes through it here. a texture picked by index changed after its upload with nothing to tell of it was logged 29 times, against 13 (A) and 18 (B). The player saw a few more small texture glitches in C than in A or B (no screenshots). C's moving route had fewer draws, so its moving row is the least comparable.
  • No ERROR lines in any run.

Not tested: Windows, more than one run per arm, DLSS or frame generation, Series X.

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:comment:7287925026 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/4206#issuecomment-7287925026). Originally posted by [gabrielecabrini](https://github.com/gabrielecabrini) on 2026-11-30T18:29:26Z. --- Tested on Linux (Proton). Standing still it helps; turning the camera it makes no difference here. `VICTORY_FILL_AHEAD=1` gave more stale-texture warnings and some visible glitches. **Setup:** RTX 4070 SUPER 12 GB, i5-14600KF (no SSE4a), 31 GB RAM, Arch Linux, NVIDIA 620.73.04, Proton Experimental (11.0-20261123b) via umu-run, `VKD3D_CONFIG=no_descriptor_heap`. Release build of this branch (6a9dcecb, on main 84bd61e2), `victory play --series-s --dlss off`. Same save each run: loaded, stood still for about 60 s, then walked and turned the camera along the same route for about 60 s. Runs in order A, B, C, one run each. - A: default (scoped writes on, fill ahead off) - B: `--set VICTORY_SCOPED_WRITES=0` - C: `--set VICTORY_FILL_AHEAD=1` Medians of the 5-second log lines (12 per phase, 10 for C moving): | Run | Phase | fps | ms/frame | submitting thread | refreshes | flushes | card idle (nothing of ours queued) | draws/frame | |---|---|---|---|---|---|---|---|---| | A | standing | **21.6** | 46.3 | 39.0 ms | 17.5 ms | **28** | 6.2 ms | 7286 | | B | standing | 18.9 | 52.8 | 44.0 ms | 20.6 ms | 46 | 13.6 ms | 7158 | | C | standing | 20.0 | 50.2 | 40.4 ms | 18.4 ms | 29 | 11.9 ms | 7123 | | A | moving | 15.9 | 63.0 | 53.2 ms | 25.8 ms | 28 | 22.6 ms | 6554 | | B | moving | 15.8 | 63.2 | 52.5 ms | 26.1 ms | 48 | 23.9 ms | 7509 | | C | moving | 14.4 | 69.6 | 57.9 ms | 27.1 ms | 29 | 36.0 ms | 5389 | - **Standing:** scoped writes cut flushes from 46 to 28 a frame and the submitting thread's time by about 5 ms (+14 % fps). The card's idle time behind that thread is halved. - **Moving:** flushes still drop (48 to 28), but frame time and the submitting thread's time don't change. Here the frame is set by the rest of that thread's work: list steps, about 13-14 ms asking the write watch (Wine), and the relay. - Your line, run A standing (mid-sample): `title writes among the steps per frame: 27.3; ... 11.7 left for a later flush; past them 3633.8 copies refreshed ahead stood (20.3 forgotten), 704.8 textures checked stood (0.0 forgotten)`. - **`VICTORY_FILL_AHEAD=1`:** `0.6 staging buffers sent to the threads, 0.6 filled by them` per frame, so almost nothing goes through it here. `a texture picked by index changed after its upload with nothing to tell of it` was logged 29 times, against 13 (A) and 18 (B). The player saw a few more small texture glitches in C than in A or B (no screenshots). C's moving route had fewer draws, so its moving row is the least comparable. - No ERROR lines in any run. Not tested: Windows, more than one run per arm, DLSS or frame generation, Series X.
mstrmoos commented 2026-11-30 20:38:28 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by mstrmoos on 2026-11-30T20:38:28Z.


A/B on the same hardware as yours: RTX 5080 16 GB and Ryzen 7 9800X3D on Windows 11, Series X, 1440p, DLSS Balanced, frame generation off.

The build was main at e1251c31 plus this PR, plus #4332 (VICTORY_SCRATCH_CARD=1, list scratch in card memory), which was on in every phase. I used one run with VICTORY_AB=20,VICTORY_SCOPED_WRITES,VICTORY_FILL_AHEAD, so every combination was played in the same scene. The run stood on a pier with people around it.

Median frame time per 20 s phase. Phases 0–2 were still loading and are left out.

cycle both off scoped writes fill ahead both
1 39.7 ms 38.3 ms 40.6 ms 37.4 / 38.9 ms
2 38.5 ms 36.3 ms 37.3 ms 36.1 ms
3 37.7 ms
  • Scoped writes: 1.4–2.2 ms faster than the phases next to it. The 90th percentile is also better: 40.4 against 45.7 ms in the second cycle.
  • Fill ahead: no gain here. On its own it was 0.4–1 ms slower than its neighbours, and with scoped writes it was about the same as scoped writes alone.

A caveat: a CPU-heavy analysis ran beside the game at high priority for the whole run, so the absolute numbers are higher than usual and drift. The alternating phases cancel most of that, but take the deltas as about ±0.5 ms. I'll rerun on an idle machine and add the result here.

Tests: cargo test -p victory-gpu --lib matches main. It has the same two failures #4025 fixes, plus host_list_uav_pool_lifecycle_retire_trim_and_info_queue, which failed once in the full run and passed 3 of 3 alone. That test is flaky; this PR doesn't touch its file.

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:comment:7291245097 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/4206#issuecomment-7291245097). Originally posted by [mstrmoos](https://github.com/mstrmoos) on 2026-11-30T20:38:28Z. --- A/B on the same hardware as yours: RTX 5080 16 GB and Ryzen 7 9800X3D on Windows 11, Series X, 1440p, DLSS Balanced, frame generation off. The build was main at e1251c31 plus this PR, plus #4332 (`VICTORY_SCRATCH_CARD=1`, list scratch in card memory), which was on in every phase. I used one run with `VICTORY_AB=20,VICTORY_SCOPED_WRITES,VICTORY_FILL_AHEAD`, so every combination was played in the same scene. The run stood on a pier with people around it. Median frame time per 20 s phase. Phases 0–2 were still loading and are left out. | cycle | both off | scoped writes | fill ahead | both | |---|---|---|---|---| | 1 | 39.7 ms | 38.3 ms | 40.6 ms | 37.4 / 38.9 ms | | 2 | 38.5 ms | 36.3 ms | 37.3 ms | 36.1 ms | | 3 | 37.7 ms | | | | - **Scoped writes:** 1.4–2.2 ms faster than the phases next to it. The 90th percentile is also better: 40.4 against 45.7 ms in the second cycle. - **Fill ahead:** no gain here. On its own it was 0.4–1 ms slower than its neighbours, and with scoped writes it was about the same as scoped writes alone. A caveat: a CPU-heavy analysis ran beside the game at high priority for the whole run, so the absolute numbers are higher than usual and drift. The alternating phases cancel most of that, but take the deltas as about ±0.5 ms. I'll rerun on an idle machine and add the result here. Tests: `cargo test -p victory-gpu --lib` matches main. It has the same two failures #4025 fixes, plus `host_list_uav_pool_lifecycle_retire_trim_and_info_queue`, which failed once in the full run and passed 3 of 3 alone. That test is flaky; this PR doesn't touch its file.
paales commented 2026-11-30 20:51:52 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by paales on 2026-11-30T20:51:52Z.


Written by 🤖:

In-game numbers for this PR, as the description asks. PC: RTX 5070 Ti 16 GB, Ryzen 9 5900X, 32 GB, Windows 11. Series X, 1440p, DLSS Performance, frame generation off. Each run: a new game (settings save, no story save), one A press, the first cutscene for 60 s from its first frame. On this PC the same build's submitting thread took 24 ms a frame in one run and 35 ms in another half an hour later, so only large differences count. 60 fps cap.

Base without this PR: main c71899d9 with #3918, #1727, #3553 and #3043. Merging this branch also brought main up to 84bd61e2, so the first table holds those commits too. The second table is one build, with the switch off and on.

base with this PR, VICTORY_FILL_AHEAD=1
frames in 60 s 1,658 1,998
median frame 38.6 ms 30.5 ms
seconds with a frame over 50 ms 42 26
seconds with a frame over 100 ms 1 1
this PR's build fill ahead off fill ahead on
seconds with a frame over 50 ms 30 23
seconds with a frame over 100 ms 6 3
median frame 31.2 ms 30.1 ms

The fill line said about 15 staging buffers a frame sent to the threads, 14 filled by them, none left to the submission. No crash and nothing wrong in the screenshots in about 20 runs. I play with it on.

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:comment:7291576649 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/4206#issuecomment-7291576649). Originally posted by [paales](https://github.com/paales) on 2026-11-30T20:51:52Z. --- _Written by 🤖:_ In-game numbers for this PR, as the description asks. PC: RTX 5070 Ti 16 GB, Ryzen 9 5900X, 32 GB, Windows 11. Series X, 1440p, DLSS Performance, frame generation off. Each run: a new game (settings save, no story save), one A press, the first cutscene for 60 s from its first frame. On this PC the same build's submitting thread took 24 ms a frame in one run and 35 ms in another half an hour later, so only large differences count. 60 fps cap. Base without this PR: `main` c71899d9 with #3918, #1727, #3553 and #3043. Merging this branch also brought `main` up to 84bd61e2, so the first table holds those commits too. The second table is one build, with the switch off and on. | | base | with this PR, `VICTORY_FILL_AHEAD=1` | | --- | --- | --- | | frames in 60 s | 1,658 | 1,998 | | median frame | 38.6 ms | 30.5 ms | | seconds with a frame over 50 ms | 42 | 26 | | seconds with a frame over 100 ms | 1 | 1 | | this PR's build | fill ahead off | fill ahead on | | --- | --- | --- | | seconds with a frame over 50 ms | 30 | 23 | | seconds with a frame over 100 ms | 6 | 3 | | median frame | 31.2 ms | 30.1 ms | The fill line said about 15 staging buffers a frame sent to the threads, 14 filled by them, none left to the submission. No crash and nothing wrong in the screenshots in about 20 runs. I play with it on.
nicolasabosch commented 2026-11-30 23:19:23 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by nicolasabosch on 2026-11-30T23:19:23Z.


Tested on an RTX 4070 Laptop 8 GB with VICTORY_FILL_AHEAD=1: no measurable fps difference in this scene (2 runs).

What was built

  • Main e1251c31 with four opt-in PRs merged together and nothing else changed: #4069, #3757, #3614 and #4206. This PR's head was 6a9dcecb.
  • Release build, same profile as main.
  • Every switch was off except the one under test. The combined build with all switches off is the control.

Setup

  • PC: RTX 4070 Laptop 8 GB, i9-14900HX, 32 GB RAM, Windows 11.
  • Command: victory play --series-s --dlss performance --framegen 2, with no fps cap and the window minimized.
  • Route: scripted Enter presses into the world from a fixed copy of a save, then the character idles there for 300 s.
  • fps is the mean of the last 40 host: reports, about 200 s. These are real frames, not generated ones.
run fps ms/frame submit thread ms refreshes ms
main, 5 runs 15.94 – 16.41 61.0 – 62.8 38.4 – 40.5 14.2 – 15.2
combined build, switches off, run 1 16.45 60.8 35.4 12.4
combined build, switches off, run 2 16.93 59.2 37.3 13.9
VICTORY_FILL_AHEAD=1, run 1 16.12 62.1 33.9 12.7
VICTORY_FILL_AHEAD=1, run 2 16.53 60.6 34.9 12.3

On this laptop, identical runs differ by about 0.5–1 fps, so only an effect of roughly 1.5 fps or more would show.

In this scene the frame (~60 ms) is longer than the submit thread's own work (~33–40 ms), so a gain on the submit thread alone may not reach the fps here. A still camera is not the case FILL_AHEAD is for. The default-on scoped writes are part of the control build. Against main, that build's refreshes were 12.5 and 13.9 ms against 14.2–15.3, and its fps was 16.45 and 16.93 against 15.9–16.4. That's a hint, not a result: the build also carries the other three PRs.

Not tested: driving, camera turns, interiors, an image comparison, other GPUs.

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:comment:7294980159 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/4206#issuecomment-7294980159). Originally posted by [nicolasabosch](https://github.com/nicolasabosch) on 2026-11-30T23:19:23Z. --- **Tested on an RTX 4070 Laptop 8 GB with `VICTORY_FILL_AHEAD=1`: no measurable fps difference in this scene (2 runs).** **What was built** - Main `e1251c31` with four opt-in PRs merged together and nothing else changed: #4069, #3757, #3614 and #4206. This PR's head was `6a9dcecb`. - Release build, same profile as main. - Every switch was off except the one under test. The combined build with all switches off is the control. **Setup** - PC: RTX 4070 Laptop 8 GB, i9-14900HX, 32 GB RAM, Windows 11. - Command: `victory play --series-s --dlss performance --framegen 2`, with no fps cap and the window minimized. - Route: scripted Enter presses into the world from a fixed copy of a save, then the character idles there for 300 s. - fps is the mean of the last 40 `host:` reports, about 200 s. These are real frames, not generated ones. | run | fps | ms/frame | submit thread ms | refreshes ms | |---|---|---|---|---| | main, 5 runs | 15.94 – 16.41 | 61.0 – 62.8 | 38.4 – 40.5 | 14.2 – 15.2 | | combined build, switches off, run 1 | 16.45 | 60.8 | 35.4 | 12.4 | | combined build, switches off, run 2 | 16.93 | 59.2 | 37.3 | 13.9 | | VICTORY_FILL_AHEAD=1, run 1 | 16.12 | 62.1 | 33.9 | 12.7 | | VICTORY_FILL_AHEAD=1, run 2 | 16.53 | 60.6 | 34.9 | 12.3 | On this laptop, identical runs differ by about 0.5–1 fps, so only an effect of roughly 1.5 fps or more would show. In this scene the frame (~60 ms) is longer than the submit thread's own work (~33–40 ms), so a gain on the submit thread alone may not reach the fps here. A still camera is not the case `FILL_AHEAD` is for. The default-on scoped writes are part of the control build. Against main, that build's refreshes were 12.5 and 13.9 ms against 14.2–15.3, and its fps was 16.45 and 16.93 against 15.9–16.4. That's a hint, not a result: the build also carries the other three PRs. **Not tested:** driving, camera turns, interiors, an image comparison, other GPUs.
Lyrnc commented 2026-12-01 01:41:34 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by Lyrnc on 2026-12-01T01:41:34Z.


Bench result: the spin A/B from "NOT tested", run overnight. RTX 5080 16 GB, Ryzen 7 9800X3D, 32 GB RAM, Windows 11. Release builds, one shared shader cache (warmed first):

  • main = 84bd61e2.
  • A = this PR at 6a9dcecb, defaults.
  • C = A with VICTORY_SCOPED_WRITES=0.
  • B = A with VICTORY_FILL_AHEAD=1.

The base is main 84bd61e2, not c71899d9 as the description planned, since this PR now sits on it. Series X, 1440p, DLSS Quality, frame generation off, same save. Standing from world+30 to 150 s, right stick held from 150 to 270 s, 360 s runs, two runs per arm, in the order main A C B (+ #4294) twice. Ranges are the two runs.

arm window fps >50 ms /1000 >100 ms /1000 submitting thread, ms/frame of it: refreshes, ms flushes of refreshes /frame refreshes asked /frame ("of N") known to copy nothing /frame texture refreshes, all threads, ms
main standing 29.8-30.2 74-77 2.0-3.1 29.3-29.8 11.1-11.6 44.3 7,023-7,097 5,841-5,916 5.1-5.3
main turning 23.2-24.1 329-352 4.6-7.8 35.0-36.0 15.3-16.0 54.3-54.6 7,335-7,377 6,101-6,138 8.6-8.8
A standing 30.9-31.1 59-69 1.4-1.7 28.4-28.6 10.5-10.8 23.9-24.0 5,679-5,714 4,652-4,666 4.4-4.5
A turning 23.9-24.3 336-344 7.3-8.5 34.0-35.0 14.5-15.2 29.0-29.2 5,846-5,849 4,742-4,759 7.8-7.9
C (SCOPED_WRITES=0) standing 30.4-31.1 42-56 1.9-3.1 29.1-29.5 10.7-11.2 43.7-44.1 6,898-7,019 5,763-5,843 5.3
C turning 23.3-24.2 337-338 5.7-10.6 35.0-36.4 15.3-15.6 55.2-55.6 7,340-7,442 6,109-6,237 8.2-8.6
B (FILL_AHEAD=1) standing 30.7-31.1 63-69 2.5-2.8 28.0-28.2 10.1-10.4 24.2-24.3 5,689-5,704 4,666-4,711 4.6-5.7
B turning 24.3-24.9 332-336 5.2-7.4 33.3-33.9 14.1-14.3 29.1-29.5 5,809-5,872 4,738-4,776 8.4-14.7

The new line, A while turning (per frame): 41.7-42.0 title writes among the steps. Before them, 4.3-4.5 pending refreshes were done and 45.1-46.3 left for a later flush. Past them, 8,506-8,691 copies refreshed ahead stood (26.4-26.7 forgotten), and 1,014-1,259 textures checked stood (0 forgotten). While standing: 27.1-27.8 writes, 0.1-0.3 done, 17.1-18.4 left, 6,050-6,330 stood (20.5-21.7 forgotten).

B's fills line while turning: 64-68 staging buffers sent to the threads per frame, 61-62 filled by them, 3-6 with nothing to read, 0 left to their submission.

No device removed, DRED or "did not close" line in any of the 8 runs.

What this shows

  • The scoping works as described. Flushes of refreshes fall by 45-47 % (44 → 24 standing, 54.5 → 29 turning), and refreshes asked fall by about 20 %. Per frame, ~45 of the ~50 refreshes pending at title writes are now left for a later flush, and nearly all copies refreshed ahead survive the writes.
  • The switch restores the old behaviour. VICTORY_SCOPED_WRITES=0 puts back main's counts exactly: 44 and 55 flushes, 6,900-7,440 asked.
  • The time saved is small. Submitting thread -1.0 ms a frame turning and -1 ms standing; refreshes -0.8 ms. The refreshes still grow by ~4 ms when the camera turns (A: 10.5 → 14.5-15.2; main: 11.1 → 15.3-16.0). So the description's expectation, "the refreshes' growth (4-5 ms) mostly gone", is not met on this PC. Half the flushes go away, but the per-refresh work while turning stays.
  • B moves texture filling off the frame. About 61 staging buffers a frame are filled by the threads while turning. The submitting thread is another 0.5-1 ms lower than A (33.3-33.9 ms). Its "texture refreshes, all threads" was 8.4 and 14.7 ms in the two runs, so whether the work moved or grew is not settled.

What it does not show

  • No frame-rate change beyond run-to-run spread. Turning: main 23.2-24.1, A 23.9-24.3, C 23.3-24.2, B 24.3-24.9. Standing, A's 30.9-31.1 against main's 29.8-30.2 looks like a gain, but C (the old steps) got 30.4-31.1 too. Frames over 50 ms while turning are the same in every arm (329-352 per 1,000).
  • A 4.9-5.9 s frame in the turning window appeared in some runs of main, A, C and B alike, so it is not this PR.
  • The long-frame line is not in 84bd61e2, so there is no per-cause split of the slow frames.
  • Not tested: HW RT, other GPUs, VICTORY_REFRESH_FRONT=0, VICTORY_LIGHT_REFRESH=0.

AI use: Claude Code (Claude Opus 5.5) ran these on our bench queue, parsed the run logs with its own scripts (and the PR author's line parser), and wrote this comment.

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:comment:7297785877 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/4206#issuecomment-7297785877). Originally posted by [Lyrnc](https://github.com/Lyrnc) on 2026-12-01T01:41:34Z. --- Bench result: the spin A/B from "NOT tested", run overnight. RTX 5080 16 GB, Ryzen 7 9800X3D, 32 GB RAM, Windows 11. Release builds, one shared shader cache (warmed first): - **main** = 84bd61e2. - **A** = this PR at 6a9dcecb, defaults. - **C** = A with `VICTORY_SCOPED_WRITES=0`. - **B** = A with `VICTORY_FILL_AHEAD=1`. The base is main 84bd61e2, not c71899d9 as the description planned, since this PR now sits on it. Series X, 1440p, DLSS Quality, frame generation off, same save. Standing from world+30 to 150 s, right stick held from 150 to 270 s, 360 s runs, two runs per arm, in the order main A C B (+ #4294) twice. Ranges are the two runs. | arm | window | fps | >50 ms /1000 | >100 ms /1000 | submitting thread, ms/frame | of it: refreshes, ms | flushes of refreshes /frame | refreshes asked /frame ("of N") | known to copy nothing /frame | texture refreshes, all threads, ms | |---|---|---:|---:|---:|---:|---:|---:|---:|---:|---:| | main | standing | 29.8-30.2 | 74-77 | 2.0-3.1 | 29.3-29.8 | 11.1-11.6 | 44.3 | 7,023-7,097 | 5,841-5,916 | 5.1-5.3 | | main | turning | 23.2-24.1 | 329-352 | 4.6-7.8 | 35.0-36.0 | 15.3-16.0 | 54.3-54.6 | 7,335-7,377 | 6,101-6,138 | 8.6-8.8 | | A | standing | 30.9-31.1 | 59-69 | 1.4-1.7 | 28.4-28.6 | 10.5-10.8 | 23.9-24.0 | 5,679-5,714 | 4,652-4,666 | 4.4-4.5 | | A | turning | 23.9-24.3 | 336-344 | 7.3-8.5 | 34.0-35.0 | 14.5-15.2 | 29.0-29.2 | 5,846-5,849 | 4,742-4,759 | 7.8-7.9 | | C (`SCOPED_WRITES=0`) | standing | 30.4-31.1 | 42-56 | 1.9-3.1 | 29.1-29.5 | 10.7-11.2 | 43.7-44.1 | 6,898-7,019 | 5,763-5,843 | 5.3 | | C | turning | 23.3-24.2 | 337-338 | 5.7-10.6 | 35.0-36.4 | 15.3-15.6 | 55.2-55.6 | 7,340-7,442 | 6,109-6,237 | 8.2-8.6 | | B (`FILL_AHEAD=1`) | standing | 30.7-31.1 | 63-69 | 2.5-2.8 | 28.0-28.2 | 10.1-10.4 | 24.2-24.3 | 5,689-5,704 | 4,666-4,711 | 4.6-5.7 | | B | turning | 24.3-24.9 | 332-336 | 5.2-7.4 | 33.3-33.9 | 14.1-14.3 | 29.1-29.5 | 5,809-5,872 | 4,738-4,776 | 8.4-14.7 | The new line, A while turning (per frame): 41.7-42.0 title writes among the steps. Before them, 4.3-4.5 pending refreshes were done and 45.1-46.3 left for a later flush. Past them, 8,506-8,691 copies refreshed ahead stood (26.4-26.7 forgotten), and 1,014-1,259 textures checked stood (0 forgotten). While standing: 27.1-27.8 writes, 0.1-0.3 done, 17.1-18.4 left, 6,050-6,330 stood (20.5-21.7 forgotten). B's fills line while turning: 64-68 staging buffers sent to the threads per frame, 61-62 filled by them, 3-6 with nothing to read, 0 left to their submission. No device removed, DRED or "did not close" line in any of the 8 runs. **What this shows** - **The scoping works as described.** Flushes of refreshes fall by 45-47 % (44 → 24 standing, 54.5 → 29 turning), and refreshes asked fall by about 20 %. Per frame, ~45 of the ~50 refreshes pending at title writes are now left for a later flush, and nearly all copies refreshed ahead survive the writes. - **The switch restores the old behaviour.** `VICTORY_SCOPED_WRITES=0` puts back main's counts exactly: 44 and 55 flushes, 6,900-7,440 asked. - **The time saved is small.** Submitting thread -1.0 ms a frame turning and -1 ms standing; refreshes -0.8 ms. The refreshes still grow by ~4 ms when the camera turns (A: 10.5 → 14.5-15.2; main: 11.1 → 15.3-16.0). So the description's expectation, "the refreshes' growth (4-5 ms) mostly gone", is not met on this PC. Half the flushes go away, but the per-refresh work while turning stays. - **B moves texture filling off the frame.** About 61 staging buffers a frame are filled by the threads while turning. The submitting thread is another 0.5-1 ms lower than A (33.3-33.9 ms). Its "texture refreshes, all threads" was 8.4 and 14.7 ms in the two runs, so whether the work moved or grew is not settled. **What it does not show** - **No frame-rate change beyond run-to-run spread.** Turning: main 23.2-24.1, A 23.9-24.3, C 23.3-24.2, B 24.3-24.9. Standing, A's 30.9-31.1 against main's 29.8-30.2 looks like a gain, but C (the old steps) got 30.4-31.1 too. Frames over 50 ms while turning are the same in every arm (329-352 per 1,000). - A 4.9-5.9 s frame in the turning window appeared in some runs of main, A, C and B alike, so it is not this PR. - The long-frame line is not in 84bd61e2, so there is no per-cause split of the slow frames. - Not tested: HW RT, other GPUs, `VICTORY_REFRESH_FRONT=0`, `VICTORY_LIGHT_REFRESH=0`. AI use: Claude Code (Claude Opus 5.5) ran these on our bench queue, parsed the run logs with its own scripts (and the PR author's line parser), and wrote this comment.
Lyrnc commented 2026-12-01 03:56:16 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by Lyrnc on 2026-12-01T03:56:16Z.


Thanks @mstrmoos, @paales and @nicolasabosch, and @gabrielecabrini above. Read together:

  • Scoped writes (on by default) save a little on the submitting thread, in every report. mstrmoos's alternating A/B on a 5080: 1.4-2.2 ms a frame faster than the phases beside it, p90 40.4 against 45.7 ms. gabrielecabrini standing (Linux, 4070 SUPER): flushes 46 → 28, the submitting thread 5 ms lower, +14 % fps. Our bench: flushes down 46 %, the submitting thread about 1 ms lower.
  • Added after mstrmoos's idle-machine rerun below: with the card 100 % busy on that scene, on and off are the same (median 33.3 against 33.4 ms, p90 36.3 against 36.7, on faster in 19 of 39 pairs). So the saving shows only where the submitting thread is the limit, and nothing where the card is. That fits both of mstrmoos's runs and the rest above.
  • No frame-rate gain while turning, in any report. gabrielecabrini's moving rows are 15.9 against 15.8 fps, and ours sit inside the run-to-run spread. Title writes flush half as often, but the per-refresh work while turning stays. So this PR doesn't deliver the turning gain its description expected. What it gives is the smaller saving above.
  • VICTORY_FILL_AHEAD=1 is mixed, so it stays opt-in. paales: median frame 31.2 → 30.1 ms in one build, seconds with a frame over 50 ms 30 → 23, ~14 staging buffers a frame filled by the threads. mstrmoos: 0.4-1 ms slower on its own, and no better than scoped writes alone. nicolasabosch (8 GB laptop): no measurable change. There the frame (~60 ms) is longer than the submitting thread's work (~34 ms), so a saving on that thread can't show in fps. gabrielecabrini saw more "changed after its upload" texture warnings with it (29 against 13 and 18) and a few small texture glitches. That needs a look before it could be more than opt-in.
  • paales's first table also includes main's move from c71899d9 to 84bd61e2. Only the second table (one build, switch off and on) measures this PR alone.

AI use: Claude Code (Claude Opus 5.5) read the reports side by side and wrote this.

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:comment:7300213369 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/4206#issuecomment-7300213369). Originally posted by [Lyrnc](https://github.com/Lyrnc) on 2026-12-01T03:56:16Z. --- Thanks @mstrmoos, @paales and @nicolasabosch, and @gabrielecabrini above. Read together: - **Scoped writes (on by default) save a little on the submitting thread, in every report.** mstrmoos's alternating A/B on a 5080: 1.4-2.2 ms a frame faster than the phases beside it, p90 40.4 against 45.7 ms. gabrielecabrini standing (Linux, 4070 SUPER): flushes 46 → 28, the submitting thread 5 ms lower, +14 % fps. Our bench: flushes down 46 %, the submitting thread about 1 ms lower. - *Added after mstrmoos's idle-machine rerun below:* with the card 100 % busy on that scene, on and off are the same (median 33.3 against 33.4 ms, p90 36.3 against 36.7, on faster in 19 of 39 pairs). So the saving shows only where the submitting thread is the limit, and nothing where the card is. That fits both of mstrmoos's runs and the rest above. - **No frame-rate gain while turning, in any report.** gabrielecabrini's moving rows are 15.9 against 15.8 fps, and ours sit inside the run-to-run spread. Title writes flush half as often, but the per-refresh work while turning stays. So this PR doesn't deliver the turning gain its description expected. What it gives is the smaller saving above. - **`VICTORY_FILL_AHEAD=1` is mixed, so it stays opt-in.** paales: median frame 31.2 → 30.1 ms in one build, seconds with a frame over 50 ms 30 → 23, ~14 staging buffers a frame filled by the threads. mstrmoos: 0.4-1 ms slower on its own, and no better than scoped writes alone. nicolasabosch (8 GB laptop): no measurable change. There the frame (~60 ms) is longer than the submitting thread's work (~34 ms), so a saving on that thread can't show in fps. gabrielecabrini saw more "changed after its upload" texture warnings with it (29 against 13 and 18) and a few small texture glitches. That needs a look before it could be more than opt-in. - paales's first table also includes main's move from c71899d9 to 84bd61e2. Only the second table (one build, switch off and on) measures this PR alone. AI use: Claude Code (Claude Opus 5.5) read the reports side by side and wrote this.
mstrmoos commented 2026-12-01 04:13:26 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by mstrmoos on 2026-12-01T04:13:26Z.


The idle-machine rerun I owed you. It doesn't change your summary.

Setup: RTX 5080 16 GB, Ryzen 7 9800X3D, Series X, DLSS Balanced, frame generation off. The player stands still on a pier for 240 s: water fills the left of the frame, people sit at a terrace behind, foliage and a far shore are in the distance, about 8,650 draws a frame. The build is main e1251c31 + #4332 + this PR. Nothing else ran this time; my first A/B had a static analysis running beside it. VICTORY_AB flipped VICTORY_SCOPED_WRITES in place in 40 phases.

phases frame median p90
scoped writes off 20 33.4 ms 36.7
scoped writes on 20 33.3 ms 36.3

On against off in 39 neighbouring pairs: median +0.0 % frame time, on faster in 19.

The caveat matters. This build is now held by the card on this scene (100 % busy, the submitting thread worked about 24 ms of a 33 ms frame), so a saving on the submitting thread can't show in the frame here. My first run's 1.4-2.2 ms came from a build that was still partly bound by the submitting thread, with the analysis competing for the CPU. So "a small saving on the submitting thread where that thread is the limit, nothing where the card is" fits both of my runs.

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:comment:7300506982 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/4206#issuecomment-7300506982). Originally posted by [mstrmoos](https://github.com/mstrmoos) on 2026-12-01T04:13:26Z. --- The idle-machine rerun I owed you. It doesn't change your summary. **Setup:** RTX 5080 16 GB, Ryzen 7 9800X3D, Series X, DLSS Balanced, frame generation off. The player stands still on a pier for 240 s: water fills the left of the frame, people sit at a terrace behind, foliage and a far shore are in the distance, about 8,650 draws a frame. The build is main e1251c31 + #4332 + this PR. Nothing else ran this time; my first A/B had a static analysis running beside it. `VICTORY_AB` flipped `VICTORY_SCOPED_WRITES` in place in 40 phases. | | phases | frame median | p90 | | --- | --- | --- | --- | | scoped writes off | 20 | 33.4 ms | 36.7 | | scoped writes on | 20 | 33.3 ms | 36.3 | On against off in 39 neighbouring pairs: median +0.0 % frame time, on faster in 19. The caveat matters. This build is now held by the card on this scene (100 % busy, the submitting thread worked about 24 ms of a 33 ms frame), so a saving on the submitting thread can't show in the frame here. My first run's 1.4-2.2 ms came from a build that was still partly bound by the submitting thread, with the analysis competing for the CPU. So "a small saving on the submitting thread where that thread is the limit, nothing where the card is" fits both of my runs.
albertik322-sudo commented 2026-12-01 16:49:20 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by albertik322-sudo on 2026-12-01T16:49:20Z.


A/B on a laptop GPU, cherry-picked onto main @ 5fabb46e. PC: RTX 3070 Laptop 8 GB, i7-11800H, 32 GB RAM, Windows 11. Series S, 1080p output, DLSS Performance (540p scene), frame generation x4 on.

Same save point, standing still, median over ~5 min in-world:

metric before with this PR
fixed cost per frame (linear fit of ms vs draws) ~47 ms 25.5 ms
fit fps @ 6000 draws 14.2 17.3
fps median 15.9 17.4 (p10 17.1)

The fixed-cost drop is the whole story here: in light scenes the ceiling went from ~15 to ~21 fps. Heavy scenes are still bounded by the per-draw cost (ms/kdraw ~9 unchanged).

One note: we're on a laptop where the write-watch/copy path dominates frame time (copies ~17-19 ms + write-watch asking ~12-16 ms of a ~67 ms frame, ~7,700 draws/frame). Anything that cuts the number of refreshes has outsized effect here, so this PR was the biggest single win we've measured so far.

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:comment:7318291411 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/4206#issuecomment-7318291411). Originally posted by [albertik322-sudo](https://github.com/albertik322-sudo) on 2026-12-01T16:49:20Z. --- A/B on a laptop GPU, cherry-picked onto main @ 5fabb46e. PC: RTX 3070 Laptop 8 GB, i7-11800H, 32 GB RAM, Windows 11. Series S, 1080p output, DLSS Performance (540p scene), frame generation x4 on. Same save point, standing still, median over ~5 min in-world: | metric | before | with this PR | | --- | --- | --- | | fixed cost per frame (linear fit of ms vs draws) | ~47 ms | **25.5 ms** | | fit fps @ 6000 draws | 14.2 | **17.3** | | fps median | 15.9 | 17.4 (p10 17.1) | The fixed-cost drop is the whole story here: in light scenes the ceiling went from ~15 to ~21 fps. Heavy scenes are still bounded by the per-draw cost (ms/kdraw ~9 unchanged). One note: we're on a laptop where the write-watch/copy path dominates frame time (copies ~17-19 ms + write-watch asking ~12-16 ms of a ~67 ms frame, ~7,700 draws/frame). Anything that cuts the number of refreshes has outsized effect here, so this PR was the biggest single win we've measured so far.
Lyrnc commented 2026-12-01 17:04:53 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by Lyrnc on 2026-12-01T17:04:53Z.


@albertik322-sudo thank you, that's the clearest result this PR has had. On a CPU-limited laptop (i7-11800H) the fixed cost per frame falls from ~47 to 25.5 ms, and the light-scene ceiling goes from ~15 to ~21 fps. That fits the mechanism: where the write-watch and copy path dominates the frame, every flush a title write no longer forces is time back. On our 9800X3D desktop the same change saved only ~1 ms, because there the submitting thread isn't the frame's limit, so desktop numbers undersell it. Thanks also for the batch numbers on #4294/#4340 (no wrong surfaces, clobber watch quiet) and for the VICTORY_WC_BAR=1 laptop warning.

AI use: Claude Code (Claude Opus 5.5) wrote this reply.

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:comment:7318720546 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/4206#issuecomment-7318720546). Originally posted by [Lyrnc](https://github.com/Lyrnc) on 2026-12-01T17:04:53Z. --- @albertik322-sudo thank you, that's the clearest result this PR has had. On a CPU-limited laptop (i7-11800H) the fixed cost per frame falls from ~47 to 25.5 ms, and the light-scene ceiling goes from ~15 to ~21 fps. That fits the mechanism: where the write-watch and copy path dominates the frame, every flush a title write no longer forces is time back. On our 9800X3D desktop the same change saved only ~1 ms, because there the submitting thread isn't the frame's limit, so desktop numbers undersell it. Thanks also for the batch numbers on #4294/#4340 (no wrong surfaces, clobber watch quiet) and for the `VICTORY_WC_BAR=1` laptop warning. AI use: Claude Code (Claude Opus 5.5) wrote this reply.
trustno1-coder commented 2026-12-01 18:45:35 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by trustno1-coder on 2026-12-01T18:45:35Z.


Closing this as part of moving main to the texture and video-memory rework (v2026.12.01.01-test). A lot of the code changed, and this pull request no longer applies cleanly to it; it would need to be rewritten against the new main rather than rebased. Thank you for the work. If the change is still needed, please open a new pull request based on the current main.

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:comment:7321488190 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/4206#issuecomment-7321488190). Originally posted by [trustno1-coder](https://github.com/trustno1-coder) on 2026-12-01T18:45:35Z. --- Closing this as part of moving main to the texture and video-memory rework (v2026.12.01.01-test). A lot of the code changed, and this pull request no longer applies cleanly to it; it would need to be rewritten against the new main rather than rebased. Thank you for the work. If the change is still needed, please open a new pull request based on the current main.

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