Repository navigation
kernelx: physical pages as section slices that can be mapped at many addresses - #2293
adiologydev wants to merge 1 commit into
Conversation
…addresses On the console a physical page mapped at several addresses is one page. XCL keeps a page at one address at a time and copies it when the title maps it elsewhere (`move_away`), so the other addresses go stale; a retail title maps its streamed pages into a pool, into the CPU view of a 24 GB reservation and into that reservation's GPU view (xcl-dev#1031). `kernelx::sections` is the base for real aliasing: a block of physical pages is one pagefile-backed SEC_RESERVE section, and a page is mapped as a view of its 64 KiB slice into a placeholder (MapViewOfFile3 with MEM_REPLACE_PLACEHOLDER). Every view of a slice is the same memory and a page takes commit once, when it is committed through any view. Unmapping leaves a placeholder for the next view. Ordinary reserved memory (write-watched if asked) can replace part of a placeholder and go back to one. Nothing calls it yet. Measured in a standalone program on Windows 11 26200 over 200 000 pages: map 2.2 us, unmap 2.75 us, commit 0.9 us a page. GetWriteWatch refuses a range that holds a view (error 87), and one call cannot span two neighbouring reservations either.
…sing stack) Integrates upstream PR stack xcl-dev#2293 -> xcl-dev#2294 -> xcl-dev#2307 -> xcl-dev#2308 (opt-in real section-slice physical page aliasing across virtual views via XCL_PAGE_ALIAS=1).
|
NVIDIA test report for
AI-assisted (Claude Code, Claude Opus 5.5). Synthetic tests only; no title run. |
|
Verification on RTX 3060 Ti (Windows 11), branch merged with current
Thanks! |
|
RX 7800 XT (RDNA3, wave32/wave64) report on exact head Tested
Not tested
AI use
|
|
Independent AMD RDNA4 / Linux (Proton/Wine, RADV, native wave64) test report for head Hardware & environment
Unit tests (
Not tested
AI use
|
bmjask
left a comment
There was a problem hiding this comment.
No concrete source defect found; SEC_RESERVE/view splitting/aliasing/write-watch tests are internally consistent. Current head lacks Windows CI and the module remains unused, so no runtime alias lifecycle/concurrency integration exists. Also, failed MapViewOfFile3 occurs after placeholder split and leaves reservation fragmented; document this recoverable state or restore transactionally before wiring into callers. Provide current CI and integration once connected.
|
Independent desktop NVIDIA verification of PR #2293 at head Environment
Targeted release tests & build (
|
| Command | Result |
|---|---|
cargo test --release -p xcl --lib hle::kernelx::sections:: -- --test-threads=1 --nocapture (3 consecutive runs) |
7 passed; 0 failed; 0 ignored; 1124 filtered out × 3 (0.00s × 3, 0 skipped: a_page_mapped_at_two_addresses_is_one_page, a_run_of_pages_is_one_view, a_section_of_no_pages_is_refused, committing_through_one_view_commits_the_page_for_all, splitting_a_range_that_is_already_a_placeholder_is_a_no_op, unmapping_leaves_a_placeholder_for_the_next_page, write_watched_memory_lives_beside_views_in_one_placeholder) |
cargo test --release -p xcl --lib hle::kernelx:: -- --test-threads=1 (3 consecutive runs) |
45 passed; 0 failed; 1 ignored; 1085 filtered out × 3 (1.15s, 1.17s, 1.16s, 0 skipped) |
cargo build --release -p xcl |
Clean build (1m 18s, exit 0, 0 new warnings) |
Paired quiet 60 s retail smoke (title: 29640639)
Exact parent & merge-base (568e7db7729c8fa6c8f0f4b32d798faaf11462bb, cached baseline on the same machine):
xcl-smoke v1
commit: 568e7db7729c8fa6c8f0f4b32d798faaf11462bb
gpu: NVIDIA GeForce RTX 4060
title: 29640639
seconds: 60
exit: 0x0
frames shown: 1587 (PresentX 1587)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 14527 MB
PR #2293 (03ceddb0be3d06287ca21ae800dbb0d7f98049e7):
xcl-smoke v1
commit: 03ceddb0be3d06287ca21ae800dbb0d7f98049e7
gpu: NVIDIA GeForce RTX 4060
title: 29640639
seconds: 60
exit: 0x0
frames shown: 1580 (PresentX 1580)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 14520 MB
Limits of coverage
- Windows 11
VirtualAlloc2placeholder splitting/coalescing andMapViewOfFile3multi-address section-slice mapping were directly verified via all 7 newhle::kernelx::sections::tests(3/3,0skipped) and the fullhle::kernelx::suite (45/45× 3). - PR kernelx: physical pages as section slices that can be mapped at many addresses #2293 adds the
sectionsbuilding block without wiringXCL_PAGE_ALIAS=1into the retail runtime path yet (wired in stacked PR kernelx: XCL_PAGE_ALIAS=1 shows a physical page at every address it is mapped at #2307), so the 60 s retail smoke confirms default-path non-regression ontitle: 29640639(single-run frame/commit delta reflects normal startup variance, not this PR).
AI disclosure: test execution and report drafting assisted by Google Antigravity (Gemini 4 Neon).
First part of the plan on #1031 (real aliasing of physical pages): a block of physical pages as one pagefile-backed section, mapped as views into placeholders, so a page can show at every address it is mapped at. Nothing calls it yet; part of #1031 / #697.
On the console a physical page mapped at several addresses is one page. XCL keeps a page at one address at a time and copies it when the title maps it elsewhere (
kernelx::move_away); a retail title maps its streamed pages into a pool, into the CPU view of a 24 GB reservation and into that reservation's GPU view.What is in it
crates/xcl/src/hle/kernelx/sections.rs(new):Section(aSEC_RESERVEpagefile-backed section of N 64 KiB pages),Section::map(a view of pagesfirst..first+ninto a placeholder withMapViewOfFile3/MEM_REPLACE_PLACEHOLDER),reserve/split/unmap(keeps the placeholder) /commit/release, andreplace_with_reservation/reservation_to_placeholder(ordinary, optionally write-watched memory in part of a placeholder). 7 unit tests.crates/xcl/src/hle/kernelx.rs: the module declaration.Measured in a standalone program (not part of the PR) on the machine below, 200 000 pages: map 2.2 µs, unmap 2.75 µs, commit 0.9 µs,
VirtualProtect0.5 µs a page.GetWriteWatchrefuses a range that holds a view (error 87) and one call cannot span two neighbouring reservations; one call per small reservation costs 0.83 µs.Tested
XCL_DXC_DIR), debug tests, release runs.cargo test --workspace -- --test-threads=4on03ceddb: 1101 passed, 4 failed, 26 ignored. The 4 failures aregpu::dxil::fuzz_tests::fuzz_validate_and_gpu_0..3(CreateComputePipelineState→E_OUTOFMEMORYon this card, DXIL GPU fuzz tests reproducibly fail with E_OUTOFMEMORY on RTX 5060 #1905);main568e7db fails the same 4 here (1094 passed, 4 failed, 26 ignored). SKIPPED (23, the same onmain): 20 need 64-lane waves ("no wave64"), 3 per-lane f16 refusals inlower_dxil::tests::{f16,f32}_programs_on_the_gpu.cargo test -p xcl --lib kernelx::sections: 7 passed.Regression run
scripts/smoke.ps1 -Game <retail title> -Seconds 60, no input,mainfirst, same machine (each run'sxcl.exebuilt from a clean checkout of its commit):Not tested
MapViewOfFile3need a Windows 10 1803+ kernel – not tried under Wine).AI use