HLE: optionally back physical page pools with temporary sparse files #2519

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

@⁠yyc160 on GitHub · 2026-11-25 15:13 UTC · original
yyc160:pr/sparse-physical-pools → main · +242 −36 · 7 files · 3 commits · open

When Windows commit is tight, let the user back XMem physical page pools with sparse, delete-on-close files instead of mapping them against the system pagefile. Views of a physical page still alias the same section. The default Windows path (SEC_RESERVE) and Wine path (SEC_COMMIT) are unchanged. This trades commit for disk space and possible I/O; it is not a GPU residency or frame-rate change.

Configuration and review changes

Set [paths].physical_pages_dir in victory.toml to a directory on a local sparse-capable volume with room for the pages the title writes. Leave it unset to use the system pagefile. For existing launchers, VICTORY_FILE_BACKED_PAGES=1 uses the configured path or <cache_dir>/physical-pages; =0 disables it even when configured. victory config shows the resolved choice. The directory is checked against the asset policy before use.

  • No new runtime crate: the backing file is created exclusively with create_new and FILE_FLAG_DELETE_ON_CLOSE. An existing file is never opened or truncated. tempfile is dev-only.
  • The README explanation is now two sentences. The example TOML documents the setting and override.

Title startup at the submitted head (646c17c)

Four launches of the same Windows diagnostics binary built directly from this PR head, not a previous integration build. Series S title, 32 GiB host with an RTX 5070 Ti, fresh cache and private save copy for each launch. The env switch was unset throughout; only the presence of the TOML setting selected the backing. Each run was stopped after present 64.

Launch order Backing System commit headroom consumed, start to minimum Peak process private bytes
1 TOML sparse 5.48 GiB 4.58 GiB
2 Default 9.17 GiB 4.57 GiB
3 Default 9.20 GiB 4.73 GiB
4 TOML sparse 4.80 GiB 4.73 GiB

All four reported four successful allocations totaling 74,864 logical 64 KiB pages. The first file-backed allocation was 3,520 pages (220 MiB); both sparse launches left the backing directory empty after exit. The default launches did not create it. The source title executable and seed save were unchanged. Commit headroom is system-wide, not a per-process saving; these are short startup samples, not gameplay or steady-state benchmarks.

Validation

  • Exact PR head: 87 HLE unit tests, 10 core unit tests and the no-DLL-planting integration test passed. The sparse alias test checked zero-initialization, bidirectional writes and last-view cleanup on this host.
  • The clean merge with upstream 63bcca4 was tested separately; its tree dc189d36 matches GitHub's test merge. 153 HLE, 15 core and 14 CLI unit tests passed, along with both workspace Clippy configurations and asset policy. The optional FidelityFX SDK integration check skipped (SDK not configured). GitHub CI.
  • Related: #471 (commit pressure), #1147 and #1905 (GPU import/lifetime). This PR does not import the backing files as GPU heaps.

AI-assisted by GPT-6.2 Astra.

**@⁠yyc160** on GitHub · 2026-11-25 15:13 UTC · [original](https://github.com/Marvisak/VIctory/pull/2519) `yyc160:pr/sparse-physical-pools` → `main` · +242 −36 · 7 files · 3 commits · open When Windows commit is tight, let the user back XMem physical page pools with sparse, delete-on-close files instead of mapping them against the system pagefile. Views of a physical page still alias the same section. The default Windows path (`SEC_RESERVE`) and Wine path (`SEC_COMMIT`) are unchanged. This trades commit for disk space and possible I/O; it is not a GPU residency or frame-rate change. ### Configuration and review changes Set `[paths].physical_pages_dir` in `victory.toml` to a directory on a local sparse-capable volume with room for the pages the title writes. Leave it unset to use the system pagefile. For existing launchers, `VICTORY_FILE_BACKED_PAGES=1` uses the configured path or `<cache_dir>/physical-pages`; `=0` disables it even when configured. `victory config` shows the resolved choice. The directory is checked against the asset policy before use. - No new runtime crate: the backing file is created exclusively with `create_new` and `FILE_FLAG_DELETE_ON_CLOSE`. An existing file is never opened or truncated. `tempfile` is dev-only. - The README explanation is now two sentences. The example TOML documents the setting and override. ### Title startup at the submitted head (`646c17c`) Four launches of the **same Windows diagnostics binary built directly from this PR head**, not a previous integration build. Series S title, 32 GiB host with an RTX 5070 Ti, fresh cache and private save copy for each launch. The env switch was **unset throughout**; only the presence of the TOML setting selected the backing. Each run was stopped after present 64. | Launch order | Backing | System commit headroom consumed, start to minimum | Peak process private bytes | | --- | --- | ---: | ---: | | 1 | TOML sparse | 5.48 GiB | 4.58 GiB | | 2 | Default | 9.17 GiB | 4.57 GiB | | 3 | Default | 9.20 GiB | 4.73 GiB | | 4 | TOML sparse | 4.80 GiB | 4.73 GiB | All four reported four successful allocations totaling 74,864 logical 64 KiB pages. The first file-backed allocation was 3,520 pages (220 MiB); both sparse launches left the backing directory empty after exit. The default launches did not create it. The source title executable and seed save were unchanged. Commit headroom is system-wide, not a per-process saving; these are short startup samples, not gameplay or steady-state benchmarks. ### Validation - Exact PR head: 87 HLE unit tests, 10 core unit tests and the no-DLL-planting integration test passed. The sparse alias test checked zero-initialization, bidirectional writes and last-view cleanup on this host. - The clean merge with upstream `63bcca4` was tested separately; its tree `dc189d36` matches GitHub's test merge. 153 HLE, 15 core and 14 CLI unit tests passed, along with both workspace Clippy configurations and asset policy. The optional FidelityFX SDK integration check skipped (SDK not configured). [GitHub CI](https://github.com/Marvisak/VIctory/actions/runs/45794217652). - Related: #471 (commit pressure), #1147 and #1905 (GPU import/lifetime). This PR does not import the backing files as GPU heaps. AI-assisted by GPT-6.2 Astra.
Preserve the title's shared section offsets and alias/remap behaviour. On constrained Windows hosts this trades pagefile commit for disk space; enable only with VICTORY_FILE_BACKED_PAGES=1. Exercise a placeholder and a storage view of the same page, including cleanup after the last view closes.
Leave the allocator diagnostics tests together, including upstream #1720. This moves the existing test unchanged so both additions merge without touching the allocator or rewriting the published PR branch.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 05:08:04 +00:00
Author
Owner

@⁠Marvisak on GitHub · 2026-11-25 18:31 UTC · original · edited 2026-11-26 03:20 UTC

Automated triage for the maintainers.

Thanks for the rebase. Reviewed at b081ccf, which merges cleanly. CI: passing.

The mechanics in crates/victory-hle/src/modules/xmem.rs read correctly. Section::new makes a sparse temporary file with FSCTL_SET_SPARSE and maps it without SEC_RESERVE. commit_view skips VirtualAlloc commits only for those file-backed sections. The default path keeps SEC_RESERVE, or SEC_COMMIT under Wine.

The points from the earlier note are still open:

  • crates/victory-hle/Cargo.toml moves tempfile from dev-dependencies into the runtime dependencies. No other crate ships it at runtime, so this needs the maintainer's decision.
  • The switch is still the VICTORY_FILE_BACKED_PAGES env var read in apps/victory/src/run.rs. A victory.toml setting would fit the other paths better.
  • The README paragraph could be cut to one or two sentences.
  • The only measurement is from an earlier integration build. A run of the title with the switch on, at this head, would help.

Verdict: needs work (needs the maintainer's decision). CI: passing.


Generated by Claude Code

**@⁠Marvisak** on GitHub · 2026-11-25 18:31 UTC · [original](https://github.com/Marvisak/VIctory/pull/2519#issuecomment-7171034181) · edited 2026-11-26 03:20 UTC <!-- victory-triage v1 head=b081ccf4a11a831b5bd9161225982143b9a8a64f verdict=needs-work at=2026-11-26T03:20:27Z --> Automated triage for the maintainers. Thanks for the rebase. Reviewed at `b081ccf`, which merges cleanly. CI: passing. The mechanics in `crates/victory-hle/src/modules/xmem.rs` read correctly. `Section::new` makes a sparse temporary file with `FSCTL_SET_SPARSE` and maps it without `SEC_RESERVE`. `commit_view` skips `VirtualAlloc` commits only for those file-backed sections. The default path keeps `SEC_RESERVE`, or `SEC_COMMIT` under Wine. The points from the earlier note are still open: - `crates/victory-hle/Cargo.toml` moves `tempfile` from dev-dependencies into the runtime dependencies. No other crate ships it at runtime, so this **needs the maintainer's decision**. - The switch is still the `VICTORY_FILE_BACKED_PAGES` env var read in `apps/victory/src/run.rs`. A `victory.toml` setting would fit the other paths better. - The README paragraph could be cut to one or two sentences. - The only measurement is from an earlier integration build. A run of the title with the switch on, at this head, would help. **Verdict: needs work (needs the maintainer's decision).** CI: passing. --- _Generated by [Claude Code](https://claude.ai/code)_
An optional [paths].physical_pages_dir selects a sparse-capable volume. Check the path outside source trees before execution and keep it absolute if the title changes directories. Keep the existing env switch as an override, and leave pagefile sections unchanged by default.

Open each backing file exclusively with create_new and FILE_FLAG_DELETE_ON_CLOSE. The kernel handles cleanup on last close, including on setup failures and process exit. tempfile remains test-only.

AI-assisted by GPT-6.2 Astra.
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/2519/head:github-bot/gh-2519'
git switch 'github-bot/gh-2519'

Merge

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