[RTX 3070 / Ryzen 5 7600X] Frame time bound by the submitting thread (~56 ms at 5–10k draws); port of cool_fox's pipeline-library "store later" reduced stalls #1427

Closed
opened 2026-11-28 19:49:20 +00:00 by github-bot · 2 comments
Owner

@⁠yoshidacaio on GitHub · 2026-11-28 19:44 UTC · original

<html>

System

  |   -- | -- GPU | RTX 3070 8 GB, Windows 11, D3D12 Agility SDK from the game folder, Resizable BAR on (card memory the CPU maps supported=true) CPU / RAM | Ryzen 5 7600X (6C/12T), 32 GB DDR5-6000 (EXPO) Game | own dump, v1.0.2.1 Build | v2026.11.28.03 (9ce3cf9), release, plus the local changes listed at the end Profile | Series S, 720p → 1080p with DLSS Quality, FSR 3 frame generation 2x (FG off where noted) Non-default switches | VICTORY_TEXTURE_ROOM_PERCENT=85, VICTORY_CARD_ROOM_FOR_TARGETS_MB=1600, VICTORY_CARD_ROOM_FOR_TARGETS_SETTLE_MS=8000, VICTORY_POOL_SMALL=1, VICTORY_WATER_LIGHT=0, VICTORY_LIBRARY_STORE_LATER=1, VICTORY_LIBRARY_SAVE_S=60

The GPU is never the limit. The frame time follows the draw count through the submitting thread. Here is one representative line from the city at ~10k draws:

the submitting thread: 55.7 ms in its submissions: 4.5 asking the write watch, 1.3 putting the title's
bytes under flights' writes, 33.1 in the lists' steps (refreshes 22.9 in 57 flushes of 9967, 8572 of them
known to copy nothing, 9296 on several threads, 0.5 one at a time in 258 before shader writes; copies and
fills 4.6), 4.7 for copies in the card's memory, 1.5 sending the lists (VICTORY_LIGHT_REFRESH is on);
ahead of these 2.2 waiting for the submission lock, 6.2 planning steps done on the card, 0.1 waiting for
flights, 1.5 the heaps' records and what is swept; after the sending 1.7

The refreshes take ~23 ms even though 86% of the flushes are already known to copy nothing. My guess, unverified: the cost on this 6-core CPU is in waking and joining the helper threads per flush, not in copying. VICTORY_WIDE_THREADS=8 instead of the default 4 changed little in a short run; I can do a longer A/B if useful.

The following made no relevant difference here:

  • RAM 4800 → 6000 (EXPO): a few fps.
  • VICTORY_WC_BAR=1 with Resizable BAR on: no relevant gain, and the picture broke (as its doc comment warns).

2. Pipeline-library saves stalled frames — port of cool_fox's LIBRARY_STORE_LATER

Before, on v2026.11.28.02 with the defaults, I ran a 36-minute session:

  • The workers saved the whole library (85 MB) 43 times.
  • There were 54 five-second windows whose longest frame was over 250 ms. 22 of them began within 6 s after a save, though those 6-second windows cover only ~16% of the session.

While a save holds saving for writing, a worker that has just made a pipeline waits to store it, and the frame that asked for it waits up to VICTORY_PIPELINE_WAIT_MS (500).

I ported DoubleGhosty/cool_fox's VICTORY_LIBRARY_STORE_LATER and VICTORY_LIBRARY_SAVE_S to pipeline/library.rs. The patch is attached: one file, off by default, unit tests included (store_or_defer / drain / save_seconds), builds clean on Windows. With it on and SAVE_S=60, the next session had 14 such windows in 21 minutes and 7 saves.

Caveat: I also ran a full victory warm in between, so the two effects are not separated. If this direction is welcome, I can do a clean A/B (same build, same spot, STORE_LATER 0/1) before a PR.

3. Other findings on a 32-lane card (for reference)

  • Only two compute programs refuse to translate in play: 6b82bc7d22016cb5 (every session) and a10179ab7eda0dc3 (first seen in one session), both no wave32 lowering for this wave64 program.
  • VICTORY_CARD_ROOM_FOR_TARGETS_MB (3072 by default) is never released at 720p, where the targets use ~1.3–1.5 GB (same as #609). 1600 MB with an 8 s settle released it and kept textures in budget at 85%.
  • VICTORY_POOL_SMALL=1 on NVIDIA: 36 minutes, no device loss. 18,746 small textures held in 218 MB, against ~1.2 GB at 64 KiB granularity.
  • VICTORY_LEVELS_ON_DEMAND=1 made things worse here: 8.1 GB in use, about half the objects missing.
  • Characters with dark areas, caused by the missing ray-traced lighting: much better with VICTORY_AMBIENT=1.8, VICTORY_AMBIENT_SHADE=0.15,0.6 and VICTORY_AMBIENT_ONCE=1, plus a small local change, VICTORY_AMBIENT_FLOOR=<share>. It floors the diffuse estimate at a share of the scene's mean (ambient.rs, max(now, mean * floor_share * open)). I can open a separate PR for it if it is of interest.

Local changes in this build

The full patch is available on request. It contains:

  • barrier flags and texture states D3D12 refuses, filtered;
  • the NaN guard and the video frame interval from Project Neptune VI;
  • the ambient floor;
  • the pipeline-library port above.

Logs available on request.

</html>

0001-pipeline-library-store-later.patch

**@⁠yoshidacaio** on GitHub · 2026-11-28 19:44 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/issues/1427) <html> <body> <!--StartFragment--><hr> <h2 dir="ltr">System</h2> <div dir="ltr">   |   -- | -- GPU | RTX 3070 8 GB, Windows 11, D3D12 Agility SDK from the game folder, Resizable BAR on (card memory the CPU maps supported=true) CPU / RAM | Ryzen 5 7600X (6C/12T), 32 GB DDR5-6000 (EXPO) Game | own dump, v1.0.2.1 Build | v2026.11.28.03 (9ce3cf9), release, plus the local changes listed at the end Profile | Series S, 720p → 1080p with DLSS Quality, FSR 3 frame generation 2x (FG off where noted) Non-default switches | VICTORY_TEXTURE_ROOM_PERCENT=85, VICTORY_CARD_ROOM_FOR_TARGETS_MB=1600, VICTORY_CARD_ROOM_FOR_TARGETS_SETTLE_MS=8000, VICTORY_POOL_SMALL=1, VICTORY_WATER_LIGHT=0, VICTORY_LIBRARY_STORE_LATER=1, VICTORY_LIBRARY_SAVE_S=60 </div> <p dir="ltr">The GPU is never the limit. The frame time follows the draw count through the submitting thread. Here is one representative line from the city at ~10k draws:</p> <div role="group" aria-label="Código" tabindex="0" dir="ltr"><div><div></div></div><div><pre><code style="white-space: pre-wrap;">the submitting thread: 55.7 ms in its submissions: 4.5 asking the write watch, 1.3 putting the title's bytes under flights' writes, 33.1 in the lists' steps (refreshes 22.9 in 57 flushes of 9967, 8572 of them known to copy nothing, 9296 on several threads, 0.5 one at a time in 258 before shader writes; copies and fills 4.6), 4.7 for copies in the card's memory, 1.5 sending the lists (VICTORY_LIGHT_REFRESH is on); ahead of these 2.2 waiting for the submission lock, 6.2 planning steps done on the card, 0.1 waiting for flights, 1.5 the heaps' records and what is swept; after the sending 1.7</code></pre></div></div> <p dir="ltr">The refreshes take ~23 ms even though 86% of the flushes are already known to copy nothing. My guess, unverified: the cost on this 6-core CPU is in waking and joining the helper threads per flush, not in copying. <code dir="ltr">VICTORY_WIDE_THREADS=8</code> instead of the default 4 changed little in a short run; I can do a longer A/B if useful.</p> <p dir="ltr">The following made no relevant difference here:</p> <ul dir="ltr"> <li>RAM 4800 → 6000 (EXPO): a few fps.</li> <li><code dir="ltr">VICTORY_WC_BAR=1</code> with Resizable BAR on: no relevant gain, and the picture broke (as its doc comment warns).</li> </ul> <h2 dir="ltr">2. Pipeline-library saves stalled frames — port of cool_fox's <code dir="ltr">LIBRARY_STORE_LATER</code></h2> <p dir="ltr">Before, on v2026.11.28.02 with the defaults, I ran a 36-minute session:</p> <ul dir="ltr"> <li>The workers saved the whole library (85 MB) <strong>43 times</strong>.</li> <li>There were <strong>54 five-second windows whose longest frame was over 250 ms</strong>. <strong>22</strong> of them began within 6 s after a save, though those 6-second windows cover only ~16% of the session.</li> </ul> <p dir="ltr">While a save holds <code dir="ltr">saving</code> for writing, a worker that has just made a pipeline waits to store it, and the frame that asked for it waits up to <code dir="ltr">VICTORY_PIPELINE_WAIT_MS</code> (500).</p> <p dir="ltr">I ported DoubleGhosty/cool_fox's <code dir="ltr">VICTORY_LIBRARY_STORE_LATER</code> and <code dir="ltr">VICTORY_LIBRARY_SAVE_S</code> to <code dir="ltr">pipeline/library.rs</code>. The patch is attached: one file, off by default, unit tests included (<code dir="ltr">store_or_defer</code> / <code dir="ltr">drain</code> / <code dir="ltr">save_seconds</code>), builds clean on Windows. With it on and <code dir="ltr">SAVE_S=60</code>, the next session had <strong>14 such windows in 21 minutes and 7 saves</strong>.</p> <p dir="ltr"><strong>Caveat:</strong> I also ran a full <code dir="ltr">victory warm</code> in between, so the two effects are not separated. If this direction is welcome, I can do a clean A/B (same build, same spot, <code dir="ltr">STORE_LATER</code> 0/1) before a PR.</p> <h2 dir="ltr">3. Other findings on a 32-lane card (for reference)</h2> <ul dir="ltr"> <li>Only two compute programs refuse to translate in play: <code dir="ltr">6b82bc7d22016cb5</code> (every session) and <code dir="ltr">a10179ab7eda0dc3</code> (first seen in one session), both <code dir="ltr">no wave32 lowering for this wave64 program</code>.</li> <li><code dir="ltr">VICTORY_CARD_ROOM_FOR_TARGETS_MB</code> (3072 by default) is never released at 720p, where the targets use ~1.3–1.5 GB (same as #609). 1600 MB with an 8 s settle released it and kept textures in budget at 85%.</li> <li><code dir="ltr">VICTORY_POOL_SMALL=1</code> on NVIDIA: 36 minutes, no device loss. 18,746 small textures held in 218 MB, against ~1.2 GB at 64 KiB granularity.</li> <li><code dir="ltr">VICTORY_LEVELS_ON_DEMAND=1</code> made things worse here: 8.1 GB in use, about half the objects missing.</li> <li>Characters with dark areas, caused by the missing ray-traced lighting: much better with <code dir="ltr">VICTORY_AMBIENT=1.8</code>, <code dir="ltr">VICTORY_AMBIENT_SHADE=0.15,0.6</code> and <code dir="ltr">VICTORY_AMBIENT_ONCE=1</code>, plus a small local change, <code dir="ltr">VICTORY_AMBIENT_FLOOR=&lt;share&gt;</code>. It floors the diffuse estimate at a share of the scene's mean (<code dir="ltr">ambient.rs</code>, <code dir="ltr">max(now, mean * floor_share * open)</code>). I can open a separate PR for it if it is of interest.</li> </ul> <h2 dir="ltr">Local changes in this build</h2> <p dir="ltr">The full patch is available on request. It contains:</p> <ul dir="ltr"> <li>barrier flags and texture states D3D12 refuses, filtered;</li> <li>the NaN guard and the video frame interval from Project Neptune VI;</li> <li>the ambient floor;</li> <li>the pipeline-library port above.</li> </ul> <p dir="ltr">Logs available on request.</p><!--EndFragment--> </body> </html> [0001-pipeline-library-store-later.patch](https://github.com/user-attachments/files/35556302/0001-pipeline-library-store-later.patch)
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-28 19:49:20 +00:00
Author
Owner

@⁠joeypercia on GitHub · 2026-11-29 07:34 UTC · original

On "serial per-item work or contention", thread stacks point at contention: the write watch's one guards lock (watch::GUARDS).

Setup. RTX 4070 Ti 12 GB, Ryzen 7 7800X3D, 32 GB, Windows 11 26200. main at 568c5e5 (release build, matching pdb), Series X, DLSS off, frame generation off, in the world. I took 30 samples of every thread with cdb -pv (non-invasive), one every ~3 s over about 2 minutes. Each sample suspends the process for a moment, so this run's per-frame times are inflated; read the shares, not the milliseconds.

What the threads were doing:

thread busy (on CPU) where
victory-submit 16 of 30 14 waiting. The largest single wait (5 samples) is the join in shadow::wide ← wide_each ← wide_each_from, i.e. the end of a refresh flush, waiting for helpers.
victory-wide-* (6) 13 of 180 157 idle, waiting for work. Of the 23 samples taken inside a refresh job, 10 were blocked in watch::guards → GUARDS.lock() (via Shadow::update_free → watch::writes → watch::guard). The other 13 were copying (copy_mapped → soft_read, Shadow::copy) or in watch::kernel_written.
victory-list-* (8) 38 of 240 mostly idle

So the refresh fan-out has spare helpers, and the time a flush takes is set by its jobs queueing on GUARDS. guard() takes that lock on its fast path too (g.clean.range(first..last).count() == ...), once per refresh item that isn't sifted out, and holds it across protect()'s VirtualProtect calls and soft_runs. The title's write faults wait on the same lock. That fits your C run (two thirds fewer helpers cost only ~12 %) and D (spinning doesn't help: the helpers are awake but blocked).

Open PRs that work on that lock, for whoever compares them: #1925 (GUARDS split by block), #1967 / #1561 / #1609 / #653 (the fast path in guard() without the count(); #1967 and #1561 also skip the second guards_timed()), #730 and #1044 (spinning or try_lock on it). I haven't measured any of them.

Not measured: with more samples, or on Series S.

(Claude Code, Claude Opus 5.5: took the samples, read the stacks, wrote this.)

**@⁠joeypercia** on GitHub · 2026-11-29 07:34 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/issues/1427#issuecomment-7252554509) On "serial per-item work or contention", thread stacks point at contention: the write watch's one guards lock (`watch::GUARDS`). **Setup.** RTX 4070 Ti 12 GB, Ryzen 7 7800X3D, 32 GB, Windows 11 26200. `main` at `568c5e5` (release build, matching pdb), Series X, DLSS off, frame generation off, in the world. I took 30 samples of every thread with `cdb -pv` (non-invasive), one every ~3 s over about 2 minutes. Each sample suspends the process for a moment, so this run's per-frame times are inflated; read the shares, not the milliseconds. **What the threads were doing:** | thread | busy (on CPU) | where | |---|---|---| | `victory-submit` | 16 of 30 | 14 waiting. The largest single wait (5 samples) is the join in `shadow::wide` ← `wide_each` ← `wide_each_from`, i.e. the end of a refresh flush, waiting for helpers. | | `victory-wide-*` (6) | 13 of 180 | 157 idle, waiting for work. Of the 23 samples taken inside a refresh job, **10 were blocked in `watch::guards` → `GUARDS.lock()`** (via `Shadow::update_free` → `watch::writes` → `watch::guard`). The other 13 were copying (`copy_mapped` → `soft_read`, `Shadow::copy`) or in `watch::kernel_written`. | | `victory-list-*` (8) | 38 of 240 | mostly idle | So the refresh fan-out has spare helpers, and the time a flush takes is set by its jobs queueing on `GUARDS`. `guard()` takes that lock on its fast path too (`g.clean.range(first..last).count() == ...`), once per refresh item that isn't sifted out, and holds it across `protect()`'s `VirtualProtect` calls and `soft_runs`. The title's write faults wait on the same lock. That fits your C run (two thirds fewer helpers cost only ~12 %) and D (spinning doesn't help: the helpers are awake but blocked). Open PRs that work on that lock, for whoever compares them: #1925 (`GUARDS` split by block), #1967 / #1561 / #1609 / #653 (the fast path in `guard()` without the `count()`; #1967 and #1561 also skip the second `guards_timed()`), #730 and #1044 (spinning or `try_lock` on it). I haven't measured any of them. Not measured: with more samples, or on Series S. (Claude Code, Claude Opus 5.5: took the samples, read the stacks, wrote this.)
Author
Owner

@⁠trustno1-coder on GitHub · 2026-11-30 15:43 UTC · original

Closing this because it was opened before v2026.11.29.01, and a great deal has changed since then. The latest release is v2026.11.30.01.

If this still happens, or still applies, on the latest release, please open a new issue. For a bug, attach both logs from that run:

  1. The play log: the newest victory-nvidia-play-<date>-<time>-<number>.log in %LOCALAPPDATA%\victory\logs\.
  2. The crash log: %LOCALAPPDATA%\VIctory\data\7952987A\crashes.log, plus the newest .crash.log in %LOCALAPPDATA%\VIctory\data\7952987A\temp\ if there is one from that run.
**@⁠trustno1-coder** on GitHub · 2026-11-30 15:43 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/issues/1427#issuecomment-7283475110) Closing this because it was opened before v2026.11.29.01, and a great deal has changed since then. The latest release is [v2026.11.30.01](https://github.com/trustno1-coder/VIctory-NVIDIA/releases/tag/v2026.11.30.01). If this still happens, or still applies, on the latest release, please open a new issue. For a bug, attach both logs from that run: 1. The play log: the newest `victory-nvidia-play-<date>-<time>-<number>.log` in `%LOCALAPPDATA%\victory\logs\`. 2. The crash log: `%LOCALAPPDATA%\VIctory\data\7952987A\crashes.log`, plus the newest `.crash.log` in `%LOCALAPPDATA%\VIctory\data\7952987A\temp\` if there is one from that run.
This discussion has been locked. Commenting is limited to contributors.
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#1427
No description provided.