GPU: a submission's refreshes copy on several threads #2051

Open
github-bot wants to merge 3 commits from github-bot/gh-2051 into main AGit
Owner

@⁠0xkn0wh3r3 on GitHub · 2026-11-25 04:08 UTC · original
0xkn0wh3r3:gpu/parallel-refresh → main · +532 −17 · 4 files · 3 commits · open

The problem

At each submission, host copies of title memory are brought up to date. That is a plain memory copy, and the submitting thread made every one of them alone.

On the world's shape (#400: a 174 MB heap, ~8,800 scattered 64 KiB pages a frame, about 525 MB), this is now most of what a frame's copies cost. Marked pages already took snapshots and copy-back down to a few milliseconds. One thread moves far less than the memory can:

threads copy rate
1 9.6 GB/s
4 15.4 GB/s (saturated)

The fix

Batch::flush now collects its refreshes' copies and makes them together at the end, on several threads (new module copy_pool):

  1. While the refreshes run, copies are queued instead of made (copy_pool::queued).
  2. At the end of the flush, copy_pool::run makes them. Copies are cut to 1 MiB. From 4 MiB in all, they are taken by index by three persistent workers and the submitting thread. Below that, one thread copies.
  3. The flush returns once all copies are made, so the steps and lists after it see them.

Only copies no snapshot reads back are queued:

  • those of ranges no shader writes, including the whole copies of parts on memory that is not the runtime's;
  • those under ranges shaders write that no snapshot covers (marked ranges keep none).

Where a snapshot covers a run, update_tracked still copies at once and takes the bytes into the snapshot. Once the queued copies are made, what they took goes into the saved bytes of armed pages (Shadow::queued_made, the same Tracked::refreshed that Shadow::copy calls). Outside a flush every copy is made at once, as before.

Testing

  • New test copy_pool::tests::queued_copies_are_made_on_the_workers: queued copies are made by run, on the workers past the threshold, a big copy is cut into pieces, and every byte is in place.

  • New test copy_pool::tests::the_workers_take_the_pieces_past_the_threshold: with the submitting thread leaving every piece to the workers, they copy all of them and every byte lands in place.

  • New ignored benchmark host::batch::world_frame_refreshes (cargo test --release -p victory-gpu -- --ignored --nocapture world_frame_refreshes). It replays a world frame's refreshes through Batch as Host::execute does: title writes to 256 random pages, 24 declared ranges armed as marked, one flush, 36 submissions. It also asserts every title write reached the copy. RTX 5070 Ti host, release build, median of 6 frames, about 525 MB copied either way. Re-measured on 13f91ca:

    run one thread with the workers
    13f91ca 76.3 ms 50.4 ms
    old base, first 65.8 ms 44.9 ms
    old base, second 69.2 ms 47.0 ms
  • cargo test -p victory-gpu on an RTX 5070 Ti (driver 621.24): all pass except descriptor::host::tests::dynamic_slots_are_held_until_released and memory::tests::lists_share_a_table_and_copies_keep_their_views. Those fail the same way on main (the NVIDIA 1,000,000-descriptor heap cap, #1835).

  • cargo clippy -p victory-gpu --all-targets, with and without --features diagnostics: clean.

  • Not run with the title by me (no game data here): the frame figures above are synthetic, shaped like #400's world frames. See the in-title measurement below.
  • Independent of the open PRs that change how one copy is made (#1010, #943, #202): every piece still goes through copy_mapped.

Rebased onto 13f91ca

  • Upstream 280b150 limits change tracking to the runtime's memory and copies the parts outside it whole (Tracked::untracked). update_free queues those whole copies too, so they also run on the workers.
  • Re-measured on the new base: 76.3 ms on one thread, 50.4 ms with the workers. On the old base it was 65.8 ms and 44.9 ms (a second run: 69.2 and 47.0).

Rebased onto f3578e3

  • Upstream 5319366 merged update_busy and update_free into update_tracked (one Tracked::take per range, so a page under a written range is still guarded). The queueing now lives there: a run with a snapshot over it is copied at once and the snapshot takes the bytes; any other run, and the untracked parts, are queued.
  • Upstream 106377d makes Shadow::copy hand what it copied to Tracked::refreshed, so a partial refresh of an armed page updates the bytes saved of it. A queued copy has no bytes until copy_pool::run makes it, so each copy records the ranges it queued, and Batch::flush calls Shadow::queued_made on every copy it updated once the run is done. copy_pool::copy now returns whether it queued.
  • New test shadow::tests::queued_partial_refresh_under_marked_range_updates_saved_bytes: upstream's partial-refresh test with the refreshes queued. Without queued_made it fails (copy-back puts a refreshed byte back over a later title write).
  • world_frame_refreshes still checks every title write reached the copy (release build, under load from other builds: 80.6 ms on one thread, 53.6 ms with the workers).
  • cargo test -p victory-gpu --lib: the same two failures as on upstream main here. cargo clippy -p victory-gpu --all-targets, with and without --features diagnostics: clean.

Measured in the title

@⁠imjustprism ran 9ff67b2 in the title (RX 9070 XT, diagnostics build, world, medians per frame, 47 to 74 frame lines per run), with timers around the phases of a submission:

per frame main, run 1 main, run 2 with this PR, run 1 run 2 run 3
Batch::flush without the write-watch take, ms 25.1 17.9 9.9 11.1 13.0
bytes refreshed, MB 114.1 115.1 96.4 105.4 104.2
ms per MB 0.22 0.16 0.10 0.11 0.12

Scenes drift between runs, so ms per MB is the row to compare: 20 to 53% lower with this PR, no errors and no device removed. On the threshold: 77% of the bytes refreshed (76 to 88% by draw bucket) were in flushes of 4 MiB or more, so they already reach the workers; lowering PARALLEL_FROM can only win on the rest, which sits in many small flushes.

Review follow-ups (b55f5c6)

  • Batch::flush calls Shadow::queued_made only on the copies that flush updated, instead of on every copy current in the submission (in run 3 above: 31,000 visits a frame against 3,600 copies updated).
  • The SAFETY comment on Shadow's Send/Sync says the workers write data only inside copy_pool::run, which the flush waits for.
  • The doc on Batch::flush says that with diagnostics the copied-whole time (WholeUs) counts only queueing, and that the copies count in the flush time and, summed over the threads, in the move time.
**@⁠0xkn0wh3r3** on GitHub · 2026-11-25 04:08 UTC · [original](https://github.com/Marvisak/VIctory/pull/2051) `0xkn0wh3r3:gpu/parallel-refresh` → `main` · +532 −17 · 4 files · 3 commits · open ## The problem At each submission, host copies of title memory are brought up to date. That is a plain memory copy, and the submitting thread made every one of them alone. On the world's shape (#400: a 174 MB heap, ~8,800 scattered 64 KiB pages a frame, about 525 MB), this is now most of what a frame's copies cost. Marked pages already took snapshots and copy-back down to a few milliseconds. One thread moves far less than the memory can: | threads | copy rate | |---|---| | 1 | 9.6 GB/s | | 4 | 15.4 GB/s (saturated) | ## The fix `Batch::flush` now collects its refreshes' copies and makes them together at the end, on several threads (new module `copy_pool`): 1. While the refreshes run, copies are queued instead of made (`copy_pool::queued`). 2. At the end of the flush, `copy_pool::run` makes them. Copies are cut to 1 MiB. From 4 MiB in all, they are taken by index by three persistent workers and the submitting thread. Below that, one thread copies. 3. The flush returns once all copies are made, so the steps and lists after it see them. Only copies no snapshot reads back are queued: - those of ranges no shader writes, including the whole copies of parts on memory that is not the runtime's; - those under ranges shaders write that no snapshot covers (marked ranges keep none). Where a snapshot covers a run, `update_tracked` still copies at once and takes the bytes into the snapshot. Once the queued copies are made, what they took goes into the saved bytes of armed pages (`Shadow::queued_made`, the same `Tracked::refreshed` that `Shadow::copy` calls). Outside a flush every copy is made at once, as before. ## Testing - New test `copy_pool::tests::queued_copies_are_made_on_the_workers`: queued copies are made by `run`, on the workers past the threshold, a big copy is cut into pieces, and every byte is in place. - New test `copy_pool::tests::the_workers_take_the_pieces_past_the_threshold`: with the submitting thread leaving every piece to the workers, they copy all of them and every byte lands in place. - New ignored benchmark `host::batch::world_frame_refreshes` (`cargo test --release -p victory-gpu -- --ignored --nocapture world_frame_refreshes`). It replays a world frame's refreshes through `Batch` as `Host::execute` does: title writes to 256 random pages, 24 declared ranges armed as marked, one flush, 36 submissions. It also asserts every title write reached the copy. RTX 5070 Ti host, release build, median of 6 frames, about 525 MB copied either way. Re-measured on 13f91ca: | run | one thread | with the workers | |---|---|---| | 13f91ca | 76.3 ms | 50.4 ms | | old base, first | 65.8 ms | 44.9 ms | | old base, second | 69.2 ms | 47.0 ms | - `cargo test -p victory-gpu` on an RTX 5070 Ti (driver 621.24): all pass except `descriptor::host::tests::dynamic_slots_are_held_until_released` and `memory::tests::lists_share_a_table_and_copies_keep_their_views`. Those fail the same way on `main` (the NVIDIA 1,000,000-descriptor heap cap, #1835). - `cargo clippy -p victory-gpu --all-targets`, with and without `--features diagnostics`: clean. ## Not covered / Related - Not run with the title by me (no game data here): the frame figures above are synthetic, shaped like #400's world frames. See the in-title measurement below. - Independent of the open PRs that change how one copy is made (#1010, #943, #202): every piece still goes through `copy_mapped`. ### Rebased onto 13f91ca - Upstream 280b150 limits change tracking to the runtime's memory and copies the parts outside it whole (`Tracked::untracked`). `update_free` queues those whole copies too, so they also run on the workers. - Re-measured on the new base: 76.3 ms on one thread, 50.4 ms with the workers. On the old base it was 65.8 ms and 44.9 ms (a second run: 69.2 and 47.0). ### Rebased onto f3578e3 - Upstream 5319366 merged `update_busy` and `update_free` into `update_tracked` (one `Tracked::take` per range, so a page under a written range is still guarded). The queueing now lives there: a run with a snapshot over it is copied at once and the snapshot takes the bytes; any other run, and the untracked parts, are queued. - Upstream 106377d makes `Shadow::copy` hand what it copied to `Tracked::refreshed`, so a partial refresh of an armed page updates the bytes saved of it. A queued copy has no bytes until `copy_pool::run` makes it, so each copy records the ranges it queued, and `Batch::flush` calls `Shadow::queued_made` on every copy it updated once the run is done. `copy_pool::copy` now returns whether it queued. - New test `shadow::tests::queued_partial_refresh_under_marked_range_updates_saved_bytes`: upstream's partial-refresh test with the refreshes queued. Without `queued_made` it fails (copy-back puts a refreshed byte back over a later title write). - `world_frame_refreshes` still checks every title write reached the copy (release build, under load from other builds: 80.6 ms on one thread, 53.6 ms with the workers). - `cargo test -p victory-gpu --lib`: the same two failures as on upstream `main` here. `cargo clippy -p victory-gpu --all-targets`, with and without `--features diagnostics`: clean. ### Measured in the title @⁠imjustprism ran 9ff67b2 in the title (RX 9070 XT, diagnostics build, world, medians per frame, 47 to 74 frame lines per run), with timers around the phases of a submission: | per frame | main, run 1 | main, run 2 | with this PR, run 1 | run 2 | run 3 | |---|---|---|---|---|---| | `Batch::flush` without the write-watch take, ms | 25.1 | 17.9 | 9.9 | 11.1 | 13.0 | | bytes refreshed, MB | 114.1 | 115.1 | 96.4 | 105.4 | 104.2 | | ms per MB | 0.22 | 0.16 | 0.10 | 0.11 | 0.12 | Scenes drift between runs, so ms per MB is the row to compare: 20 to 53% lower with this PR, no errors and no device removed. On the threshold: 77% of the bytes refreshed (76 to 88% by draw bucket) were in flushes of 4 MiB or more, so they already reach the workers; lowering `PARALLEL_FROM` can only win on the rest, which sits in many small flushes. ### Review follow-ups (b55f5c6) - `Batch::flush` calls `Shadow::queued_made` only on the copies that flush updated, instead of on every copy current in the submission (in run 3 above: 31,000 visits a frame against 3,600 copies updated). - The `SAFETY` comment on `Shadow`'s `Send`/`Sync` says the workers write `data` only inside `copy_pool::run`, which the flush waits for. - The doc on `Batch::flush` says that with `diagnostics` the copied-whole time (`WholeUs`) counts only queueing, and that the copies count in the flush time and, summed over the threads, in the move time.
Bringing host copies of title memory up to date at submission is a
memory copy, and the submitting thread made every one of them alone. On
the world's shape (#400: a 174 MB heap, ~8,800 scattered 64 KiB pages a
frame, about 525 MB) that is most of what a frame's copies cost now that
marked pages took snapshots and copy-back down to a few milliseconds,
and one thread moves far less than the memory can: here 9.6 GB/s on one
thread, 15.4 GB/s on four, where it saturates.

`Batch::flush` now collects its refreshes' copies (`copy_pool::queued`)
and makes them together at the end (`copy_pool::run`): copies are cut to
1 MiB, and from 4 MiB in all they are taken by index by three persistent
workers and the submitting thread; flush returns once all are made, so
the steps and lists after it see them. Queued are the copies no snapshot
reads back: those of ranges no shader writes, and those under ranges
shaders write that no snapshot covers (marked ranges keep none). Where a
snapshot covers a run, `update_tracked` still copies at once and takes
the bytes into the snapshot. What a queued copy took goes into the saved
bytes of the armed pages it covers once it is made
(`Shadow::queued_made`, as `Shadow::copy` hands its bytes to
`Tracked::refreshed`). Outside a flush every copy is made at once, as
before.

The new ignored benchmark `host::batch::world_frame_refreshes` replays a
world frame's refreshes through `Batch` as `Host::execute` does (title
writes to 256 random pages, 24 declared ranges armed as marked, one
flush, 36 submissions) and checks every title write reached the copy.
RTX 5070 Ti host, release build, median of 6 frames: 65.8 ms per frame
on one thread, 44.9 ms with the workers (a second run: 69.2 and 47.0),
about 525 MB copied either way.
A test for what review asked of the copy pool: past the threshold the
workers copy. With a test-only switch the submitting thread leaves every
piece to the workers, and a test-only count of the pieces they copied
shows they copied all 128 of a run's, each byte where it belongs. The
copies are unchanged outside tests.

Also measured and dropped: handing copies to the workers while the
submitting thread is still finding dirty pages (to overlap its ~7 ms of
finding with the copying). On the world-frame benchmark it made refresh
slower, 49 -> 70 ms per frame (20 alternating runs, slower in all 20):
finding resets write watches and page protections, which contends with
the workers' ReadProcessMemory for the process's address space.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 04:52:59 +00:00
Author
Owner

@⁠jeremygold02 on GitHub · 2026-11-25 04:19 UTC · original

Triage verdict — Keep the parallel refresh path, verify worker participation explicitly (cda7548)

Evidence

  • @⁠0xkn0wh3r3 queues refresh copies and waits for completion before submission continues. Snapshot-covered ranges still copy synchronously. #1010, #943, and #202 modify the individual copy or fallback, so they remain separate from this dispatch change. Batch refresh · Worker dispatch

Checks and limits

  • The exact-head CPU copy-pool test passed. A disposable control forced the serial path and all the submitted test’s assertions still passed. Another control required a live pool and kept the submitting thread from claiming pieces. Worker-only copies completed with the expected bytes, confirming the wait and completion path in that run.
  • The controls check byte results and execution paths. I did not rerun the frame-scale performance benchmark. Existing test

Next step

  • Keep the byte-equivalence and repeat-call coverage. Add a deterministic participation assertion for the above-threshold case, or name the existing test for its verified queue and byte behavior and keep a separate worker-only control.

This verification was AI-assisted.

**@⁠jeremygold02** on GitHub · 2026-11-25 04:19 UTC · [original](https://github.com/Marvisak/VIctory/pull/2051#issuecomment-7152746589) **Triage verdict — Keep the parallel refresh path, verify worker participation explicitly** (`cda7548`) **Evidence** - @⁠0xkn0wh3r3 queues refresh copies and waits for completion before submission continues. Snapshot-covered ranges still copy synchronously. #1010, #943, and #202 modify the individual copy or fallback, so they remain separate from this dispatch change. [Batch refresh](https://github.com/Marvisak/VIctory/blob/cda7548ab79df72ccbb6722eba0497438418813e/crates/victory-gpu/src/host.rs#L1943-L1979) · [Worker dispatch](https://github.com/Marvisak/VIctory/blob/cda7548ab79df72ccbb6722eba0497438418813e/crates/victory-gpu/src/copy_pool.rs#L64-L82) **Checks and limits** - The exact-head CPU copy-pool test passed. A disposable control forced the serial path and all the submitted test’s assertions still passed. Another control required a live pool and kept the submitting thread from claiming pieces. Worker-only copies completed with the expected bytes, confirming the wait and completion path in that run. - The controls check byte results and execution paths. I did not rerun the frame-scale performance benchmark. [Existing test](https://github.com/Marvisak/VIctory/blob/cda7548ab79df72ccbb6722eba0497438418813e/crates/victory-gpu/src/copy_pool.rs#L191-L231) **Next step** - Keep the byte-equivalence and repeat-call coverage. Add a deterministic participation assertion for the above-threshold case, or name the existing test for its verified queue and byte behavior and keep a separate worker-only control. This verification was AI-assisted.
Author
Owner

@⁠0xkn0wh3r3 on GitHub · 2026-11-25 05:27 UTC · original

Thanks for the triage. Added in e004f35: copy_pool::tests::the_workers_take_the_pieces_past_the_threshold. A test-only switch makes the submitting thread leave every piece to the workers, and a test-only count of the pieces they copy shows they copied all 128 of an 8 MiB run, each byte where it belongs. Nothing outside tests changes.

Also measured on the same benchmark and dropped: handing copies to the workers while the submitting thread is still finding dirty pages. It made refresh slower (median 49 -> 70 ms per frame, slower in all 20 alternating runs), as finding resets write watches and page protections, which contends with the workers' ReadProcessMemory.

**@⁠0xkn0wh3r3** on GitHub · 2026-11-25 05:27 UTC · [original](https://github.com/Marvisak/VIctory/pull/2051#issuecomment-7153786014) Thanks for the triage. Added in e004f35: `copy_pool::tests::the_workers_take_the_pieces_past_the_threshold`. A test-only switch makes the submitting thread leave every piece to the workers, and a test-only count of the pieces they copy shows they copied all 128 of an 8 MiB run, each byte where it belongs. Nothing outside tests changes. Also measured on the same benchmark and dropped: handing copies to the workers while the submitting thread is still finding dirty pages. It made refresh slower (median 49 -> 70 ms per frame, slower in all 20 alternating runs), as finding resets write watches and page protections, which contends with the workers' `ReadProcessMemory`.
Author
Owner

@⁠Marvisak on GitHub · 2026-11-25 09:22 UTC · original · edited 2026-11-26 01:20 UTC

Automated triage for the maintainers.

Merge candidate (unchanged). The head is still 9ff67b2, which merges cleanly onto current main. The latest reply only answers @⁠MeMako's in-title numbers. Its explanation fits the code: copy_pool::run uses one thread below PARALLEL_FROM (4 MiB per flush), and Shadow::update_tracked still copies snapshot-covered runs at once. So nothing in the earlier reading of Batch::flush, Shadow::queued_made and the Pool::run/Pool::worker handshake changes.

One minor, non-blocking point from the comments: copy_pool::queued doesn't clear its thread-local queue when the closure panics. A drop guard would make it robust if update_all ever gains a panic path.

CI: passing (check).

Recommending a look, not approving.


Generated by Claude Code

**@⁠Marvisak** on GitHub · 2026-11-25 09:22 UTC · [original](https://github.com/Marvisak/VIctory/pull/2051#issuecomment-7158236383) · edited 2026-11-26 01:20 UTC <!-- victory-triage v1 head=9ff67b2aa8bba361a7d6cb26c612c06d8ed529e9 verdict=merge-candidate at=2026-11-26T01:20:36Z --> Automated triage for the maintainers. **Merge candidate (unchanged).** The head is still `9ff67b2`, which merges cleanly onto current `main`. The latest reply only answers @⁠MeMako's in-title numbers. Its explanation fits the code: `copy_pool::run` uses one thread below `PARALLEL_FROM` (4 MiB per flush), and `Shadow::update_tracked` still copies snapshot-covered runs at once. So nothing in the earlier reading of `Batch::flush`, `Shadow::queued_made` and the `Pool::run`/`Pool::worker` handshake changes. One minor, non-blocking point from the comments: `copy_pool::queued` doesn't clear its thread-local queue when the closure panics. A drop guard would make it robust if `update_all` ever gains a panic path. CI: passing (`check`). Recommending a look, not approving. --- _Generated by [Claude Code](https://claude.ai/code)_
Author
Owner

@⁠xndbogdan on GitHub · 2026-11-25 23:33 UTC · original

Results from #2134's world_frame_preparing on two quite different CPUs, against the same benchmark on main.

Builds: main 842b0cb with #2134 merged, and the same with this PR merged on top (6a3296f). diag profile with diagnostics, hardware adapter. #2134 doesn't build on current main as it is: Shadow::mark_written calls bitmap(), which now takes memory: bool. I changed it to bitmap(false) locally in both builds, which is the only change. Three runs per build, interleaved with the other builds, each the benchmark's median of 5 frames.

Ryzen 7 9800X3D (8 cores, DDR5), RTX 5080 Xeon E5-2670 v3 (12 cores, DDR4), RX 9070 XT
preparing, main 48.1 / 48.9 / 50.2 ms 159.9 / 163.6 / 159.3 ms
preparing, this PR 37.6 / 34.6 / 33.9 ms (−28%) 134.0 / 131.4 / 133.8 ms (−17%)
of it, "GPU writes" step, main 41.6 / 41.6 / 43.4 ms 149.4 / 153.3 / 148.9 ms
of it, "GPU writes" step, this PR 31.0 / 28.4 / 27.7 ms 122.9 / 120.5 / 122.8 ms
copying back, main 39.0 / 39.3 / 42.0 ms 147.3 / 145.2 / 143.3 ms
copying back, this PR 41.7 / 37.5 / 36.1 ms 149.4 / 147.8 / 147.8 ms
  • The work counters are identical between the two builds on both machines: 1,325 change checks, 6,657.8 MB checked, 243.7 MB copied. So the same copies are made, faster.
  • The gain is well outside the spread of three other PRs measured in the same rounds, whose code doesn't run in this benchmark (0–6 ms either way; see #2134).
  • Copying back doesn't move, as expected.

All 30 runs passed the benchmark's checks.

AI-assisted (Claude Code). Synthetic benchmark only, no game data.

**@⁠xndbogdan** on GitHub · 2026-11-25 23:33 UTC · [original](https://github.com/Marvisak/VIctory/pull/2051#issuecomment-7177726360) Results from #2134's `world_frame_preparing` on two quite different CPUs, against the same benchmark on `main`. **Builds:** `main` `842b0cb` with #2134 merged, and the same with this PR merged on top (`6a3296f`). `diag` profile with `diagnostics`, hardware adapter. #2134 doesn't build on current `main` as it is: `Shadow::mark_written` calls `bitmap()`, which now takes `memory: bool`. I changed it to `bitmap(false)` locally in both builds, which is the only change. Three runs per build, interleaved with the other builds, each the benchmark's median of 5 frames. | | Ryzen 7 9800X3D (8 cores, DDR5), RTX 5080 | Xeon E5-2670 v3 (12 cores, DDR4), RX 9070 XT | |---|---:|---:| | preparing, `main` | 48.1 / 48.9 / 50.2 ms | 159.9 / 163.6 / 159.3 ms | | preparing, this PR | **37.6 / 34.6 / 33.9 ms** (−28%) | **134.0 / 131.4 / 133.8 ms** (−17%) | | of it, "GPU writes" step, `main` | 41.6 / 41.6 / 43.4 ms | 149.4 / 153.3 / 148.9 ms | | of it, "GPU writes" step, this PR | 31.0 / 28.4 / 27.7 ms | 122.9 / 120.5 / 122.8 ms | | copying back, `main` | 39.0 / 39.3 / 42.0 ms | 147.3 / 145.2 / 143.3 ms | | copying back, this PR | 41.7 / 37.5 / 36.1 ms | 149.4 / 147.8 / 147.8 ms | - The work counters are identical between the two builds on both machines: 1,325 change checks, 6,657.8 MB checked, 243.7 MB copied. So the same copies are made, faster. - The gain is well outside the spread of three other PRs measured in the same rounds, whose code doesn't run in this benchmark (0–6 ms either way; see #2134). - Copying back doesn't move, as expected. All 30 runs passed the benchmark's checks. *AI-assisted (Claude Code). Synthetic benchmark only, no game data.*
Author
Owner

@⁠0xkn0wh3r3 on GitHub · 2026-11-25 23:35 UTC · original

@⁠xndbogdan thanks for running it on two very different machines. Identical work counters (1,325 checks, 6,657.8 MB checked, 243.7 MB copied) with the "GPU writes" step down 25–34% on the 9800X3D and about 18% on the Xeon is the cleanest evidence that the same copies just run in parallel. Copy-back not moving is expected too: this PR only parallelises the refresh copies.

**@⁠0xkn0wh3r3** on GitHub · 2026-11-25 23:35 UTC · [original](https://github.com/Marvisak/VIctory/pull/2051#issuecomment-7177772323) @⁠xndbogdan thanks for running it on two very different machines. Identical work counters (1,325 checks, 6,657.8 MB checked, 243.7 MB copied) with the "GPU writes" step down 25–34% on the 9800X3D and about 18% on the Xeon is the cleanest evidence that the same copies just run in parallel. Copy-back not moving is expected too: this PR only parallelises the refresh copies.
Author
Owner

@⁠fuzeofficlal on GitHub · 2026-11-26 00:44 UTC · original

Code review (lifetime/concurrency audit) and RTX 5090 + WARP verification at head 9ff67b2aa8bb merged cleanly onto main (63bcca43c6a0):

  • Concurrency & lifetime audit:
    • Batch::flush (host.rs:2442-2455) collects pieces via copy_pool::queued(|| self.update_all()), executes copy_pool::run(pieces), and then calls shadow.queued_made() over self.current.values(). Since Batch::add deduplicates by Shadow pointer and self.current holds Arc<Shadow> across both parallel copy and queued_made() (Batch::title_written() flushes before clearing current), every backing buffer outlives its copy work.
    • Shadow::update_tracked (shadow.rs:611-680) keeps snapshot-overlapping (before) and unmapped ranges synchronous, queuing only disjoint non-overlapping runs/untracked spans for parallel copy before queued_made calls Tracked::refreshed.
    • Pool::run (copy_pool.rs:138-182) serializes batches under running, publishes jobs under self.job, and re-acquires self.job before finished.notify_all() (no lost wakeup). Minor non-blocking note: copy_pool::queued (lines 24-29) does not use a Drop guard on TLS QUEUE, so a panic inside the closure would leave Some installed (currently update_all has no panic path).
  • Verified (Windows 11, NVIDIA RTX 5090 + WARP, VICTORY_D3D12_DEBUG=1, Rust 1.98.1):
    • cargo xtask policy: 192 files ok; cargo clippy -p victory-gpu --all-targets -- -D warnings (default + --features diagnostics): 0 warnings
    • copy_pool:: shadow:: host::tests:: --skip descriptor::host: 29/29 passed on both RTX 5090 and WARP (--features diagnostics)
    • --release host::batch::world_frame_refreshes: passed (all title writes observed on host copies; first 3 frames dropped from 85.3–102.9 ms single-threaded to 52.5–73.9 ms with workers).

Clean concurrency design; LGTM.

**@⁠fuzeofficlal** on GitHub · 2026-11-26 00:44 UTC · [original](https://github.com/Marvisak/VIctory/pull/2051#issuecomment-7179073333) Code review (lifetime/concurrency audit) and RTX 5090 + WARP verification at head `9ff67b2aa8bb` merged cleanly onto `main` (`63bcca43c6a0`): - **Concurrency & lifetime audit**: - `Batch::flush` (`host.rs:2442-2455`) collects pieces via `copy_pool::queued(|| self.update_all())`, executes `copy_pool::run(pieces)`, and then calls `shadow.queued_made()` over `self.current.values()`. Since `Batch::add` deduplicates by `Shadow` pointer and `self.current` holds `Arc<Shadow>` across both parallel copy and `queued_made()` (`Batch::title_written()` flushes before clearing `current`), every backing buffer outlives its copy work. - `Shadow::update_tracked` (`shadow.rs:611-680`) keeps snapshot-overlapping (`before`) and `unmapped` ranges synchronous, queuing only disjoint non-overlapping `runs`/`untracked` spans for parallel copy before `queued_made` calls `Tracked::refreshed`. - `Pool::run` (`copy_pool.rs:138-182`) serializes batches under `running`, publishes jobs under `self.job`, and re-acquires `self.job` before `finished.notify_all()` (no lost wakeup). Minor non-blocking note: `copy_pool::queued` (lines 24-29) does not use a `Drop` guard on TLS `QUEUE`, so a panic inside the closure would leave `Some` installed (currently `update_all` has no panic path). - **Verified (Windows 11, NVIDIA RTX 5090 + WARP, `VICTORY_D3D12_DEBUG=1`, Rust 1.98.1)**: - `cargo xtask policy`: `192 files ok`; `cargo clippy -p victory-gpu --all-targets -- -D warnings` (default + `--features diagnostics`): 0 warnings - `copy_pool:: shadow:: host::tests:: --skip descriptor::host`: **29/29 passed** on both RTX 5090 and WARP (`--features diagnostics`) - `--release` `host::batch::world_frame_refreshes`: passed (all title writes observed on host copies; first 3 frames dropped from 85.3–102.9 ms single-threaded to 52.5–73.9 ms with workers). Clean concurrency design; LGTM.
Author
Owner

@⁠MeMako on GitHub · 2026-11-26 00:56 UTC · original

Independent verification of 9ff67b2 on AMD Ryzen 9 7950X + AMD Radeon RX 9070 XT (adapter 0, driver 32.0.32029.2010, Windows 11 10.0.26200 x64).

CI checks & synthetic benchmark:

  • cargo clippy -p victory-gpu -p victory --all-targets --locked -- -D warnings (and --all-features): pass
  • cargo test -p victory-gpu --locked: 234 passed, 0 failed (all new copy_pool / shadow tests pass on RX 9070 XT)
  • world_frame_refreshes (release build, median of 6 frames, ~518 MB/frame):
    • One thread: 51.7 ms (~10.0 GB/s)
    • Workers (4 threads): 32.6 ms (~15.9 GB/s, 37% faster)

Live title run (release build, warm shader & pipeline cache):
(Note: merged cleanly onto 842b0cb + a local RDNA 4 separate-handle workaround equivalent to #2122 and DYNAMIC = 1 << 19, since plain main crashes amdxc64.dll on this card; before/after compared against the exact same local branch without #2051.)

Bucket (draws >= 200, excluding menus/pause) Without #2051 With #2051 Delta
All world (n=104 vs n=29) — copies avg 153.1 ms (560.1 MB) 123.4 ms (549.2 MB) -29.7 ms (-19.4%)
All world — copies throughput (med / agg) 4.08 / 3.66 GB/s 4.74 / 4.45 GB/s +16% / +21.6%
Heavy world (>2,500 draws, n=73 vs n=22) — copies avg 161.0 ms (585.3 MB) 122.5 ms (530.6 MB) -38.5 ms (-23.9%)
Crashes / errors 0 0 Clean

One observation from the live run: real-world copy throughput reached ~4.45 GB/s vs ~15.9 GB/s in the synthetic benchmark (~550 MB/frame copied), likely because smaller submissions (< 4 MiB), snapshot-covered ranges, or unmapped-hole fallbacks still run single-threaded — #2051 is a clear win either way with zero regressions.

No game data, shader names, or screenshots are included, per docs/asset-policy.md. Hardware runs were performed by me on my 7950X / RX 9070 XT; comment drafted with Antigravity.

**@⁠MeMako** on GitHub · 2026-11-26 00:56 UTC · [original](https://github.com/Marvisak/VIctory/pull/2051#issuecomment-7179271349) Independent verification of `9ff67b2` on AMD Ryzen 9 7950X + AMD Radeon RX 9070 XT (adapter 0, driver `32.0.32029.2010`, Windows 11 `10.0.26200` x64). **CI checks & synthetic benchmark:** - `cargo clippy -p victory-gpu -p victory --all-targets --locked -- -D warnings` (and `--all-features`): pass - `cargo test -p victory-gpu --locked`: 234 passed, 0 failed (all new `copy_pool` / `shadow` tests pass on RX 9070 XT) - `world_frame_refreshes` (release build, median of 6 frames, ~518 MB/frame): - One thread: **51.7 ms** (~10.0 GB/s) - Workers (4 threads): **32.6 ms** (~15.9 GB/s, **37% faster**) **Live title run (release build, warm shader & pipeline cache):** *(Note: merged cleanly onto `842b0cb` + a local RDNA 4 separate-handle workaround equivalent to #2122 and `DYNAMIC = 1 << 19`, since plain `main` crashes `amdxc64.dll` on this card; before/after compared against the exact same local branch without #2051.)* | Bucket (`draws >= 200`, excluding menus/pause) | Without #2051 | With #2051 | Delta | |---|---|---|---| | All world (`n=104` vs `n=29`) — `copies` avg | `153.1 ms` (`560.1 MB`) | `123.4 ms` (`549.2 MB`) | **-29.7 ms (-19.4%)** | | All world — `copies` throughput (med / agg) | `4.08` / `3.66 GB/s` | `4.74` / `4.45 GB/s` | **+16% / +21.6%** | | Heavy world (`>2,500` draws, `n=73` vs `n=22`) — `copies` avg | `161.0 ms` (`585.3 MB`) | `122.5 ms` (`530.6 MB`) | **-38.5 ms (-23.9%)** | | Crashes / errors | `0` | `0` | Clean | One observation from the live run: real-world copy throughput reached ~4.45 GB/s vs ~15.9 GB/s in the synthetic benchmark (~550 MB/frame copied), likely because smaller submissions (`< 4 MiB`), snapshot-covered ranges, or unmapped-hole fallbacks still run single-threaded — `#2051` is a clear win either way with zero regressions. No game data, shader names, or screenshots are included, per `docs/asset-policy.md`. Hardware runs were performed by me on my 7950X / RX 9070 XT; comment drafted with Antigravity.
Author
Owner

@⁠0xkn0wh3r3 on GitHub · 2026-11-26 00:59 UTC · original

@⁠MeMako thanks for the 7950X / RX 9070 XT numbers, especially the in-title buckets: copies down 19% across the world and 24% in heavy scenes, with no errors. Your reading of the gap to the synthetic 15.9 GB/s fits the code. Submissions under 4 MiB in all stay on one thread (PARALLEL_FROM), and pages a snapshot covers are copied at once so the snapshot can take their bytes. So a frame of many small submissions keeps part of its copying serial. Lowering the threshold, or batching across submissions, would be the next step if that share turns out large.

**@⁠0xkn0wh3r3** on GitHub · 2026-11-26 00:59 UTC · [original](https://github.com/Marvisak/VIctory/pull/2051#issuecomment-7179308628) @⁠MeMako thanks for the 7950X / RX 9070 XT numbers, especially the in-title buckets: copies down 19% across the world and 24% in heavy scenes, with no errors. Your reading of the gap to the synthetic 15.9 GB/s fits the code. Submissions under 4 MiB in all stay on one thread (`PARALLEL_FROM`), and pages a snapshot covers are copied at once so the snapshot can take their bytes. So a frame of many small submissions keeps part of its copying serial. Lowering the threshold, or batching across submissions, would be the next step if that share turns out large.
Author
Owner

@⁠catminou4 on GitHub · 2026-11-25 04:17 UTC · original · reviewed

Static review only: victory-gpu is Windows-only (D3D12/windows_sys) — nothing compiles or runs on macOS; source review of the diff.

Submission refreshes copy on several threads — parallel copy of refresh data; check the threading invariants on the copy sources.

**@⁠catminou4** on GitHub · 2026-11-25 04:17 UTC · [original](https://github.com/Marvisak/VIctory/pull/2051#pullrequestreview-6051789105) · **reviewed** Static review only: victory-gpu is Windows-only (D3D12/windows_sys) — nothing compiles or runs on macOS; source review of the diff. Submission refreshes copy on several threads — parallel copy of refresh data; check the threading invariants on the copy sources.
Author
Owner

@⁠DenRakEiw on GitHub · 2026-11-25 04:49 UTC · original · approved these changes

Verified locally merged onto origin/main (940d32f, Windows 11 x64, Rust 1.98.1 MSVC):

  • cargo test -p victory-gpu --lib copy_pool:: — 1 passed, 0 failed
  • cargo clippy -p victory-gpu --all-targets — 0 warnings
  • cargo xtask policy — ok (184 files ok)

Clean multithreaded copy pool for parallelizing submission shadow-buffer refreshes. Looks good.

AI-assisted (Gemini 4 Neon).

**@⁠DenRakEiw** on GitHub · 2026-11-25 04:49 UTC · [original](https://github.com/Marvisak/VIctory/pull/2051#pullrequestreview-6052017503) · **approved these changes** Verified locally merged onto `origin/main` (`940d32f`, Windows 11 x64, Rust 1.98.1 MSVC): - `cargo test -p victory-gpu --lib copy_pool::` — 1 passed, 0 failed - `cargo clippy -p victory-gpu --all-targets` — 0 warnings - `cargo xtask policy` — ok (`184 files ok`) Clean multithreaded copy pool for parallelizing submission shadow-buffer refreshes. Looks good. AI-assisted (Gemini 4 Neon).
Author
Owner

@⁠Xvania7 on GitHub · 2026-11-25 11:43 UTC · original · approved these changes

Verified e004f35 on Windows 10 + NVIDIA GeForce RTX 5060:

  • copy_pool::tests:: (2 passed: queued_copies_are_made_on_the_workers, the_workers_take_the_pieces_past_the_threshold)
  • shadow::tests:: (4 passed)
  • cargo clippy -p victory-gpu --all-targets -- -D warnings: 0 warnings
  • cargo xtask policy: 183 files ok

Approving.

**@⁠Xvania7** on GitHub · 2026-11-25 11:43 UTC · [original](https://github.com/Marvisak/VIctory/pull/2051#pullrequestreview-6056981427) · **approved these changes** Verified `e004f35` on Windows 10 + NVIDIA GeForce RTX 5060: - `copy_pool::tests::` (2 passed: `queued_copies_are_made_on_the_workers`, `the_workers_take_the_pieces_past_the_threshold`) - `shadow::tests::` (4 passed) - `cargo clippy -p victory-gpu --all-targets -- -D warnings`: 0 warnings - `cargo xtask policy`: 183 files ok Approving.
Author
Owner

@⁠imjustprism on GitHub · 2026-11-26 18:16 UTC · original · reviewed

ran 9ff67b2 in the title with timers around the phases of a submission, to split out what this pr changes and to answer the open question about the 4 MiB threshold. rx 9070 xt, world, medians per frame:

per frame main, run 1 main, run 2 with this pr, run 1 run 2 run 3
Batch::flush without the write-watch take, ms 25.1 17.9 9.9 11.1 13.0
bytes refreshed, MB 114.1 115.1 96.4 105.4 104.2
ms per MB 0.22 0.16 0.10 0.11 0.12
flushes 185 181 151 157 171

63bcca4 plus #2122 (this card needs it) plus local timers, with and without this pr merged in. diag build, series-x, the same scripted key presses, warm shader and pipeline caches, quiet machine, 12-minute runs, medians over 47 to 74 world frame lines per run. no errors and no device removed in any run. scenes drift between runs, so ms per MB is the row to compare: 20 to 53% less before rounding, and every run with the pr is below both runs without. the copy alone goes from 4.9 and 7.1 GB/s on one thread to 9.5 GB/s (run 3, time inside copy_pool::run). the whole frame was 195 and 213 ms without and 155 to 182 ms with; i would read that only as "not slower".

run 3 had one more timer and three counters in Batch::flush:

run 3, per frame
bytes queued 104.2 MB of 104.2 MB refreshed
bytes in flushes of 4 MiB or more 79.9 MB (77%; 76 to 88% by draw bucket)
time in copy_pool::run 11.0 ms
time in the queued_made loop 0.6 ms (3.1 ms in the heaviest bucket, 4 lines)
copies that loop visits 31,000 (242,000 in the heaviest bucket)

so on the threshold: about three quarters of the bytes already reach the workers here, though there are 150 to 180 flushes a frame. the other quarter sits in the many small flushes; lowering PARALLEL_FROM can only win on that part.

what i checked from the description:

  • the three new tests pass here.
  • world_frame_refreshes, release, two runs: 50.3 and 51.4 ms on one thread, 26.7 and 30.0 ms with the workers, about 520 MB (10 GB/s against 17 to 19). matches.
  • "about 525 MB" a frame is the benchmark's load. this scene on this profile refreshes 96 to 115 MB a frame, up to about 200 MB in the heaviest bucket.
  • "only copies no snapshot reads back are queued": in these runs every refreshed byte was queued, none was copied at once under a snapshot, so the path that copies at once got no coverage from my runs.

small points from reading the diff, none blocking:

  • host.rs:2450: after every flush the loop calls queued_made on every copy in current, and each tracked one takes its queued lock, whether or not that flush queued anything for it. run 3 counted 31,000 visits a frame against 3,600 copies updated, so about nine in ten find nothing. it costs 0.6 ms a frame here and 3.1 ms in the heaviest scenes. update_all already knows which copies it updated in this flush; visiting only those removes it.
  • shadow.rs:138: the SAFETY comment on unsafe impl Send for Shadow says data is "written only on the submitting thread". with this pr the workers write it too. the code holds because the flush waits for run; the comment should say that instead.
  • shadow.rs:669 and shadow.rs:691: with the diagnostics feature, WholeUs now times queueing, so the "copied whole" time in the frame line reads near zero while the copy itself is counted elsewhere. the doc on Batch::flush says this for the per-range time but not for this one.

i agree with the audit above on Pool::run and Pool::worker: i looked for a lost wakeup and for a copy outliving its buffer and found neither.

**@⁠imjustprism** on GitHub · 2026-11-26 18:16 UTC · [original](https://github.com/Marvisak/VIctory/pull/2051#pullrequestreview-6078870077) · **reviewed** ran 9ff67b2 in the title with timers around the phases of a submission, to split out what this pr changes and to answer the open question about the 4 MiB threshold. rx 9070 xt, world, medians per frame: | per frame | main, run 1 | main, run 2 | with this pr, run 1 | run 2 | run 3 | |---|---|---|---|---|---| | `Batch::flush` without the write-watch take, ms | 25.1 | 17.9 | 9.9 | 11.1 | 13.0 | | bytes refreshed, MB | 114.1 | 115.1 | 96.4 | 105.4 | 104.2 | | ms per MB | 0.22 | 0.16 | 0.10 | 0.11 | 0.12 | | flushes | 185 | 181 | 151 | 157 | 171 | 63bcca4 plus #2122 (this card needs it) plus local timers, with and without this pr merged in. diag build, series-x, the same scripted key presses, warm shader and pipeline caches, quiet machine, 12-minute runs, medians over 47 to 74 world frame lines per run. no errors and no device removed in any run. scenes drift between runs, so ms per MB is the row to compare: 20 to 53% less before rounding, and every run with the pr is below both runs without. the copy alone goes from 4.9 and 7.1 GB/s on one thread to 9.5 GB/s (run 3, time inside `copy_pool::run`). the whole frame was 195 and 213 ms without and 155 to 182 ms with; i would read that only as "not slower". run 3 had one more timer and three counters in `Batch::flush`: | run 3, per frame | | |---|---| | bytes queued | 104.2 MB of 104.2 MB refreshed | | bytes in flushes of 4 MiB or more | 79.9 MB (77%; 76 to 88% by draw bucket) | | time in `copy_pool::run` | 11.0 ms | | time in the `queued_made` loop | 0.6 ms (3.1 ms in the heaviest bucket, 4 lines) | | copies that loop visits | 31,000 (242,000 in the heaviest bucket) | so on the threshold: about three quarters of the bytes already reach the workers here, though there are 150 to 180 flushes a frame. the other quarter sits in the many small flushes; lowering `PARALLEL_FROM` can only win on that part. what i checked from the description: - the three new tests pass here. - `world_frame_refreshes`, release, two runs: 50.3 and 51.4 ms on one thread, 26.7 and 30.0 ms with the workers, about 520 MB (10 GB/s against 17 to 19). matches. - "about 525 MB" a frame is the benchmark's load. this scene on this profile refreshes 96 to 115 MB a frame, up to about 200 MB in the heaviest bucket. - "only copies no snapshot reads back are queued": in these runs every refreshed byte was queued, none was copied at once under a snapshot, so the path that copies at once got no coverage from my runs. small points from reading the diff, none blocking: - `host.rs:2450`: after every flush the loop calls `queued_made` on every copy in `current`, and each tracked one takes its `queued` lock, whether or not that flush queued anything for it. run 3 counted 31,000 visits a frame against 3,600 copies updated, so about nine in ten find nothing. it costs 0.6 ms a frame here and 3.1 ms in the heaviest scenes. `update_all` already knows which copies it updated in this flush; visiting only those removes it. - `shadow.rs:138`: the `SAFETY` comment on `unsafe impl Send for Shadow` says `data` is "written only on the submitting thread". with this pr the workers write it too. the code holds because the flush waits for `run`; the comment should say that instead. - `shadow.rs:669` and `shadow.rs:691`: with the `diagnostics` feature, `WholeUs` now times queueing, so the "copied whole" time in the frame line reads near zero while the copy itself is counted elsewhere. the doc on `Batch::flush` says this for the per-range time but not for this one. i agree with the audit above on `Pool::run` and `Pool::worker`: i looked for a lost wakeup and for a copy outliving its buffer and found neither.
Batch::flush called Shadow::queued_made on every copy current in the
submission after each flush, each tracked one taking its queued lock
whether or not that flush queued anything for it. update_all now
leaves the refreshes in place and the flush drains them after
copy_pool::run, so only the copies it updated are visited.

The SAFETY comment on Shadow's Send and Sync says the refresh workers
write its mapping too, only inside copy_pool::run, which the flush
waits for. The doc on Batch::flush says that with diagnostics the
copied-whole time counts only queueing, and where the copies count.
Author
Owner

@⁠0xkn0wh3r3 on GitHub · 2026-11-26 18:26 UTC · original

@⁠imjustprism thanks for the in-title runs and the phase timers. ms per MB down 20 to 53%, with no errors, is the figure I could not get here. I added your table to the description. All three points are addressed in b55f5c6:

  • queued_made loop: Batch::flush now visits only the copies that flush updated. update_all leaves them in refreshes, and the flush drains that list after copy_pool::run. Before, it went through every copy current in the submission. Nothing else changes: only update_all calls update inside copy_pool::queued, so only those copies can have queued ranges.
  • SAFETY on Shadow's Send/Sync: it now says the refresh workers write data only inside copy_pool::run, and the flush waits for that before it goes on.
  • WholeUs: doc only. The Batch::flush doc now says that with diagnostics, both the per-range time and the copied-whole time count only finding and queueing. The copies themselves count in the flush time (FlushUs) and, summed over the threads, in the move time (MoveUs). I left the counter alone: putting the pool's time under "copied whole" would mean tagging each queued piece by its kind, and the threads overlap, so a summed time would not be wall time anyway.

On the threshold: 77% of the bytes were in flushes of 4 MiB or more, so about three quarters already reach the workers. Lowering PARALLEL_FROM can only win on the remaining quarter, the many small flushes. I've left the threshold as it is in this PR.

**@⁠0xkn0wh3r3** on GitHub · 2026-11-26 18:26 UTC · [original](https://github.com/Marvisak/VIctory/pull/2051#issuecomment-7200466563) @⁠imjustprism thanks for the in-title runs and the phase timers. ms per MB down 20 to 53%, with no errors, is the figure I could not get here. I added your table to the description. All three points are addressed in b55f5c6: - `queued_made` loop: `Batch::flush` now visits only the copies that flush updated. `update_all` leaves them in `refreshes`, and the flush drains that list after `copy_pool::run`. Before, it went through every copy current in the submission. Nothing else changes: only `update_all` calls `update` inside `copy_pool::queued`, so only those copies can have queued ranges. - `SAFETY` on `Shadow`'s `Send`/`Sync`: it now says the refresh workers write `data` only inside `copy_pool::run`, and the flush waits for that before it goes on. - `WholeUs`: doc only. The `Batch::flush` doc now says that with `diagnostics`, both the per-range time and the copied-whole time count only finding and queueing. The copies themselves count in the flush time (`FlushUs`) and, summed over the threads, in the move time (`MoveUs`). I left the counter alone: putting the pool's time under "copied whole" would mean tagging each queued piece by its kind, and the threads overlap, so a summed time would not be wall time anyway. On the threshold: 77% of the bytes were in flushes of 4 MiB or more, so about three quarters already reach the workers. Lowering `PARALLEL_FROM` can only win on the remaining quarter, the many small flushes. I've left the threshold as it is in this PR.
Author
Owner

@⁠imjustprism on GitHub · 2026-11-26 19:24 UTC · original

checked b55f5c6 the same way as before (same base, same timers and counters, one 12-minute world run):

per frame 9ff67b2, run 3 b55f5c6
copies the queued_made loop visits 31,000 4,010
copies updated 3,550 4,010
time in that loop, ms 0.6 0.3
time in that loop, heaviest bucket, ms 3.1 (4 lines) 0.4 (15 lines)
Batch::flush without the write-watch take, ms per MB 0.12 0.10

the loop now visits exactly the copies the flush updated, on every frame line. no errors and no device removed, 70 world frame lines. the three tests pass at this head, and world_frame_refreshes gives 59.5 ms on one thread and 29.7 ms with the workers (one run). the new SAFETY text matches the code, and leaving WholeUs as a documented limit is fine by me. nothing open from my side.

**@⁠imjustprism** on GitHub · 2026-11-26 19:24 UTC · [original](https://github.com/Marvisak/VIctory/pull/2051#issuecomment-7201552301) checked b55f5c6 the same way as before (same base, same timers and counters, one 12-minute world run): | per frame | 9ff67b2, run 3 | b55f5c6 | |---|---|---| | copies the `queued_made` loop visits | 31,000 | 4,010 | | copies updated | 3,550 | 4,010 | | time in that loop, ms | 0.6 | 0.3 | | time in that loop, heaviest bucket, ms | 3.1 (4 lines) | 0.4 (15 lines) | | `Batch::flush` without the write-watch take, ms per MB | 0.12 | 0.10 | the loop now visits exactly the copies the flush updated, on every frame line. no errors and no device removed, 70 world frame lines. the three tests pass at this head, and `world_frame_refreshes` gives 59.5 ms on one thread and 29.7 ms with the workers (one run). the new `SAFETY` text matches the code, and leaving `WholeUs` as a documented limit is fine by me. nothing open from my side.
This pull request can be merged automatically.
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/2051/head:github-bot/gh-2051'
git switch 'github-bot/gh-2051'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-2051'
git switch 'github-bot/gh-2051'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-2051'
git switch 'github-bot/gh-2051'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-2051'
git switch 'main'
git merge --squash 'github-bot/gh-2051'
git switch 'main'
git merge --ff-only 'github-bot/gh-2051'
git switch 'main'
git merge 'github-bot/gh-2051'
git push origin 'main'
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/Marvisak--VIctory!2051
No description provided.