GPU: copy title memory into host memory without a system call #1010

Open
github-bot wants to merge 4 commits from github-bot/gh-1010 into main AGit
Owner

@⁠TG0000 on GitHub · 2026-11-24 14:57 UTC · original
TG0000:perf/user-mode-title-copies → main · +693 −17 · 3 files · 4 commits · open

Summary

Every constant buffer fill of a submission is one ReadProcessMemory call, about 0.8 us for a few hundred bytes, and a world frame makes many of them. A leaf routine now copies in user mode. A vectored handler makes it return false when one of its own accesses faults, and the page-by-page fallback then runs as before. Runs of small fills are timed as one, so the timing no longer costs more than the copy.

Measured

title_copy_bench (included, ignored by default), release build, Ryzen 9 5900X, Windows 11. Other builds were running, so treat the numbers as approximate. Time per copy:

Size to heap, kernel to heap, user to upload buffer, kernel to upload buffer, user
64 B 801 ns 11 ns 898 ns 11 ns
256 B 796 ns 81 ns 839 ns 76 ns
4 KiB 3029 ns 1003 ns 2683 ns 578 ns
64 KiB 14.0 us 8.5 us 12.0 us 6.7 us
4 MiB 612 us 363 us 595 us 479 us

A copy that fails: 4.1 us before, 2.8 us now. 4096 fills of 256 B: 2.94 ms before, 0.046 ms now (the source is in cache here, so the gain in a real frame is smaller). This is a microbenchmark; the in-game frame time of this branch alone was not measured.

Verification

Rust 1.98.1 MSVC, base ffe310e:

  • cargo clippy --workspace --all-targets --locked -- -D warnings, with and without --all-features: clean.
  • cargo test --workspace --locked --no-fail-fast: 347 passed, 1 failed. The failure is frame::tests::waits_end_on_ticks_and_count_frames, which this PR does not touch: it fails the same way on unmodified main in the same session (341 passed, 1 failed, loaded PC) and passes 20 of 20 times alone on both. #174 and #689 are about that kind of wait.
  • The new tests compare with the kernel copy at inaccessible pages, check the exact range, page protections and memory unmapped meanwhile, and that other faults are left alone.

Overlap

Conflicts textually with #943, which changes how the fallback of the same functions finds regions, not the copy itself; I will rebase on whichever lands first. #322 (copies into title memory without a region query first) and #202 (skips unmapped regions after a failed bulk read) edit the same area of host.rs.

AI-assisted: written, benchmarked and checked with Claude Opus 5.5. No game data.

🤖 Generated with Claude Code

**@⁠TG0000** on GitHub · 2026-11-24 14:57 UTC · [original](https://github.com/Marvisak/VIctory/pull/1010) `TG0000:perf/user-mode-title-copies` → `main` · +693 −17 · 3 files · 4 commits · open ## Summary Every constant buffer fill of a submission is one `ReadProcessMemory` call, about 0.8 us for a few hundred bytes, and a world frame makes many of them. A leaf routine now copies in user mode. A vectored handler makes it return false when one of its own accesses faults, and the page-by-page fallback then runs as before. Runs of small fills are timed as one, so the timing no longer costs more than the copy. ## Measured `title_copy_bench` (included, ignored by default), release build, Ryzen 9 5900X, Windows 11. Other builds were running, so treat the numbers as approximate. Time per copy: | Size | to heap, kernel | to heap, user | to upload buffer, kernel | to upload buffer, user | |---|---|---|---|---| | 64 B | 801 ns | 11 ns | 898 ns | 11 ns | | 256 B | 796 ns | 81 ns | 839 ns | 76 ns | | 4 KiB | 3029 ns | 1003 ns | 2683 ns | 578 ns | | 64 KiB | 14.0 us | 8.5 us | 12.0 us | 6.7 us | | 4 MiB | 612 us | 363 us | 595 us | 479 us | A copy that fails: 4.1 us before, 2.8 us now. 4096 fills of 256 B: 2.94 ms before, 0.046 ms now (the source is in cache here, so the gain in a real frame is smaller). This is a microbenchmark; **the in-game frame time of this branch alone was not measured**. ## Verification Rust 1.98.1 MSVC, base `ffe310e`: - `cargo clippy --workspace --all-targets --locked -- -D warnings`, with and without `--all-features`: clean. - `cargo test --workspace --locked --no-fail-fast`: 347 passed, 1 failed. The failure is `frame::tests::waits_end_on_ticks_and_count_frames`, which this PR does not touch: it fails the same way on unmodified `main` in the same session (341 passed, 1 failed, loaded PC) and passes 20 of 20 times alone on both. #174 and #689 are about that kind of wait. - The new tests compare with the kernel copy at inaccessible pages, check the exact range, page protections and memory unmapped meanwhile, and that other faults are left alone. ## Overlap Conflicts textually with #943, which changes how the fallback of the same functions finds regions, not the copy itself; I will rebase on whichever lands first. #322 (copies into title memory without a region query first) and #202 (skips unmapped regions after a failed bulk read) edit the same area of `host.rs`. AI-assisted: written, benchmarked and checked with Claude Opus 5.5. No game data. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Each constant buffer fill of a submission was one ReadProcessMemory call,
0.7-1 us for a few hundred bytes. A leaf routine now copies in user mode;
a vectored handler makes it return false when one of its own accesses
faults, and the page-by-page fallback runs as before. Runs of fills are
timed as one. 4096 fills of 256 B: 2.94 ms -> 0.046 ms.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Reading title memory directly spends a page's guard, which the kernel's
copy does not; the fallback then read the page and copied its bytes where
it read as zeros before. The handler now puts the guard back, with the
page's other protection, before the copy fails.

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

@⁠TG0000 on GitHub · 2026-11-24 15:07 UTC · original

Thanks for testing on the RTX 5090 and WARP.

**@⁠TG0000** on GitHub · 2026-11-24 15:07 UTC · [original](https://github.com/Marvisak/VIctory/pull/1010#issuecomment-7135507274) Thanks for testing on the RTX 5090 and WARP.
Author
Owner

@⁠Zipettte on GitHub · 2026-11-24 15:12 UTC · original

Tested on AMD Radeon RX 7700 XT (RDNA3, gfx1101), driver 32.0.32029.2010, Windows 11, Rust 1.98.1 MSVC at e99253e: cargo test -p victory-gpu passes, 56 passed / 0 failed. Workspace baseline on main (ffe310e) is green on the same machine (342 passed).

Tested with AI assistance (Claude).

**@⁠Zipettte** on GitHub · 2026-11-24 15:12 UTC · [original](https://github.com/Marvisak/VIctory/pull/1010#issuecomment-7135643921) Tested on AMD Radeon RX 7700 XT (RDNA3, gfx1101), driver 32.0.32029.2010, Windows 11, Rust 1.98.1 MSVC at e99253e: `cargo test -p victory-gpu` passes, 56 passed / 0 failed. Workspace baseline on main (ffe310e) is green on the same machine (342 passed). _Tested with AI assistance (Claude)._
Author
Owner

@⁠DaviTostes on GitHub · 2026-11-24 15:54 UTC · original

In-game A/B on AMD/Linux, since the description only has the microbenchmark:

  • Build: this head on main ffe310e, release MSVC, real title 1.0.2.1 (build unknown (b99f876b…)).
  • Setup: RX 9060 XT (RDNA4, RADV 26.3.1), Arch, Wine 11.22, DXVK 3.1.1 dxgi, vkd3d-proton 3.2.0, WINEDLLOVERRIDES="d3d12,d3d12core,dxgi=n", scripted Enter through the menus, 600 s run.
  • 48 world frame lines vs 33 on unmodified main in the same setup:
main this PR
fps 0.3 0.3
frame 4027 ms 4289 ms
copies 2627 ms / 56.7 MB 2641 ms / 53.7 MB
textures 421 ms 516 ms

No measurable difference here: the copies in this workload are dominated by large watched ranges and page holes (the #783 path), not by the many small fills the microbenchmark targets, or the user-mode path falls back on this setup. Not a controlled same-save A/B, so treat it as directional.

Not tested: Windows/NVIDIA (where the microbenchmark was taken), and the #943/#322 combinations you mention.

**@⁠DaviTostes** on GitHub · 2026-11-24 15:54 UTC · [original](https://github.com/Marvisak/VIctory/pull/1010#issuecomment-7136799833) In-game A/B on **AMD/Linux**, since the description only has the microbenchmark: - Build: this head on `main` `ffe310e`, release MSVC, real title 1.0.2.1 (`build unknown (b99f876b…)`). - Setup: RX 9060 XT (RDNA4, RADV 26.3.1), Arch, Wine 11.22, DXVK 3.1.1 `dxgi`, vkd3d-proton 3.2.0, `WINEDLLOVERRIDES="d3d12,d3d12core,dxgi=n"`, scripted Enter through the menus, 600 s run. - 48 world frame lines vs 33 on unmodified `main` in the same setup: | | `main` | this PR | |---|---:|---:| | fps | 0.3 | 0.3 | | frame | 4027 ms | 4289 ms | | copies | 2627 ms / 56.7 MB | 2641 ms / 53.7 MB | | textures | 421 ms | 516 ms | No measurable difference here: the copies in this workload are dominated by large watched ranges and page holes (the #783 path), not by the many small fills the microbenchmark targets, or the user-mode path falls back on this setup. Not a controlled same-save A/B, so treat it as directional. **Not tested:** Windows/NVIDIA (where the microbenchmark was taken), and the #943/#322 combinations you mention.
Author
Owner

@⁠TG0000 on GitHub · 2026-11-24 16:00 UTC · original

Thanks for the in-game A/B. That matches what we see: in the world, large watched ranges and page holes dominate the copies, and this PR only speeds up the copy call itself (small fills most). Please read its numbers as the microbenchmark they are; I claim no frame-time gain for it alone. A run of ours on an RX 6800 was too noisy to add a number.

**@⁠TG0000** on GitHub · 2026-11-24 16:00 UTC · [original](https://github.com/Marvisak/VIctory/pull/1010#issuecomment-7136983247) Thanks for the in-game A/B. That matches what we see: in the world, large watched ranges and page holes dominate the copies, and this PR only speeds up the copy call itself (small fills most). Please read its numbers as the microbenchmark they are; I claim no frame-time gain for it alone. A run of ours on an RX 6800 was too noisy to add a number.
Author
Owner

@⁠TG0000 on GitHub · 2026-11-24 16:26 UTC · original

Pushed 79c9b93 (fast-forward): when a copy meets a guard page, the read spends the guard, which the kernel's copy on main does not. The handler now makes the page a guard page again, so the title still gets its guard fault. Between the fault and that call, a title touch of the page is not reported; the code comment says so.

New tests: guard pages of three protections stay guarded, and the bytes match the kernel copy's (zeros for that page); two threads copying the same guard page; a thread that touches the page while copies run. title_copy tests 8 passed and host tests 12 passed on this commit (Windows 11, RX 6800), clippy clean with and without --all-features. The full workspace tests ran on the same code before a rustfmt rewrap; only frame::tests::waits_end_on_ticks_and_count_frames failed, which also fails at times on main here.

AI-assisted (Claude Code).

**@⁠TG0000** on GitHub · 2026-11-24 16:26 UTC · [original](https://github.com/Marvisak/VIctory/pull/1010#issuecomment-7137676650) Pushed 79c9b93 (fast-forward): when a copy meets a guard page, the read spends the guard, which the kernel's copy on main does not. The handler now makes the page a guard page again, so the title still gets its guard fault. Between the fault and that call, a title touch of the page is not reported; the code comment says so. New tests: guard pages of three protections stay guarded, and the bytes match the kernel copy's (zeros for that page); two threads copying the same guard page; a thread that touches the page while copies run. `title_copy` tests 8 passed and `host` tests 12 passed on this commit (Windows 11, RX 6800), clippy clean with and without `--all-features`. The full workspace tests ran on the same code before a rustfmt rewrap; only `frame::tests::waits_end_on_ticks_and_count_frames` failed, which also fails at times on main here. _AI-assisted (Claude Code)._
Author
Owner

@⁠465d6a0eac on GitHub · 2026-11-24 17:49 UTC · original

Thank you for this, @⁠TG0000! Many pull requests here are still waiting to be merged, so I've ported this one to 465d6a0eac/AgentRecompVI, a VIctory fork where AI agents review and merge each other's work: https://github.com/465d6a0eac/AgentRecompVI/pull/36. You're credited as the author there. This stays the original.

Test results

  • Windows 11, NVIDIA GeForce RTX 3070 Ti (driver 32.0.16.1088, 32-lane waves): together with the rest of this batch, cargo clippy (both variants) and cargo test --workspace pass (429 passed, 0 failed).
  • Title memory copies in the world went from 400–730 ms per frame (160–400 MB) before this batch to 240–510 ms (70–245 MB) with it. #1024 and #1025 changed the same path, so that is the three together, in a scene that moves.
  • In the world (the first mission's scene), the whole batch took the title from 0.1–0.2 fps (3,300–6,400 ms of GPU time per frame) to 0.8–1.2 fps (190–310 ms). The screen is still black there, and the GPU still hangs after about 3 minutes (one command list over 2 s), so this is not playable yet.
**@⁠465d6a0eac** on GitHub · 2026-11-24 17:49 UTC · [original](https://github.com/Marvisak/VIctory/pull/1010#issuecomment-7139762163) Thank you for this, @⁠TG0000! Many pull requests here are still waiting to be merged, so I've ported this one to [465d6a0eac/AgentRecompVI](https://github.com/465d6a0eac/AgentRecompVI), a VIctory fork where AI agents review and merge each other's work: https://github.com/465d6a0eac/AgentRecompVI/pull/36. You're credited as the author there. This stays the original. **Test results** - Windows 11, NVIDIA GeForce RTX 3070 Ti (driver 32.0.16.1088, 32-lane waves): together with the rest of this batch, `cargo clippy` (both variants) and `cargo test --workspace` pass (429 passed, 0 failed). - Title memory copies in the world went from 400–730 ms per frame (160–400 MB) before this batch to 240–510 ms (70–245 MB) with it. #1024 and #1025 changed the same path, so that is the three together, in a scene that moves. - In the world (the first mission's scene), the whole batch took the title from 0.1–0.2 fps (3,300–6,400 ms of GPU time per frame) to 0.8–1.2 fps (190–310 ms). The screen is still black there, and the GPU still hangs after about 3 minutes (one command list over 2 s), so this is not playable yet.
Author
Owner

@⁠adnanoos on GitHub · 2026-11-24 20:47 UTC · original

RTX 5060 Laptop GPU: in the world this PR takes frames from ~3.0 s to ~1.7 s (0.36 → 0.64 fps), and the run outlasts the title-pool stop at +0x5149aec

Setup. NVIDIA GeForce RTX 5060 Laptop GPU, driver 32.0.16.2124, Intel Core 7 240H, 32 GB, Windows 11 Pro 26200, title 1.0.2.1, Series X mode. Release build with --features diagnostics, VICTORY_D3D12_DRED=1, Enter every 5 s for 4 min, 12-minute cap. The base is the stack that gets this laptop through the world without a GPU hang: #1520 (2190efe) + the resync_title_writes bound from #994's thread + #452. This PR at 79c9b93 was merged onto it cleanly. One run each.

World frames only, from the fps, ms/frame lines (5-s samples):

stack stack + this PR
fps (avg) 0.36 0.64
ms/frame, avg / median 3,118 / 3,036 1,781 / 1,670
preparing 905 ms 746 ms
copies 726 ms for 116 MB (160 MB/s) 620 ms for 168 MB (271 MB/s)
on the GPU 569 ms 284 ms
copying back 333 ms 201 ms
draws/frame 527 720
end 0x80000003 at +0x5149aec after 7m45s in the world still running at the 12-min cap, 10m35s in the world, no device removal

The run without this PR ends at the title's empty-pool assert that #1232 reads as a frame-rate symptom; with this PR it does not come within the run, which fits that reading.

Copies still move only ~270 MB/s here, so they remain the largest part of "preparing".

Tests. cargo test --release -p victory-gpu --lib on this PR alone: 59 passed, 0 failed, 3 ignored (all 8 title_copy tests pass, the bench ignored).

**@⁠adnanoos** on GitHub · 2026-11-24 20:47 UTC · [original](https://github.com/Marvisak/VIctory/pull/1010#issuecomment-7144059671) **RTX 5060 Laptop GPU: in the world this PR takes frames from ~3.0 s to ~1.7 s (0.36 → 0.64 fps), and the run outlasts the title-pool stop at `+0x5149aec`** **Setup.** NVIDIA GeForce RTX 5060 Laptop GPU, driver 32.0.16.2124, Intel Core 7 240H, 32 GB, Windows 11 Pro 26200, title 1.0.2.1, Series X mode. Release build with `--features diagnostics`, `VICTORY_D3D12_DRED=1`, Enter every 5 s for 4 min, 12-minute cap. The base is the stack that gets this laptop through the world without a GPU hang: #1520 (`2190efe`) + the `resync_title_writes` bound from #994's thread + #452. This PR at `79c9b93` was merged onto it cleanly. One run each. World frames only, from the `fps, ms/frame` lines (5-s samples): | | stack | **stack + this PR** | |---|---:|---:| | fps (avg) | 0.36 | **0.64** | | ms/frame, avg / median | 3,118 / 3,036 | **1,781 / 1,670** | | preparing | 905 ms | 746 ms | | copies | 726 ms for 116 MB (160 MB/s) | 620 ms for 168 MB (271 MB/s) | | on the GPU | 569 ms | 284 ms | | copying back | 333 ms | 201 ms | | draws/frame | 527 | 720 | | end | `0x80000003` at `+0x5149aec` after 7m45s in the world | **still running at the 12-min cap**, 10m35s in the world, no device removal | The run without this PR ends at the title's empty-pool assert that #1232 reads as a frame-rate symptom; with this PR it does not come within the run, which fits that reading. Copies still move only ~270 MB/s here, so they remain the largest part of "preparing". **Tests.** `cargo test --release -p victory-gpu --lib` on this PR alone: 59 passed, 0 failed, 3 ignored (all 8 `title_copy` tests pass, the bench ignored).
Author
Owner

@⁠TG0000 on GitHub · 2026-11-24 23:00 UTC · original

Merged main in (fast-forward); both the per-step timer of main and the run of fills timed as one are kept.
victory-gpu 87 and victory-shader 209 tests pass on Windows (RX 6800), clippy clean with and without all features. The microbenchmark was not run again and I still claim no frame-time gain.
Thanks @⁠adnanoos for the run in the world. AI-assisted (Claude Code).

139 perf/shader-address-sums : PUSH

local ref: prready/139 (90cf2f6), GitHub head 697c4bc
git push fork prready/139:perf/shader-address-sums
Resolved: took main's tracer whole; the cache sits in a RefCell so its &self stays, and is emptied after the spilled parameters change the origins. One test expected a refusal that main turned into title memory: expectation changed, and the same test file passes on main without the cache.
Checks: Mac lint 0, Mac tests formats 23, shader 118 + 3. Windows tests gpu 78, shader 209 + 3, 0 failed. Benchmark and census not run again.
Draft comment:
Merged main in (fast-forward). Main's tracer is unchanged; the sums are cached behind a RefCell and dropped when the spilled parameters change the origins.
One test follows main's rule that an address from no root parameter is title memory; the same file passes on main without the cache.
victory-shader 209 + 3 tests pass on Windows (RX 6800). The benchmark was not run again. AI-assisted (Claude Code).

999 perf/shader-lane-condition-search : MERGED, CENSUS BEFORE THE PUSH

local ref: prready/999 (255377d), GitHub head 3ca9456
git push fork prready/999:perf/shader-lane-condition-search
Resolved: main now remembers refuted states in Bools::meet too; kept this PR's search, tables and implies, added main's decides on the new node table. The pass that finds all missing phis was REWRITTEN: it looks at main's live edges only and skips edges main calls never taken or dead.
Checks: Mac lint 0, Mac tests formats 23, shader 120. Windows tests gpu 78, shader 211, 0 failed.
Not done: the census against main. "None goes from translating to refused", the byte-for-byte check and all timings in the body are from ffe310e and the old phi pass. Do not repeat them for this head.
Draft comment (if pushed without the census):
Merged main in (fast-forward). Main's search now remembers failed states as well, so item 1 gains less than the table says.
The pass that finds every missing phi was rewritten: it follows main's live edges and skips the edges main calls never taken or dead.
victory-shader 211 tests pass on Windows (RX 6800), clippy clean. The corpus comparison and the timings in the description are from ffe310e and were not run again on this head.
AI-assisted (Claude Code).

No push needed (mergeable, no failing check, no open question)

prready/1000, 993, 188, 172, 153, 126 = head + main, only to prove that they merge and build: do not push.
All six: clean merge, Mac lint 0, Mac tests pass (formats 23 to 25, shader 118 to 121). Their Windows-only tests (1000 and 153 gpu, 188 loader) were not run on the merge.
#1000: the two nits promised for its next change (a message when the test is skipped, one line on the order) are still open.
#124 is closed on GitHub: nothing done.

Worktree: C:\Users\theo_\victory-prs (detached at origin/main).

**@⁠TG0000** on GitHub · 2026-11-24 23:00 UTC · [original](https://github.com/Marvisak/VIctory/pull/1010#issuecomment-7146900106) Merged main in (fast-forward); both the per-step timer of main and the run of fills timed as one are kept. victory-gpu 87 and victory-shader 209 tests pass on Windows (RX 6800), clippy clean with and without all features. The microbenchmark was not run again and I still claim no frame-time gain. Thanks @⁠adnanoos for the run in the world. AI-assisted (Claude Code). ## 139 perf/shader-address-sums : PUSH local ref: prready/139 (90cf2f6), GitHub head 697c4bc git push fork prready/139:perf/shader-address-sums Resolved: took main's tracer whole; the cache sits in a RefCell so its &self stays, and is emptied after the spilled parameters change the origins. One test expected a refusal that main turned into title memory: expectation changed, and the same test file passes on main without the cache. Checks: Mac lint 0, Mac tests formats 23, shader 118 + 3. Windows tests gpu 78, shader 209 + 3, 0 failed. Benchmark and census not run again. Draft comment: Merged main in (fast-forward). Main's tracer is unchanged; the sums are cached behind a RefCell and dropped when the spilled parameters change the origins. One test follows main's rule that an address from no root parameter is title memory; the same file passes on main without the cache. victory-shader 209 + 3 tests pass on Windows (RX 6800). The benchmark was not run again. AI-assisted (Claude Code). ## 999 perf/shader-lane-condition-search : MERGED, CENSUS BEFORE THE PUSH local ref: prready/999 (255377d), GitHub head 3ca9456 git push fork prready/999:perf/shader-lane-condition-search Resolved: main now remembers refuted states in Bools::meet too; kept this PR's search, tables and implies, added main's `decides` on the new node table. The pass that finds all missing phis was REWRITTEN: it looks at main's live edges only and skips edges main calls never taken or dead. Checks: Mac lint 0, Mac tests formats 23, shader 120. Windows tests gpu 78, shader 211, 0 failed. Not done: the census against main. "None goes from translating to refused", the byte-for-byte check and all timings in the body are from ffe310e and the old phi pass. Do not repeat them for this head. Draft comment (if pushed without the census): Merged main in (fast-forward). Main's search now remembers failed states as well, so item 1 gains less than the table says. The pass that finds every missing phi was rewritten: it follows main's live edges and skips the edges main calls never taken or dead. victory-shader 211 tests pass on Windows (RX 6800), clippy clean. The corpus comparison and the timings in the description are from ffe310e and were not run again on this head. AI-assisted (Claude Code). ## No push needed (mergeable, no failing check, no open question) prready/1000, 993, 188, 172, 153, 126 = head + main, only to prove that they merge and build: do not push. All six: clean merge, Mac lint 0, Mac tests pass (formats 23 to 25, shader 118 to 121). Their Windows-only tests (1000 and 153 gpu, 188 loader) were not run on the merge. #1000: the two nits promised for its next change (a message when the test is skipped, one line on the order) are still open. #124 is closed on GitHub: nothing done. Worktree: C:\Users\theo_\victory-prs (detached at origin/main).
Author
Owner

@⁠Marvisak on GitHub · 2026-11-25 01:17 UTC · original · edited 2026-11-25 13:27 UTC

Automated triage for the maintainers.

Merge candidate (worth a look). Rebased onto current main and merges cleanly. It replaces ReadProcessMemory with a small user-mode copy routine (title_copy.rs, copy) for title-to-host copies only (copy_mapped with title_dst == false), with a vectored handler that only redirects faults whose RIP lies inside the routine's own begin..end range, and re-arms spent guard pages (guard_again); run_deferred times runs of fills as one. I read the assembly's length/tail handling and the handler's scope and found no issue; tests compare against the kernel copy at inaccessible, guard and concurrently unmapped pages. CI check passes. The inline assembly and the extra exception handler deserve the maintainer's own read; the author claims only a microbenchmark gain, and a tester reports an in-world improvement on an RTX 5060.


Generated by Claude Code

**@⁠Marvisak** on GitHub · 2026-11-25 01:17 UTC · [original](https://github.com/Marvisak/VIctory/pull/1010#issuecomment-7149393597) · edited 2026-11-25 13:27 UTC <!-- victory-triage v1 head=6e3c516074aef3dbcf04ba6ffee8598ac9d66bd5 verdict=merge-candidate at=2026-11-25T13:27:35Z --> Automated triage for the maintainers. **Merge candidate (worth a look).** Rebased onto current `main` and merges cleanly. It replaces `ReadProcessMemory` with a small user-mode copy routine (`title_copy.rs`, `copy`) for title-to-host copies only (`copy_mapped` with `title_dst == false`), with a vectored handler that only redirects faults whose RIP lies inside the routine's own `begin..end` range, and re-arms spent guard pages (`guard_again`); `run_deferred` times runs of fills as one. I read the assembly's length/tail handling and the handler's scope and found no issue; tests compare against the kernel copy at inaccessible, guard and concurrently unmapped pages. CI `check` passes. The inline assembly and the extra exception handler deserve the maintainer's own read; the author claims only a microbenchmark gain, and a tester reports an in-world improvement on an RTX 5060. --- _Generated by [Claude Code](https://claude.ai/code)_
Author
Owner

@⁠TG0000 on GitHub · 2026-11-25 12:28 UTC · original

Merged main 940d32f in (fast-forward). The only conflict was the comment on copy_mapped; it now says both things.

Windows (RX 6800 and WARP, one thread): victory-gpu 152 and victory-shader 247 passed; clippy -D warnings clean for the Windows target, with and without all features. The microbenchmark was not run again and I still claim no frame-time gain. AI-assisted (Claude Code).

**@⁠TG0000** on GitHub · 2026-11-25 12:28 UTC · [original](https://github.com/Marvisak/VIctory/pull/1010#issuecomment-7162425167) Merged main 940d32f in (fast-forward). The only conflict was the comment on `copy_mapped`; it now says both things. Windows (RX 6800 and WARP, one thread): victory-gpu 152 and victory-shader 247 passed; clippy `-D warnings` clean for the Windows target, with and without all features. The microbenchmark was not run again and I still claim no frame-time gain. AI-assisted (Claude Code).
Author
Owner

@⁠HLVM04 on GitHub · 2026-11-25 15:29 UTC · original

A Windows/NVIDIA data point for the in-game side of this idea, from a different tree: our own local change on a fxceless/victory-fork base, not this PR's code. It reads title memory with a rep movsb copy, and a vectored handler turns a fault at that instruction into a failed copy, in place of ReadProcessMemory.

  • RTX 5070 Ti, Ryzen 7 9800X3D, Windows 11, Series S profile.
  • The submitting thread's time in those reads went from 26 to 7.5 ms a frame.

That is the thread's time in the reads, on one machine, with scene variance. It is not a frame-time A/B, so it supports the per-call cost on native Windows but is not a measured fps gain for this PR.

**@⁠HLVM04** on GitHub · 2026-11-25 15:29 UTC · [original](https://github.com/Marvisak/VIctory/pull/1010#issuecomment-7166937178) A Windows/NVIDIA data point for the in-game side of this idea, from a different tree: our own local change on a fxceless/victory-fork base, not this PR's code. It reads title memory with a `rep movsb` copy, and a vectored handler turns a fault at that instruction into a failed copy, in place of `ReadProcessMemory`. - RTX 5070 Ti, Ryzen 7 9800X3D, Windows 11, Series S profile. - The submitting thread's time in those reads went from 26 to 7.5 ms a frame. That is the thread's time in the reads, on one machine, with scene variance. It is not a frame-time A/B, so it supports the per-call cost on native Windows but is not a measured fps gain for this PR.
Author
Owner

@⁠kais7654 on GitHub · 2026-11-25 17:15 UTC · original

Verified on the branch head (6e3c516, Windows 11, RTX 5070 Laptop GPU,
driver 616.87, hardware + WARP, rustc 1.98.1, --locked): clippy -D
warnings clean with and without --all-features; victory-gpu lib 150
passed / 2 failed — the two failures are the known heap-cap pair (#1943),
and the branch's own title_copy tests pass on hardware; victory-shader
lib 244 passed / 3 failed (the NVIDIA machine trio, #2317). Merge into
current main (67e8ae1) is clean.

**@⁠kais7654** on GitHub · 2026-11-25 17:15 UTC · [original](https://github.com/Marvisak/VIctory/pull/1010#issuecomment-7169236894) Verified on the branch head (6e3c516, Windows 11, RTX 5070 Laptop GPU, driver 616.87, hardware + WARP, rustc 1.98.1, --locked): clippy -D warnings clean with and without --all-features; victory-gpu lib 150 passed / 2 failed — the two failures are the known heap-cap pair (#1943), and the branch's own title_copy tests pass on hardware; victory-shader lib 244 passed / 3 failed (the NVIDIA machine trio, #2317). Merge into current main (67e8ae1) is clean.
Author
Owner

@⁠fuzeofficlal on GitHub · 2026-11-26 01:27 UTC · original

Code review (VEH / watch.rs / PAGE_GUARD audit) and RTX 5090 + WARP + release benchmark verification at head 6e3c516074ae merged cleanly onto main (63bcca43c6a0):

  • VEH & memory-safety audit (title_copy.rs, host.rs:2500-2556):
    • Only used for !title_dst (title -> host staging/upload); title-destination writes retain watch::writing + ReadProcessMemory. Reading PAGE_READONLY pages watched by watch.rs does not fault or trip watch::on_write.
    • AddVectoredExceptionHandler(1, Some(on_fault)) restricts interception strictly to AV/IN_PAGE_ERROR/GUARD_PAGE with Rip inside [victory_title_copy_begin .. victory_title_copy_end) and redirects to victory_title_copy_failed without clobbering stack/non-volatile registers; guard_again(va) restores PAGE_GUARD before copy_mapped falls back 64 KiB -> 4 KiB and zero-fills unreadable pages.
  • 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
    • RTX 5090 (title_copy:: shadow:: watch:: host:: skipping descriptor::host/pipeline::host): 50/50 passed (2 ignored); WARP (--features diagnostics, skipping present_plane_tests): 69/69 passed (2 ignored)
    • --release title_copy_bench:
      • To heap: 85.0x at 64 B (514.9 -> 6.1 ns), 30.1x at 256 B, 13.0x at 1 KiB, 2.4x at 4 MiB
      • To upload buffer: 105.0x at 64 B (538.3 -> 5.1 ns), 40.3x at 256 B, 12.2x at 1 KiB, 1.7x at 4 MiB
      • 4096 constant fills: 2.8 / 8.4 / 16.3 ns each (64 / 256 / 512 B).

Rock-solid safety boundaries and huge speedup; LGTM.

**@⁠fuzeofficlal** on GitHub · 2026-11-26 01:27 UTC · [original](https://github.com/Marvisak/VIctory/pull/1010#issuecomment-7179785959) Code review (VEH / `watch.rs` / `PAGE_GUARD` audit) and RTX 5090 + WARP + release benchmark verification at head `6e3c516074ae` merged cleanly onto `main` (`63bcca43c6a0`): - **VEH & memory-safety audit (`title_copy.rs`, `host.rs:2500-2556`)**: - Only used for `!title_dst` (title -> host staging/upload); title-destination writes retain `watch::writing` + `ReadProcessMemory`. Reading `PAGE_READONLY` pages watched by `watch.rs` does not fault or trip `watch::on_write`. - `AddVectoredExceptionHandler(1, Some(on_fault))` restricts interception strictly to `AV`/`IN_PAGE_ERROR`/`GUARD_PAGE` with `Rip` inside `[victory_title_copy_begin .. victory_title_copy_end)` and redirects to `victory_title_copy_failed` without clobbering stack/non-volatile registers; `guard_again(va)` restores `PAGE_GUARD` before `copy_mapped` falls back 64 KiB -> 4 KiB and zero-fills unreadable pages. - **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 - RTX 5090 (`title_copy:: shadow:: watch:: host::` skipping `descriptor::host`/`pipeline::host`): **50/50 passed** (2 ignored); WARP (`--features diagnostics`, skipping `present_plane_tests`): **69/69 passed** (2 ignored) - `--release` `title_copy_bench`: - To heap: **85.0x** at 64 B (`514.9 -> 6.1 ns`), **30.1x** at 256 B, **13.0x** at 1 KiB, **2.4x** at 4 MiB - To upload buffer: **105.0x** at 64 B (`538.3 -> 5.1 ns`), **40.3x** at 256 B, **12.2x** at 1 KiB, **1.7x** at 4 MiB - `4096` constant fills: **2.8 / 8.4 / 16.3 ns** each (64 / 256 / 512 B). Rock-solid safety boundaries and huge speedup; LGTM.
Author
Owner

@⁠MeMako on GitHub · 2026-11-26 03:51 UTC · original

Independent verification of 6e3c516 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 & microbenchmark:

  • cargo clippy -p victory-gpu -p victory --all-targets --locked -- -D warnings (and --all-features): pass
  • cargo test -p victory-gpu --locked: 252 passed, 0 failed (including all new title_copy tests)
  • title_copy_bench (release build, Ryzen 9 7950X):
    • 64 B: heap 362.8 → 7.6 ns (48x), upload 399.9 → 3.5 ns (115x)
    • 256 B: heap 357.0 → 17.8 ns (20x), upload 442.6 → 10.0 ns (44x)
    • 4 KiB: heap 789.6 → 220.4 ns (3.6x), upload 857.5 → 238.4 ns (3.6x)
    • 64 KiB: heap 3.88 → 1.99 µs (1.9x), upload 4.42 → 2.42 µs (1.8x)
    • 4 MiB: heap 195.8 → 114.7 µs (1.7x), upload 234.2 → 147.6 µs (1.6x)
    • Failing copy: 1437 → 1118 ns

Live title run (release build, warm shader & pipeline cache):
(Note: merged cleanly onto a local RX 9070 XT branch on 842b0cb carrying a separate-handle workaround equivalent to #2122, DYNAMIC = 1 << 19, #2051, #2472, and #2918; compared against the same branch without #1010.)

Metric (world frames, draws >= 500) Without #1010 (n=116) With #1010 (n=82) Delta
copies time / volume (median) 89.5 ms (155 MB) 71.2 ms (154 MB) -18.3 ms (-20.4%)
Frame time (median) 505.4 ms (2.00 fps) 455.8 ms (2.20 fps) -49.6 ms (+10%)
copy_back_marks (median) 81.2 ms (32.1 µs/page) 72.3 ms (31.0 µs/page) -8.9 ms
Crashes / errors 0 0 Clean (#1010 + #2918 VEH handlers coexist cleanly)

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 03:51 UTC · [original](https://github.com/Marvisak/VIctory/pull/1010#issuecomment-7182081075) Independent verification of `6e3c516` 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 & microbenchmark:** - `cargo clippy -p victory-gpu -p victory --all-targets --locked -- -D warnings` (and `--all-features`): pass - `cargo test -p victory-gpu --locked`: 252 passed, 0 failed (including all new `title_copy` tests) - `title_copy_bench` (release build, Ryzen 9 7950X): - `64 B`: heap `362.8 → 7.6 ns` (48x), upload `399.9 → 3.5 ns` (115x) - `256 B`: heap `357.0 → 17.8 ns` (20x), upload `442.6 → 10.0 ns` (44x) - `4 KiB`: heap `789.6 → 220.4 ns` (3.6x), upload `857.5 → 238.4 ns` (3.6x) - `64 KiB`: heap `3.88 → 1.99 µs` (1.9x), upload `4.42 → 2.42 µs` (1.8x) - `4 MiB`: heap `195.8 → 114.7 µs` (1.7x), upload `234.2 → 147.6 µs` (1.6x) - Failing copy: `1437 → 1118 ns` **Live title run (release build, warm shader & pipeline cache):** *(Note: merged cleanly onto a local RX 9070 XT branch on `842b0cb` carrying a separate-handle workaround equivalent to #2122, `DYNAMIC = 1 << 19`, #2051, #2472, and #2918; compared against the same branch without #1010.)* | Metric (world frames, `draws >= 500`) | Without #1010 (`n=116`) | With #1010 (`n=82`) | Delta | |---|---|---|---| | `copies` time / volume (median) | `89.5 ms` (`155 MB`) | **`71.2 ms`** (`154 MB`) | **-18.3 ms (-20.4%)** | | Frame time (median) | `505.4 ms` (`2.00 fps`) | **`455.8 ms`** (**`2.20 fps`**) | **-49.6 ms (+10%)** | | `copy_back_marks` (median) | `81.2 ms` (`32.1 µs/page`) | `72.3 ms` (`31.0 µs/page`) | -8.9 ms | | Crashes / errors | `0` | **`0`** | Clean (`#1010` + `#2918` VEH handlers coexist cleanly) | 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

@⁠DenRakEiw on GitHub · 2026-11-24 15:02 UTC · original · approved these changes

Tested head e99253e (fast-forward on main ffe310e) on Windows 11 x64 (Rust 1.98.1 MSVC) with NVIDIA GeForce RTX 5090 (Blackwell) and WARP (VICTORY_D3D12_WARP=1):

  • cargo test -p victory-gpu (RTX 5090): 56 passed, 0 failed, 3 ignored (including all new title_copy::tests::* and host::fills::steps_run_in_order_and_unmapped_pages_read_as_zeros)
  • VICTORY_D3D12_WARP=1 cargo test -p victory-gpu (WARP): 56 passed, 0 failed, 3 ignored
  • cargo clippy -p victory-gpu --all-targets: 0 warnings
  • cargo xtask policy: ok (156 files ok)

Clean SEH-guarded title-memory copy avoiding per-copy syscalls, with strong fault/protection/unmap test coverage. Approving.

AI-assisted (Gemini 4 Neon).

**@⁠DenRakEiw** on GitHub · 2026-11-24 15:02 UTC · [original](https://github.com/Marvisak/VIctory/pull/1010#pullrequestreview-6041717065) · **approved these changes** Tested head `e99253e` (fast-forward on `main` `ffe310e`) on Windows 11 x64 (Rust 1.98.1 MSVC) with **NVIDIA GeForce RTX 5090** (Blackwell) and **WARP** (`VICTORY_D3D12_WARP=1`): - `cargo test -p victory-gpu` (RTX 5090): **56 passed, 0 failed, 3 ignored** (including all new `title_copy::tests::*` and `host::fills::steps_run_in_order_and_unmapped_pages_read_as_zeros`) - `VICTORY_D3D12_WARP=1 cargo test -p victory-gpu` (WARP): **56 passed, 0 failed, 3 ignored** - `cargo clippy -p victory-gpu --all-targets`: **0 warnings** - `cargo xtask policy`: ok (`156 files ok`) Clean SEH-guarded title-memory copy avoiding per-copy syscalls, with strong fault/protection/unmap test coverage. Approving. AI-assisted (Gemini 4 Neon).
Author
Owner

@⁠fuzeofficlal on GitHub · 2026-11-26 14:39 UTC · original · approved these changes

Reviewed 6e3c516074aef3dbcf04ba6ffee8598ac9d66bd5 merged cleanly onto main (63bcca43c6a0) and verified on Windows 11 x64 (Ryzen 9 9950X, NVIDIA GeForce RTX 5090, Microsoft WARP, VICTORY_D3D12_DEBUG=1, Rust 1.98.1, debug and --release).

Code Review

  • Assembly & Win64 ABI (crates/victory-gpu/src/title_copy.rs:28-105): victory_title_copy is a pure leaf routine that leaves rsp and all non-volatile registers untouched (only rax, rcx, rdx, r8–r10, and xmm0–xmm3), so redirecting Rip to victory_title_copy_failed (xor eax, eax; ret) is safe under --release optimization without stack unwinding. All length tiers (0, 1..=15, 16..=63, 64+, overlapping 16 B tail) handle exact boundaries cleanly in ascending order for write-combined upload destinations.
  • VEH isolation & PAGE_GUARD (crates/victory-gpu/src/title_copy.rs:107-176, crates/victory-gpu/src/host.rs:2026):
    • Used strictly for !title_dst (title → host) copies; title-destination writes continue using watch::writing + ReadProcessMemory, and any failed bulk read falls back to the existing 64 KiB → 4 KiB page-by-page zero-fill path.
    • on_fault intercepts only EXCEPTION_ACCESS_VIOLATION, EXCEPTION_IN_PAGE_ERROR, and EXCEPTION_GUARD_PAGE with Rip inside [victory_title_copy_begin .. victory_title_copy_end) and holds no shared mutable state, making concurrent multi-threaded faults safe. It coexists cleanly with watch::on_write in either handler order (read faults on src are ignored by watch::on_write, and write faults outside [begin..end) are ignored by on_fault).
    • guard_again re-arms spent PAGE_GUARD pages via VirtualQuery/VirtualProtect and restores old if another thread changed the base protection in between.
  • Batched fill timing (crates/victory-gpu/src/host.rs:1799,1842): Batching consecutive Step::Fill entries under one timer preserves ordering relative to Step::Copy, Step::Refresh, Step::Run, and Step::GpuWrite.

Verification (9950X + RTX 5090 + WARP + VICTORY_D3D12_DEBUG=1, Rust 1.98.1)

  • cargo run --locked -p xtask -- policy: 192 files ok.
  • cargo clippy --locked -p victory-gpu --all-targets -- -D warnings (default and --all-features): 0 warnings.
  • victory-gpu (title_copy:: host::fills:: host::title_copies:: watch:: shadow::): 36/36 passed (2 benchmarks ignored) on RTX 5090 + Debug Layer, WARP (--features diagnostics) + Debug Layer, and --release RTX 5090.
  • Additional 8-thread --release VEH coexistence stress probe (6 reader threads calling title_copy::copy concurrently across valid RW, PAGE_NOACCESS, MEM_DECOMMIT, PAGE_GUARD, and watch::track-guarded pages while 2 writer threads concurrently fault into watch::on_write): passed (ok_reads=960, faults_caught=1440, both watched pages marked dirty, PAGE_GUARD preserved as 0x104).
  • --release benchmarks on Ryzen 9 9950X + RTX 5090:
    • title_copy_bench (to heap): 64 B 484.4 -> 5.8 ns (83.3x), 256 B 438.3 -> 15.1 ns (29.1x), 1 KiB 903.8 -> 60.4 ns (15.0x), 4 KiB 1162.8 -> 248.3 ns (4.7x), 64 KiB 4312.8 -> 1617.4 ns (2.7x), 4 MiB 217.2 -> 92.1 µs (2.4x).
    • title_copy_bench (to RTX 5090 upload buffer): 64 B 517.9 -> 11.0 ns (46.9x), 256 B 532.1 -> 11.3 ns (47.2x), 1 KiB 986.2 -> 64.4 ns (15.3x), 4 KiB 1244.6 -> 255.3 ns (4.9x), 64 KiB 5547.6 -> 2835.8 ns (2.0x), 4 MiB 291.6 -> 169.0 µs (1.7x).
    • Failing copy: 1698 -> 1311 ns. constant_fills_per_list (4,096 fills): 64 B: 11.7 µs (2.9 ns/fill), 256 B: 32.9 µs (8.0 ns/fill), 512 B: 68.6 µs (16.7 ns/fill).

LGTM.

**@⁠fuzeofficlal** on GitHub · 2026-11-26 14:39 UTC · [original](https://github.com/Marvisak/VIctory/pull/1010#pullrequestreview-6075993112) · **approved these changes** Reviewed `6e3c516074aef3dbcf04ba6ffee8598ac9d66bd5` merged cleanly onto `main` (`63bcca43c6a0`) and verified on Windows 11 x64 (Ryzen 9 9950X, NVIDIA GeForce RTX 5090, Microsoft WARP, `VICTORY_D3D12_DEBUG=1`, Rust `1.98.1`, debug and `--release`). ### Code Review - **Assembly & Win64 ABI (`crates/victory-gpu/src/title_copy.rs:28-105`)**: `victory_title_copy` is a pure leaf routine that leaves `rsp` and all non-volatile registers untouched (only `rax`, `rcx`, `rdx`, `r8`–`r10`, and `xmm0`–`xmm3`), so redirecting `Rip` to `victory_title_copy_failed` (`xor eax, eax; ret`) is safe under `--release` optimization without stack unwinding. All length tiers (`0`, `1..=15`, `16..=63`, `64+`, overlapping 16 B tail) handle exact boundaries cleanly in ascending order for write-combined upload destinations. - **VEH isolation & `PAGE_GUARD` (`crates/victory-gpu/src/title_copy.rs:107-176`, `crates/victory-gpu/src/host.rs:2026`)**: - Used strictly for `!title_dst` (title → host) copies; title-destination writes continue using `watch::writing` + `ReadProcessMemory`, and any failed bulk read falls back to the existing 64 KiB → 4 KiB page-by-page zero-fill path. - `on_fault` intercepts only `EXCEPTION_ACCESS_VIOLATION`, `EXCEPTION_IN_PAGE_ERROR`, and `EXCEPTION_GUARD_PAGE` with `Rip` inside `[victory_title_copy_begin .. victory_title_copy_end)` and holds no shared mutable state, making concurrent multi-threaded faults safe. It coexists cleanly with `watch::on_write` in either handler order (read faults on `src` are ignored by `watch::on_write`, and write faults outside `[begin..end)` are ignored by `on_fault`). - `guard_again` re-arms spent `PAGE_GUARD` pages via `VirtualQuery`/`VirtualProtect` and restores `old` if another thread changed the base protection in between. - **Batched fill timing (`crates/victory-gpu/src/host.rs:1799,1842`)**: Batching consecutive `Step::Fill` entries under one timer preserves ordering relative to `Step::Copy`, `Step::Refresh`, `Step::Run`, and `Step::GpuWrite`. ### Verification (9950X + RTX 5090 + WARP + `VICTORY_D3D12_DEBUG=1`, Rust `1.98.1`) - `cargo run --locked -p xtask -- policy`: `192 files ok`. - `cargo clippy --locked -p victory-gpu --all-targets -- -D warnings` (default and `--all-features`): 0 warnings. - `victory-gpu` (`title_copy:: host::fills:: host::title_copies:: watch:: shadow::`): **36/36 passed** (2 benchmarks ignored) on RTX 5090 + Debug Layer, WARP (`--features diagnostics`) + Debug Layer, and `--release` RTX 5090. - Additional 8-thread `--release` VEH coexistence stress probe (6 reader threads calling `title_copy::copy` concurrently across valid RW, `PAGE_NOACCESS`, `MEM_DECOMMIT`, `PAGE_GUARD`, and `watch::track`-guarded pages while 2 writer threads concurrently fault into `watch::on_write`): passed (`ok_reads=960`, `faults_caught=1440`, both watched pages marked dirty, `PAGE_GUARD` preserved as `0x104`). - `--release` benchmarks on Ryzen 9 9950X + RTX 5090: - `title_copy_bench` (to heap): 64 B `484.4 -> 5.8 ns` (**83.3x**), 256 B `438.3 -> 15.1 ns` (**29.1x**), 1 KiB `903.8 -> 60.4 ns` (**15.0x**), 4 KiB `1162.8 -> 248.3 ns` (**4.7x**), 64 KiB `4312.8 -> 1617.4 ns` (**2.7x**), 4 MiB `217.2 -> 92.1 µs` (**2.4x**). - `title_copy_bench` (to RTX 5090 upload buffer): 64 B `517.9 -> 11.0 ns` (**46.9x**), 256 B `532.1 -> 11.3 ns` (**47.2x**), 1 KiB `986.2 -> 64.4 ns` (**15.3x**), 4 KiB `1244.6 -> 255.3 ns` (**4.9x**), 64 KiB `5547.6 -> 2835.8 ns` (**2.0x**), 4 MiB `291.6 -> 169.0 µs` (**1.7x**). - Failing copy: `1698 -> 1311 ns`. `constant_fills_per_list` (4,096 fills): `64 B: 11.7 µs (2.9 ns/fill)`, `256 B: 32.9 µs (8.0 ns/fill)`, `512 B: 68.6 µs (16.7 ns/fill)`. LGTM.
Author
Owner

@⁠tumbubu on GitHub · 2026-11-26 18:21 UTC · original

6e3c516 merged onto current main 63bcca4, measured in the world on an RX 7900 XT (Windows): refresh copies run at 4.6–5.0 GB/s against 3.8–3.9 on main. In the stack samples the refresh's ZwReadVirtualMemory becomes victory_title_copy. Tests: 240 passed.

This adds a Windows/AMD data point next to the RTX 5060 Laptop and Linux runs above.

  • Setup: AMD Radeon RX 7900 XT, driver 32.0.31036.15, Windows 11 Pro 26300.
  • Builds: diag builds (--profile diag --features diagnostics) of 63bcca4, and of 63bcca4 with this PR merged (clean, 17c95b0). The translator is the same, so one cache warmed with translate --cache --pipelines served both, and no shader was translated during the runs.
  • Runs: 180 s each, Enter every 3 s from 8 s to 47 s, VICTORY_LOG=info. Two runs per build; the second of each was sampled with VICTORY_STACKS.
  • What counts as world: frame-rate lines under 10 fps with at least 500 draws.
run ms/frame preparing copies: ms / MB per frame copy rate on the GPU copying back draws/frame
main 695 352 178 / 686 3.85 GB/s 221 99 3729
main, sampled 762 388 174 / 658 3.78 GB/s 214 111 3991
this PR 627 301 123 / 610 4.97 GB/s 205 83 3208
this PR, sampled 680 334 143 / 654 4.58 GB/s 226 94 3541
  • The copy volume is about the same in all four: 610–690 MB a frame, 32–34 submissions, 19–20 k refreshes. So per byte, the copies cost 20–30% less with this PR.
  • The whole frame is about 10% shorter. That is in the same direction, but within the spread I see between runs of one build.
  • No device removal in any run, and 20–22 warnings in each log.

Stack samples (a dump every 0.25 s from 105 s to 175 s; 80 dumps on main, 84 with this PR; victory.exe symbolised from the build's PDB):

leaf, with its callers main this PR
ZwReadVirtualMemory ← copy_mapped ← Shadow::update ← Batch::flush 7 0
victory_title_copy_begin ← copy_mapped ← Shadow::update 0 7
ZwReadVirtualMemory elsewhere: copy_back_marks, write_mapped, copy_back_or_not, watch::mark_changed 3 6
  • The refresh copies now run in user mode, as intended. Copies into title memory keep the kernel path, as the PR says.
  • The refresh keeps the same number of samples, 7 against 7. That fits @⁠TG0000's note above: in the world the refresh is dominated by the bytes copied, about 650 MB a frame here, more than by the call. This PR makes each byte cheaper, but it does not reduce how many bytes there are.

Tests. cargo test --locked -p victory-gpu --lib -- --test-threads=1 on the merge: 240 passed, 0 failed, 3 ignored.

AI-assisted (Claude Code); every run was on this machine. Only timings, counts and VIctory's own function names are posted, no game files.

**@⁠tumbubu** on GitHub · 2026-11-26 18:21 UTC · [original](https://github.com/Marvisak/VIctory/pull/1010#issuecomment-7200363218) **`6e3c516` merged onto current `main` `63bcca4`, measured in the world on an RX 7900 XT (Windows): refresh copies run at 4.6–5.0 GB/s against 3.8–3.9 on `main`. In the stack samples the refresh's `ZwReadVirtualMemory` becomes `victory_title_copy`. Tests: 240 passed.** This adds a Windows/AMD data point next to the RTX 5060 Laptop and Linux runs above. - **Setup:** AMD Radeon RX 7900 XT, driver 32.0.31036.15, Windows 11 Pro 26300. - **Builds:** diag builds (`--profile diag --features diagnostics`) of `63bcca4`, and of `63bcca4` with this PR merged (clean, `17c95b0`). The translator is the same, so one cache warmed with `translate --cache --pipelines` served both, and no shader was translated during the runs. - **Runs:** 180 s each, Enter every 3 s from 8 s to 47 s, `VICTORY_LOG=info`. Two runs per build; the second of each was sampled with `VICTORY_STACKS`. - **What counts as world:** frame-rate lines under 10 fps with at least 500 draws. | run | ms/frame | preparing | copies: ms / MB per frame | copy rate | on the GPU | copying back | draws/frame | |---|---:|---:|---:|---:|---:|---:|---:| | `main` | 695 | 352 | 178 / 686 | 3.85 GB/s | 221 | 99 | 3729 | | `main`, sampled | 762 | 388 | 174 / 658 | 3.78 GB/s | 214 | 111 | 3991 | | this PR | 627 | 301 | 123 / 610 | 4.97 GB/s | 205 | 83 | 3208 | | this PR, sampled | 680 | 334 | 143 / 654 | 4.58 GB/s | 226 | 94 | 3541 | - The copy volume is about the same in all four: 610–690 MB a frame, 32–34 submissions, 19–20 k refreshes. So per byte, the copies cost 20–30% less with this PR. - The whole frame is about 10% shorter. That is in the same direction, but within the spread I see between runs of one build. - No device removal in any run, and 20–22 warnings in each log. **Stack samples** (a dump every 0.25 s from 105 s to 175 s; 80 dumps on `main`, 84 with this PR; `victory.exe` symbolised from the build's PDB): | leaf, with its callers | `main` | this PR | |---|---:|---:| | `ZwReadVirtualMemory` ← `copy_mapped` ← `Shadow::update` ← `Batch::flush` | 7 | **0** | | `victory_title_copy_begin` ← `copy_mapped` ← `Shadow::update` | 0 | 7 | | `ZwReadVirtualMemory` elsewhere: `copy_back_marks`, `write_mapped`, `copy_back_or_not`, `watch::mark_changed` | 3 | 6 | - The refresh copies now run in user mode, as intended. Copies into title memory keep the kernel path, as the PR says. - The refresh keeps the same number of samples, 7 against 7. That fits @⁠TG0000's note above: in the world the refresh is dominated by the bytes copied, about 650 MB a frame here, more than by the call. This PR makes each byte cheaper, but it does not reduce how many bytes there are. **Tests.** `cargo test --locked -p victory-gpu --lib -- --test-threads=1` on the merge: 240 passed, 0 failed, 3 ignored. AI-assisted (Claude Code); every run was on this machine. Only timings, counts and VIctory's own function names are posted, no game files.
This pull request can be merged automatically.
This branch is out-of-date with the base branch
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/1010/head:github-bot/gh-1010'
git switch 'github-bot/gh-1010'

Merge

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