Pipelines: the library is not saved again mid-burst or under memory pressure (stutters on 32 GB PCs) #81

Merged
harrisotiropoulos-jpg merged 1 commit from upstream-pr/81 into main 2026-11-28 19:01:28 +00:00
harrisotiropoulos-jpg commented 2026-11-27 17:15:17 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by harrisotiropoulos-jpg on 2026-11-27T17:15:17Z.


Every save of the host pipeline library serialises the whole library (over a gigabyte once warm) and holds off every store while it does. On a 32 GB PC, two cases turned that into hitches.

1. Saves in the middle of a burst of new pipelines. A worker saved the library every 20 s while pipelines were still queued, which is a new area or a cutscene, exactly when the title is waiting on them. The write also competed with texture streaming for the disk. Saves in a burst now come at most every 180 s (VICTORY_LIBRARY_SAVE_BUSY_S; 20 restores the old behaviour). The first one waits a full interval too.

2. Saves under host memory pressure. The serialised library is written through the PC's memory and pushes the title's own pages out. On an RTX 4080 with 32 GB, the log shows the layer going pressured a minute in (available_commit_mib=3446 with physical_free_mib=9402) and staying pressured for the rest of the 28-minute session. Live counters during play showed about 6,700 hard page faults a second, and the frame lines show the worst windows (5–8 fps) with the card idle while the title had not submitted. While residency::pressured() holds, the periodic save now waits 600 s instead of 20 s.

The save when the queue runs dry (outside pressure) and the save at exit (save(true)) are unchanged, so nothing made is lost unless the process ends without a save.

Changes

  • pipeline/library.rs: new save_while_busy() with its own interval. save() uses a 600 s interval while pressured.
  • pipeline/make.rs: the worker calls save_while_busy() instead of save(false) when more pipelines are still queued.

Testing

  • cargo build --release --locked -p victory succeeds.
  • cargo test --release -p victory-gpu --lib: 414 passed. The 2 failures (indirect::tests::host_list_budget_starts_empty_at_each_submission, warp_batch_charges_every_execution) fail the same way on main, and #67 addresses them.
  • cargo clippy -p victory-gpu --all-targets -- -D warnings reports nothing in the two changed files. It does fail on main already, for other files.
  • cargo xtask policy --staged: ok.
  • In-game: the user reports clearly fewer stutters on Series X at 1440p. That run also had a larger page file and other apps closed, so the improvement is not isolated to this change. A clean A/B with VICTORY_LIBRARY_SAVE_BUSY_S=20 would isolate case 1.

🤖 Generated with Claude Code

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:issue:5530507243 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/81). Originally posted by [harrisotiropoulos-jpg](https://github.com/harrisotiropoulos-jpg) on 2026-11-27T17:15:17Z. --- Every save of the host pipeline library serialises the whole library (over a gigabyte once warm) and holds off every store while it does. On a 32 GB PC, two cases turned that into hitches. **1. Saves in the middle of a burst of new pipelines.** A worker saved the library every 20 s while pipelines were still queued, which is a new area or a cutscene, exactly when the title is waiting on them. The write also competed with texture streaming for the disk. Saves in a burst now come at most every 180 s (`VICTORY_LIBRARY_SAVE_BUSY_S`; `20` restores the old behaviour). The first one waits a full interval too. **2. Saves under host memory pressure.** The serialised library is written through the PC's memory and pushes the title's own pages out. On an RTX 4080 with 32 GB, the log shows the layer going pressured a minute in (`available_commit_mib=3446` with `physical_free_mib=9402`) and staying pressured for the rest of the 28-minute session. Live counters during play showed about 6,700 hard page faults a second, and the frame lines show the worst windows (5–8 fps) with the card idle while the title had not submitted. While `residency::pressured()` holds, the periodic save now waits 600 s instead of 20 s. The save when the queue runs dry (outside pressure) and the save at exit (`save(true)`) are unchanged, so nothing made is lost unless the process ends without a save. ### Changes - `pipeline/library.rs`: new `save_while_busy()` with its own interval. `save()` uses a 600 s interval while pressured. - `pipeline/make.rs`: the worker calls `save_while_busy()` instead of `save(false)` when more pipelines are still queued. ### Testing - `cargo build --release --locked -p victory` succeeds. - `cargo test --release -p victory-gpu --lib`: 414 passed. The 2 failures (`indirect::tests::host_list_budget_starts_empty_at_each_submission`, `warp_batch_charges_every_execution`) fail the same way on `main`, and #67 addresses them. - `cargo clippy -p victory-gpu --all-targets -- -D warnings` reports nothing in the two changed files. It does fail on `main` already, for other files. - `cargo xtask policy --staged`: ok. - In-game: the user reports clearly fewer stutters on Series X at 1440p. That run also had a larger page file and other apps closed, so the improvement is **not isolated to this change**. A clean A/B with `VICTORY_LIBRARY_SAVE_BUSY_S=20` would isolate case 1. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
fladit123 commented 2026-11-27 19:22:59 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by fladit123 on 2026-11-27T19:22:59Z.

Review: CHANGES_REQUESTED


Request changes

Thanks for addressing pipeline-library serialization during busy periods and memory pressure. Independent synthetic testing confirms that the proposed policy reduces unnecessary mid-burst work.

Validation

Reviewed HEAD: a162ae7f9facefa6b23ed897da12a96b4dac9c40.

Tested baseline: 29d8dbf7d9892ceb8bec378a9dbc3c4f2931b745.

Both revisions passed:

  • 26/26 existing pipeline and residency tests.
  • 13/13 instrumented simulated-clock scenarios using real synthetic D3D12 graphics PSOs.

The fixtures exercise the original save functions, substituting the scheduling clock and pressure state rather than implementing a separate scheduler model.

In the default busy sequence, the candidate reduced blob publications from five to two and serialized bytes from 43,862 to 24,794.

The contention fixture also confirmed that serialization holds the writer lock required by pipeline stores.

P2 — A rejected inner save consumes the next busy interval

In pipeline/library.rs:630–650, save_while_busy() updates its timestamp before calling save(false).

A reproduced sequence was:

  • t=179: a drain publishes the library.
  • t=181: a busy callback passes the outer gate, but the shared gate rejects the save.
  • t=199: the shared interval has elapsed, but the candidate's busy gate remains closed.
  • t=361: the candidate finally publishes again.

The rejected attempt delays the next publication by 162 simulated seconds compared with the baseline.

Please preserve the next eligible busy opportunity when the shared gate rejects a save. A unified admission policy or explicit save outcomes could address this without a broad refactor.

P2 — Clarify deferred persistence when the queue stays empty

A final worker completion under pressure can be rejected by the 600-second gate. If the queue remains empty, subsequent pressure recovery does not independently trigger another save.

The candidate retained pending work until the forced shutdown save in our synthetic scenario.

Please either document this event-driven persistence trade-off or arrange a bounded recheck through an appropriate existing periodic callback.

Related observations:

  • A cold drain can still publish immediately under pressure.
  • VICTORY_LIBRARY_SAVE_BUSY_S=20 does not completely restore the previous behavior because the initial busy delay and pressure-dependent gate remain.
  • The 600-second interval is a minimum admission interval, not a guaranteed maximum time between publications.

Separate pre-existing finding

Both revisions reproduced a persistence failure when serialization succeeds but publication fails.

The added counter is cleared before the rename succeeds. After repairing the destination, a forced save without new stores did not publish the library.

This is not introduced by #81, and I would track it separately rather than expand this PR's scope. It does qualify the stated shutdown persistence guarantee.

Recommendation

The optimization is promising. I recommend retaining it while correcting the interaction between the two scheduling gates and adding deterministic regression tests for the deferred-save policy.

The synthetic results establish fewer serialization operations, not an application FPS improvement.

Hardware: RTX 4060, driver 610.88, Windows 11, 32 GB RAM.

All experiments used synthetic graphics workloads. No game files or execution.

AI-assisted review and testing using OpenAI ChatGPT and Codex.

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:review:6092525319 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/81#pullrequestreview-6092525319). Originally posted by [fladit123](https://github.com/fladit123) on 2026-11-27T19:22:59Z. **Review:** CHANGES_REQUESTED --- **Request changes** Thanks for addressing pipeline-library serialization during busy periods and memory pressure. Independent synthetic testing confirms that the proposed policy reduces unnecessary mid-burst work. ### Validation Reviewed HEAD: `a162ae7f9facefa6b23ed897da12a96b4dac9c40`. Tested baseline: `29d8dbf7d9892ceb8bec378a9dbc3c4f2931b745`. Both revisions passed: - 26/26 existing pipeline and residency tests. - 13/13 instrumented simulated-clock scenarios using real synthetic D3D12 graphics PSOs. The fixtures exercise the original save functions, substituting the scheduling clock and pressure state rather than implementing a separate scheduler model. In the default busy sequence, the candidate reduced blob publications from five to two and serialized bytes from 43,862 to 24,794. The contention fixture also confirmed that serialization holds the writer lock required by pipeline stores. ### P2 — A rejected inner save consumes the next busy interval In `pipeline/library.rs:630–650`, `save_while_busy()` updates its timestamp before calling `save(false)`. A reproduced sequence was: - t=179: a drain publishes the library. - t=181: a busy callback passes the outer gate, but the shared gate rejects the save. - t=199: the shared interval has elapsed, but the candidate's busy gate remains closed. - t=361: the candidate finally publishes again. The rejected attempt delays the next publication by 162 simulated seconds compared with the baseline. Please preserve the next eligible busy opportunity when the shared gate rejects a save. A unified admission policy or explicit save outcomes could address this without a broad refactor. ### P2 — Clarify deferred persistence when the queue stays empty A final worker completion under pressure can be rejected by the 600-second gate. If the queue remains empty, subsequent pressure recovery does not independently trigger another save. The candidate retained pending work until the forced shutdown save in our synthetic scenario. Please either document this event-driven persistence trade-off or arrange a bounded recheck through an appropriate existing periodic callback. Related observations: - A cold drain can still publish immediately under pressure. - `VICTORY_LIBRARY_SAVE_BUSY_S=20` does not completely restore the previous behavior because the initial busy delay and pressure-dependent gate remain. - The 600-second interval is a minimum admission interval, not a guaranteed maximum time between publications. ### Separate pre-existing finding Both revisions reproduced a persistence failure when serialization succeeds but publication fails. The `added` counter is cleared before the rename succeeds. After repairing the destination, a forced save without new stores did not publish the library. This is not introduced by #81, and I would track it separately rather than expand this PR's scope. It does qualify the stated shutdown persistence guarantee. ### Recommendation The optimization is promising. I recommend retaining it while correcting the interaction between the two scheduling gates and adding deterministic regression tests for the deferred-save policy. The synthetic results establish fewer serialization operations, not an application FPS improvement. Hardware: RTX 4060, driver 610.88, Windows 11, 32 GB RAM. All experiments used synthetic graphics workloads. No game files or execution. AI-assisted review and testing using OpenAI ChatGPT and Codex.
POMXARK commented 2026-11-28 04:16:56 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by POMXARK on 2026-11-28T04:16:56Z.


Testing feedback on AMD Ryzen 7 5700X (8C/16T), NVIDIA RTX 5080 16 GB, 32 GB RAM, Windows 11, Series X 1440p + DLSS Quality + DLSS MFG 4× (4 MiB windows, VICTORY_GPU_BCPACK=0, VICTORY_WAIT_RESIDENT=0, VICTORY_TEXTURE_ROOM_PERCENT=70, VICTORY_LAND_SKIP=1, default VICTORY_LIBRARY_SAVE_BUSY_S=180).

Full disclosure: tested on a fork branch based on v2026.11.27.7 (with local GPU patches, x86-64-v3/ThinLTO, PR #516, and PR #340), comparing two identical 12-minute (720 s) 3D runs (3.2k–6.2k draws/frame) with and without PR #81.

12-minute (720 s) A/B results on 32 GB RAM

Metric (3D only, fps < 20, draws >= 100) Baseline (without PR #81) With PR #81 Delta
host pipeline library saved count 14 saves 3 saves (all after pressure subsided, ~37.5 MB) 4.7× fewer
Min free physical RAM (MinRAM) 0.41 GB 0.73 GB +320 MB headroom
Peak commit (CommitMax) 27,667 MB 27,047 MB -620 MB
Peak DXGI Shared (SharedMax / mean) 6,879 / 5,237 MB 6,696 / 5,084 MB -183 / -153 MB
Frames >=250 ms / >=500 ms / GPU>=50 ms 2 / 0 / 0 1 / 0 / 0 (0 in 360..760 s) cleaner
Low-draw 3D (1k–4k draws) 17.20 p50 / 15.66 mean (58.1 ms) 17.55 p50 / 16.17 mean (57.0 ms) +2.0% / +3.3%
Mid-draw 3D (4k–7k draws) 16.65 p50 (60.0 ms, p50=4992 draws) 16.50 p50 (60.7 ms, p50=5160 draws) parity
Stability 0 errors / 198/198 Responding 0 errors / 198/198 Responding clean

Zero pipeline library saves fired during the first 11 minutes of loading/memory pressure, noticeably improving RAM headroom (MinRAM 0.41 -> 0.73 GB, CommitMax -620 MB) on a 32 GB system.

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:comment:7233882895 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/81#issuecomment-7233882895). Originally posted by [POMXARK](https://github.com/POMXARK) on 2026-11-28T04:16:56Z. --- Testing feedback on **AMD Ryzen 7 5700X (8C/16T), NVIDIA RTX 5080 16 GB, 32 GB RAM**, Windows 11, Series X 1440p + DLSS Quality + DLSS MFG 4× (`4 MiB` windows, `VICTORY_GPU_BCPACK=0`, `VICTORY_WAIT_RESIDENT=0`, `VICTORY_TEXTURE_ROOM_PERCENT=70`, `VICTORY_LAND_SKIP=1`, default `VICTORY_LIBRARY_SAVE_BUSY_S=180`). Full disclosure: tested on a fork branch based on `v2026.11.27.7` (with local GPU patches, `x86-64-v3`/ThinLTO, PR #516, and PR #340), comparing two identical 12-minute (720 s) 3D runs (`3.2k–6.2k draws/frame`) with and without PR #81. ### 12-minute (720 s) A/B results on 32 GB RAM | Metric (3D only, `fps < 20`, `draws >= 100`) | Baseline (without PR #81) | With PR #81 | Delta | |---|---:|---:|---:| | **`host pipeline library saved` count** | `14` saves | **`3` saves** (all after pressure subsided, `~37.5 MB`) | **`4.7×` fewer** | | **Min free physical RAM (`MinRAM`)** | `0.41 GB` | **`0.73 GB`** | **`+320 MB` headroom** | | **Peak commit (`CommitMax`)** | `27,667 MB` | **`27,047 MB`** | **`-620 MB`** | | **Peak DXGI Shared (`SharedMax` / mean)** | `6,879` / `5,237 MB` | **`6,696` / `5,084 MB`** | `-183` / `-153 MB` | | **Frames `>=250 ms` / `>=500 ms` / `GPU>=50 ms`** | `2` / `0` / `0` | **`1` / `0` / `0`** (`0` in `360..760 s`) | cleaner | | **Low-draw 3D (`1k–4k draws`)** | `17.20` p50 / `15.66` mean (`58.1 ms`) | **`17.55` p50 / `16.17` mean** (`57.0 ms`) | `+2.0%` / `+3.3%` | | **Mid-draw 3D (`4k–7k draws`)** | `16.65` p50 (`60.0 ms`, `p50=4992 draws`) | **`16.50` p50** (`60.7 ms`, `p50=5160 draws`) | parity | | **Stability** | `0` errors / `198/198` Responding | **`0` errors / `198/198` Responding** | clean | Zero pipeline library saves fired during the first 11 minutes of loading/memory pressure, noticeably improving RAM headroom (`MinRAM 0.41 -> 0.73 GB`, `CommitMax -620 MB`) on a 32 GB system.
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!81
No description provided.