8 GB cards and 6-core CPUs: narrow fence waits, first uploads under the budget, submit-thread and RAM relief #3500

Closed
github-bot wants to merge 3 commits from github-bot/gh-3500 into main AGit
Owner

@⁠Zedwhyrex on GitHub · 2026-11-30 00:06 UTC · original
Zedwhyrex:perf-8gb-pr → main · +1576 −76 · 16 files · 3 commits · closed without merging

Frame time and memory on an 8 GB card / 6-core CPU / 32 GB PC (RTX 4060 8 GB on PCIe 4.0 x8, Resizable BAR on, Ryzen 5 7600, Windows 11). Three commits, each change logged once at start and switchable; the opt-in ones change nothing unless set.

What changes

1. 8 GB cards and the submitting thread (fence.rs, resource.rs, streamline.rs, draw.rs, watch.rs, host.rs, host/panel.rs)

  • VICTORY_FENCE_NARROW (on with the relay; 0: as before). A title thread blocked on a fence (null-event SetEventOnCompletion) waits for that value alone instead of settling every flight while it holds the submission lock. With the relay, the landing thread sets the fence (late_signal → set, and fence::written now wakes WaitOnAddress waiters too), so the settle moved nothing and only held the lock. The settle still runs once at the 250 ms FORCE_AFTER.
  • VICTORY_FIRST_UPLOAD_CARD_PERCENT (92; 0: off). First uploads past the room line that need new card memory stop at 92 % of the budget, weighed against use less the free texture blocks. An upload that fits a free range still goes in (widest_free is looked up from that line). In a 30-minute run, texture copies went from 3.4 to 5.8 GB and the card's use to 9.7 GB of a 6.9 GB budget, and nothing could evict them.
  • VICTORY_TARGETS_PEAK_DECAY (on for budgets ≤ 8.5 GiB): the render-target reserve's peak halves every 20 s once targets hold still. 1.7–2.1 GB stayed reserved for the whole run, and 183 of 190 room checks said "no room".
  • VICTORY_FG_ROOM_ONCE (on for budgets ≤ 8.5 GiB): the launcher's 80 % frame-generation line (VICTORY_FRAMEGEN_ROOM_RESERVE) is lifted after 5 s of DLSS frame generation, once its resources are counted in the card's use. It ignores gaps under 10 s. A line set by hand is never lifted.
  • VICTORY_WROTE_PARTS (on): watch::wrote marks only the 4 KiB parts a write of ours met, not the whole 64 KiB page.
  • Release-build counters: dropped draws by reason (no host pipeline / structure-builder stage / pipeline there but bindings not made) every 5 s. The F1/F3 note "N draws skipped, their shaders cannot be converted yet" now counts only draws without a host pipeline: in one run 586,859 of the drops were the structure builder's stages left out on purpose, against 1,809 without a pipeline. Players read the old number as broken textures.

2. Submitting thread (cores.rs, list/thin.rs, host.rs, host/card_steps.rs, shadow.rs)

  • VICTORY_LIST_BELOW_SUBMIT (on; 0: as before): list translators run one priority below victory-submit unless set by hand. With VICTORY_HELPER_PRIORITY=1 and no placing, they ran at its own ABOVE_NORMAL, with 653 ms of translation a frame beside it on 12 logical processors.
  • VICTORY_SWEEP_ASIDE=1 (opt-in): the once-a-second sweep runs on a victory-sweep thread, without the slot eviction. A flush (F7/F8) stays on the submitting thread. It cost 9–13 ms a frame plus a ~100 ms stall once a second.
  • VICTORY_THIN_THREADS=auto (physical cores less two); VICTORY_REFRESH_INLINE=<n> (default 0: nothing changes); planning-time split by part in the card-steps line; slot writes split from 64 a submission.

3. RAM on a 32 GB PC (shadow.rs, procmem.rs, cores.rs, land.rs, pipeline/make.rs, host.rs, host/send.rs)

  • VICTORY_BUFFER_COPY_IDLE_S (30; 0: never) and VICTORY_BUFFER_COPY_IDLE_FREE_MB (4096): while the PC has under 4 GiB free, host copies of title buffers idle 30 s and 60 frames are let go. This applies only to copies nothing holds (no list, pass, snapshot or descriptor slot), never shader-written or kept for stores by address, and not a window, placed, mapped or an arena's. Before, a title buffer's copy was never let go while the title kept the buffer: 4,355 copies held 6 GB with 572 MB of the PC's memory free.
  • VICTORY_THREADS_BY_CORES=1 (opt-in): pools sized by physical cores (translators 8→5, wide, land, pipeline workers, DirectStorage), the last physical core for the submitting thread at HIGHEST, translators at NORMAL.
  • The process memory: line splits private bytes at host addresses by region size, and splits write-combined bytes by whether they are in the working set. With Resizable BAR the driver maps the card's own memory write-combined: the "8.1 GB of upload memory" was VRAM, not RAM (checked with a small probe). It also prints the layer's upload pools.

Measured

All measurements are on the RTX 4060 PC above, open world, Series S profile, from release-build log lines. They were taken on v2026.11.29.01/.02 with these changes (plus #1944 and #1937 merged locally, which are not part of this PR). They have not yet been re-measured on .05.

before after
submitting thread waiting for the submission lock 33.4 ms/frame 0.0
title threads waiting at presents 28.8 ms/frame 0.0–23.5
card's use, median / max of budget (30 min) 118 % / 143 % 99–102 % / 104 %
frame time, free roam, similar draw counts ~108 ms ~50–66 ms
draws dropped "not bound" (slots, with .02's 393,216) 13,625 0–1

Most of these come from separate free-roam sessions, so scenes differ. The last two runs replayed one recorded controller route (VICTORY_INPUT_REPLAY) and were compared at matching draw counts. Those runs also showed that renderer port 1 with the title's 32-bit heap in system memory costs 10–20 ms a frame on this PCIe x8 card. It is left as it is in this PR.

Tests

On this branch (on v2026.11.29.05):

  • cargo build --release -p victory: OK.
  • cargo test -p victory-gpu --lib -- --test-threads=1: 931 passed, 1 failed. The failure, shader_cache::tests::every_switch_of_the_translator_is_in_the_key, fails on the plain release too (KEYED still names VICTORY_SCALAR_SPLITS, which the translator no longer reads).
  • cargo test -p victory: 83 passed.
  • cargo clippy -p victory-gpu --release: 29 warnings, the same per file as plain v2026.11.29.05, so none are new.

🤖 Generated with Claude Code

**@⁠Zedwhyrex** on GitHub · 2026-11-30 00:06 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/3500) `Zedwhyrex:perf-8gb-pr` → `main` · +1576 −76 · 16 files · 3 commits · closed without merging Frame time and memory on an 8 GB card / 6-core CPU / 32 GB PC (RTX 4060 8 GB on PCIe 4.0 x8, Resizable BAR on, Ryzen 5 7600, Windows 11). Three commits, each change logged once at start and switchable; the opt-in ones change nothing unless set. ## What changes **1. 8 GB cards and the submitting thread** (`fence.rs`, `resource.rs`, `streamline.rs`, `draw.rs`, `watch.rs`, `host.rs`, `host/panel.rs`) - `VICTORY_FENCE_NARROW` (on with the relay; `0`: as before). A title thread blocked on a fence (null-event `SetEventOnCompletion`) waits for that value alone instead of settling every flight while it holds the submission lock. With the relay, the landing thread sets the fence (`late_signal` → `set`, and `fence::written` now wakes `WaitOnAddress` waiters too), so the settle moved nothing and only held the lock. The settle still runs once at the 250 ms `FORCE_AFTER`. - `VICTORY_FIRST_UPLOAD_CARD_PERCENT` (92; `0`: off). First uploads past the room line that need **new** card memory stop at 92 % of the budget, weighed against use less the free texture blocks. An upload that fits a free range still goes in (`widest_free` is looked up from that line). In a 30-minute run, texture copies went from 3.4 to 5.8 GB and the card's use to 9.7 GB of a 6.9 GB budget, and nothing could evict them. - `VICTORY_TARGETS_PEAK_DECAY` (on for budgets ≤ 8.5 GiB): the render-target reserve's peak halves every 20 s once targets hold still. 1.7–2.1 GB stayed reserved for the whole run, and 183 of 190 room checks said "no room". - `VICTORY_FG_ROOM_ONCE` (on for budgets ≤ 8.5 GiB): the launcher's 80 % frame-generation line (`VICTORY_FRAMEGEN_ROOM_RESERVE`) is lifted after 5 s of DLSS frame generation, once its resources are counted in the card's use. It ignores gaps under 10 s. A line set by hand is never lifted. - `VICTORY_WROTE_PARTS` (on): `watch::wrote` marks only the 4 KiB parts a write of ours met, not the whole 64 KiB page. - Release-build counters: dropped draws by reason (no host pipeline / structure-builder stage / pipeline there but bindings not made) every 5 s. The F1/F3 note "N draws skipped, their shaders cannot be converted yet" now counts only draws without a host pipeline: in one run 586,859 of the drops were the structure builder's stages left out on purpose, against 1,809 without a pipeline. Players read the old number as broken textures. **2. Submitting thread** (`cores.rs`, `list/thin.rs`, `host.rs`, `host/card_steps.rs`, `shadow.rs`) - `VICTORY_LIST_BELOW_SUBMIT` (on; `0`: as before): list translators run one priority below `victory-submit` unless set by hand. With `VICTORY_HELPER_PRIORITY=1` and no placing, they ran at its own `ABOVE_NORMAL`, with 653 ms of translation a frame beside it on 12 logical processors. - `VICTORY_SWEEP_ASIDE=1` (opt-in): the once-a-second sweep runs on a `victory-sweep` thread, without the slot eviction. A flush (F7/F8) stays on the submitting thread. It cost 9–13 ms a frame plus a ~100 ms stall once a second. - `VICTORY_THIN_THREADS=auto` (physical cores less two); `VICTORY_REFRESH_INLINE=<n>` (default 0: nothing changes); planning-time split by part in the card-steps line; slot writes split from 64 a submission. **3. RAM on a 32 GB PC** (`shadow.rs`, `procmem.rs`, `cores.rs`, `land.rs`, `pipeline/make.rs`, `host.rs`, `host/send.rs`) - `VICTORY_BUFFER_COPY_IDLE_S` (30; `0`: never) and `VICTORY_BUFFER_COPY_IDLE_FREE_MB` (4096): while the PC has under 4 GiB free, host copies of title buffers idle 30 s and 60 frames are let go. This applies only to copies nothing holds (no list, pass, snapshot or descriptor slot), never shader-written or kept for stores by address, and not a window, placed, mapped or an arena's. Before, a title buffer's copy was never let go while the title kept the buffer: 4,355 copies held 6 GB with 572 MB of the PC's memory free. - `VICTORY_THREADS_BY_CORES=1` (opt-in): pools sized by physical cores (translators 8→5, wide, land, pipeline workers, DirectStorage), the last physical core for the submitting thread at `HIGHEST`, translators at `NORMAL`. - The `process memory:` line splits private bytes at host addresses by region size, and splits write-combined bytes by whether they are in the working set. With Resizable BAR the driver maps the card's own memory write-combined: the "8.1 GB of upload memory" was VRAM, not RAM (checked with a small probe). It also prints the layer's upload pools. ## Measured All measurements are on the RTX 4060 PC above, open world, Series S profile, from release-build log lines. They were taken on v2026.11.29.01/.02 with these changes (plus #1944 and #1937 merged locally, which are **not** part of this PR). They have **not yet been re-measured on .05**. | | before | after | |---|---|---| | submitting thread waiting for the submission lock | 33.4 ms/frame | 0.0 | | title threads waiting at presents | 28.8 ms/frame | 0.0–23.5 | | card's use, median / max of budget (30 min) | 118 % / 143 % | 99–102 % / 104 % | | frame time, free roam, similar draw counts | ~108 ms | ~50–66 ms | | draws dropped "not bound" (slots, with .02's 393,216) | 13,625 | 0–1 | Most of these come from separate free-roam sessions, so scenes differ. The last two runs replayed one recorded controller route (`VICTORY_INPUT_REPLAY`) and were compared at matching draw counts. Those runs also showed that renderer port 1 with the title's 32-bit heap in system memory **costs** 10–20 ms a frame on this PCIe x8 card. It is left as it is in this PR. ## Tests On this branch (on v2026.11.29.05): - `cargo build --release -p victory`: OK. - `cargo test -p victory-gpu --lib -- --test-threads=1`: 931 passed, 1 failed. The failure, `shader_cache::tests::every_switch_of_the_translator_is_in_the_key`, fails on the plain release too (`KEYED` still names `VICTORY_SCALAR_SPLITS`, which the translator no longer reads). - `cargo test -p victory`: 83 passed. - `cargo clippy -p victory-gpu --release`: 29 warnings, the same per file as plain v2026.11.29.05, so none are new. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
- Blocking fence waits (VICTORY_FENCE_NARROW, on with the relay): a title
  thread blocked on a fence waits for that value alone instead of settling
  every flight under the submission lock. RTX 4060 open world: 33.4 ms a
  frame of the submitting thread waiting for that lock, 0.0 ms after.
- First uploads past the room line (VICTORY_FIRST_UPLOAD_CARD_PERCENT, 92):
  uploads that need new card memory stop at 92 % of the budget, weighed
  against use less the free texture blocks; one that fits a free range still
  goes in. A 30-minute run had texture copies grow from 3.4 to 5.8 GB and the
  card's use to 9.7 GB of a 6.9 GB budget.
- Render-target reserve (VICTORY_TARGETS_PEAK_DECAY, small cards): its peak
  halves every 20 s once the targets hold still (1.7-2.1 GB were kept for the
  run; 183 of 190 room checks said "no room").
- Frame generation's memory counted once (VICTORY_FG_ROOM_ONCE, small cards):
  the launcher's 80 % line is lifted after 5 s of DLSS frame generation, whose
  resources are then in the card's use; a line set by hand stays.
- watch::wrote marks the 4 KiB parts a write of ours met (VICTORY_WROTE_PARTS).
- Dropped draws counted by why in release builds, and the stats panel's
  "shaders cannot be converted" note counts only draws without a host
  pipeline (most were the structure builder's stages, left out on purpose).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
- List translators run one priority below victory-submit unless set by hand
  (VICTORY_LIST_BELOW_SUBMIT=0: as before). With VICTORY_HELPER_PRIORITY=1
  and no placing they ran at its own ABOVE_NORMAL on a 6-core/12-thread
  part, 653 ms of translation a frame beside it.
- VICTORY_SWEEP_ASIDE=1 (opt-in): the once-a-second sweep runs on a thread of
  its own, without the slot eviction; a flush (F7/F8) stays on the
  submitting thread. It cost 9-13 ms a frame there and a ~100 ms stall once
  a second.
- VICTORY_THIN_THREADS=auto: physical cores less two.
- Card-steps planning split by part in its per-frame line; slot writes split
  eight ways from 64 a submission (VICTORY_CARD_STEPS_SLOT_PARTS_MIN).
- VICTORY_REFRESH_INLINE=<n> (default 0, nothing changes): small refresh
  flushes run on the submitting thread.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
- Host copies of title buffers idle 30 s and 60 frames are let go while the
  PC has under 4 GiB free (VICTORY_BUFFER_COPY_IDLE_S, 0: never;
  VICTORY_BUFFER_COPY_IDLE_FREE_MB). Only copies nothing holds: no list,
  pass, snapshot or descriptor slot, never shader-written or kept for stores
  by address, not a window, placed, mapped or an arena's. A title buffer's
  copy was never let go while the title kept the buffer: 4,355 copies held
  6 GB with 572 MB of the PC's memory free.
- VICTORY_THREADS_BY_CORES=1 (opt-in): pools sized by physical cores
  (translators, wide, land, pipeline workers, DirectStorage), the last
  physical core for the submitting thread at HIGHEST, translators at NORMAL.
- The "process memory:" line splits private bytes at host addresses by
  region size, and the write-combined bytes by whether they are in the
  working set: on a PC with Resizable BAR the driver maps the card's own
  memory write-combined (8.1 GB of "upload memory" was VRAM, not RAM); it
  also prints the layer's upload pools (VICTORY_PROCMEM_WC_SPLIT=0: no
  working-set query).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-30 00:11:35 +00:00
Author
Owner

@⁠Zedwhyrex on GitHub · 2026-11-30 01:07 UTC · original

Re-measured on v2026.11.29.05. Same PC (RTX 4060 8 GB, PCIe 4.0 x8, Ryzen 5 7600, 32 GB). The settings were Series X, DLSS Balanced and frame generation 2x; the opt-ins were off for the PR build. I replayed one recorded controller route (VICTORY_INPUT_REPLAY) four times, alternating plain .05 and .05 with this PR, each build warmed first.

Result: on .05 this route shows no measurable difference. Medians over gameplay seconds (more than 3,000 draws a frame, stall frames excluded):

run submission lock wait in submissions title wait at presents submit thread worked
.05 #1 0.0 ms 41.5 13.3 66.2
.05 #2 0.0 46.8 5.3 71.2
.05 + PR #1 0.0 45.8 4.8 70.2
.05 + PR #2 0.0 48.9 5.7 68.9

On .05 no blocking fence wait happens on this route, so VICTORY_FENCE_NARROW has nothing to act on there. On .01 the same path cost 33.4 ms a frame. The ten memory-tracking PRs in .05 already removed much of the submit-thread load measured before. Frame times at matching draw counts range from −20 % to +9 % between the builds. That is within the noise of these replays: the runs drifted into different scenes, and the last PR run overlapped with compile work on the same PC.

What this PR still does on .05:

  • Blocking fence waits: nothing settles every flight under the submission lock when a title thread blocks on a fence. This matters in scenes that make such waits.
  • 8 GB cards: first uploads stay under 92 % of the budget for new card memory, the render-target reserve decays, and frame generation's memory is counted once.
  • RAM: idle title-buffer copies are let go under memory pressure. The process memory line now splits write-combined bytes: the "8 GB of upload memory" on a Resizable BAR PC is the card's own memory.
  • Panel: the "shaders cannot be converted" note counts only draws without a pipeline.

Unrelated to this PR, found in the plain .05 replay: going into water drops to 0.1 fps. Each frame waits about 10 s (title threads "waited 10075.8 ms at presents") while pipeline::make logs "draws dropped for pipelines not made yet ... keys=860c083c452e76d06f0063ae9d750323 a6d3d14fe71eae87bd70a363c8c79692" with 0 being made. I'm looking into it separately.

**@⁠Zedwhyrex** on GitHub · 2026-11-30 01:07 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/3500#issuecomment-7265869543) Re-measured on v2026.11.29.05. Same PC (RTX 4060 8 GB, PCIe 4.0 x8, Ryzen 5 7600, 32 GB). The settings were Series X, DLSS Balanced and frame generation 2x; the opt-ins were off for the PR build. I replayed one recorded controller route (`VICTORY_INPUT_REPLAY`) four times, alternating plain .05 and .05 with this PR, each build warmed first. Result: **on .05 this route shows no measurable difference.** Medians over gameplay seconds (more than 3,000 draws a frame, stall frames excluded): | run | submission lock wait | in submissions | title wait at presents | submit thread worked | |---|---|---|---|---| | .05 #1 | 0.0 ms | 41.5 | 13.3 | 66.2 | | .05 #2 | 0.0 | 46.8 | 5.3 | 71.2 | | .05 + PR #1 | 0.0 | 45.8 | 4.8 | 70.2 | | .05 + PR #2 | 0.0 | 48.9 | 5.7 | 68.9 | On .05 no blocking fence wait happens on this route, so `VICTORY_FENCE_NARROW` has nothing to act on there. On .01 the same path cost 33.4 ms a frame. The ten memory-tracking PRs in .05 already removed much of the submit-thread load measured before. Frame times at matching draw counts range from −20 % to +9 % between the builds. That is within the noise of these replays: the runs drifted into different scenes, and the last PR run overlapped with compile work on the same PC. What this PR still does on .05: - **Blocking fence waits:** nothing settles every flight under the submission lock when a title thread blocks on a fence. This matters in scenes that make such waits. - **8 GB cards:** first uploads stay under 92 % of the budget for new card memory, the render-target reserve decays, and frame generation's memory is counted once. - **RAM:** idle title-buffer copies are let go under memory pressure. The process memory line now splits write-combined bytes: the "8 GB of upload memory" on a Resizable BAR PC is the card's own memory. - **Panel:** the "shaders cannot be converted" note counts only draws without a pipeline. Unrelated to this PR, found in the plain .05 replay: going into water drops to 0.1 fps. Each frame waits about 10 s (title threads "waited 10075.8 ms at presents") while `pipeline::make` logs "draws dropped for pipelines not made yet ... keys=860c083c452e76d06f0063ae9d750323 a6d3d14fe71eae87bd70a363c8c79692" with 0 being made. I'm looking into it separately.
Author
Owner

@⁠korbannour578-alt on GitHub · 2026-12-01 12:05 UTC · original

Test result on an RTX 4060 Laptop 8 GB (i7-13620H 6P+4E, 32 GB RAM, NVIDIA 610.78), Series S profile, build 5fabb46e + the warpGTAIV/VIctory-8GB small-card policy.

I applied parts 1 and 3 (narrowed fence waits, first uploads under the budget, idle buffer copies let go). Part 2 and the thread sizing didn't apply cleanly on top of my build, so I skipped them.

  • calm areas: 14.5-15 fps
  • data sent up per frame: ~50 MB vs ~73-74 MB before
  • average incl. heavy driving: ~12.0 fps vs ~11.4 before
  • no new visual problems seen; free RAM ~4 GB while playing

Small but real gain, so I'm keeping it. Thanks!

Full laptop report: #4868

**@⁠korbannour578-alt** on GitHub · 2026-12-01 12:05 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/3500#issuecomment-7310645152) Test result on an RTX 4060 Laptop 8 GB (i7-13620H 6P+4E, 32 GB RAM, NVIDIA 610.78), Series S profile, build 5fabb46e + the warpGTAIV/VIctory-8GB small-card policy. I applied **parts 1 and 3** (narrowed fence waits, first uploads under the budget, idle buffer copies let go). Part 2 and the thread sizing didn't apply cleanly on top of my build, so I skipped them. - calm areas: 14.5-15 fps - data sent up per frame: ~50 MB vs ~73-74 MB before - average incl. heavy driving: ~12.0 fps vs ~11.4 before - no new visual problems seen; free RAM ~4 GB while playing Small but real gain, so I'm keeping it. Thanks! Full laptop report: #4868
github-bot closed this pull request 2026-12-01 18:58:30 +00:00

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