Copy-back compares the 174 MB GPU-heap buffer twice a frame for ~2 MB of writes; upstream cd94d35 + 940d32f fix this (needs 27c3dc9 / c75fdba) #650

Open
opened 2026-11-26 03:48:12 +00:00 by github-bot · 9 comments
Owner

@⁠maplerouteadmin-dev on GitHub · 2026-11-25 04:00 UTC · original

On 310c6eb with VICTORY_TEXTURE_NO_WAIT=1 (see #612), the world runs at 0.8-1.1 s a frame on a Ryzen 5 5600X + RTX 5070 12 GB, and "copying back" is now one of the two largest parts of it: 125-660 ms a frame (typically 125-400), next to 350-480 ms on the GPU.

The host's comparison list says where it goes (one frame-rate period, world, prison yard):

compared after submissions: 407 ranges; the largest follow
compared 0x3fa00000+0xae00000: 2.0x/frame, 364.90 MB/frame, 2.255 MB/frame of it written back
compared 0xfb2600000+0x3200000: 2.0x/frame, 104.86 MB/frame, 9.381 MB/frame of it written back
compared 0xd6b610000+0x5a00000: 1.0x/frame, 94.37 MB/frame, 17.366 MB/frame of it written back
compared 0xfb5800000+0x1900000: 2.0x/frame, 52.43 MB/frame, 0.476 MB/frame of it written back
compared 0x1011920000+0x2400000: 1.0x/frame, 37.75 MB/frame, 6.526 MB/frame of it written back
compared 0x10085e0000+0x1800000: 1.0x/frame, 25.17 MB/frame, 0.000 MB/frame of it written back
compared 0x1013e20000+0x1800000: 1.0x/frame, 25.17 MB/frame, 0.000 MB/frame of it written back

The first one is the title's 174 MB GPU-heap buffer: 365 MB compared a frame for 2.3 MB written back (99.4 % unchanged). Over the top eight, about 730 MB is compared a frame for about 36 MB that changed.

Upstream fixed exactly this last night:

  • cd94d35 "GPU: shaders mark the pages they write through views; copy-backs compare only those": the translation sets a bit per 64 KiB title page for every store or atomic through an unordered buffer view, and after a submission only marked pages are compared and written back. Its commit message measures the same buffer: 2.8-4.5 GB snapshotted a frame, 98 % unchanged, 0.45-0.7 s of a 1.5-1.7 s intro frame.
  • 940d32f a follow-up (a marked page's copy-back does not save the page for its own copy).

I tried cherry-picking them onto 310c6eb: about 85 conflict hunks in 20 files, because they build on two upstream rewrites the fork does not have, 27c3dc9 (title memory at raw addresses through a page table) and c75fdba (views the shaders pick from the heap, one change journal). So it is not a drop-in; flagging it in case it fits the next upstream merge, or the idea is worth redoing on the fork's own copy-back path. Happy to measure a build that has it on this machine (12 GB NVIDIA, 6-core).

**@⁠maplerouteadmin-dev** on GitHub · 2026-11-25 04:00 UTC · [original](https://github.com/fxceless/victory-fork/issues/650) On `310c6eb` with `VICTORY_TEXTURE_NO_WAIT=1` (see #612), the world runs at 0.8-1.1 s a frame on a Ryzen 5 5600X + RTX 5070 12 GB, and "copying back" is now one of the two largest parts of it: **125-660 ms a frame** (typically 125-400), next to 350-480 ms on the GPU. The host's comparison list says where it goes (one frame-rate period, world, prison yard): ``` compared after submissions: 407 ranges; the largest follow compared 0x3fa00000+0xae00000: 2.0x/frame, 364.90 MB/frame, 2.255 MB/frame of it written back compared 0xfb2600000+0x3200000: 2.0x/frame, 104.86 MB/frame, 9.381 MB/frame of it written back compared 0xd6b610000+0x5a00000: 1.0x/frame, 94.37 MB/frame, 17.366 MB/frame of it written back compared 0xfb5800000+0x1900000: 2.0x/frame, 52.43 MB/frame, 0.476 MB/frame of it written back compared 0x1011920000+0x2400000: 1.0x/frame, 37.75 MB/frame, 6.526 MB/frame of it written back compared 0x10085e0000+0x1800000: 1.0x/frame, 25.17 MB/frame, 0.000 MB/frame of it written back compared 0x1013e20000+0x1800000: 1.0x/frame, 25.17 MB/frame, 0.000 MB/frame of it written back ``` The first one is the title's 174 MB GPU-heap buffer: 365 MB compared a frame for 2.3 MB written back (99.4 % unchanged). Over the top eight, about 730 MB is compared a frame for about 36 MB that changed. Upstream fixed exactly this last night: - **cd94d35** "GPU: shaders mark the pages they write through views; copy-backs compare only those": the translation sets a bit per 64 KiB title page for every store or atomic through an unordered buffer view, and after a submission only marked pages are compared and written back. Its commit message measures the same buffer: 2.8-4.5 GB snapshotted a frame, 98 % unchanged, 0.45-0.7 s of a 1.5-1.7 s intro frame. - **940d32f** a follow-up (a marked page's copy-back does not save the page for its own copy). I tried cherry-picking them onto `310c6eb`: about 85 conflict hunks in 20 files, because they build on two upstream rewrites the fork does not have, **27c3dc9** (title memory at raw addresses through a page table) and **c75fdba** (views the shaders pick from the heap, one change journal). So it is not a drop-in; flagging it in case it fits the next upstream merge, or the idea is worth redoing on the fork's own copy-back path. Happy to measure a build that has it on this machine (12 GB NVIDIA, 6-core).
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 03:48:12 +00:00
Author
Owner

@⁠MrEjecutor on GitHub · 2026-11-25 04:24 UTC · original

A data point for this on an RTX 5060 Ti (Blackwell, driver 621.24, Windows 11 26200, Intel Core Ultra 5 225F, 32 GB, Series X profile), the mean of 60 world samples of the frame-rate line in each run:

build on the GPU copying back
upstream 70564ae (+ two NVIDIA boot fixes, three compute programs skipped, see Marvisak/VIctory#1968) 441 ms 136 ms for 20.2 MB
upstream 940d32f (same, so with cd94d35) 556 ms 47 ms for 0.2 MB
this fork at 310c6eb, VICTORY_TEXTURE_GUARD=0 165 ms 274 ms for 67.4 MB

So on this card too, cd94d35 takes copying back from the largest part of a frame to a small one, while this fork's GPU part is about three times shorter than upstream's (upstream draws a black scene here, with three programs skipped, so its GPU number is not a like-for-like comparison). Bringing the page marks over would matter more here than anything else in the frame outside the GPU.

Not tested: the cherry-pick itself; the same scene in all three (different runs, different places in the prologue).

AI-assisted (Claude Code); checked by mrejecutor. No game data attached.

**@⁠MrEjecutor** on GitHub · 2026-11-25 04:24 UTC · [original](https://github.com/fxceless/victory-fork/issues/650#issuecomment-7152820881) A data point for this on an RTX 5060 Ti (Blackwell, driver 621.24, Windows 11 26200, Intel Core Ultra 5 225F, 32 GB, Series X profile), the mean of 60 world samples of the frame-rate line in each run: | build | on the GPU | copying back | |---|---|---| | upstream `70564ae` (+ two NVIDIA boot fixes, three compute programs skipped, see Marvisak/VIctory#1968) | 441 ms | 136 ms for 20.2 MB | | upstream `940d32f` (same, so with `cd94d35`) | 556 ms | **47 ms for 0.2 MB** | | this fork at `310c6eb`, `VICTORY_TEXTURE_GUARD=0` | **165 ms** | 274 ms for 67.4 MB | So on this card too, `cd94d35` takes copying back from the largest part of a frame to a small one, while this fork's GPU part is about three times shorter than upstream's (upstream draws a black scene here, with three programs skipped, so its GPU number is not a like-for-like comparison). Bringing the page marks over would matter more here than anything else in the frame outside the GPU. Not tested: the cherry-pick itself; the same scene in all three (different runs, different places in the prologue). AI-assisted (Claude Code); checked by mrejecutor. No game data attached.
Author
Owner

@⁠firefloc on GitHub · 2026-11-25 09:56 UTC · original

Linux/RADV data point on this, plus a reachability problem for the fix.

Run: origin/main 9376fd6 (merged today), VICTORY_NO_WATCHDOG=1, VICTORY_LATE_WAIT=3 VICTORY_WIDE_BACK=1 VICTORY_CARD_BUFFERS_MIN_MB=1 VICTORY_CARD_BUFFERS_MB=1024, VICTORY_GPU_TIMING=1, title 1.0.2.1 (b99f876b74d4a77f), Proton Experimental 11.0-100 (d3d12,d3d12core,dxgi=n, vkd3d-proton), RX 7900 XTX (RADV, Mesa), 30 GB RAM.

Frame line in the world:

0.1 fps, 8423.7 ms/frame (5500.4 preparing: copies 3682.5 ms 315.4 MB,
textures 1679.3 ms 197.2 MB; 290.2 on the GPU; 2606.0 copying back 61.2 MB),
4600 draws/frame

Same shape as the report above, an order of magnitude larger: copying back
2.6 s a frame, copies 3.7 s, the card 6 % busy.

Counters grow during the run (two minutes, world, uninterrupted): texture
slots placed 232 426 -> 286 489, textures picked by index: 24 600 uploaded (9 160 MB), 17 411 waiting -> waiting 22 263.

Measured and rejected on this box: VICTORY_RELAY=2 (median frame 1826 ->
1883 ms), VICTORY_JOIN_COPIES=1 (title buffer copies recorded per frame: 73/ 94, of them 0 continue, no effect), VICTORY_TEXTURE_NO_WAIT=1 +
VICTORY_WIDE_TEXTURES=1 (6732 ms median in the world window, worse than 1826).

The problem: the fix you name is unreachable from any ref.

$ git fetch origin cd94d35388
fatal: couldn't find remote ref cd94d35388

$ curl /repos/fxceless/victory-fork/commits/cd94d35388/branches-where-head   -> []
$ curl /repos/fxceless/victory-fork/commits/cd94d35388/pulls                -> []

cd94d35 and 940d32f resolve by SHA, but their parent ccfb0299 is not in
main, so replaying the API patch on 9376fd6 fails at
apps/victory/src/translate.rs:568, crates/victory-gpu/src/copystat.rs:85 and
crates/victory-gpu/src/descriptor/host.rs:44.

Could you push that chain as a branch (or land it on main)? It is exactly the
bill we pay on Linux, and we can measure any build you publish the same day.

One question, since #821 and #676 point at the same counters: with ~20 000
textures waiting, is the intended reading that the card is full (so
VICTORY_CARD_BUFFERS_MB is the lever) or that the queue never drains?

**@⁠firefloc** on GitHub · 2026-11-25 09:56 UTC · [original](https://github.com/fxceless/victory-fork/issues/650#issuecomment-7159012053) Linux/RADV data point on this, plus a reachability problem for the fix. **Run:** `origin/main` `9376fd6` (merged today), `VICTORY_NO_WATCHDOG=1`, `VICTORY_LATE_WAIT=3 VICTORY_WIDE_BACK=1 VICTORY_CARD_BUFFERS_MIN_MB=1 VICTORY_CARD_BUFFERS_MB=1024`, `VICTORY_GPU_TIMING=1`, title 1.0.2.1 (`b99f876b74d4a77f`), Proton Experimental 11.0-100 (`d3d12,d3d12core,dxgi=n`, vkd3d-proton), RX 7900 XTX (RADV, Mesa), 30 GB RAM. **Frame line in the world:** ``` 0.1 fps, 8423.7 ms/frame (5500.4 preparing: copies 3682.5 ms 315.4 MB, textures 1679.3 ms 197.2 MB; 290.2 on the GPU; 2606.0 copying back 61.2 MB), 4600 draws/frame ``` Same shape as the report above, an order of magnitude larger: `copying back` 2.6 s a frame, `copies` 3.7 s, the card 6 % busy. **Counters grow during the run** (two minutes, world, uninterrupted): texture slots placed 232 426 -> 286 489, `textures picked by index: 24 600 uploaded (9 160 MB), 17 411 waiting` -> `waiting 22 263`. **Measured and rejected on this box**: `VICTORY_RELAY=2` (median frame 1826 -> 1883 ms), `VICTORY_JOIN_COPIES=1` (`title buffer copies recorded per frame: 73/ 94, of them 0 continue`, no effect), `VICTORY_TEXTURE_NO_WAIT=1` + `VICTORY_WIDE_TEXTURES=1` (6732 ms median in the world window, worse than 1826). **The problem: the fix you name is unreachable from any ref.** ``` $ git fetch origin cd94d35388 fatal: couldn't find remote ref cd94d35388 $ curl /repos/fxceless/victory-fork/commits/cd94d35388/branches-where-head -> [] $ curl /repos/fxceless/victory-fork/commits/cd94d35388/pulls -> [] ``` `cd94d35` and `940d32f` resolve by SHA, but their parent `ccfb0299` is not in `main`, so replaying the API patch on `9376fd6` fails at `apps/victory/src/translate.rs:568`, `crates/victory-gpu/src/copystat.rs:85` and `crates/victory-gpu/src/descriptor/host.rs:44`. Could you push that chain as a branch (or land it on `main`)? It is exactly the bill we pay on Linux, and we can measure any build you publish the same day. One question, since #821 and #676 point at the same counters: with ~20 000 textures waiting, is the intended reading that the card is full (so `VICTORY_CARD_BUFFERS_MB` is the lever) or that the queue never drains?
Author
Owner

@⁠CLHelper on GitHub · 2026-11-25 10:01 UTC · original

Is anyone porting this? If not, I'd like to take it: port cd94d35 + 940d32f (with what they need from 27c3dc9 / c75fdba) onto main 9376fd6 as one pull request, and measure copy-back before and after on an RTX 4060 Laptop 8 GB (on 9376fd6 today, in the world: copying back 170 ms a frame for 64 MB).

@⁠firefloc on reaching the commits: both are on upstream marvisak/VIctory main (940d32f is its head as of this morning), so git fetch https://github.com/marvisak/VIctory main gets the whole chain including ccfb029. AI-assisted.

**@⁠CLHelper** on GitHub · 2026-11-25 10:01 UTC · [original](https://github.com/fxceless/victory-fork/issues/650#issuecomment-7159120957) Is anyone porting this? If not, I'd like to take it: port cd94d35 + 940d32f (with what they need from 27c3dc9 / c75fdba) onto `main` 9376fd6 as one pull request, and measure copy-back before and after on an RTX 4060 Laptop 8 GB (on 9376fd6 today, in the world: `copying back` 170 ms a frame for 64 MB). @⁠firefloc on reaching the commits: both are on upstream `marvisak/VIctory` `main` (940d32f is its head as of this morning), so `git fetch https://github.com/marvisak/VIctory main` gets the whole chain including `ccfb029`. AI-assisted.
Author
Owner

@⁠firefloc on GitHub · 2026-11-25 10:14 UTC · original

Thanks @⁠CLHelper — the pointer to marvisak/VIctory main worked: git fetch https://github.com/marvisak/VIctory main brings ccfb029, cd94d35 and 940d32f into a fresh clone.

And your reading of the job is right: this is not a cherry-pick. Here, cd94d353
sits 318 commits off main 9376fd6, its parent ccfb0299 is not an ancestor
of main, and replaying the commit conflicts in 20 files — four of them test
files that main has since removed (memory_tests.rs, semantics_tests.rs,
synthetic_tests.rs, stride_tests.rs). So please take it: one integration on
main is worth more than each of us resolving the same 20 files.

We will measure whatever build lands, on the machine in my comment above
(Linux/RADV, RX 7900 XTX), with the same launcher and the same
VICTORY_GPU_TIMING=1 line. Today copying back is 2 606 ms of an 8 423 ms
frame with the card at 6 % busy, so a copy-back fix shows up there immediately
and unambiguously.

One note for the integration: our branch carries two loader-only patches (the
#454 watchdog hook and a VICTORY_PATCH=<rva>:<hex> switch). They touch no GPU
or shader file, so rebasing on your PR will be clean on our side.

**@⁠firefloc** on GitHub · 2026-11-25 10:14 UTC · [original](https://github.com/fxceless/victory-fork/issues/650#issuecomment-7159431580) Thanks @⁠CLHelper — the pointer to `marvisak/VIctory` `main` worked: `git fetch https://github.com/marvisak/VIctory main` brings `ccfb029`, `cd94d35` and `940d32f` into a fresh clone. And your reading of the job is right: this is not a cherry-pick. Here, `cd94d353` sits 318 commits off `main` `9376fd6`, its parent `ccfb0299` is not an ancestor of `main`, and replaying the commit conflicts in 20 files — four of them test files that `main` has since removed (`memory_tests.rs`, `semantics_tests.rs`, `synthetic_tests.rs`, `stride_tests.rs`). So please take it: one integration on `main` is worth more than each of us resolving the same 20 files. We will measure whatever build lands, on the machine in my comment above (Linux/RADV, RX 7900 XTX), with the same launcher and the same `VICTORY_GPU_TIMING=1` line. Today `copying back` is 2 606 ms of an 8 423 ms frame with the card at 6 % busy, so a copy-back fix shows up there immediately and unambiguously. One note for the integration: our branch carries two loader-only patches (the #454 watchdog hook and a `VICTORY_PATCH=<rva>:<hex>` switch). They touch no GPU or shader file, so rebasing on your PR will be clean on our side.
Author
Owner

@⁠iGoldenNinja on GitHub · 2026-11-25 10:45 UTC · original · edited 2026-11-25 11:21 UTC

Current-main baseline for the copy-back work on an RTX 5080 16 GB, driver 617.14, Windows 11 Pro 25H2 (26200.9974), Ryzen 9 5900X and 32 GB RAM. Both Series X runs reached controllable prison using the same 90-second route and cache seed. The new copy queue and async submit were left at defaults.

At 9376fd6 I measured 175.50 ms median copy-back and 136.25 ms median card fetch wait. At f85101b6095e8cf3cecf8f0647cc7f5428daa177 I measured 170.90 ms and 131.20 ms, with 5,845 median draws per frame. Displayed FPS was 3.56 and 3.86 respectively. This is one run per revision and a baseline for future copy-back comparisons. Both runs had the same eight distinct pipeline refusals and no logged device removal. Pinned report

Same-executable follow-up on f85101b with only VICTORY_QUEUE2=1 added and the same verified cache seed. The copy queue was active in the prison route (median 14.5 fetch jobs and 74.9 MiB per frame, zero upload jobs). Median relay fetch wait dropped from 131.20 to 11.00 ms and median copy-back from 170.90 to 79.60 ms. In this one fixed-order pair, displayed FPS went 3.86 → 3.41 and displayed P99 376.31 → 540.96 ms. Mean GPU busy went 195.54 → 230.36 ms per displayed frame, with similar draw counts and matching pipeline refusals. Both reached controllable prison with similar rooms and the same visible courtyard tile band. Same-build comparison

I also tested VICTORY_ASYNC_SUBMIT=1 by itself on the same f85101b executable and cache seed. Median copy-back in the 90-second prison route was 176.55 ms with async submission, compared with 170.90 and 172.10 ms in two default runs. Displayed FPS was 3.63 vs 3.86 and 3.84. All three completed the route with the same pipeline refusals and similar visual output. Early async captures showed a performance overlay, which was absent in the post-retreat captures. This series has one async run. Three-run comparison

**@⁠iGoldenNinja** on GitHub · 2026-11-25 10:45 UTC · [original](https://github.com/fxceless/victory-fork/issues/650#issuecomment-7160137817) · edited 2026-11-25 11:21 UTC Current-main baseline for the copy-back work on an RTX 5080 16 GB, driver 617.14, Windows 11 Pro 25H2 (26200.9974), Ryzen 9 5900X and 32 GB RAM. Both Series X runs reached controllable prison using the same 90-second route and cache seed. The new copy queue and async submit were left at defaults. At `9376fd6` I measured **175.50 ms** median copy-back and **136.25 ms** median card fetch wait. At `f85101b6095e8cf3cecf8f0647cc7f5428daa177` I measured **170.90 ms** and **131.20 ms**, with 5,845 median draws per frame. Displayed FPS was 3.56 and 3.86 respectively. This is one run per revision and a baseline for future copy-back comparisons. Both runs had the same eight distinct pipeline refusals and no logged device removal. [Pinned report](https://github.com/iGoldenNinja/victory-fork/blob/b8eb22fe76383345efe0eaa8e2811397c54eb18b/docs/nvidia-f85101b-default-5080.md) Same-executable follow-up on `f85101b` with only `VICTORY_QUEUE2=1` added and the same verified cache seed. The copy queue was active in the prison route (median 14.5 fetch jobs and 74.9 MiB per frame, zero upload jobs). Median relay fetch wait dropped from **131.20 to 11.00 ms** and median copy-back from **170.90 to 79.60 ms**. In this one fixed-order pair, displayed FPS went **3.86 → 3.41** and displayed P99 **376.31 → 540.96 ms**. Mean GPU busy went 195.54 → 230.36 ms per displayed frame, with similar draw counts and matching pipeline refusals. Both reached controllable prison with similar rooms and the same visible courtyard tile band. [Same-build comparison](https://github.com/iGoldenNinja/victory-fork/blob/da476154aa2765f9933a487b279fb588cc41024f/docs/nvidia-f85101b-default-5080.md#dedicated-copy-queue-fetches) I also tested `VICTORY_ASYNC_SUBMIT=1` by itself on the same `f85101b` executable and cache seed. Median copy-back in the 90-second prison route was **176.55 ms** with async submission, compared with **170.90 and 172.10 ms** in two default runs. Displayed FPS was **3.63** vs **3.86 and 3.84**. All three completed the route with the same pipeline refusals and similar visual output. Early async captures showed a performance overlay, which was absent in the post-retreat captures. This series has one async run. [Three-run comparison](https://github.com/iGoldenNinja/victory-fork/blob/de21496424f8eb3dd675e5e638a6b0dee0e67165/docs/nvidia-f85101b-default-5080.md#async-submission-by-itself)
Author
Owner

@⁠Proudnoob4 on GitHub · 2026-11-25 11:34 UTC · original

The same VICTORY_QUEUE2=1 pair on an RTX 4080, where it goes the other way for frame rate.

Machine: RTX 4080 16 GB (driver 621.01), i5-13600K, 32 GB, Windows 10 Pro 22H2 (19045), 2560x1440, Series X. Tree: f85101b plus the Agility SDK exports for Windows 10 (nothing else), diagnostics build (for the scripted menu keys), its own cache warmed with translate --warm. Common switches: VICTORY_RELAY=2 VICTORY_LATE_WAIT=3 VICTORY_PIPELINE_WORKERS=8 VICTORY_GROUP_SYNC=2 VICTORY_WIDE_BACK=1 VICTORY_CARD_BUFFERS_MB=1024 VICTORY_CARD_BUFFERS_MIN_MB=1 VICTORY_CARD_REHASH_RUNS=1 VICTORY_JOIN_COPIES=1 VICTORY_SHADER_LOOP_LIMIT=1024, no VICTORY_GPU_TIMING. 600 s into the cell; medians over the 5-second frame lines with more than 1,000 draws.

f85101b fps ms/frame waiting for the card copying back relay fetch wait card busy (clock line)
defaults, run 1 4.6 215 73 124 83 69%
defaults, run 2 5.1 196 76 120 - -
VICTORY_QUEUE2=1, run 1 5.7 175 66 44 6 75%
VICTORY_QUEUE2=1, run 2 5.6 179 65 45 6 73%
+ ASYNC_SUBMIT INDIRECT_WINDOW TEXTURE_NO_WAIT 7.1 140 44 45 - -

So here the copy queue is about +10-24% on its own (two runs each), where @⁠iGoldenNinja's 5080 pair above went 3.86 -> 3.41. On this card the copy-back thread was on the critical path; with the copy queue it is no longer the longest thread. For scale, skornuta's tree with the same switches gives 5.3 fps in two runs.

Picture: as in your pair, a band shows with and without the copy queue (mine is in the cell, along the bottom of the screen, so it may or may not be your courtyard one). f85101b draws a blocky band there (grey blocks at the left, a broken band from the middle to the right): 4 of 5 world frames at defaults (frames 4096-4600 of one run; frame 4096 of another run is clean) and 5 of 5 with QUEUE2 (four with QUEUE2 alone, one with all the switches; light-blue blocks along the very bottom are stronger). So it is not the copy queue. For comparison, skornuta/victory-fork at 9292987 with the same switches, same machine and same scene has no band in 5 of 5 world frames (4096-4800), so on this card it is something f85101b draws and that tree does not, if anyone wants to bisect it. No device loss in any of these runs.

If it helps I can run QUEUE2 with VICTORY_FILL_WAIT=1, or with anything you want logged, on this machine.

Runs, captures and numbers from my machine; analysis and write-up with Claude Code (Claude Opus 5.5) at my request. No game files attached.

**@⁠Proudnoob4** on GitHub · 2026-11-25 11:34 UTC · [original](https://github.com/fxceless/victory-fork/issues/650#issuecomment-7161217832) The same `VICTORY_QUEUE2=1` pair on an RTX 4080, where it goes the other way for frame rate. **Machine:** RTX 4080 16 GB (driver 621.01), i5-13600K, 32 GB, Windows 10 Pro 22H2 (19045), 2560x1440, Series X. **Tree:** `f85101b` plus the Agility SDK exports for Windows 10 (nothing else), diagnostics build (for the scripted menu keys), its own cache warmed with `translate --warm`. Common switches: `VICTORY_RELAY=2 VICTORY_LATE_WAIT=3 VICTORY_PIPELINE_WORKERS=8 VICTORY_GROUP_SYNC=2 VICTORY_WIDE_BACK=1 VICTORY_CARD_BUFFERS_MB=1024 VICTORY_CARD_BUFFERS_MIN_MB=1 VICTORY_CARD_REHASH_RUNS=1 VICTORY_JOIN_COPIES=1 VICTORY_SHADER_LOOP_LIMIT=1024`, no `VICTORY_GPU_TIMING`. 600 s into the cell; medians over the 5-second frame lines with more than 1,000 draws. | f85101b | fps | ms/frame | waiting for the card | copying back | relay fetch wait | card busy (clock line) | |---|---|---|---|---|---|---| | defaults, run 1 | 4.6 | 215 | 73 | 124 | 83 | 69% | | defaults, run 2 | 5.1 | 196 | 76 | 120 | - | - | | `VICTORY_QUEUE2=1`, run 1 | 5.7 | 175 | 66 | 44 | 6 | 75% | | `VICTORY_QUEUE2=1`, run 2 | 5.6 | 179 | 65 | 45 | 6 | 73% | | + `ASYNC_SUBMIT` `INDIRECT_WINDOW` `TEXTURE_NO_WAIT` | 7.1 | 140 | 44 | 45 | - | - | So here the copy queue is about +10-24% on its own (two runs each), where @⁠iGoldenNinja's 5080 pair above went 3.86 -> 3.41. On this card the copy-back thread was on the critical path; with the copy queue it is no longer the longest thread. For scale, skornuta's tree with the same switches gives 5.3 fps in two runs. **Picture:** as in your pair, a band shows with and without the copy queue (mine is in the cell, along the bottom of the screen, so it may or may not be your courtyard one). `f85101b` draws a blocky band there (grey blocks at the left, a broken band from the middle to the right): 4 of 5 world frames at defaults (frames 4096-4600 of one run; frame 4096 of another run is clean) and 5 of 5 with `QUEUE2` (four with `QUEUE2` alone, one with all the switches; light-blue blocks along the very bottom are stronger). So it is not the copy queue. For comparison, `skornuta/victory-fork` at `9292987` with the same switches, same machine and same scene has no band in 5 of 5 world frames (4096-4800), so on this card it is something `f85101b` draws and that tree does not, if anyone wants to bisect it. No device loss in any of these runs. If it helps I can run `QUEUE2` with `VICTORY_FILL_WAIT=1`, or with anything you want logged, on this machine. *Runs, captures and numbers from my machine; analysis and write-up with Claude Code (Claude Opus 5.5) at my request. No game files attached.*
Author
Owner

@⁠chazi123 on GitHub · 2026-11-25 13:23 UTC · original

Adding a measurement from the same lineage on a different card, because your number and mine line up and that may say something about where the copy-back time actually goes.

RTX 3060 Laptop 12 GB, Windows 10 19045, victory-amd (the sibling fork, not this one) — world, 2560x1440, one frame line at 1540 draws:

2.8 fps, 355.7 ms/frame
  preparing    127.8 ms  (copies 67.7 ms / 125.1 MB, textures 21.1 ms / 38.0 MB)
  on the GPU   121.4 ms
  copying back 178.9 ms / 47.8 MB

Your 4060 Laptop 8 GB on 9376fd6: 170 ms / 64 MB. Mine: 178.9 ms / 47.8 MB. Same order, and in both cases the MB written back is far smaller than the MB examined — so this is not a bandwidth problem on either machine.

The part that may matter for your port: in victory-amd the comparison is not done on the CPU at all. Its per-frame lines say

shadow: shader writes looked for on the CPU per frame: 0.0 MB compared in 0 ranges of windows
        outside buffers, 29.6 MB in 288 ranges of title buffers' copies (27.9 MB snapshotted)
host:   our passes over copies in the card's memory per frame: 303 hash passes over 1104 pieces
        after ranges were sent up (VICTORY_CARD_REHASH_RUNS=1 joins them: now off),
        81 compare passes

So of the 178.9 ms, the CPU-side compare accounts for 29.6 MB in 288 ranges, and the rest runs as 303 hash passes over 1,104 pieces in card memory, plus 81 compare passes — and the log itself notes that VICTORY_CARD_REHASH_RUNS=1 would join the hash passes, but it is off by default.

The relay breakdown, same frame:

the relay per frame: 38.0 flights landed in 9.2 landings
  waited 53.8 ms for the card with nothing to land
  waited 79.3 ms for fetches of card copies' pieces
  was 165.7 ms landing in all   <- this is the frame line's "copying back"

That is, most of the 178.9 ms is 79.3 ms waiting for fetches of the card copies' pieces plus 53.8 ms idle waiting on the card, not comparing.

Two things I would ask before you measure, and they are the reason I am writing rather than just +1:

  1. Is cd94d35 aimed at the CPU-side compare, or at the card-side hash? If the mark is per 64 KiB title page set by the translation, then in a tree that compares on the card it would cut the "pieces" that get hashed (1,104 a frame here) rather than the 288 CPU ranges. If it only cuts the CPU compare, a tree like this one would keep its 303 hash passes and your before/after on 9376fd6 may not transfer.
  2. Does the fix survive VICTORY_RELAY? In victory-amd the copy-back is done by a landing thread beside the submitting thread, and the flights are sent ahead. A page-marking scheme that assumes every submission has completed (the way the current compare does) may need to be kept in step with the flights. inplace.rs there has the same warning for a different reason ("do not combine 2 with late wait").

If you want a second absolute number to check against, the same tree with relay off is 289-437 ms on the GPU and 504-1300 ms a frame, so copy-back is roughly a third of the frame in both configurations here; it is not a RELAY artefact.

Practical note on your plan: measuring copy-back before/after on an 8 GB 4060 Laptop is worth doing with a fixed scene (a checkpointed interior frame) and the median of 10 frame lines, not the first line after the world loads — in this tree the frame time swings between 160 and 2,013 ms in the same run depending on what the title is streaming, so a single line can look like a 3x win or a 3x loss.

Patch/notes for the tree I am on, if it is useful for comparison: https://github.com/chazi123/xcl-chazi/tree/main/victory-amd-win10-nvidia

**@⁠chazi123** on GitHub · 2026-11-25 13:23 UTC · [original](https://github.com/fxceless/victory-fork/issues/650#issuecomment-7163718532) Adding a measurement from the same lineage on a different card, because your number and mine line up and that may say something about where the copy-back time actually goes. **RTX 3060 Laptop 12 GB, Windows 10 19045, `victory-amd` (the sibling fork, not this one)** — world, 2560x1440, one frame line at 1540 draws: ``` 2.8 fps, 355.7 ms/frame preparing 127.8 ms (copies 67.7 ms / 125.1 MB, textures 21.1 ms / 38.0 MB) on the GPU 121.4 ms copying back 178.9 ms / 47.8 MB ``` Your 4060 Laptop 8 GB on `9376fd6`: **170 ms / 64 MB**. Mine: **178.9 ms / 47.8 MB**. Same order, and in both cases the MB written back is far smaller than the MB examined — so this is not a bandwidth problem on either machine. The part that may matter for your port: **in victory-amd the comparison is not done on the CPU at all.** Its per-frame lines say ``` shadow: shader writes looked for on the CPU per frame: 0.0 MB compared in 0 ranges of windows outside buffers, 29.6 MB in 288 ranges of title buffers' copies (27.9 MB snapshotted) host: our passes over copies in the card's memory per frame: 303 hash passes over 1104 pieces after ranges were sent up (VICTORY_CARD_REHASH_RUNS=1 joins them: now off), 81 compare passes ``` So of the 178.9 ms, the CPU-side compare accounts for 29.6 MB in 288 ranges, and the rest runs as **303 hash passes over 1,104 pieces in card memory, plus 81 compare passes** — and the log itself notes that `VICTORY_CARD_REHASH_RUNS=1` would join the hash passes, but it is off by default. The relay breakdown, same frame: ``` the relay per frame: 38.0 flights landed in 9.2 landings waited 53.8 ms for the card with nothing to land waited 79.3 ms for fetches of card copies' pieces was 165.7 ms landing in all <- this is the frame line's "copying back" ``` That is, most of the 178.9 ms is **79.3 ms waiting for fetches of the card copies' pieces plus 53.8 ms idle waiting on the card**, not comparing. Two things I would ask before you measure, and they are the reason I am writing rather than just +1: 1. **Is `cd94d35` aimed at the CPU-side compare, or at the card-side hash?** If the mark is per 64 KiB title page set by the *translation*, then in a tree that compares on the card it would cut the "pieces" that get hashed (1,104 a frame here) rather than the 288 CPU ranges. If it only cuts the CPU compare, a tree like this one would keep its 303 hash passes and your before/after on `9376fd6` may not transfer. 2. **Does the fix survive `VICTORY_RELAY`?** In victory-amd the copy-back is done by a landing thread beside the submitting thread, and the flights are sent ahead. A page-marking scheme that assumes every submission has completed (the way the current compare does) may need to be kept in step with the flights. `inplace.rs` there has the same warning for a different reason ("do not combine 2 with late wait"). If you want a second absolute number to check against, the same tree with relay off is 289-437 ms on the GPU and 504-1300 ms a frame, so copy-back is roughly a third of the frame in both configurations here; it is not a RELAY artefact. Practical note on your plan: measuring copy-back before/after on an 8 GB 4060 Laptop is worth doing with a **fixed scene** (a checkpointed interior frame) and the median of 10 frame lines, not the first line after the world loads — in this tree the frame time swings between 160 and 2,013 ms in the same run depending on what the title is streaming, so a single line can look like a 3x win or a 3x loss. Patch/notes for the tree I am on, if it is useful for comparison: https://github.com/chazi123/xcl-chazi/tree/main/victory-amd-win10-nvidia
Author
Owner

@⁠CLHelper on GitHub · 2026-11-25 13:25 UTC · original

Measured before starting the port, and it changes what the port is worth on current main.

Setup: main 0b0074e0, RTX 4060 Laptop 8 GB (NVIDIA 576.80), Windows 11, Series X, release build, defaults (relay on) plus VICTORY_SHADER_LOOP_LIMIT=256 VICTORY_CAPPED_DYNAMIC=262144 VICTORY_D3D12_DRED=1, warm cache, a person walking the first rooms. 37 world samples of the frame line (>= 3,000 draws):

median p25 p75
frame 277 ms (3.6 fps) 260 321
on the GPU 112 ms 99 118
copying back 191 ms for 60 MB 178 204

Where the copy-back goes here: the big buffers are copies in the card's memory (host copies in the card's memory: 97 copies 941 MB; the first such line, 1 copies 174 MB, is the GPU-heap buffer of this issue), compared on the card: 13,000-20,000 pieces a frame, of which 750-1,400 are fetched (49-92 MB) with 5-7.5 more waits for the card (119-266 ms). The relay line splits the landing thread's 126-185 ms into 100-155 ms waiting for fetches of card copies' pieces and 19-65 ms waiting with nothing to land. The CPU-side compared list is small: the largest range is 5 MB a frame, the rest under 2 MB (312 ranges).

So: cd94d35's marks replace the snapshot-and-compare of the declared ranges. With the copies on the card, that compare already runs on the card and is not the cost here; the fetch and merge of the pieces that did change stay the same with marks. On this configuration the port would save little; the lever is the fetch waits (VICTORY_QUEUE2 / VICTORY_CARD_FETCH_INFLIGHT, which iGoldenNinja and Proudnoob4 are measuring above).

It matters where copies are in the PC's memory, as in the original report (310c6eb, 365 MB compared a frame) and maybe in @⁠firefloc's run (2.6 s copying back on RADV). @⁠firefloc: does your log have a host copies in the card's memory line, and what are the largest compared ranges? If the big ones are compared on the CPU there, a first increment is worth doing: marks for root UAVs only (host words instead of a heap table), used to shrink what relay_hand_back compares, with the snapshot kept as the merge reference. A literal port is out: cd94d35 sits on five upstream commits fxceless does not have (0b35b7fe, d71c3889, 6d021fe3, 27c3dc9, c75fdba), each conflicting on its own (9-28 files). I'll hold the port until that answer; on a card-copy configuration I would rather not land 1,000 lines that do not move the frame. AI-assisted.

**@⁠CLHelper** on GitHub · 2026-11-25 13:25 UTC · [original](https://github.com/fxceless/victory-fork/issues/650#issuecomment-7163748515) Measured before starting the port, and it changes what the port is worth on current `main`. **Setup:** `main` 0b0074e0, RTX 4060 Laptop 8 GB (NVIDIA 576.80), Windows 11, Series X, release build, defaults (relay on) plus `VICTORY_SHADER_LOOP_LIMIT=256 VICTORY_CAPPED_DYNAMIC=262144 VICTORY_D3D12_DRED=1`, warm cache, a person walking the first rooms. 37 world samples of the frame line (>= 3,000 draws): | | median | p25 | p75 | |---|---|---|---| | frame | 277 ms (3.6 fps) | 260 | 321 | | on the GPU | 112 ms | 99 | 118 | | copying back | 191 ms for 60 MB | 178 | 204 | **Where the copy-back goes here:** the big buffers are copies in the card's memory (`host copies in the card's memory: 97 copies 941 MB`; the first such line, `1 copies 174 MB`, is the GPU-heap buffer of this issue), compared on the card: 13,000-20,000 pieces a frame, of which 750-1,400 are fetched (49-92 MB) with 5-7.5 more waits for the card (119-266 ms). The relay line splits the landing thread's 126-185 ms into **100-155 ms waiting for fetches of card copies' pieces** and 19-65 ms waiting with nothing to land. The CPU-side `compared` list is small: the largest range is 5 MB a frame, the rest under 2 MB (312 ranges). **So:** cd94d35's marks replace the snapshot-and-compare of the declared ranges. With the copies on the card, that compare already runs on the card and is not the cost here; the fetch and merge of the pieces that did change stay the same with marks. On this configuration the port would save little; the lever is the fetch waits (`VICTORY_QUEUE2` / `VICTORY_CARD_FETCH_INFLIGHT`, which iGoldenNinja and Proudnoob4 are measuring above). It matters where copies are in the PC's memory, as in the original report (310c6eb, 365 MB compared a frame) and maybe in @⁠firefloc's run (2.6 s copying back on RADV). @⁠firefloc: does your log have a `host copies in the card's memory` line, and what are the largest `compared` ranges? If the big ones are compared on the CPU there, a first increment is worth doing: marks for root UAVs only (host words instead of a heap table), used to shrink what `relay_hand_back` compares, with the snapshot kept as the merge reference. A literal port is out: cd94d35 sits on five upstream commits fxceless does not have (0b35b7fe, d71c3889, 6d021fe3, 27c3dc9, c75fdba), each conflicting on its own (9-28 files). I'll hold the port until that answer; on a card-copy configuration I would rather not land 1,000 lines that do not move the frame. AI-assisted.
Author
Owner

@⁠fubukiclears on GitHub · 2026-11-25 16:53 UTC · original

That 174 MB buffer is three things glued together, and only one of them changes per frame. From the exe
(0x1e86440): it's windows 2+3+4 of the 185 MiB 32-bit pool. Window 2 (27 MiB) is the per-frame constan
t/upload ring (216 x 128 KiB chunks); windows 3 and 4 (47 + 100 MiB) are shader/PSO/command-stream heaps
that barely ever change. The ring allocates downward from each chunk's top, and chunks are fence-stampe
d on submit, so only [write pointer .. chunk top] of the chunks a submission touched can have changed.

Allocator entry points, cursor fields, the chunk queue and the stamps are all in Marvisak/VIctory#2609 (
section 2), in case it helps whoever ends up doing the page-mark port.

**@⁠fubukiclears** on GitHub · 2026-11-25 16:53 UTC · [original](https://github.com/fxceless/victory-fork/issues/650#issuecomment-7168679919) That 174 MB buffer is three things glued together, and only one of them changes per frame. From the exe (`0x1e86440`): it's windows 2+3+4 of the 185 MiB 32-bit pool. Window 2 (27 MiB) is the per-frame constan t/upload ring (216 x 128 KiB chunks); windows 3 and 4 (47 + 100 MiB) are shader/PSO/command-stream heaps that barely ever change. The ring allocates downward from each chunk's top, and chunks are fence-stampe d on submit, so only `[write pointer .. chunk top]` of the chunks a submission touched can have changed. Allocator entry points, cursor fields, the chunk queue and the stamps are all in Marvisak/VIctory#2609 ( section 2), in case it helps whoever ends up doing the page-mark port.
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/fxceless--victory-fork#650
No description provided.