Repository navigation
KernelX: a page mapped away moves to its next address directly, not by way of its home - #849
Conversation
…y way of its home A physical page mapped at one address that the title maps at another went back home first: its home was committed again, the page copied there, the old address decommitted, then the home copied to the new address and decommitted. In a sparse window each commit and decommit is also a tile mapping. A retail game moving pages one at a time after its first movie spent over 20 s in them, and its watchdog ended it. 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 never used where it was (lazy) still comes from its home. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SKtJseucqXR6iuAE6HBtiA
|
The direct-move regression passed on native Windows at
One error path looks worth checking before merging. For an already materialised page, 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
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
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. |
|
Linux / AMD RDNA3 datapoint. Merged state: head Full suite, Not tested: retail titles (none here), Windows, RDNA4. 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 AI use: Hermes agent (local Qwen-class) ran the suite and drafted this; I checked it before posting. |
…#851, ivall#864, ivall#875-ivall#876 and Wine raw fences Integrate clean upstream PRs on top of upstream/main (1ec4c98): - ivall#849: direct move_away for remapped physical pages (avoids 4x sparse tile-mapping round-trips) - ivall#838: FillMemoryWith*BitValueX uses list upload arena instead of leaked pattern buffers - ivall#840: merge released ranges of the shared descriptor heap - ivall#839: map queue-specific D3D12_BARRIER_LAYOUT values to legacy resource states - ivall#841: preserve due frame-clock events when schedule changes at deadline - ivall#851: split wrapped command lists before Wait64 GE after ordinary GPU work - ivall#864: export XMemIsToolsMemAvailable returning 0 on retail - ivall#875: tbuffer_load_format_* uses identity DST_SEL instead of V# DST_SEL - ivall#876: implement IDXGIDevice2::EnqueueSetEvent Also add real::create_raw_fence for internal fences (late_release and EnqueueSetEvent) so Wine/vkd3d-proton never receives a FenceProxy on unadopted internal queues or SetEventOnMultipleFenceCompletion, and wrap list_x test exec with UnadoptGuard. Assisted-by: Antigravity (Google DeepMind)
… Linux PRs ivall#867/ivall#871/ivall#877 Update fork README for upstream/main 1ec4c98 (fenced late_release and queue-wait diagnostics), newly integrated PRs (ivall#838-ivall#841, ivall#849, ivall#851, ivall#864, ivall#875, ivall#876), live gameplay audio progress, and our three open upstream Linux PRs (ivall#867, ivall#871, ivall#877). Assisted-by: Antigravity (Google DeepMind)
Reported in review: move_away dropped both lookups of a page before committing its destination, so a failed commit left its bytes at the old address with nothing pointing at them. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SKtJseucqXR6iuAE6HBtiA
|
Thanks @badoomtch, you're right about the error path. Fixed in the latest commit on this branch: New test: 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 AI use: Claude Code (Claude Opus 5.5) wrote the fix, the test and this reply. |
|
Hardware check of Tested
Regression run PR ( Not tested
AI use
|
badoomtch
left a comment
There was a problem hiding this comment.
There’s a second case in move_away on 5b693e675. A title can call VirtualAlloc(MEM_COMMIT) on part of a lazy page and write to it without going through the first-touch handler. The lazy marker is still set. When the title moves that page, lazy::unmark(old) succeeds and the new address loses those bytes.
I reproduced this on native Windows with a 64 KiB reservation. I committed two separate 4 KiB spans, filled them with 0x35 and 0xa9, then moved the page through XMemMapPhysicalPagesScatter. On this PR’s exact head the first mismatch was at offset 4096: expected 0x35, read 0x00. On our play build the same test verified all 65,536 bytes, including the zero-filled gaps.
I’ve put the direct-move change and regression on my fork. It reuses Babyhamsta’s committed-span reader from #934 and preserves the original mapping if reading the source or committing the destination fails. Six focused tests passed on the clean branch, including both #934 unmap tests and the failed-move retry. Patch against the combined PR heads
This establishes a page-content bug. Our integrated retail run still stopped after the loading artwork. Codex helped write the patch, run the tests and check the results.
|
Merged (6bac4b4). Checked on an RX 9070 (RDNA4) on main 6bac4b4 together with #923 and #849: |
A 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
https://claude.ai/code/session_01SKtJseucqXR6iuAE6HBtiA