Repository navigation
Card copies: a census, and an opt-in switch that leaves write-combining memory on the card (−11…−20 % frame, 3 GPUs) - #868
Chipsraine wants to merge 4 commits into
Conversation
…memory on the card Both are off by default; without the switches nothing changes. VICTORY_CENSUS=1 logs every 10 s (VICTORY_CENSUS_SECONDS) the title buffers whose host copies are in the card's memory: the XMemVirtualAlloc reservation each lies in with the flags the title asked for (the runtime drops write-combining, uncached and the GPU access bits; the census keeps them), how much of it is physical-page views and how much shows a page at more than one address, and per frame the bytes sent up, the pieces compared and the bytes fetched back. A second line counts the host resources made per frame by kind (read-back, upload, shared, UAV, textures, depth twins, placed, host lists). On an RTX 5080 in the prologue's first room it found 100 copies (about 1 GB); per frame some 100 MB fetched back, 97 to 99 % of it from memory the title reserved write-combining, which the console's CPU does not read back either. VICTORY_SKIP_WC_BACK=1, an experiment: what shaders wrote to copies of write-combining title memory is not fetched back into title memory. VICTORY_SKIP_WC_COMPARE=1 (implies it): those copies are not hashed or compared on the card at all. The CPU's changes are still sent up, and pending ranges are still closed by the flights' declared writes. Expect wrong bytes where the CPU writes part of a piece the card wrote, or reads what the card wrote: a correct form would fetch such a piece on the CPU's first touch (a no-access guard) instead of every frame. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Tried this on a 5080 (16 GB, Win11, Series X profile), on top of f85101b with With Only one run, so I can't say for sure it's the switch. But your caveat about the CPU writing part of a 64 KiB piece the card wrote would fit. I haven't tried FYI there's a small conflict in host.rs against current main, next to the |
… card (-24% frame)
|
Test report on real hardware: AMD RX 6950 XT (RDNA2), Windows 11, Rust 1.98.1, with a GPU present. I merged this PR's head AI-assisted (Claude Code); no game data. |
|
Thanks both for testing. @Ym1r1710: a device removal is exactly the failure the caveat predicts (stale bytes sent up over a piece the card wrote, e.g. indirect arguments), so I'd treat |
A tester's RTX 5080 lost its device about 75 s into the world with it; VICTORY_SKIP_WC_BACK=1 alone has had no device loss in any reported run. The switch stays for measurement, with the warning in its comment and log line. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Chipsraine, we reproduced a separate census accounting gap on PR head The CPU-only regression on Windows 11 25H2 (26200.9974) exercises the production landing loop with synthetic slot buffers and a stub merge. On the parent, copy A records 0 fetched bytes despite 17 bytes landing. On the correction, A records 17 bytes across two spans and B records 14 bytes in one span, matching the global 31 bytes. The stub reports zero title bytes changed. The rejected batch records zero on both revisions. Both regression cases pass with the correction. Correction commit · Reproduction fixture Reservation-range correctness Two CPU regressions expose a separate classification defect on the same PR head. In a synthetic 4 MiB card window spanning two adjacent 2 MiB reservations, the parent classified a 64 KiB write in the ordinary reservation using the write-combining flag at the start of the window. The correction classifies each declared guest interval. Declarations that cross a reservation boundary or include ordinary memory use the normal comparison and readback paths. Writes entirely inside a write-combining reservation still qualify for the experiment. Both regressions pass, covering exact end boundaries, adjacent reservations and integer overflow. Synthetic checks also exercised the direct, relay and compare gates. The separate local RTX 5080 control used default card-window settings. All 99 recorded exact buffer extents fit inside individual observed reservations. The synthetic tests establish the classifier defect, and its effect on the rendered scene remains unmeasured. Reservation-range correction and CPU tests Live RTX 5080 back-only comparison Following Chipsraine’s back-only request, we ran one control-first pair at the same 2542 × 1396 prison window, about 90 seconds per arm, with no replay input during measurement. Both used
Sampled geometry and lighting looked similar and dark areas remained. We stopped both runs deliberately without a logged device removal. This pair measures traffic and display timing in one stationary scene. Guest CPU reads of skipped GPU-written data and later gameplay remain untested. November 25 follow-up. A retrospective check of four matched-view bottom-fifth crops per arm from our single 90-second RTX 5080 pair on |
|
Rebased onto Steady world frames (≥3,000 draws, no pipelines being made), p50:
So
|
4e34eb0 to
7e64279
Compare
|
@iGoldenNinja thanks — both fixes are right and I've taken your two commits as they are ( On the P99 / composed-flip regression: from one 30 s WPR trace of my |
…r runs across the cursor, snapshots flushed before a copy goes, changed runs reused, texture checks side by side, the card-copy census and its write-combining experiment From fxceless/victory-fork's open pull requests: - fxceless#911 (douline): a constant buffer view is at most 64 KiB; the title names larger ones and NVIDIA removes the device for them. - fxceless#932 (avt0m4t48): the search for free dynamic descriptor slots finds a run that lies across its starting point. - fxceless#936 (faycalbaklouti): queued snapshots are taken before a host copy is dropped (a use after free); its test's imports added for this tree. - fxceless#925 (alpz1000): changed-byte runs are found into one buffer reused across pages, the merge gap joined in the same pass. - fxceless#768 (KyleS98): a submission's texture checks run several at a time (`VICTORY_WIDE_TEXTURES=1`, off by default). - fxceless#868 (Chipsraine): a census of the card copies (`VICTORY_CENSUS=1`) and an EXPERIMENT, off by default: `VICTORY_SKIP_WC_COMPARE=1` leaves copies of write-combining title memory out of the compare and the copy-back. Here (RTX 4070, first gameplay scene) it took the median from 213 to 186 ms a frame, best 150 ms; not exact (the title must never read that memory after the card wrote it). With them gameplay went from a median of 233 to 213 ms a frame here. Tried and left off: `VICTORY_CARD_REHASH_RUNS=1` (1,735 passes a frame joined to about 220, no gain). victory-gpu: 174 tests pass (`inplace::...shows_its_bytes_at_its_offset` fails now and then, as before these); victory-hle: 99 pass. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…d victory-lod14.exe Same build and passage: ~7.0 fps without it, 8.0-8.9 with it; copy-back 69-88 -> 10-14 ms, preparing 74-81 -> 45-55 ms, card 80-91% busy; picture checked right in screenshots. PR fxceless#916 (only address-storing shaders mark title memory written) is in the build, on by default. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…-8.0 back to back), run spread, timestamps and viewports Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Second machine with the same CPU class, for
|
|
Long runs on the RTX 5080 (Ryzen 5 5600), from the prologue to the start of chapter 1, on
Draw-matched comparison (the scenes differ a lot in draws, so frames are binned by draws per frame; steady world frames, no pipelines being made), p50:
So on top of the author's set the gain is ~11–13 %, smaller than the 22 % of my earlier short pair: with Game logic: in the switch run the story broke twice (control returned to Lucia in the police car after the cutscene, a scene that does not exist on console; later a switch to Jason in a barely streamed world). The control run without the switch broke at the same two places, so these are not caused by Present timing from WPR (flip mode per present, ~30 s windows in the cell): with the switch p50 130 ms, p99 223 ms, no interval over 500 ms in either independent or composed flip, so the P99 regression reported above did not reproduce here. |
|
Correction to my comment above, after looking at the captures properly (AI-assisted, Claude; same RTX 4070 / Ryzen 5 5600 machine). Picture: I wrote that I found no difference that stands out. That was wrong. In the cell-window shot (world +300, +600, +900), two of the three Speed: the third Census in the B run, world part: per frame about 22-24 MB sent up and 5.5-5.9 MB fetched back, of which 0.0 MB from write-combining memory (as expected with the switch on). I have not run the census with the switch off yet, so I cannot say yet how much write-combining read-back the switch skips; that run is queued. |
|
@xunbreakablex thank you — A-B-A-B at 480 s on a 4070 with the same CPU class is the cleanest measurement in this thread; I've put it at the top of the summary table in the description, next to the other reports. |
|
One more caveat on the speed numbers above (AI-assisted, Claude): on this machine the first game run after each new build looks systematically slow. In two separate chains the first run of the default arm came out at 195.8 and 195.4 ms, while the later default runs of the same binaries were 172.1, 160.1 and 159.0 ms. Both of my comparisons started with such a first run, so the "about 18%" is inflated; against the later default runs the |
|
@Chipsraine thanks. Before it goes in on my numbers, please see my two follow-ups just above yours: (1) two of my three |
|
@Chipsraine a further correction, in your favour: I can no longer attribute the grey stepped patches to |
|
Did the run you asked for, SKIP_WC_BACK=1 alone (no COMPARE), on the current head merged into my tree (ca8829f + #1043), RTX 5080 + 7800X3D, Win11. Base switches RELAY=2, QUEUE2, ASYNC_SUBMIT, INDIRECT_WINDOW, TEXTURE_NO_WAIT, COPY_PLAIN. Three runs to world+800 on the same binary: one with DRED armed (no removal, no warnings), then without DRED with and without the switch. With it: 105 ms median, copy-back ~11 ms. Without: 116.8 ms, copy-back ~49 ms. So about 10% here, close to your draw-binned number. Looked at the captures at world+250, +400 and +800 next to the control run: same picture, no grey blocks or specks. Only the first cell scene though, I haven't played further with it yet. Keeping it on in my build for now. |
…ear u32::MAX) On top of fork PRs fxceless#911 (constant buffer views at most 64 KiB) and fxceless#868 (card copies census, VICTORY_SKIP_WC_BACK), both merged here. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
|
Tested on RTX 5060 Ti 8 GB, 16 GB RAM, Windows 11. The base was fork 🤖 Generated with Claude Code |
…less#868), one view per section (fxceless#231) - Input (diagnostics builds): a key of VICTORY_KEYS is held until the title's reads have seen it down, with repeats and a log line per press. - fxceless#868 (Chipsrain, iGoldenNinja): VICTORY_CENSUS=1 logs what each card copy sends, compares and fetches back; VICTORY_SKIP_WC_BACK=1 is an experiment that leaves on the card what shaders wrote to write-combining title memory. Both off. - fxceless#231 (HailLucifer666): VICTORY_XMEM_PERSISTENT_VIEW=1 keeps one view of a physical-page section instead of a view per write. Off. Nothing changes with the switches unset. Tested as ce18a1a: victory-gpu library suite three runs clean (198 passed, 5 ignored), victory-hle 116 of 116 with and without diagnostics. The build measured next is of that commit; this merge differs from it in the README only. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…ess#231) and scripted keys held until read Three rows under what this fork adds, all off by default or diagnostics only, none measured here yet. English and Spanish. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…alks in warm()
|
A Series S data point on an RTX 5070 Ti (Ryzen 7 9800X3D, Windows 11 build 26200), first gameplay scene, on our own stack: an older fork main plus several open PRs and local changes, including the 2 MiB section patch from #1089.
It's few runs in one scene, so read the frame-time difference as small, not as measured exactly. Edit (2026-11-26), correction: on our stack |
…le memory (VICTORY_CENSUS, VICTORY_SKIP_WC_BACK) All off by default; without the switches nothing changes. VICTORY_CENSUS=1 logs every VICTORY_CENSUS_SECONDS (10) the title buffers whose host copies are in the card's memory: the XMemVirtualAlloc reservation each lies in with the flags the title asked for (kept before the runtime drops write-combining and the GPU bits), how much is physical-page views, and per frame the bytes sent up, the pieces compared and the bytes fetched back; plus host resources made per frame by kind. On an RTX 5080 it found 97-99 % of the bytes fetched back came from memory the title reserved write-combining, which the console's CPU does not read back either. VICTORY_SKIP_WC_BACK=1, an experiment: what shaders wrote to card copies whose declared range lies wholly in write-combining title memory is not fetched back (all three fetch paths: pushed parts, relay fetch, card_back). VICTORY_SKIP_WC_COMPARE=1 also leaves those copies out of the compare; its author marks it unsafe (one device removal reported), so test VICTORY_SKIP_WC_BACK=1 alone first. Port of fxceless#868 (Chipsrain 7e64279, iGoldenNinja b57479c + f9c43fa, Chipsrain fef9592) onto the fork's card-back paths, which cut pieces into 4 KiB parts (card_piece_parts) where fxceless#868 had whole pieces. (cherry picked from commit 7e64279) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017V7WBBU55HJVgqSgZRhMqc
…celess#24/fxceless#104), null CBVs (fxceless#304), tables at list cuts (fxceless#742), heap entries (fxceless#589), barriers (fxceless#787), depth-stencil UAV barriers (fxceless#214), windows ending at recorded writes (fxceless#663), sRGB views (fxceless#644), wide accesses across pages (fxceless#846), view-guard costs (fxceless#812/fxceless#853), the fill latch (fxceless#860), pipeline waits (fxceless#709), robustness; opt-in fxceless#868/fxceless#845
…, VICTORY_SKIP_WC_BACK (off by default)
|
@Chipsraine a data point from a setup that isn't in this thread yet: RTX 5080 without Tree. This PR ( Machine. RTX 5080 16 GB (driver 621.24, 32-lane), Ryzen 7 9800X3D, 64 GB, Windows 11 26300, Series X profile, release build with Runs. A-B-A-B, same binary, 10 minutes each from launch, scripted Enter from the same prologue save (world after 60-120 s). Steady world frames only (≥1,000 draws, no pipelines being made), medians:
So on this machine: copy-back about −45 %, the usual frame −9 to −22 %, about +22 % fps at 4-6k draws. No device removal in any of the four runs. In two screenshots from run 4 (the cell door with the guard, the common room) there are no grey stepped blocks or specks; the scripted input carried the runs to different scenes, so I don't have same-frame comparisons. Two pairs on one machine, so take the size of the gain as approximate. AI-assisted (Claude Code); the numbers are from the run logs. |
Summary
Two opt-in additions about the card copies of title buffers (
crate::shadow::cards). Nothing changes without the switches. Rebased on0b0074e.VICTORY_CENSUS=1(logging only): every 10 s (VICTORY_CENSUS_SECONDS) a census of those copies: theXMemVirtualAllocreservation each lies in with the flags the title asked for (the runtime drops write-combining, uncached and the GPU access bits; the census keeps them), how much of it is physical-page views and how much shows a page at more than one address, and per frame the bytes sent up, pieces compared and bytes fetched back; plus host resources made per frame by kind.VICTORY_SKIP_WC_BACK=1(experiment): what shaders wrote to copies of write-combining title memory is not fetched back into title memory. Declared ranges that cross a reservation boundary or touch ordinary memory still take the normal path (fix by @iGoldenNinja,f9c43fa).VICTORY_SKIP_WC_COMPARE=1(implies it; marked UNSAFE): those copies are not hashed or compared on the card either. One device removal was reported with it (see below); kept only for measurement.Why
The census found ~100 copies (~1 GB) on the card, and per frame ~100 MB fetched back of which 97–99 % comes from memory the title reserved write-combining, i.e. memory the console's CPU writes but does not read back. About half of the uploads were an echo: a fetched piece makes title memory differ from the CPU side, and the next submission sends it up again.
Results for
VICTORY_SKIP_WC_BACK=1(independent testers)All on
0b0074e-era trees with the author's speed set (ASYNC_SUBMIT QUEUE2 INDIRECT_WINDOW TEXTURE_NO_WAIT COPY_PLAIN), warm caches, Series X profile.SKIP_WC_COMPARE)Uploads to the card fall by about half in every report (e.g. 161 → 77 MB/frame here, 140 → 27 MB/frame for @iGoldenNinja).
Known issues and caveats
VICTORY_SKIP_WC_COMPARE=1: one device removal ~75 s into the world on a 5080 (@Ym1r1710); none in other runs. Cause unknown; do not use for play.Verification
cargo build --release -p victory;cargo clippy -p victory-gpu -p victory-hle --all-targets(no new warnings);cargo test --release -p victory-gpu --lib(census, shadow, inplace; @iGoldenNinja's reservation tests included);cargo xtask policy(180 files ok). Numbers only; no game data, captures or screenshots.🤖 Generated with Claude Code