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

Open
github-bot wants to merge 2 commits from github-bot/gh-488 into main AGit
Owner

@⁠Koaio on GitHub · 2026-12-02 17:17 UTC · original
Koaio:pr/buffer-refusals-and-mandy-ports → main · +187 −13 · 4 files · 2 commits · open

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

**@⁠Koaio** on GitHub · 2026-12-02 17:17 UTC · [original](https://github.com/readmet3xt-lab/foxhound/pull/488) `Koaio:pr/buffer-refusals-and-mandy-ports` → `main` · +187 −13 · 4 files · 2 commits · open 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)
Upload, write-back upload and shared buffers refused for want of memory start a 500 ms moment of their own (a refused texture does not), in which only buffers at least as large as the smallest refused are not asked of the system; smaller ones still are. Before, one refused 64 MB buffer held back every size for a minute of reopening windows, and a host state prelude then failed (0x8007000E). Shared buffers now count their refusals like the others. Refusals are logged the first time and every thousandth. VICTORY_BUFFER_RETRY=1 asks every time. Played for an hour on an RTX 3060 12 GB without a crash.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
VICTORY_PLACED_TITLE=1 (the launcher sets it): a copy at its place in a list of at most 64 KiB into bytes no flight in the air declares (VICTORY_PLACED_UNDECLARED, on), or that no shader's write went into in 600 frames, with its source undeclared or the title's by the rule for fills, is taken by title memory at submission. What reads its destination on the CPU no longer waits for every flight; the destination's reference is left to the landing.

Ported from ProjectLeonida/mandy (LEONIDA_PLACED_TITLE, GPL-3.0-or-later), where the title's ring of constants made three such copies a frame wait for every flight; measured there on a six-core Ryzen 5 7600X, 8 A/B phases: frame median 88.5 -> 73.9 ms. Not measured here yet.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-12-02 19:06:44 +00:00
Author
Owner

@⁠tillo88 on GitHub · 2026-12-03 00:38 UTC · original

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.

**@⁠tillo88** on GitHub · 2026-12-03 00:38 UTC · [original](https://github.com/readmet3xt-lab/foxhound/pull/488#issuecomment-7363429686) **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 has changes conflicting with the target branch.
  • crates/victory-gpu/src/residency.rs
  • launcher/Launcher.cs
View command line instructions

Manual merge helper

Use this merge commit message when completing the merge manually.

Checkout

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

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-488'
git switch 'github-bot/gh-488'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-488'
git switch 'github-bot/gh-488'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-488'
git switch 'main'
git merge --squash 'github-bot/gh-488'
git switch 'main'
git merge --ff-only 'github-bot/gh-488'
git switch 'main'
git merge 'github-bot/gh-488'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No description provided.