Host copies: quick window finds, 4 KiB takes, write-combined parts left on the card (from mandy) #551

Open
voiceovarian1-max wants to merge 1 commit from upstream-pr/551 into main
voiceovarian1-max commented 2026-12-03 09:44:13 +00:00 (Migrated from github.com)

Imported from readmet3xt-lab/foxhound. Originally posted by voiceovarian1-max on 2026-12-03T09:44:13Z.


  • VICTORY_QUICK_FIND_WINDOWS=1 (the launcher sets it): a thread also remembers what its asks for
    memory outside buffers found, while the buffers' and windows' tables are unchanged
    (shadow.rs quick_windows). mandy d27ba8b68: frame -0.9 to -2.4 ms.
  • VICTORY_TAKE_BLOCKS (on): a page of a card copy that the copy held before and the title wrote
    goes up as the 4 KiB pieces that changed, not whole (mandy 6d0ba44f0 and d920d850d).
  • VICTORY_WC_SUBRANGE_NO_BACK (on, with VICTORY_WC_NO_BACK): shader writes into write-combined
    parts of a copy stay on the card as whole write-combined copies do (mandy f85d1790a by
    hardly-relevant, after gmanka/victory 32be36d).

Ported from ProjectLeonida/mandy (GPL-3.0-or-later), commits above (NotRexed unless named).
The refresh test is adjusted as in mandy 6d0ba44f0: with VICTORY_TAKE_BLOCKS the page the
landing took goes up as the 4 KiB that differ.

What is in it

  • crates/victory-gpu/src/host.rs | 6 +
  • crates/victory-gpu/src/lib.rs | 2 +-
  • crates/victory-gpu/src/shadow.rs | 532 ++++++++++++++++++++++++++++++---
  • crates/victory-gpu/src/watch.rs | 9 +-
  • crates/victory-hle/src/modules/xmem.rs | 42 ++-
  • scripts/play-foxhound.ps1 | 3 +

Tested

  • cargo check --workspace --tests --locked on main 7dbcdcb: no errors, no warnings.
  • In the game: only together with the other ports from mandy, in one combined build (results to follow here before this leaves draft).

Not tested

  • This change on its own in the game; AMD and Intel cards; the Series X profile.

AI use

Claude Code with Claude Opus 5.5 ported this from mandy, resolved its conflicts with this tree and wrote this description.

🤖 Generated with Claude Code

<!-- greyfinch-sync:readmet3xt-lab/foxhound:issue:5623938280 --> Imported from [readmet3xt-lab/foxhound](https://github.com/readmet3xt-lab/foxhound/pull/551). Originally posted by [voiceovarian1-max](https://github.com/voiceovarian1-max) on 2026-12-03T09:44:13Z. --- - VICTORY_QUICK_FIND_WINDOWS=1 (the launcher sets it): a thread also remembers what its asks for memory outside buffers found, while the buffers' and windows' tables are unchanged (shadow.rs quick_windows). mandy d27ba8b68: frame -0.9 to -2.4 ms. - VICTORY_TAKE_BLOCKS (on): a page of a card copy that the copy held before and the title wrote goes up as the 4 KiB pieces that changed, not whole (mandy 6d0ba44f0 and d920d850d). - VICTORY_WC_SUBRANGE_NO_BACK (on, with VICTORY_WC_NO_BACK): shader writes into write-combined parts of a copy stay on the card as whole write-combined copies do (mandy f85d1790a by hardly-relevant, after gmanka/victory 32be36d). Ported from ProjectLeonida/mandy (GPL-3.0-or-later), commits above (NotRexed unless named). The refresh test is adjusted as in mandy 6d0ba44f0: with VICTORY_TAKE_BLOCKS the page the landing took goes up as the 4 KiB that differ. **What is in it** - `crates/victory-gpu/src/host.rs` | 6 + - `crates/victory-gpu/src/lib.rs` | 2 +- - `crates/victory-gpu/src/shadow.rs` | 532 ++++++++++++++++++++++++++++++--- - `crates/victory-gpu/src/watch.rs` | 9 +- - `crates/victory-hle/src/modules/xmem.rs` | 42 ++- - `scripts/play-foxhound.ps1` | 3 + **Tested** - `cargo check --workspace --tests --locked` on `main` 7dbcdcb: no errors, no warnings. - In the game: only together with the other ports from mandy, in one combined build (results to follow here before this leaves draft). **Not tested** - This change on its own in the game; AMD and Intel cards; the Series X profile. **AI use** Claude Code with Claude Opus 5.5 ported this from mandy, resolved its conflicts with this tree and wrote this description. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
voiceovarian1-max commented 2026-12-03 10:04:21 +00:00 (Migrated from github.com)

Imported from readmet3xt-lab/foxhound. Originally posted by voiceovarian1-max on 2026-12-03T10:04:21Z.


Combined test of this PR with #521, #543 and #544-#556, all merged onto main 7dbcdcb (branch fox-all of voiceovarian1-max/foxhound):

  • RTX 4070 Ti 12 GB (driver 617.14), i7-14700K, 32 GB, Windows 11 Pro 26300; release.
  • cargo test --workspace --locked -- --test-threads=4: 1,415 passed, 0 failed, 50 ignored (29 binaries), no SKIPPED.
  • Retail title, Series S profile, DLSS Balanced, 60 fps limit, keys pressed by the layer only (VICTORY_KEYS, no input from the PC): window scene 38-42 fps against 34-37 for main on the same boot; no device removal, no crash; a burst of 67 pictures showed no one-picture flicker of the character's clothes.
  • Not tested: each PR alone in the game; AMD and Intel; the Series X profile; long play.

Tested by Claude Code with Claude Opus 5.5 on the hardware named.

<!-- greyfinch-sync:readmet3xt-lab/foxhound:comment:7374692220 --> Imported from [readmet3xt-lab/foxhound](https://github.com/readmet3xt-lab/foxhound/pull/551#issuecomment-7374692220). Originally posted by [voiceovarian1-max](https://github.com/voiceovarian1-max) on 2026-12-03T10:04:21Z. --- Combined test of this PR with #521, #543 and #544-#556, all merged onto `main` 7dbcdcb (branch fox-all of voiceovarian1-max/foxhound): - RTX 4070 Ti 12 GB (driver 617.14), i7-14700K, 32 GB, Windows 11 Pro 26300; release. - `cargo test --workspace --locked -- --test-threads=4`: 1,415 passed, 0 failed, 50 ignored (29 binaries), no `SKIPPED`. - Retail title, Series S profile, DLSS Balanced, 60 fps limit, keys pressed by the layer only (`VICTORY_KEYS`, no input from the PC): window scene 38-42 fps against 34-37 for `main` on the same boot; no device removal, no crash; a burst of 67 pictures showed no one-picture flicker of the character's clothes. - Not tested: each PR alone in the game; AMD and Intel; the Series X profile; long play. Tested by Claude Code with Claude Opus 5.5 on the hardware named.
BrenoMazini commented 2026-12-03 16:41:35 +00:00 (Migrated from github.com)

Imported from readmet3xt-lab/foxhound. Originally posted by BrenoMazini on 2026-12-03T16:41:35Z.


Tested on v0.8.3.5 together with #545 and #552: less work on the submitting thread, but #551 and #552 together bring long frames while the camera turns

I ran this PR on top of v0.8.3.5 together with #545 and #552, then each PR on its own, then #551 with #552. That was 14 runs on one PC, in one day, plus one I dropped.

In short

  • The saving is real. With all three on, the submitting thread prepares a frame about 5 ms faster. Refreshes fall by about 4 ms and copies of changed buffers by another 4 ms. The card's time does not change.
  • It barely shows in the frame rate. In the morning series, turning, the mean went from 14.0 to 14.4 fps. Per thousand indirect executions, the median frame stayed the same (11.4 against 11.3 ms).
  • #551 and #552 together give more long frames while the camera turns. With all three on, the share of frames over 100 ms rose in both series: by 4 points in the morning and by 7 in the afternoon. With #551 and #552 alone it rose by 9.5 points. Neither one does it on its own:
turning, same afternoon (~7,000 indirect executions a frame) frames over 100 ms p95 median frame per 1,000 indirect executions submitting thread, preparing
none of the three (2 runs) 17.1 / 18.8 % 109 / 110 ms 10.3 / 10.5 ms 63.8 / 61.4 ms
#545 only 16.8 % 108 ms 10.6 ms 61.6 ms
#551 only 13.1 % 107 ms 9.2 ms 56.7 ms
#552 only (2 runs) 21.1 / 18.1 % 128 / 119 ms 10.3 / 10.3 ms 63.9 / 59.1 ms
#551 + #552 27.5 % 122 ms 10.8 ms 58.2 ms
all three 24.6 % 111 ms 10.2 ms 54.9 ms
  • Alone, #551 had fewer long frames than the baseline and the best median frame. Alone, #552 stays within the spread of two baseline runs. #545 does not change it.
  • Standing still, no configuration differs: in the afternoon, 13-20 % of frames were over 100 ms in all of them. The long frames come only while the camera turns, when the title writes to a lot of new memory.
  • The two PRs share a path: copies and refreshes of title buffers. #551 changes how pages go up (TAKE_BLOCKS, WC_SUBRANGE_NO_BACK, QUICK_FIND_WINDOWS). #552 changes which copies refresh again after a title write (COPY_SCOPED, LAND_SAME). My guess is that something in how they meet makes some frames wait, but I haven't split them any further.

How it was measured

  • PC and settings:
    • RTX 4070 SUPER 12 GB, Ryzen 7 5700X, 32 GB, Windows 11;
    • Series X profile, 3440x1440, DLSS Performance, no frame generation;
    • a title profile with the 0.8.3.5 groups (max_step applied).
  • Build: my fork rebased on v0.8.3.5 (5e44415), with #545, #551 and #552 merged. The fork's big-buffer home and the constants port are off in these runs. Around that, the build adds #527's lock-free journal reads, bakes without the full texture pass (BAKE_PASS_MS) and a longer wait on Quit. These are the same in every run.
    • #551 conflicted in shadow.rs shader_writes: v0.8.3.5 limits the read-only skip to card copies with a twin.
    • I kept that limit for the read-only part and the PR's write-combined part as it is: ro_on = gpu_ro_skip_now() && self.card.is_some() && self.card_has_before(), then if !ro_on && !wc_on.
  • Switches in every run: GUARD_PAGES=1, PROFILE=1, PROFILE_TOP=1, BAKE_PASS_MS=0, and VICTORY_KEYS_FILE for the input. Only the PR switches differ:
switches
none TAKE_BLOCKS=0, WC_SUBRANGE_NO_BACK=0, LAND_SAME=0
#545 only INDEX_HEAP_SPANS=1, TAKE_BLOCKS=0, WC_SUBRANGE_NO_BACK=0, LAND_SAME=0
#551 only QUICK_FIND_WINDOWS=1, LAND_SAME=0 (TAKE_BLOCKS, WC_SUBRANGE_NO_BACK at their default, on)
#552 only COPY_SCOPED=1, TAKE_BLOCKS=0, WC_SUBRANGE_NO_BACK=0 (LAND_SAME at its default, on)
#551 + #552 QUICK_FIND_WINDOWS=1, COPY_SCOPED=1 (the others at their defaults)
all three INDEX_HEAP_SPANS=1, QUICK_FIND_WINDOWS=1, COPY_SCOPED=1
  • Each run:
    • a fresh start of the game;
    • I walked by hand to the same spot in a heavy scene, faced the same way and waited at least 30 s;
    • from a key press on, the input came only from VICTORY_KEYS_FILE: 20 s to settle (not counted), 60 s standing still, then 24 s turning the camera (12 s right, 12 s back).
  • What is counted:
    • "frames over 100 ms" is the sum of the "over 100 ms" counts of the per-second frame-time lines, divided by the frames of the phase;
    • the p95 and the median frame are medians of the per-second values;
    • the other values are medians of the 5-second lines in the phase.
  • The world fills differently on each load, and its density rose over the afternoon. In the morning, turning ran at 6,200-6,400 indirect executions a frame; in the afternoon, at 6,900-7,400.
    • Long frames follow density: with none of the PRs, 6-8 % of frames were over 100 ms in the morning and 17-19 % in the afternoon.
    • So the table above compares only afternoon runs, in alternating order. Two runs with none of the PRs give the spread.
  • One run was dropped: the title's autosave notice lightened the scene for 90 s in the middle of the path.
  • The runs and the configuration were mine; a model (Claude) read the logs. Every number comes from the logs.
Morning series: none against all three (AG AGP AGP AG), turning
none (2 runs) all three (2 runs)
fps 13.9 / 14.1 14.4 / 14.3
frame, median 73.2 / 72.0 ms 70.6 / 71.8 ms
frame, p95 84.6 / 82.2 ms 96.0 / 94.5 ms
frames over 100 ms 7.8 / 6.2 % 10.5 / 11.6 %
indirect executions a frame 6,395 / 6,360 6,357 / 6,230
card busy 57 / 56 % 57 / 57 %
submitting thread, preparing 66.2 / 64.3 ms 61.2 / 59.0 ms
asking the write watch 18.4 / 16.9 ms 20.8 / 20.5 ms
refreshes 23.0 / 22.1 ms 18.5 / 18.4 ms
copies of changed buffers 27.7 / 29.0 ms 22.8 / 24.6 ms

The write-watch asking grew by about 3 ms with the three on and took back part of the saving.

With my fork's constants port and big-buffer home (one run each), the card is the limit (90-95 % busy). There the three cut preparing from 56.2 to 45.5 ms while turning, but frames over 100 ms went from 17.6 to 21.1 % and the p95 from 105 to 114 ms.

I saw no visual faults in any run.

If it helps, I can split the pair further: TAKE_BLOCKS, WC_SUBRANGE_NO_BACK and QUICK_FIND_WINDOWS one at a time against COPY_SCOPED and LAND_SAME. I can also run with a log line you'd like to see, or attach the logs with the game folder replaced by <game>. I'm posting a short note on #552 that points here.

<!-- greyfinch-sync:readmet3xt-lab/foxhound:comment:7385277621 --> Imported from [readmet3xt-lab/foxhound](https://github.com/readmet3xt-lab/foxhound/pull/551#issuecomment-7385277621). Originally posted by [BrenoMazini](https://github.com/BrenoMazini) on 2026-12-03T16:41:35Z. --- **Tested on v0.8.3.5 together with #545 and #552: less work on the submitting thread, but #551 and #552 together bring long frames while the camera turns** I ran this PR on top of v0.8.3.5 together with #545 and #552, then each PR on its own, then #551 with #552. That was 14 runs on one PC, in one day, plus one I dropped. **In short** - **The saving is real.** With all three on, the submitting thread prepares a frame about 5 ms faster. Refreshes fall by about 4 ms and copies of changed buffers by another 4 ms. The card's time does not change. - **It barely shows in the frame rate.** In the morning series, turning, the mean went from 14.0 to 14.4 fps. Per thousand indirect executions, the median frame stayed the same (11.4 against 11.3 ms). - **#551 and #552 together give more long frames while the camera turns.** With all three on, the share of frames over 100 ms rose in both series: by 4 points in the morning and by 7 in the afternoon. With #551 and #552 alone it rose by 9.5 points. Neither one does it on its own: | turning, same afternoon (~7,000 indirect executions a frame) | frames over 100 ms | p95 | median frame per 1,000 indirect executions | submitting thread, preparing | |---|---|---|---|---| | none of the three (2 runs) | **17.1 / 18.8 %** | 109 / 110 ms | 10.3 / 10.5 ms | 63.8 / 61.4 ms | | #545 only | 16.8 % | 108 ms | 10.6 ms | 61.6 ms | | #551 only | 13.1 % | 107 ms | **9.2 ms** | 56.7 ms | | #552 only (2 runs) | 21.1 / 18.1 % | 128 / 119 ms | 10.3 / 10.3 ms | 63.9 / 59.1 ms | | **#551 + #552** | **27.5 %** | **122 ms** | 10.8 ms | 58.2 ms | | all three | 24.6 % | 111 ms | 10.2 ms | **54.9 ms** | - Alone, #551 had fewer long frames than the baseline and the best median frame. Alone, #552 stays within the spread of two baseline runs. #545 does not change it. - Standing still, no configuration differs: in the afternoon, 13-20 % of frames were over 100 ms in all of them. The long frames come only while the camera turns, when the title writes to a lot of new memory. - The two PRs share a path: copies and refreshes of title buffers. #551 changes how pages go up (`TAKE_BLOCKS`, `WC_SUBRANGE_NO_BACK`, `QUICK_FIND_WINDOWS`). #552 changes which copies refresh again after a title write (`COPY_SCOPED`, `LAND_SAME`). My guess is that something in how they meet makes some frames wait, but I haven't split them any further. **How it was measured** - **PC and settings:** - RTX 4070 SUPER 12 GB, Ryzen 7 5700X, 32 GB, Windows 11; - Series X profile, 3440x1440, DLSS Performance, no frame generation; - a title profile with the 0.8.3.5 groups (`max_step` applied). - **Build:** my fork rebased on v0.8.3.5 (5e44415), with #545, #551 and #552 merged. The fork's big-buffer home and the constants port are off in these runs. Around that, the build adds #527's lock-free journal reads, bakes without the full texture pass (`BAKE_PASS_MS`) and a longer wait on Quit. These are the same in every run. - #551 conflicted in `shadow.rs` `shader_writes`: v0.8.3.5 limits the read-only skip to card copies with a twin. - I kept that limit for the read-only part and the PR's write-combined part as it is: `ro_on = gpu_ro_skip_now() && self.card.is_some() && self.card_has_before()`, then `if !ro_on && !wc_on`. - **Switches in every run:** `GUARD_PAGES=1`, `PROFILE=1`, `PROFILE_TOP=1`, `BAKE_PASS_MS=0`, and `VICTORY_KEYS_FILE` for the input. Only the PR switches differ: | | switches | |---|---| | none | `TAKE_BLOCKS=0`, `WC_SUBRANGE_NO_BACK=0`, `LAND_SAME=0` | | #545 only | `INDEX_HEAP_SPANS=1`, `TAKE_BLOCKS=0`, `WC_SUBRANGE_NO_BACK=0`, `LAND_SAME=0` | | #551 only | `QUICK_FIND_WINDOWS=1`, `LAND_SAME=0` (`TAKE_BLOCKS`, `WC_SUBRANGE_NO_BACK` at their default, on) | | #552 only | `COPY_SCOPED=1`, `TAKE_BLOCKS=0`, `WC_SUBRANGE_NO_BACK=0` (`LAND_SAME` at its default, on) | | #551 + #552 | `QUICK_FIND_WINDOWS=1`, `COPY_SCOPED=1` (the others at their defaults) | | all three | `INDEX_HEAP_SPANS=1`, `QUICK_FIND_WINDOWS=1`, `COPY_SCOPED=1` | - **Each run:** - a fresh start of the game; - I walked by hand to the same spot in a heavy scene, faced the same way and waited at least 30 s; - from a key press on, the input came only from `VICTORY_KEYS_FILE`: 20 s to settle (not counted), 60 s standing still, then 24 s turning the camera (12 s right, 12 s back). - **What is counted:** - "frames over 100 ms" is the sum of the "over 100 ms" counts of the per-second frame-time lines, divided by the frames of the phase; - the p95 and the median frame are medians of the per-second values; - the other values are medians of the 5-second lines in the phase. - **The world fills differently on each load**, and its density rose over the afternoon. In the morning, turning ran at 6,200-6,400 indirect executions a frame; in the afternoon, at 6,900-7,400. - Long frames follow density: with none of the PRs, 6-8 % of frames were over 100 ms in the morning and 17-19 % in the afternoon. - So the table above compares only afternoon runs, in alternating order. Two runs with none of the PRs give the spread. - One run was dropped: the title's autosave notice lightened the scene for 90 s in the middle of the path. - The runs and the configuration were mine; a model (Claude) read the logs. Every number comes from the logs. <details> <summary>Morning series: none against all three (AG AGP AGP AG), turning</summary> | | none (2 runs) | all three (2 runs) | |---|---|---| | fps | 13.9 / 14.1 | 14.4 / 14.3 | | frame, median | 73.2 / 72.0 ms | 70.6 / 71.8 ms | | frame, p95 | 84.6 / 82.2 ms | **96.0 / 94.5 ms** | | frames over 100 ms | 7.8 / 6.2 % | **10.5 / 11.6 %** | | indirect executions a frame | 6,395 / 6,360 | 6,357 / 6,230 | | card busy | 57 / 56 % | 57 / 57 % | | submitting thread, preparing | 66.2 / 64.3 ms | 61.2 / 59.0 ms | | asking the write watch | 18.4 / 16.9 ms | 20.8 / 20.5 ms | | refreshes | 23.0 / 22.1 ms | 18.5 / 18.4 ms | | copies of changed buffers | 27.7 / 29.0 ms | 22.8 / 24.6 ms | The write-watch asking grew by about 3 ms with the three on and took back part of the saving. With my fork's constants port and big-buffer home (one run each), the card is the limit (90-95 % busy). There the three cut preparing from 56.2 to 45.5 ms while turning, but frames over 100 ms went from 17.6 to 21.1 % and the p95 from 105 to 114 ms. </details> I saw no visual faults in any run. If it helps, I can split the pair further: `TAKE_BLOCKS`, `WC_SUBRANGE_NO_BACK` and `QUICK_FIND_WINDOWS` one at a time against `COPY_SCOPED` and `LAND_SAME`. I can also run with a log line you'd like to see, or attach the logs with the game folder replaced by `<game>`. I'm posting a short note on #552 that points here.
This pull request cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'upstream-pr/551:upstream-pr/551'
git switch 'upstream-pr/551'

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch 'main'
git merge --no-ff 'upstream-pr/551'
git switch 'upstream-pr/551'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/551'
git switch 'upstream-pr/551'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/551'
git switch 'main'
git merge --squash 'upstream-pr/551'
git switch 'main'
git merge --ff-only 'upstream-pr/551'
git switch 'main'
git merge 'upstream-pr/551'
git push origin 'main'
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
readmet3xt-lab/foxhound!551
No description provided.