hle/xmem: reuse freed physical page numbers within 21-bit limit #35
No reviewers
Labels
No labels
accessibility
area: build
area: formats
area: gpu
area: launcher
area: loader
area: runtime
area: shader
bug
documentation
duplicate
enhancement
good first issue
gpu: amd
gpu: intel
gpu: nvidia
help wanted
host: wine
invalid
out of scope
question
run report
security: hold
triage: confirmed
triage: has patch
triage: merge candidate
triage: needs gpu test
triage: needs info
triage: needs rebase
triage: needs work
triage: proposed close
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/Androtim--MiniVI!35
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/35/head"
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?
@Androtim on GitHub · 2026-11-28 10:33 UTC · original
Androtim:feat/iter50-xmem-reuse-page-numbers→main· +125 −4 · 1 files · 2 commits · merged 2026-11-28 23:02 UTCSummary
Port rustno1-coder/VIctory-NVIDIA 108a897 (after vatarmanz/VIctory-7900XTX#316):
umber >> 4), then reuses the lowest contiguous run of freed pages instead of overflowing past 21 bits (~124 GiB cumulative allocations). If no contiguous run fits, it logs a warning, writes to count, and returns .
Rig Specs Tested On
Run Settings & Profile
elease @ $sha (static/clippy + ictory-hle unit suite + CI full workspace suite; no separate live game capture since sequential allocation below ~124 GiB cumulative physical allocations is unchanged)
Measurements & Verification
@Androtim on GitHub · 2026-11-28 11:03 UTC · original · edited 2026-11-28 22:03 UTC
Automated triage for the maintainers (not an approval).
Verdict:
merge-candidate· CI (check):passingTechnical Review
crates/victory-hle/src/modules/xmem.rs):FIRST_PAGE(0x10_0000) andPAGE_LIMIT(1 << 25), matching the title's 21-bitnumber >> 4packing forFRAMES(PAGE >> 12= 16).Pages::take/Pages::take_inpreserves the existing sequential fast path whileself.next_page + n * FRAMES <= PAGE_LIMIT, then falls back tofree_run_into find the lowest contiguous freed run within[floor, limit).self.next_page = self.next_page.max(first + len)preserves the invariant that all live keys inPages::pagesremain strictly belowself.next_page, preventing duplicate page numbers when a reused run straddlesnext_page.XMemAllocatePhysicalPages, iftable.take(n)returnsNone,tableis dropped before returning0and writing0tocount;Section::dropthen cleanly callsvictory_gpu::title_memory_section_goneandCloseHandlewithout holding thePAGESlock.page_numbers_freed_are_given_again_past_the_title_s_21_bitscovers boundary sequential allocation, free-run reuse, overflow/exhaustion, 21-bit packing, and thenext_page-straddling regression case.Verdict
merge-candidate— clean HLE physical page-number reuse fix with solid edge-case handling and unit test coverage (pending maintainer review/merge).Generated with Antigravity CLI (
agy).@Androtim on GitHub · 2026-11-28 21:41 UTC · original
Fixed the
Pages::take/next_pageinvariant bug flagged in review (fe3c5e8):crates/victory-hle/src/modules/xmem.rs, whenPages::take_infalls through tofree_run_inbecauseself.next_page + len > limit, it now advancesself.next_page = self.next_page.max(first + len)so[self.next_page, limit)stays disjoint fromself.pagesand subsequent smallertake(1)allocations cannot hand out an already-live page number.page_numbers_freed_are_given_again_past_the_title_s_21_bitswith a regression test covering afree_runspan that straddlesself.next_pagefollowed bytake_in(..., 1).Verified locally:
xtask policy:294 files okxtasktests:6 passed; 0 failedclippy --workspace --all-targets -- -D warnings: 0 warningsclippy --workspace --all-targets --features diagnostics -- -D warnings: 0 warningsvictory-hle xmem:22 passed; 0 failed; 1 ignoredvictory-hle --lib:183 passed; 0 failed; 3 ignored