Skip to content

kernelx: physical pages as section slices that can be mapped at many addresses - #2293

Open
adiologydev wants to merge 1 commit into
xcl-dev:mainfrom
adiologydev:kernelx/page-sections
Open

adiologydev wants to merge 1 commit into
xcl-dev:mainfrom
adiologydev:kernelx/page-sections

Conversation

@adiologydev

@adiologydev adiologydev commented Nov 25, 2026 •

Copy link
Copy Markdown

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 (a SEC_RESERVE pagefile-backed section of N 64 KiB pages), Section::map (a view of pages first..first+n into a placeholder with MapViewOfFile3 / MEM_REPLACE_PLACEHOLDER), reserve / split / unmap (keeps the placeholder) / commit / release, and replace_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, VirtualProtect 0.5 µs a page. GetWriteWatch refuses 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

  • NVIDIA GeForce RTX 5090 32 GB (driver 621.40), AMD Ryzen 9 7950X, 64 GB RAM, Windows 11 Pro 26200, Rust 1.100.0 MSVC, DXC 1.9.2609 (XCL_DXC_DIR), debug tests, release runs.
  • cargo test --workspace -- --test-threads=4 on 03ceddb: 1101 passed, 4 failed, 26 ignored. The 4 failures are gpu::dxil::fuzz_tests::fuzz_validate_and_gpu_0..3 (CreateComputePipelineState → E_OUTOFMEMORY on this card, DXIL GPU fuzz tests reproducibly fail with E_OUTOFMEMORY on RTX 5060 #1905); main 568e7db fails the same 4 here (1094 passed, 4 failed, 26 ignored). SKIPPED (23, the same on main): 20 need 64-lane waves ("no wave64"), 3 per-lane f16 refusals in lower_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, main first, same machine (each run's xcl.exe built from a clean checkout of its commit):

xcl-smoke v1
commit: 568e7db7729c8fa6c8f0f4b32d798faaf11462bb
gpu: NVIDIA GeForce RTX 5090
title: 2c508222
seconds: 60
exit: 0x0
frames shown: 1015 (PresentX 1015)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 16257 MB
xcl-smoke v1
commit: 03ceddb0be3d06287ca21ae800dbb0d7f98049e7
gpu: NVIDIA GeForce RTX 5090
title: 2c508222
seconds: 60
exit: 0x0
frames shown: 1517 (PresentX 1517)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 15514 MB

Not tested

  • AMD and Intel GPUs; Wine / Proton (placeholders and MapViewOfFile3 need a Windows 10 1803+ kernel – not tried under Wine).
  • Nothing in the runtime uses the module yet, so the smoke runs only show it changes nothing.

AI use

  • Claude Code (Claude Opus 5.5): wrote the code, the tests, the feasibility program and this description, and made the runs above on this hardware. I read every line of the diff and checked it.

…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.
@upipibi

upipibi commented Nov 25, 2026

Copy link
Copy Markdown
Contributor

NVIDIA test report for 03ceddb (head as is, base 568e7db), for #1607's NVIDIA list. RTX 3070 8 GB (Ampere, 32-lane waves), driver 616.56, Windows 11, debug, after cargo 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.
  • main 0829441 on the same machine, same command: 1263 passed, 0 failed, 46 ignored (the PR's base is older, so it has fewer tests).
  • Skipped hle::xaudio2, because its tests fail or hang on this machine on main too. The PR doesn't touch it.
  • SKIPPED lines: 25: 20 no wave64 on 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.

@DavidM1911

Copy link
Copy Markdown
Contributor

Verification on RTX 3060 Ti (Windows 11), branch merged with current main:

Thanks!

@oni-swr

oni-swr commented Nov 25, 2026

Copy link
Copy Markdown
Contributor

RX 7800 XT (RDNA3, wave32/wave64) report on exact head 03ceddb0be3d06287ca21ae800dbb0d7f98049e7 (as is, on its base 568e7db7; no merge with current main, which merges cleanly).

Tested

  • AMD Radeon RX 7800 XT, driver 32.0.31035.1003; Ryzen 7 5700X3D; Windows 11 build 26200; Rust 1.100.0 MSVC; debug profile; dxc.exe from Windows SDK 10.0.26100.0.
  • cargo test --workspace --no-fail-fast -- --test-threads=4 on this head: 1160 passed, 1 failed, 46 ignored (21 targets). The one failure is fuzz_validate_and_gpu_1, which fails the same way on main; nothing else failed.
  • Baseline, same machine and command, unmodified main at c9ee916a: 1330 passed, 2 failed, 46 ignored (24 targets). The 2 failures are gpu::dxil::fuzz_tests::fuzz_validate_and_gpu_1 (seed 722: CPU 0x7fffffff, GPU 0x1) and gpu::recomp::lower_dxil::tests::a_bridged_mask_write_where_one_half_is_elsewhere_meets_no_barrier.
  • Note: a_bridged_mask_write... does not exist on this older head, so only fuzz_validate_and_gpu_1 is comparable with main.
  • Relevant tests, all passing: the 7 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 as main): the f16 / f32-conversion per-lane programs, "refused (unsupported V_MUL_F16 / V_PK_MUL_F16 / V_CVT_F16_F32 ...)", and heap_window_out_of_memory_falls_back_to_the_switch_form ("no heap windows").

Not tested

  • No title and no scripts/smoke.ps1 run (no xcl-smoke blocks): I did not run an untrusted retail executable. This is a test-suite report only, not the regression run the PR needs.
  • Release profile, NVIDIA, Intel, Wine, RDNA2/RDNA4.

AI use

  • This run and report were done by Claude Code (Claude Sonnet 5.5): it fetched the head, ran the commands above and wrote this comment. Nothing was reviewed line by line for correctness here.

@ClosetPie107

Copy link
Copy Markdown

Independent AMD RDNA4 / Linux (Proton/Wine, RADV, native wave64) test report for head 03ceddb0be3d06287ca21ae800dbb0d7f98049e7 (merged cleanly onto main 6d12f58).

Hardware & environment

  • AMD Radeon RX 9070 16 GB (RDNA4, RADV GFX1201, Mesa 26.3.1, native wave64), Ryzen 5 9600X, 30 GiB RAM, CachyOS Linux
  • Proton Experimental (experimental-11.0-20261112), vkd3d-proton master ec207194 (3.2.0) + dxil-spirv b540c8a2 + relaxed-vtable patch (-Db_ndebug=true), DXVK v3.1.1-209, DXC 1.9.2609.5, Rust x86_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)
    • All 7 tests pass under Proton Experimental (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), confirming MapViewOfFile3 / MEM_REPLACE_PLACEHOLDER + write-watched neighbours work on Proton 11.

Not tested

  • Full workspace test suite, native Windows, or a retail-title smoke pair (module is not wired into the runtime yet).

AI use

  • T3 Code / Antigravity (Gemini 4 Neon) merged the PR onto main, ran the tests under Proton on this machine, and drafted this report.

@bmjask bmjask left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@Decodere

Copy link
Copy Markdown
Contributor

Independent desktop NVIDIA verification of PR #2293 at head 03ceddb0be3d06287ca21ae800dbb0d7f98049e7 (1 commit; exact parent & merge-base: 568e7db7729c8fa6c8f0f4b32d798faaf11462bb, pre-#2555 ancestor of main).

Environment

  • GPU: NVIDIA GeForce RTX 4060 (8 GB / 7956 MiB reported by D3D12), driver 32.0.16.2114 (NVIDIA 621.14, WDDM 3.2)
  • CPU / RAM / OS: Intel Core i5-11400F (6C / 12T), 32 GB RAM (31.9 GiB usable), Windows 11 Home 26200 (Developer Mode off)
  • Toolchain: rustc 1.100.0 (0ef1bc386 2026-11-09) MSVC, DXC 1.9.2609.5, --release

Targeted release tests & build (03ceddb0)

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

AI disclosure: test execution and report drafting assisted by Google Antigravity (Gemini 4 Neon).

jessenic added a commit to jessenic/xcl that referenced this pull request Nov 28, 2026
… stand down, and the log says which is at work

Lab port of the upstream alias stack (xcl-dev#2293, xcl-dev#2294, xcl-dev#2307, xcl-dev#2308, xcl-dev#3074,
xcl-dev#3075). The lab's two stopgaps for a physical page at more than one address
keep the page at ONE address and move it (bring_page / bring_range,
XCL_PAGE_BRING) or its video memory (sparse::share_page, XCL_PAGE_SHARE=1).
With real aliases a page is at every address the title mapped it at, outside
the sparse windows, and an address it is not at was unmapped by the title:
both stand down when XCL_PAGE_ALIAS=1. With the switch not set they are as
they were.

One line at start-up (the first time the switch is asked) names which of the
three is at work; with aliases, a line at the first view and at each power
of two from 1024 on says how many pages are shown at how many addresses and
how many of them at more than one (guards::view_counts).

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
@brainhay5

Copy link
Copy Markdown

merge-check claim
head: 03ceddb

@brainhay5

brainhay5 commented Nov 30, 2026 •

Copy link
Copy Markdown

merge-check
base: d52ff48
head: 03ceddb
merge: 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_d16 fails on base d52ff48 by itself (verified separately with the same command: "assertion failed: 2D D16 resinfo clobbered v2/v3"). Verdict corrected. Apologies for the noise.

@Pipodi

Pipodi commented Nov 30, 2026

Copy link
Copy Markdown
Contributor

merge-check claim
head: 03ceddb

@github-actions github-actions Bot added area:hle kernelx, XGameRuntime, XAudio2, VFS, PE loader, TLS, EH needs-1st-check Passes gates; needs first independent merge-check (#3041) labels Nov 30, 2026
@thehollowedone

thehollowedone commented Nov 30, 2026 •

Copy link
Copy Markdown
Contributor

I checked two independent failure cases in the current section helper. I reproduced both on a local candidate rebased onto current main f95f5f66 with PR head 03ceddb0.

  • Section::new used eager then_some, so a null result from CreateFileMappingW still constructed and immediately dropped a Section; that calls CloseHandle(NULL) and overwrites the thread’s last-error value (6 on this machine). Use the lazy then path.
  • reserve(Some(0), len) passes a null base to VirtualAlloc2, 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. Reject Some(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).
  • With both fixes reverted: 7 passed, 2 failed; one detected the null-handle last-error change and one detected that the zero-base request reached the allocator.
  • Windows x64; Rust 1.99.1 MSVC. CPU-side Win32 memory tests; GPU unused. This is not a merge-check or runtime integration test.
Candidate diff against PR head
diff --git a/crates/xcl/src/hle/kernelx/sections.rs b/crates/xcl/src/hle/kernelx/sections.rs
index 99356862..17b78958 100644
--- a/crates/xcl/src/hle/kernelx/sections.rs
+++ b/crates/xcl/src/hle/kernelx/sections.rs
@@ -44,9 +44,9 @@ impl Section {
     pub fn new(pages: usize) -> Option<Section> {
         let bytes = pages.checked_mul(PAGE).filter(|&b| b > 0)?;
         // SAFETY: a pagefile-backed mapping with no name and default security.
         let handle = unsafe { CreateFileMappingW(INVALID_HANDLE_VALUE, std::ptr::null(), PAGE_READWRITE | SEC_RESERVE, (bytes >> 32) as u32, bytes as u32, std::ptr::null()) };
-        (!handle.is_null()).then_some(Section { handle, pages })
+        section_from_handle(handle, pages)
     }
 
     pub fn pages(&self) -> usize {
         self.pages
@@ -69,8 +69,12 @@ impl Section {
         v.Value as usize == at
     }
 }
 
+fn section_from_handle(handle: HANDLE, pages: usize) -> Option<Section> {
+    (!handle.is_null()).then(|| Section { handle, pages })
+}
+
 impl Drop for Section {
     fn drop(&mut self) {
         // views still mapped keep the section alive until they are unmapped
         // SAFETY: the handle is ours and closed once.
@@ -82,13 +86,20 @@ impl Drop for Section {
 ///
 /// # Safety
 /// Only reserves address space; the caller releases it with `release`.
 pub unsafe fn reserve(at: Option<usize>, len: usize) -> Option<usize> {
-    if len == 0 || !len.is_multiple_of(PAGE) {
+    reserve_with(at, len, |want, len| {
+        // SAFETY: the helper validates the requested placeholder range before calling here.
+        unsafe { VirtualAlloc2(GetCurrentProcess(), want as *const c_void, len, MEM_RESERVE | MEM_RESERVE_PLACEHOLDER, PAGE_NOACCESS, std::ptr::null_mut(), 0) as usize }
+    })
+}
+
+fn reserve_with(at: Option<usize>, len: usize, allocate: impl FnOnce(usize, usize) -> usize) -> Option<usize> {
+    if at == Some(0) || len == 0 || !len.is_multiple_of(PAGE) {
         return None;
     }
     let want = at.unwrap_or(0);
-    let p = VirtualAlloc2(GetCurrentProcess(), want as *const c_void, len, MEM_RESERVE | MEM_RESERVE_PLACEHOLDER, PAGE_NOACCESS, std::ptr::null_mut(), 0) as usize;
+    let p = allocate(want, len);
     (p != 0 && (at.is_none() || p == want)).then_some(p)
 }
 
 /// The allocation `p` lies in: (base, size, state, type), from one VirtualQuery.
@@ -304,5 +315,24 @@ mod tests {
     #[test]
     fn a_section_of_no_pages_is_refused() {
         assert!(Section::new(0).is_none());
     }
+
+    #[test]
+    fn failed_section_creation_does_not_close_a_null_handle() {
+        use windows_sys::Win32::Foundation::{GetLastError, SetLastError, ERROR_ACCESS_DENIED};
+
+        unsafe { SetLastError(ERROR_ACCESS_DENIED) };
+        assert!(section_from_handle(std::ptr::null_mut(), 1).is_none());
+        assert_eq!(unsafe { GetLastError() }, ERROR_ACCESS_DENIED);
+    }
+
+    #[test]
+    fn an_explicit_zero_base_is_rejected_before_reserving() {
+        let mut called = false;
+        assert_eq!(reserve_with(Some(0), PAGE, |_, _| {
+            called = true;
+            PAGE
+        }), None);
+        assert!(!called, "Some(0) must not be passed to VirtualAlloc2 as an OS-chosen base");
+    }
 }

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.

@Pipodi

Pipodi commented Nov 30, 2026

Copy link
Copy Markdown
Contributor

merge-check
base: d52ff48
head: 03ceddb
merge: 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 d52ff48, 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.

@github-actions github-actions Bot added needs-2nd-check Has 1 safe merge-check; needs second independent check (#3041) and removed needs-1st-check Passes gates; needs first independent merge-check (#3041) labels Nov 30, 2026
@Edgaras0404

Copy link
Copy Markdown

Tested

  • Hardware & OS: AMD Radeon RX 6700 XT (RDNA2, driver 32.0.21045.29003), AMD Ryzen 5 5600X 6-Core Processor, Windows 10 Pro 22H2 (build 19045)
  • Toolchain & build: rustc 1.100.1 (20ddd0171 2026-11-25), dxcompiler 1.9.2609.5 / dxil 1.9.2609.5, D3D12 Agility SDK, debug
  • Commits: PR #2293 head 03ceddb0 trial-merged onto main 9dfbe3ea (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 7 hle::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:
    • All passing workspace binaries finished with 0 failed (including tests\gpu_compute_e2e.rs: 9 passed; 0 failed with SKIPPED 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 on main 9dfbe3ea).
    • -p xcl --lib (2776 tests): aborted with exit code: 0x80004005 (xcl: sparse upload preparation still failed after bounded retries – the title is stopped before its GPU submission), matching main 9dfbe3ea baseline behavior. Before aborting, it logged SKIPPED hle::d3d12x::bind::tests::two_pass_binds_set_the_shared_view_heap: no heap windows (opt-in: XCL_HEAP_WINDOWS=1), the 5 pre-existing gpu:: 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), and hle::d3d12x::list_x::tests::a_reset_while_the_last_submit_runs_records_on_another_pc_list (FAILED under --test-threads=4).

Not tested

  • Ignored tests\heap_probe.rs tests (--ignored)
  • Isolated -p xcl --lib -- --skip gpu:: --skip hle::d3d12x:: slice on the merged tree (full -p xcl --lib hit the pre-existing 0x80004005 abort)
  • Opt-in XCL_HEAP_WINDOWS=1 tests (the 2 SKIPPED heap-window tests above)
  • Release build and scripts/smoke.ps1 (new sections module is not yet wired into runtime/in-game paths)
  • Windows 11 and earlier Windows 10 builds (e.g. 1803)

AI use

  • Gemini formatted this test report from the author's directly run commands and outputs (no code or diffs written).

@Foniass

Foniass commented Dec 1, 2026

Copy link
Copy Markdown
Collaborator

Triage (#1607) – head 03ceddb

No open or merged PR makes the same change: main has no section-backed physical pages (kernelx/placeholders.rs on 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.rs is 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.

@Decodere

Decodere commented Dec 2, 2026 •

Copy link
Copy Markdown
Contributor

merge-check
base: 1c8b551
head: 03ceddb
merge: clean trial merge into 1c8b551475e1e7bfe48f94448492a4c3544a2e0f (trial-merge commit 3b90656d0522d1ccd21279128054a3cb5fdae339; git diff --check clean).
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 vs main 1c8b5514; all 43 targets green including gpu_two_pass_cache_e2e). All 7 new hle::kernelx::sections::tests passed 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. 28 SKIPPED lines — all hardware/environment-expected on RTX 4060 (22 no wave64, 2 no d3d12SDKLayers.dll, 1 no D3D12 debug layer, 2 no heap windows, 1 cannot 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 (CreateFileMappingW with SEC_RESERVE, VirtualAlloc2 placeholder reserve/replace, MapViewOfFile3, UnmapViewOfFile2 with MEM_PRESERVE_PLACEHOLDER, and VirtualFree split/release) are clean, with bounds/alignment checks in Section::new and Section::map, safe CloseHandle drop 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) validates len alignment but not at alignment; if an unaligned Some(at) is ever passed, VirtualAlloc2 rounds BaseAddress down to 64 KiB and returning None on p != want would leave that reservation unfreed (easy to guard with at.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 per TESTING.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)

@github-actions github-actions Bot added ready-to-merge Has 2 independent safe merge-checks on current head (#3041) and removed needs-2nd-check Has 1 safe merge-check; needs second independent check (#3041) labels Dec 2, 2026
@throny throny added needs:title-run Runtime change: needs a merge-check with a real title run into the world (#3041) and removed ready-to-merge Has 2 independent safe merge-checks on current head (#3041) labels Dec 2, 2026
@tiagonleal

Copy link
Copy Markdown
Contributor

merge-check
base: 5ad98ad
head: 03ceddb
merge: clean (merge commit 39b6c3441c1fff5d4d7addfdb97d0e99da1a8334; git diff --check clean)
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::sections module 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 5ad98ad, 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

@github-actions github-actions Bot added ready-to-merge Has 2 independent safe merge-checks on current head (#3041) and removed needs:title-run Runtime change: needs a merge-check with a real title run into the world (#3041) labels Dec 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:hle kernelx, XGameRuntime, XAudio2, VFS, PE loader, TLS, EH goal:world-load Bears on the retail title getting past world loading ready-to-merge Has 2 independent safe merge-checks on current head (#3041)

Projects

None yet

Development

Successfully merging this pull request may close these issues.