kernelx: physical pages as section slices that can be mapped at many addresses #2283
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2293"
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?
Imported from ivall/xcl. Originally posted by adiologydev on 2026-11-25T12:45:38Z.
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, #1905);main568e7dbfails 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
upstream-sync referenced this pull request2026-11-25 14:08:43 +00:00
Imported from ivall/xcl. Originally posted by nnonno91 on 2026-11-25T14:56:24Z.
Independent native Windows check of the section and placeholder primitives on
03ceddb0be3d06287ca21ae800dbb0d7f98049e7.Tested
cargo test --locked -p xcl --lib hle::kernelx::sections -- --nocapture --test-threads=1gave 7 passed, 0 failed, 0 ignored and no skips. The same page was visible through multiple addresses, committing through one view made it visible to the others, and unmapping left a reusable placeholder. The multi-page, write-watch adjacency and invalid-size checks also passed.Not tested
Wine, a retail title, performance, GPU integration and the full workspace suite.
AI use
OpenAI Codex (GPT-6.2 Sol) ran the checks and wrote this report.
Imported from ivall/xcl. Originally posted by upipibi on 2026-11-25T16:57:56Z.
NVIDIA test report for
03ceddb(head as is, base568e7db), for #1607's NVIDIA list. RTX 3070 8 GB (Ampere, 32-lane waves), driver 616.56, Windows 11, debug, aftercargo build --workspace:cargo test --workspace --no-fail-fast -- --test-threads=4 --skip hle::xaudio2: 1152 passed, 0 failed, 46 ignored. The end-to-end title tests pass.main0829441on the same machine, same command: 1263 passed, 0 failed, 46 ignored (the PR's base is older, so it has fewer tests).hle::xaudio2, because its tests fail or hang on this machine onmaintoo. The PR doesn't touch it.no wave64on this card, 3 f16/f32 forms the per-lane path refuses, 1 no heap windows, and 1 PSO measurement that needs Developer Mode to turn the driver cache off.AI-assisted (Claude Code, Claude Opus 5.5). Synthetic tests only; no title run.
Imported from ivall/xcl. Originally posted by DavidM1911 on 2026-11-25T17:29:50Z.
Verification on RTX 3060 Ti (Windows 11), branch merged with current
main:cargo test -p xcl --lib: all passed, 0 failed, ~26 ignored. (Intermittent single-test flake / 0xc0000005 abort under parallel scheduling — tracked in #1978; clean on single-threaded rerun.)Thanks!
Imported from ivall/xcl. Originally posted by oni-swr on 2026-11-25T18:33:55Z.
RX 7800 XT (RDNA3, wave32/wave64) report on exact head
03ceddb0be3d06287ca21ae800dbb0d7f98049e7(as is, on its base568e7db7; no merge with currentmain, which merges cleanly).Tested
dxc.exefrom Windows SDK 10.0.26100.0.cargo test --workspace --no-fail-fast -- --test-threads=4on this head: 1160 passed, 1 failed, 46 ignored (21 targets). The one failure isfuzz_validate_and_gpu_1, which fails the same way onmain; nothing else failed.mainatc9ee916a: 1330 passed, 2 failed, 46 ignored (24 targets). The 2 failures aregpu::dxil::fuzz_tests::fuzz_validate_and_gpu_1(seed 722: CPU0x7fffffff, GPU0x1) andgpu::recomp::lower_dxil::tests::a_bridged_mask_write_where_one_half_is_elsewhere_meets_no_barrier.a_bridged_mask_write...does not exist on this older head, so onlyfuzz_validate_and_gpu_1is comparable withmain.hle::kernelx::sections::tests::*(e.g.a_page_mapped_at_two_addresses_is_one_page)SKIPPED(7 lines on the heads that have these tests, same asmain): the f16 / f32-conversion per-lane programs, "refused (unsupported V_MUL_F16 / V_PK_MUL_F16 / V_CVT_F16_F32 ...)", andheap_window_out_of_memory_falls_back_to_the_switch_form("no heap windows").Not tested
scripts/smoke.ps1run (noxcl-smokeblocks): I did not run an untrusted retail executable. This is a test-suite report only, not the regression run the PR needs.AI use
upstream-sync referenced this pull request2026-11-25 20:07:08 +00:00
Imported from ivall/xcl. Originally posted by ClosetPie107 on 2026-11-25T20:46:07Z.
Independent AMD RDNA4 / Linux (Proton/Wine, RADV, native wave64) test report for head
03ceddb0be3d06287ca21ae800dbb0d7f98049e7(merged cleanly ontomain6d12f58).Hardware & environment
experimental-11.0-20261112),vkd3d-protonmasterec207194(3.2.0) +dxil-spirvb540c8a2+ relaxed-vtable patch (-Db_ndebug=true), DXVKv3.1.1-209, DXC1.9.2609.5, Rustx86_64-pc-windows-gnu(debug)Unit tests (
XCL_REQUIRE_GPU=wave64,XCL_DXC_DIR,VKD3D_CONFIG=ignore_shared_fence,--test-threads=1 --nocapture)hle::kernelx::sections: 7 passed, 0 failed, 0 ignored (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), confirmingMapViewOfFile3/MEM_REPLACE_PLACEHOLDER+ write-watched neighbours work on Proton 11.Not tested
AI use
main, ran the tests under Proton on this machine, and drafted this report.Imported from ivall/xcl. Originally posted by bmjask on 2026-11-25T21:15:09Z.
Review: COMMENTED
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.
Imported from ivall/xcl. Originally posted by Decodere on 2026-11-27T06:56:29Z.
Independent desktop NVIDIA verification of PR #2293 at head
03ceddb0be3d06287ca21ae800dbb0d7f98049e7(1commit; exact parent & merge-base:568e7db7729c8fa6c8f0f4b32d798faaf11462bb, pre-#2555ancestor ofmain).Environment
7956 MiBreported by D3D12), driver32.0.16.2114(NVIDIA621.14, WDDM 3.2)31.9 GiBusable), Windows 11 Home26200(Developer Mode off)rustc 1.100.0 (0ef1bc386 2026-11-09)MSVC, DXC1.9.2609.5,--releaseTargeted release tests & build (
03ceddb0)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,0skipped: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,0skipped)cargo build --release -p xcl1m 18s, exit0,0new warnings)Paired quiet 60 s retail smoke (
title: 29640639)Exact parent & merge-base (
568e7db7729c8fa6c8f0f4b32d798faaf11462bb, cached baseline on the same machine):PR #2293 (
03ceddb0be3d06287ca21ae800dbb0d7f98049e7):Limits of coverage
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).sectionsbuilding block without wiringXCL_PAGE_ALIAS=1into the retail runtime path yet (wired in stacked PR #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).
Imported from ivall/xcl. Originally posted by brainhay5 on 2026-11-30T07:22:32Z.
merge-check claim
head:
03ceddb0beImported from ivall/xcl. Originally posted by brainhay5 on 2026-11-30T07:36:12Z.
merge-check
base:
d52ff48caahead:
03ceddb0bemerge: clean
build: cargo build --workspace -> ok
tests: cargo test --workspace --no-fail-fast -- --test-threads=4 -> 2882 passed, 2 failed, 51 ignored; 29 SKIPPED lines
failing: test_title_runs_and_game_folder_is_untouched
review: automated overnight check — diff inspected for safety only (no build/CI/toolchain/script changes, no process/network/runtime-loading code); no duplicate search performed; no line-by-line code review.
performance: not assessed beyond the suite.
verdict: safe to merge
hardware / tool and model: RTX 5070 Ti 16 GB, driver 610.88 (32.0.16.1088); Ryzen 7 5800X3D, 64 GB; Windows 11 22631; OpenCode agent, DeepSeek V4.1 Flash 1017
correction: this check first reported the PR as "not yet" because of a test failure that is not the PR's. The base-comparison step failed to run (test names contain a double colon, not a legal Windows filename), so an empty read was mistaken for "passes on base".
gpu::dxil::msaa_tests::gpu_direct_image_get_resinfo_d16fails on based52ff48cby itself (verified separately with the same command: "assertion failed: 2D D16 resinfo clobbered v2/v3"). Verdict corrected. Apologies for the noise.Imported from ivall/xcl. Originally posted by Pipodi on 2026-11-30T08:33:53Z.
merge-check claim
head:
03ceddb0beImported from ivall/xcl. Originally posted by thehollowedone on 2026-11-30T09:26:30Z.
I checked two independent failure cases in the current section helper. I reproduced both on a local candidate rebased onto current
mainf95f5f66with PR head03ceddb0.Section::newused eagerthen_some, so a null result fromCreateFileMappingWstill constructed and immediately dropped aSection; that callsCloseHandle(NULL)and overwrites the thread’s last-error value (6 on this machine). Use the lazythenpath.reserve(Some(0), len)passes a null base toVirtualAlloc2, which means Windows may choose an address. The helper then rejects the nonzero result as not equal to the requested zero and leaves the successful reservation allocated. RejectSome(0)before calling the API.The two new regression tests both fail when their respective fix is removed, and pass with the candidate.
Local candidate verification
cargo test --offline --locked -p xcl --lib kernelx::sections -- --nocapture --test-threads=1: 9 passed, 0 failed, 0 ignored (2,767 filtered out).Candidate diff against PR head
The candidate leaves the existing view-replacement failure/placeholder-fragmentation question unchanged. AI-assisted: Codex (GPT-6.2 Sol) prepared the candidate and ran the tests; GPT-6.2 Astra reviewed the Win32 handle and reservation semantics.
Imported from ivall/xcl. Originally posted by Pipodi on 2026-11-30T10:11:48Z.
merge-check
base:
d52ff48caahead:
03ceddb0bemerge: clean
build: cargo build --workspace -> ok
tests: cargo test --workspace --no-fail-fast -- --test-threads=4 -> 2883 passed, 1 failed, 51 ignored; failing: gpu::dxil::msaa_tests::gpu_direct_image_get_resinfo_d16 (also fails on main
d52ff48c, fixed by #3513). The 7 new hle::kernelx::sections tests pass. 25 SKIPPED: 21 "no wave64", plus two_pass_binds_set_the_shared_view_heap and heap_window_out_of_memory_falls_back_to_the_switch_form (no heap windows), pso_measurement_compiles_an_exact_synthetic_record (cannot disable the driver cache: Developer Mode needed).review: read the whole diff (kernelx.rs +2, kernelx/sections.rs +308). No blocker; the module is not called from anywhere yet (dead code), so it cannot change behaviour. Nits: (1) sections.rs:85-92 reserve(Some(0)) asks for address 0, which VirtualAlloc2 treats as "any address"; the allocation succeeds, p != want, None is returned and the reservation leaks; no caller passes it. (2) sections.rs:109-117 split accepts any MEM_RESERVE region, not only placeholders; the unsafe contract covers it and VirtualFree fails on a plain reservation. (3) sections.rs:30 defines MEM_WRITE_WATCH locally (0x200000), harmless. (4) test Space::drop (sections.rs:182-193) asserts inside Drop, which aborts if it fires during a panic unwind (test-only). (5) Section::map leaves the split placeholders if MapViewOfFile3 fails; benign.
performance: none: not called by any code path in this PR, so no frame time or memory cost by default.
verdict: safe to merge
hardware / tool and model: Claude Code, Claude Opus 5.5 (review) and Claude Sonnet 5.5 (build, tests, draft). NVIDIA RTX 4090, driver 621.40; i9-13900K; Windows 11 Pro 10.0.26300; rustc 1.100.0; debug.
Imported from ivall/xcl. Originally posted by Edgaras0404 on 2026-11-30T12:50:50Z.
Tested
32.0.21045.29003), AMD Ryzen 5 5600X 6-Core Processor, Windows 10 Pro 22H2 (build 19045)rustc 1.100.1 (20ddd0171 2026-11-25),dxcompiler 1.9.2609.5/dxil 1.9.2609.5, D3D12 Agility SDK,debug#2293head03ceddb0trial-merged ontomain9dfbe3ea(crates/xcl/src/hle/kernelx.rs+2,crates/xcl/src/hle/kernelx/sections.rs+308)cargo test --workspace sections -- --test-threads=1 --nocapture:-p xcl --lib:7 passed; 0 failed; 0 ignored; 0 measured; 2769 filtered out(0 SKIPPED; all 7hle::kernelx::sections::tests::*tests passed)tests\heap_probe.rs:0 passed; 0 failed; 2 ignored; 0 measured; 2 filtered out(heaps_over_partly_committed_sections,heaps_over_sections_in_a_placeholder)cargo test --workspace --no-fail-fast -- --test-threads=4:0 failed(includingtests\gpu_compute_e2e.rs:9 passed; 0 failedwithSKIPPED heap_window_out_of_memory_falls_back_to_the_switch_form: no heap windows;tests\console_shaders.rs:3 passed; 0 failed; 4 ignored;tests\heap_probe.rs:0 passed; 0 failed; 4 ignored;tests\xg_oracle.rs:6 passed; 0 failed; 12 ignored).tests\gpu_two_pass_cache_e2e.rs:0 passed; 1 failed; 0 ignored(two_pass_driver_cache_reuses_both_passes_and_recovers_corrupt_blobs, pre-existing failure onmain9dfbe3ea).-p xcl --lib(2776tests): aborted withexit code: 0x80004005(xcl: sparse upload preparation still failed after bounded retries – the title is stopped before its GPU submission), matchingmain9dfbe3eabaseline behavior. Before aborting, it loggedSKIPPED hle::d3d12x::bind::tests::two_pass_binds_set_the_shared_view_heap: no heap windows (opt-in: XCL_HEAP_WINDOWS=1), the 5 pre-existinggpu::baseline failures (gpu_compact_form_with_micro_blocks_and_literal_table_runs_as_the_plain_form,gpu_direct_image_get_resinfo_d16,f32_programs_on_the_gpu,gpu_f32_compares_with_nan,gpu_float_compares_random), andhle::d3d12x::list_x::tests::a_reset_while_the_last_submit_runs_records_on_another_pc_list(FAILEDunder--test-threads=4).Not tested
tests\heap_probe.rstests (--ignored)-p xcl --lib -- --skip gpu:: --skip hle::d3d12x::slice on the merged tree (full-p xcl --libhit the pre-existing0x80004005abort)XCL_HEAP_WINDOWS=1tests (the 2SKIPPEDheap-window tests above)scripts/smoke.ps1(newsectionsmodule is not yet wired into runtime/in-game paths)AI use
Imported from ivall/xcl. Originally posted by Foniass on 2026-12-01T07:45:54Z.
Triage (#1607) – head
03ceddbNo open or merged PR makes the same change: main has no section-backed physical pages (
kernelx/placeholders.rson main is the title's sparse-window placeholders, unrelated). #2294 and #2307 are stacked on this PR, and #2308, #3074 and #3075 build on that stack.No problems found in the diff:
sections.rsis not called yet, and its 7 tests cover map/unmap/commit/split and the write-watch limitation.Recommendation: keep open.
AI review: Claude Code (Claude Opus 5.5), diffs read only, not built or run; not checked by a human.
Imported from ivall/xcl. Originally posted by Decodere on 2026-12-02T08:29:36Z.
merge-check
base:
1c8b551475head:
03ceddb0bemerge: clean trial merge into
1c8b551475e1e7bfe48f94448492a4c3544a2e0f(trial-merge commit3b90656d0522d1ccd21279128054a3cb5fdae339;git diff --checkclean).build:
cargo build --workspace-> ok.tests:
cargo test --workspace --no-fail-fast -- --test-threads=4 --nocapture(43 targets) -> 2916 passed, 0 failed, 51 ignored (+7 new tests vsmain1c8b5514; all 43 targets green includinggpu_two_pass_cache_e2e). All 7 newhle::kernelx::sections::testspassed with 0 skips: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. 28SKIPPEDlines — all hardware/environment-expected on RTX 4060 (22no wave64, 2no d3d12SDKLayers.dll, 1no D3D12 debug layer, 2no heap windows, 1cannot disable the driver cache (Windows Developer Mode required)).review: read the full merged diff (2 files:
crates/xcl/src/hle/kernelx.rs+2,crates/xcl/src/hle/kernelx/sections.rs+308, total +310/-0). Scope is strictly additive (#[allow(dead_code)] pub mod sections;with no live callers yet). The Win32 section and placeholder primitives (CreateFileMappingWwithSEC_RESERVE,VirtualAlloc2placeholder reserve/replace,MapViewOfFile3,UnmapViewOfFile2withMEM_PRESERVE_PLACEHOLDER, andVirtualFreesplit/release) are clean, with bounds/alignment checks inSection::newandSection::map, safeCloseHandledrop semantics while mapped views retain kernel references, and 7 focused unit tests covering aliasing, shared commit, placeholder preservation, multi-page runs, and write-watch coexistence. Minor non-blocking note:reserve(at, len)(sections.rs:85-92) validateslenalignment but notatalignment; if an unalignedSome(at)is ever passed,VirtualAlloc2roundsBaseAddressdown to 64 KiB and returningNoneonp != wantwould leave that reservation unfreed (easy to guard withat.is_some_and(|a| !a.is_multiple_of(PAGE))when wiring callers).performance: Tier 1 — purely additive
#[allow(dead_code)]module with no runtime callers yet; no hot-path or title-run impact (retail smoke not required perTESTING.md).verdict: safe to merge
hardware / tool and model: NVIDIA GeForce RTX 4060 8 GB (driver 621.40), Intel Core i5-11400F, 32 GB RAM, Windows 11 Build 26200, Rust 1.100.1 MSVC, DXC 1.9.2602.17 / Antigravity (Gemini 4 Neon)
Imported from ivall/xcl. Originally posted by tiagonleal on 2026-12-02T21:42:32Z.
merge-check
base:
5ad98adbc3head:
03ceddb0bemerge: clean (merge commit 39b6c3441c1fff5d4d7addfdb97d0e99da1a8334;
git diff --checkclean)build: cargo build --workspace -> ok
tests: cargo test --workspace --no-fail-fast -- --test-threads=4 -> 3012 passed, 0 failed, 52 ignored; SKIPPED: 24 (22 no wave64, 2 no heap windows); failing: none
title run: Newer Retail Game, release build of this merge, Series S settings (
XCL_DEVICE_TYPE=lockhart,XCL_COHERENT_MB=512,XCL_UMA_WINDOWS=16,XCL_SPARSE_LAZY=1), scripted A presses, 240 s planned: into the world at 80 s, 51 s there with 86 frames presented, no crash, no device removal; then our RAM guard stopped it (free RAM under 1 GB on this 32 GB PC, as in main's second run).review: none. The new
kernelx::sectionsmodule is not called yet, so the run covers only that it changes nothing.performance: none (not called yet). World frame rate not compared: on this 32 GB PC the runs of main and of the PRs end 30 to 150 s into the world (RAM guard or time limit).
verdict: safe to merge
hardware / tool and model: RTX 5070 Ti 16 GB (driver 617.42), Ryzen 7 9800X3D, 32 GB, Windows 11 Pro 26300 / Claude Code with Claude Opus 5.5
Same settings on main
5ad98adb, two runs: into the world at 94 s with 145 s there and no frame presented (ran to the 240 s limit); into the world at 80 s with 59 s there and 90 frames, then stopped by our RAM guard (free RAM under 1 GB). "In the world" here means the first 2 s window of the activity log with 5,000+ draws and dispatches.AI use: Claude Code (Claude Opus 5.5) ran the build, tests and title runs and wrote this; a Claude Sonnet subagent read the diff and I checked its points.
~Tiago
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.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.