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

Open
adiologydev wants to merge 1 commit from upstream-pr/2293 into main
adiologydev commented 2026-11-25 12:45:38 +00:00 (Migrated from github.com)

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 (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, #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.
<!-- greyfinch-sync:ivall/xcl:issue:5491586388 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2293). Originally posted by [adiologydev](https://github.com/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` (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, #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.
nnonno91 commented 2026-11-25 15:08:03 +00:00 (Migrated from github.com)

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

  • Windows 11 25H2 build 26200.9974, Ryzen 7 9800X3D, Rust 1.100.0 MSVC, unoptimized profile. CPU-side tests using native Windows memory APIs.
  • cargo test --locked -p xcl --lib hle::kernelx::sections -- --nocapture --test-threads=1 gave 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.

<!-- greyfinch-sync:ivall/xcl:comment:7166051905 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2293#issuecomment-7166051905). Originally posted by [nnonno91](https://github.com/nnonno91) on 2026-11-25T14:56:24Z. --- Independent native Windows check of the section and placeholder primitives on `03ceddb0be3d06287ca21ae800dbb0d7f98049e7`. **Tested** - Windows 11 25H2 build 26200.9974, Ryzen 7 9800X3D, Rust 1.100.0 MSVC, unoptimized profile. CPU-side tests using native Windows memory APIs. - `cargo test --locked -p xcl --lib hle::kernelx::sections -- --nocapture --test-threads=1` gave 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.
upipibi commented 2026-11-25 17:07:32 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by upipibi on 2026-11-25T16:57:56Z.


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.

<!-- greyfinch-sync:ivall/xcl:comment:7168797591 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2293#issuecomment-7168797591). Originally posted by [upipibi](https://github.com/upipibi) on 2026-11-25T16:57:56Z. --- 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 commented 2026-11-25 18:04:35 +00:00 (Migrated from github.com)

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!

<!-- greyfinch-sync:ivall/xcl:comment:7169586996 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2293#issuecomment-7169586996). Originally posted by [DavidM1911](https://github.com/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!
oni-swr commented 2026-11-25 19:09:08 +00:00 (Migrated from github.com)

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 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.
<!-- greyfinch-sync:ivall/xcl:comment:7171082137 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2293#issuecomment-7171082137). Originally posted by [oni-swr](https://github.com/oni-swr) on 2026-11-25T18:33:55Z. --- **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 commented 2026-11-25 21:05:21 +00:00 (Migrated from github.com)

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 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.
<!-- greyfinch-sync:ivall/xcl:comment:7174160498 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2293#issuecomment-7174160498). Originally posted by [ClosetPie107](https://github.com/ClosetPie107) on 2026-11-25T20:46:07Z. --- 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 commented 2026-11-25 21:15:09 +00:00 (Migrated from github.com)

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.

<!-- greyfinch-sync:ivall/xcl:review:6065082073 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2293#pullrequestreview-6065082073). Originally posted by [bmjask](https://github.com/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.
Decodere commented 2026-11-27 06:56:29 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Decodere on 2026-11-27T06:56:29Z.


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

  • Windows 11 VirtualAlloc2 placeholder splitting/coalescing and MapViewOfFile3 multi-address section-slice mapping were directly verified via all 7 new hle::kernelx::sections::tests (3/3, 0 skipped) and the full hle::kernelx:: suite (45/45 × 3).
  • PR #2293 adds the sections building block without wiring XCL_PAGE_ALIAS=1 into the retail runtime path yet (wired in stacked PR #2307), so the 60 s retail smoke confirms default-path non-regression on title: 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).

<!-- greyfinch-sync:ivall/xcl:comment:7211989629 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2293#issuecomment-7211989629). Originally posted by [Decodere](https://github.com/Decodere) on 2026-11-27T06:56:29Z. --- 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 - Windows 11 `VirtualAlloc2` placeholder splitting/coalescing and `MapViewOfFile3` multi-address section-slice mapping were directly verified via all 7 new `hle::kernelx::sections::tests` (`3/3`, `0` skipped) and the full `hle::kernelx::` suite (`45/45` × 3). - PR #2293 adds the `sections` building block without wiring `XCL_PAGE_ALIAS=1` into the retail runtime path yet (wired in stacked PR #2307), so the 60 s retail smoke confirms default-path non-regression on `title: 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).*
brainhay5 commented 2026-11-30 07:22:32 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by brainhay5 on 2026-11-30T07:22:32Z.


merge-check claim
head: 03ceddb0be

<!-- greyfinch-sync:ivall/xcl:comment:7271661213 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2293#issuecomment-7271661213). Originally posted by [brainhay5](https://github.com/brainhay5) on 2026-11-30T07:22:32Z. --- merge-check claim head: 03ceddb0be3d06287ca21ae800dbb0d7f98049e7
brainhay5 commented 2026-11-30 07:36:12 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by brainhay5 on 2026-11-30T07:36:12Z.


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

<!-- greyfinch-sync:ivall/xcl:comment:7271916471 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2293#issuecomment-7271916471). Originally posted by [brainhay5](https://github.com/brainhay5) on 2026-11-30T07:36:12Z. --- merge-check base: d52ff48caade1f5350d513bfffd370396dadfeb6 head: 03ceddb0be3d06287ca21ae800dbb0d7f98049e7 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 d52ff48c by itself (verified separately with the same command: "assertion failed: 2D D16 resinfo clobbered v2/v3"). Verdict corrected. Apologies for the noise.
Pipodi commented 2026-11-30 08:33:53 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Pipodi on 2026-11-30T08:33:53Z.


merge-check claim
head: 03ceddb0be

<!-- greyfinch-sync:ivall/xcl:comment:7273062996 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2293#issuecomment-7273062996). Originally posted by [Pipodi](https://github.com/Pipodi) on 2026-11-30T08:33:53Z. --- merge-check claim head: 03ceddb0be3d06287ca21ae800dbb0d7f98049e7
thehollowedone commented 2026-11-30 09:26:30 +00:00 (Migrated from github.com)

Imported 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 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.

<!-- greyfinch-sync:ivall/xcl:comment:7274211067 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2293#issuecomment-7274211067). Originally posted by [thehollowedone](https://github.com/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 `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. <details> <summary>Candidate diff against PR head</summary> ```diff 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"); + } } ``` </details> 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 commented 2026-11-30 10:11:48 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Pipodi on 2026-11-30T10:11:48Z.


merge-check
base: d52ff48caa
head: 03ceddb0be
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 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.

<!-- greyfinch-sync:ivall/xcl:comment:7275260446 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2293#issuecomment-7275260446). Originally posted by [Pipodi](https://github.com/Pipodi) on 2026-11-30T10:11:48Z. --- merge-check base: d52ff48caade1f5350d513bfffd370396dadfeb6 head: 03ceddb0be3d06287ca21ae800dbb0d7f98049e7 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 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.
Edgaras0404 commented 2026-11-30 12:50:50 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Edgaras0404 on 2026-11-30T12:50:50Z.


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).
<!-- greyfinch-sync:ivall/xcl:comment:7279004117 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2293#issuecomment-7279004117). Originally posted by [Edgaras0404](https://github.com/Edgaras0404) on 2026-11-30T12:50:50Z. --- **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 commented 2026-12-01 07:45:54 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Foniass on 2026-12-01T07:45:54Z.


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.

<!-- greyfinch-sync:ivall/xcl:comment:7304451520 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2293#issuecomment-7304451520). Originally posted by [Foniass](https://github.com/Foniass) on 2026-12-01T07:45:54Z. --- **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 commented 2026-12-02 08:29:36 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Decodere on 2026-12-02T08:29:36Z.


merge-check
base: 1c8b551475
head: 03ceddb0be
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)

<!-- greyfinch-sync:ivall/xcl:comment:7339526897 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2293#issuecomment-7339526897). Originally posted by [Decodere](https://github.com/Decodere) on 2026-12-02T08:29:36Z. --- merge-check base: 1c8b551475e1e7bfe48f94448492a4c3544a2e0f head: 03ceddb0be3d06287ca21ae800dbb0d7f98049e7 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)
tiagonleal commented 2026-12-02 21:42:32 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by tiagonleal on 2026-12-02T21:42:32Z.


merge-check
base: 5ad98adbc3
head: 03ceddb0be
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 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

<!-- greyfinch-sync:ivall/xcl:comment:7359666999 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2293#issuecomment-7359666999). Originally posted by [tiagonleal](https://github.com/tiagonleal) on 2026-12-02T21:42:32Z. --- merge-check base: 5ad98adbc360225ac8a57ad9661e16fe8df9d8dd head: 03ceddb0be3d06287ca21ae800dbb0d7f98049e7 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 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
This pull request cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'upstream-pr/2293:upstream-pr/2293'
git switch 'upstream-pr/2293'

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.

git switch 'main'
git merge --no-ff 'upstream-pr/2293'
git switch 'upstream-pr/2293'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/2293'
git switch 'upstream-pr/2293'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/2293'
git switch 'main'
git merge --squash 'upstream-pr/2293'
git switch 'main'
git merge --ff-only 'upstream-pr/2293'
git switch 'main'
git merge 'upstream-pr/2293'
git push origin 'main'
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
xcl-dev/xcl!2283
No description provided.