perf(xmem): physical pages from sections of at most VICTORY_SECTION_MB MiB (off by default) #44
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/trustno1-coder--VIctory-NVIDIA!44
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-44"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
@CLHelper on GitHub · 2026-11-27 13:38 UTC · original
CLHelper:perf/section-mb→main· +474 −68 · 3 files · 2 commits · openWhat
XMemAllocatePhysicalPagesmakes one pagefile-backed section per request. The title asks for its 6.1 GiB ofphysical pages in one call and then maps them a 64 KiB view at a time, so one section ends up with views by the
hundred thousand. Windows' large-page rebuild worker walks a section's views under that section's lock, and every
map and unmap of the title's pages waits behind it. That shows up as stalls when the camera turns or the player
moves.
VICTORY_SECTION_MB=<n>backs each request with sections of at most n MiB (2 is the measured value). The pages arestill numbered as one request. Unset,
0or not a number keeps one section per request: same calls, same numbers.Off by default.
xmem/section_mb.rs(new): the switch andallocate_physical(n, per), which makes the sections, reports each oneto the GPU side and numbers the pages consecutively. Each section keeps its own window and is closed
(
title_memory_section_gone) when its last page goes, as before.xmem.rs:XMemAllocatePhysicalPagescalls it. Nothing else changes: a mapping or a write already ends a run at asection's end, and a DirectStorage destination that crosses a bound gets no window and goes through
write_physical, run by run.inplace.rs: sections and our whole views of them are kept in maps by handle instead of vectors scanned on everylookup (with the switch on, a request is about 3,100 sections). Census lines group alike sections; a section that
is one of a kind prints as before.
Measured (with the switch on: same change on an earlier main,
6a31e431e)RTX 4060 Laptop GPU (8 GB), 31 GB RAM, Windows 11. The host was left as it was (a browser open, two screens). Two
pairs, one run per arm. Mapping cost comes from the title's mapping calls (ms spent in them per second of play).
No device removals or exceptions in any of the four runs.
Caveats:
only, so pair a's frame times are not a clean A/B (the mapping and lock numbers are the point there).
6a31e431e. Since thenxmem.rsgained renderer port 1 (VICTORY_PORT_CONSTANTS). On959dcaf60this change is built and unit-tested only; it has not been measured in the title on this base.VICTORY_PORT_CONSTANTS=1. Port 1 needs the 32-bit heap's pages in one section. WithVICTORY_SECTION_MBset,arrange()logs its "not of one section as big as it" warning and leaves the pages wherethey are, so that heap stays on the copy path. Both are off by default. If port 1 becomes always on (#38), setting
this switch turns port 1 off for that heap. There is no textual conflict with #38 (or with #33-#42).
by run). These copies are not counted separately here.
does not change (still
SEC_RESERVE, committed on first map or write).Tests
cargo test -p victory-hle --lib section_mb(switch unset andVICTORY_SECTION_MB=2):Plus
physical_remap_bench(#[ignore = "benchmark"], title-free): it remaps single pages of a 4 GiB request whileanother thread makes and frees 2 GiB, one section vs 2 MiB sections.
On this branch (Rust 1.98.1, offline,
--features diagnosticsfor victory-gpu), next to the same commands on959dcaf60:section_mb: 5 passed, 1 ignored, with the switch unset and with it set to 2. If the per-section cap is dropped(
let pages = n - made;), 3 of the 5 fail.victory-hle --lib: 176 passed, 3 ignored (main: 171 passed, 2 ignored).victory-gpu --lib: 460 passed, 2 failed, 35 ignored. This is the same on main: the two failures areindirect::tests::host_list_budget_starts_empty_at_each_submissionandindirect::tests::warp_batch_charges_every_execution, and this change does not touch them.cargo build --release -p victory --features diagnostics: builds, with the same 6 warnings as main.Credit
This is a port. The finding and the cure are RyanCase94's and CuteBooty's (fxceless's fork, issue #1089, PR #1274).
The code follows voidopcode/vilocity 0f44a1706, whose
xmem.rsmatched this repository's. The tests follow KainanP(Skyfrye/anyXboxx-diffbase ee8b92e14) and Xeltax (Xeltax/VIcky a8c223149).
AI-assisted.
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.