KernelX: a page mapped away moves to its next address directly, not by way of its home #849
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
goal:world-load
good first issue
help wanted
invalid
keep-open
off-goal
question
stale
test-only
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/xcl-dev--xcl!849
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/849/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?
@Sr-0w on GitHub · 2026-11-24 06:44 UTC · original
Sr-0w:direct-page-moves-pr→main· +106 −6 · 1 files · 2 commits · merged 2026-11-24 09:31 UTCA physical page that is mapped at one address and that the title maps at another went back home first. Its home was committed again and the page copied there, then the old address was decommitted. After that, the home was copied to the new address and decommitted. In a sparse window, each of those commits and decommits is also a tile mapping (
UpdateTileMappings+ a signal), so every page move cost about four of them.A retail game, after its first movie, moves tens of thousands of pages one at a time. Measured with a counter in
MapTitlePhysicalPages(not in this PR):The page is now copied from where it is to the new address, and the old address is given up; its home is not touched. A page that was never used where it was (lazy) still comes from its home, as before.
What is in it
crates/xcl/src/hle/kernelx.rs:move_away, called frommap_pagesfor a page already mapped away;release_at, the decommit thatunmap_awayalready did, factored out;a_page_away_moves_on_without_going_homeand a test-only counter of pages copied home.Tested
cargo test --release --workspace -- --test-threads=4: 661 passed, 3 failed, 21 ignored.placed_title_textures_share_vram_and_preserve_pixels,transitions_apply_when_their_list_is_submittedandd32s8_targets_take_their_own_size_of_video_memory.main(e50836b) with--test-threads=4and pass when run alone, on both.a_page_away_moves_on_without_going_homefails without the change ("the page went by way of its home") and passes with it.scatter_timing(--ignored,XCL_SCATTER_PAGES=4096,16384), "reverse" being the pass that moves pages already mapped away:main(below).Regression run
main:
this PR:
Not tested
maintoo (cross-queueWait64BitValueXon values nothing writes); that is not addressed here.AI use
🤖 Generated with Claude Code
@SlopTart on GitHub · 2026-11-24 07:17 UTC · original
Linux / AMD RDNA3 datapoint.
Merged state: head
f1e2113onto mainbeaa245, clean merge.Full suite,
cargo test --workspace --release --no-fail-fast --target x86_64-pc-windows-gnu -- --test-threads=4: 704 passed, 10 failed, 41 ignored. Failures are the known Wine-lane set from my #42 rows plus #718 trio members; nothing here fails because of your change. Kernel page-move tests green in the full suite run (no new failures anywhere).Not tested: retail titles (none here), Windows, RDNA4.
Counts only, no game data.
Machine: RX 7900 XT (RADV NAVI31), Mesa 26.2.5, kernel 7.2 (Arch), Proton Experimental (wine-11.0), patched vkd3d-proton v3.1, Rust cross
x86_64-pc-windows-gnu,XCL_NETWORK=0, release profile,--test-threads=4. Linux rows: #42 / #718.AI use: Hermes agent (local Qwen-class) ran the suite and drafted this; I checked it before posting.
@badoomtch on GitHub · 2026-11-24 07:01 UTC · original · edited 2026-11-24 07:35 UTC
The direct-move regression passed on native Windows at
f1e2113a76246e766570c66dda69cf767f7b6931. The test initialised UMA, preserved the first and last words, and released the old address. Windows 11 build 26300, RTX 5080 (610.88), Core Ultra 7 265, Rust 1.96.0 MSVC, debug build.cargo test --frozen -p xcl --lib a_page_away_moves_on_without_going_home -- --nocapture --test-threads=1— 1 passed, 0 failed, 0 ignored.One error path looks worth checking before merging. For an already materialised page,
move_awayremovesoldfromaway.atand the page fromaway.pagebefore committing the new destination. If that commit fails, the function returnsErrwith the original bytes still atoldbut both lookup entries gone. Moving those removals after a successful destination commit, or restoring the entries on that error, would preserve the previous mapping for a retry. I checked the order in the source. The passing test covers successful moves only.We also ran a longer offline retail pair on the same native Windows machine. Both used the same returning-player profile and learned memory-window setting, with a shared cache. The control was our integration build based on
beaa245. The candidate added this PR's runtime change alone. The following are integration runs, separate from the exact-head test above.The extra 135 presents were almost entirely before the fade. Both runs stopped within two presents of the first captured black frame. Neither showed a world frame. These builds do not count direct page moves or time spent in them, so this comparison cannot attribute the extra frames to faster remapping.
On a second pair based on
1ec4c98cd(including #873), we counted move attempts and native tile-mapping calls in two-second windows. The only runtime difference between the arms was #849. Both started with separate, byte-identical copies of XCL's cache (582 compatible translations), the same profile and memory-window setting. The machine's driver cache persisted across the pair.Both arms peaked at 44,049 moves in a two-second window during early loading. In both, the last 14 complete windows before the abort recorded zero move attempts, tile-mapping calls and new presents. Direct moves did run, and the prolonged freeze remained. These counters measure calls, not their cost.
AI use: Codex (GPT-6) checked the source, ran the tests and summarised the local captures and logs.
@Sr-0w on GitHub · 2026-11-24 08:10 UTC · original
Thanks @badoomtch, you're right about the error path. Fixed in the latest commit on this branch:
move_awaynow only drops the page's two lookups once the destination is committed. A lazy page is still released before the commit, as before.New test:
a_page_whose_move_fails_stays_mapped_where_it_was. It points a move at an address with nothing reserved there, then checks that the page keeps both lookups and its bytes. It fails onf1e2113("the page lost where it is") and passes now. The fourkernelxpage tests pass (release, RX 7800 XT, Windows 11 26300).Thanks for the long paired runs too. They match what I see: direct moves run, but the freeze after the loading artwork does not come from page moves. On my side it is the title's watchdog while its threads wait in
pso_async::resolve_waiton long driver compiles of compute programs (#505). #891 targets that, opt-in. @SlopTart, thanks for the Linux / RDNA3 run.AI use: Claude Code (Claude Opus 5.5) wrote the fix, the test and this reply.
@eizispark on GitHub · 2026-11-24 08:56 UTC · original
Hardware check of
5b693e67524d63282911ce9cfacc7b980cbb04af(verified clean merge withmain077ce40): pass.Tested
rustc 1.100.0 (0ef1bc386 2026-11-09), release + test profilecargo test --workspace -- --test-threads=4:706 passed, 0 failed, 41 ignored(GPU tests skipped on this adapter:none)hle::kernelxunit tests (28 passed, 0 failed), includinghle::kernelx::tests::a_page_away_moves_on_without_going_homeandhle::kernelx::tests::a_page_whose_move_fails_stays_mapped_where_it_wasRegression run
main(beaa245):PR (
5b693e6):Not tested
AI use
scripts/smoke.ps1harness on this machine and formatted this report.@ivall on GitHub · 2026-11-24 09:32 UTC · original
Merged (
6bac4b4). Checked on an RX 9070 (RDNA4) on main6bac4b4together with #923 and #849:cargo test --workspace -- --test-threads=4- 678 unit tests passed, 0 failed; the retail game plays its intro and menus at 30 fps and starts loading the world (the run then hits this machine's commit limit, not a crash). Picked over #531 (the same move without going home); #556 will need its run-dropping added tomove_awaywhen rebased.