Buffer refusals held back by size, and small placed copies taken for the title's (from mandy) #488

Open
Koaio wants to merge 2 commits from upstream-pr/488 into main
Koaio commented 2026-12-02 17:17:01 +00:00 (Migrated from github.com)

Imported from readmet3xt-lab/foxhound. Originally posted by Koaio on 2026-12-02T17:17:01Z.


Two changes, measured on an i5-10400F (6 cores, 12 threads), 16 GB of RAM and an RTX 3060 12 GB, Series S profile at 1080p with DLSS Performance. They were written and played on an older main, then moved onto the current one; the move needed conflict fixes but no change of logic.

What changes

  1. A refused CPU-visible buffer holds back only buffers that large, for its own moment (residency.rs, host.rs). Upload, write-back upload and shared buffers refused with E_OUTOFMEMORY start a 500 ms window of their own. In that window only buffers at least as large as the smallest one refused are not asked for; smaller ones still are. Before, one refused 64 MB buffer held back every size for about a minute of reopening windows (428 k refusals), and then a host state prelude failed (0x8007000E) and the game crashed. Shared buffers now count their refusals like the others, through allocation_error. Refusals are logged the first time and every thousandth. VICTORY_BUFFER_RETRY=1 asks every time. An hour of play after the change had no crash, with 2,039 refusals in all.
  2. A small copy at its place into undeclared bytes is the title's own (host.rs, host/place.rs, launcher), ported from ProjectLeonida/mandy's LEONIDA_PLACED_TITLE (GPL-3.0-or-later). With VICTORY_PLACED_TITLE=1, which the launcher now sets, a copy at its place of at most 64 KiB is taken by title memory at submission when two things hold: no flight in the air declares its destination (VICTORY_PLACED_UNDECLARED, on) or no shader wrote there in 600 frames; and its source is undeclared or the title's by the rule for fills. What reads the destination on the CPU then stops waiting for every flight. Mandy measured a frame median of 88.5 to 73.9 ms on a Ryzen 5 7600X. Here it fired about 130 times in 28 minutes: no harm seen, no measurable gain.

Measured, not included

  • List threads by processor: main now gives 6 threads for 12 logical processors. On the i5, 5 and 4 threads both took the worst frames (p99) from 774 to 142–165 ms for the same median against 8. 6 was not measured.
  • Sections of 16 MiB for physical pages (mandy's LEONIDA_SECTION_MB): no gain on this 16 GB PC. With them off, ten minutes came out as before them (median 83.8 against 82.0 ms); with 16 MiB sections the first two minutes were slower (median 86 against 74 ms). Left out.
  • VICTORY_HELPER_PRIORITY=0: worse (median 92.2 against 84.2 ms).
  • VICTORY_WINDOWS_BAR_MB=3072: does nothing without resizable BAR.

Tests

  • cargo test -p victory-gpu on this branch: 621 passed, 0 failed.
  • cargo clippy -p victory-gpu: clean.

🤖 Generated with Claude Code

<!-- greyfinch-sync:readmet3xt-lab/foxhound:issue:5611405053 --> Imported from [readmet3xt-lab/foxhound](https://github.com/readmet3xt-lab/foxhound/pull/488). Originally posted by [Koaio](https://github.com/Koaio) on 2026-12-02T17:17:01Z. --- Two changes, measured on an i5-10400F (6 cores, 12 threads), 16 GB of RAM and an RTX 3060 12 GB, Series S profile at 1080p with DLSS Performance. They were written and played on an older `main`, then moved onto the current one; the move needed conflict fixes but no change of logic. ## What changes 1. **A refused CPU-visible buffer holds back only buffers that large, for its own moment** (`residency.rs`, `host.rs`). Upload, write-back upload and shared buffers refused with `E_OUTOFMEMORY` start a 500 ms window of their own. In that window only buffers at least as large as the smallest one refused are not asked for; smaller ones still are. Before, one refused 64 MB buffer held back every size for about a minute of reopening windows (428 k refusals), and then a host state prelude failed (`0x8007000E`) and the game crashed. Shared buffers now count their refusals like the others, through `allocation_error`. Refusals are logged the first time and every thousandth. `VICTORY_BUFFER_RETRY=1` asks every time. An hour of play after the change had no crash, with 2,039 refusals in all. 2. **A small copy at its place into undeclared bytes is the title's own** (`host.rs`, `host/place.rs`, launcher), ported from ProjectLeonida/mandy's `LEONIDA_PLACED_TITLE` (GPL-3.0-or-later). With `VICTORY_PLACED_TITLE=1`, which the launcher now sets, a copy at its place of at most 64 KiB is taken by title memory at submission when two things hold: no flight in the air declares its destination (`VICTORY_PLACED_UNDECLARED`, on) or no shader wrote there in 600 frames; and its source is undeclared or the title's by the rule for fills. What reads the destination on the CPU then stops waiting for every flight. Mandy measured a frame median of 88.5 to 73.9 ms on a Ryzen 5 7600X. Here it fired about 130 times in 28 minutes: no harm seen, no measurable gain. ## Measured, not included - **List threads by processor**: `main` now gives 6 threads for 12 logical processors. On the i5, 5 and 4 threads both took the worst frames (p99) from 774 to 142–165 ms for the same median against 8. 6 was not measured. - **Sections of 16 MiB for physical pages** (mandy's `LEONIDA_SECTION_MB`): no gain on this 16 GB PC. With them off, ten minutes came out as before them (median 83.8 against 82.0 ms); with 16 MiB sections the first two minutes were slower (median 86 against 74 ms). Left out. - `VICTORY_HELPER_PRIORITY=0`: worse (median 92.2 against 84.2 ms). - `VICTORY_WINDOWS_BAR_MB=3072`: does nothing without resizable BAR. ## Tests - `cargo test -p victory-gpu` on this branch: 621 passed, 0 failed. - `cargo clippy -p victory-gpu`: clean. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
tillo88 commented 2026-12-03 00:38:56 +00:00 (Migrated from github.com)

Imported from readmet3xt-lab/foxhound. Originally posted by tillo88 on 2026-12-03T00:38:56Z.


Replay-bench measurement: no measurable difference on v0.8.3.3

Measured: PR head bd12bb8 merged onto release v0.8.3.3 (same code as main 7dbcdcb), with VICTORY_PLACED_TITLE=1, 2 measured runs (each after a warm-up run that is not counted), against 4 runs of v0.8.3.3 without the PR, same route (~6.5 min).

run fps CPU prep ms median ms p95 ms p99 ms frames > 100 ms
release run 1 36.54 19.08 29.00 50.42 60.01 32
release run 2 36.45 20.15 28.10 38.59 45.48 13
release run 3 36.15 19.30 29.35 38.74 46.08 10
release run 4 36.69 19.55 28.20 37.38 46.28 15
PR #488 + VICTORY_PLACED_TITLE=1 run 1 36.18 20.10 28.80 38.50 46.13 13
PR #488 + VICTORY_PLACED_TITLE=1 run 2 36.78 19.16 29.15 38.83 46.29 16

Mean fps: release 36.46, PR 36.48 (+0.1%). That is below the 2-3% we treat as a real change, so: no measurable difference on this route. With 4 release runs the release's own spread on this route is 36.15-36.69 fps.

Crashes: none in the PR runs and none in the release runs (no host GPU failure, no device lost).

Config: RTX 5070 Ti 16 GB, Ryzen 7 9800X3D, 32 GB, Windows 11; default play-foxhound.ps1 settings (Series X profile, 1440p, DLSS balanced, no frame generation), fullscreen, no frame cap.

Measured unattended on a replay bench (same save, recorded controller input); numbers and text prepared with Claude.

<!-- greyfinch-sync:readmet3xt-lab/foxhound:comment:7363429686 --> Imported from [readmet3xt-lab/foxhound](https://github.com/readmet3xt-lab/foxhound/pull/488#issuecomment-7363429686). Originally posted by [tillo88](https://github.com/tillo88) on 2026-12-03T00:38:56Z. --- **Replay-bench measurement: no measurable difference on v0.8.3.3** Measured: PR head `bd12bb8` merged onto release **v0.8.3.3** (same code as main `7dbcdcb`), with `VICTORY_PLACED_TITLE=1`, 2 measured runs (each after a warm-up run that is not counted), against 4 runs of v0.8.3.3 without the PR, same route (~6.5 min). | run | fps | CPU prep ms | median ms | p95 ms | p99 ms | frames > 100 ms | |---|---|---|---|---|---|---| | release run 1 | 36.54 | 19.08 | 29.00 | 50.42 | 60.01 | 32 | | release run 2 | 36.45 | 20.15 | 28.10 | 38.59 | 45.48 | 13 | | release run 3 | 36.15 | 19.30 | 29.35 | 38.74 | 46.08 | 10 | | release run 4 | 36.69 | 19.55 | 28.20 | 37.38 | 46.28 | 15 | | PR #488 + VICTORY_PLACED_TITLE=1 run 1 | 36.18 | 20.10 | 28.80 | 38.50 | 46.13 | 13 | | PR #488 + VICTORY_PLACED_TITLE=1 run 2 | 36.78 | 19.16 | 29.15 | 38.83 | 46.29 | 16 | Mean fps: release 36.46, PR 36.48 (+0.1%). That is below the 2-3% we treat as a real change, so: **no measurable difference** on this route. With 4 release runs the release's own spread on this route is 36.15-36.69 fps. Crashes: none in the PR runs and none in the release runs (no host GPU failure, no device lost). Config: RTX 5070 Ti 16 GB, Ryzen 7 9800X3D, 32 GB, Windows 11; default `play-foxhound.ps1` settings (Series X profile, 1440p, DLSS balanced, no frame generation), fullscreen, no frame cap. Measured unattended on a replay bench (same save, recorded controller input); numbers and text prepared with Claude.
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/488:upstream-pr/488'
git switch 'upstream-pr/488'

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/488'
git switch 'upstream-pr/488'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/488'
git switch 'upstream-pr/488'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/488'
git switch 'main'
git merge --squash 'upstream-pr/488'
git switch 'main'
git merge --ff-only 'upstream-pr/488'
git switch 'main'
git merge 'upstream-pr/488'
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!488
No description provided.