Memory: use a 2 MiB grain for allocator page size two #3092

Open
Prime1997 wants to merge 1 commit from upstream-pr/3092 into main
Prime1997 commented 2026-11-28 03:35:23 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Prime1997 on 2026-11-28T03:35:23Z.


Correct XMemAllocDefault graphics PageSize=2 rounding from 4 MiB to 2 MiB while preserving larger explicit alignment, overflow checks and recorded allocation/free accounting.

What is in it

  • One page-grain correction, related comments and three bounded fixtures in kernelx.rs; README behavior note.
  • The test title now checks 2 MiB alignment and the first/last words within that allocation, preserving its null, zeroing and free checks.

Tested

  • Windows build 26200 x64; Intel Core i5-10400; RTX 3060 Ti, driver 32.0.16.1714; Rust 1.100.0 MSVC, debug profile with debug symbols disabled.
  • 3 passed, 0 failed, 0 ignored, 0 reported skips. Restoring the original 4 MiB grain fails all three controls. Fixtures check boundary rounding, other page codes, overflow, owned allocation charging and release.
  • cargo test --locked -p xcl --lib --target-dir <private-target> -- --exact --test-threads=1 --nocapture hle::kernelx::tests::xmem_graphics_page_size_two_uses_two_mib_grain hle::kernelx::tests::xmem_graphics_page_grain_preserves_other_codes_and_checks_overflow hle::kernelx::tests::xmem_two_mib_layout_accounts_and_releases_owned_memory
  • The three focused results above are historical, from the preserved patch on NVIDIA ba9d1f947. The previous PR head was d40a1540f6497eabcbe36793f4a6c1c2254d91ac. New squashed head f00e1c4fec6207ed99489947b0180caefaf57c53 includes the test-title correction and has not been run individually. Source review and git diff --check passed; they are not native-test coverage.

Regression run
Pending. No retail smoke blocks are claimed.

Not tested

  • The full suite and retail regression on this individual PR head, AMD, or launch readiness. A separate seven-fix candidate 5d0833553c68d2afa327c913cd9a22f17ec6f45e includes this correction; its full suite and release build are pending. Those combined results will be reported separately and will not establish an individual PR smoke run.
  • This does not implement physical-page clusters, XMemVirtualAlloc flag routing, allocator hooks or native fallback alignment. #1343 owns the separate fallback-alignment issue and retains the older grain.

AI use
Codex (GPT-6) implemented and independently reviewed the change and ran the reported checks. API contracts were checked against local GDK documentation; no SDK code, headers, binaries, samples or documentation text are included.

Optional temporary Discord for coordinating contributor work, testing and comparing results.

<!-- greyfinch-sync:ivall/xcl:issue:5536282736 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3092). Originally posted by [Prime1997](https://github.com/Prime1997) on 2026-11-28T03:35:23Z. --- Correct XMemAllocDefault graphics PageSize=2 rounding from 4 MiB to 2 MiB while preserving larger explicit alignment, overflow checks and recorded allocation/free accounting. **What is in it** - One page-grain correction, related comments and three bounded fixtures in kernelx.rs; README behavior note. - The test title now checks 2 MiB alignment and the first/last words within that allocation, preserving its null, zeroing and free checks. **Tested** - Windows build 26200 x64; Intel Core i5-10400; RTX 3060 Ti, driver 32.0.16.1714; Rust 1.100.0 MSVC, debug profile with debug symbols disabled. - 3 passed, 0 failed, 0 ignored, 0 reported skips. Restoring the original 4 MiB grain fails all three controls. Fixtures check boundary rounding, other page codes, overflow, owned allocation charging and release. - `cargo test --locked -p xcl --lib --target-dir <private-target> -- --exact --test-threads=1 --nocapture hle::kernelx::tests::xmem_graphics_page_size_two_uses_two_mib_grain hle::kernelx::tests::xmem_graphics_page_grain_preserves_other_codes_and_checks_overflow hle::kernelx::tests::xmem_two_mib_layout_accounts_and_releases_owned_memory` - The three focused results above are historical, from the preserved patch on NVIDIA `ba9d1f947`. The previous PR head was `d40a1540f6497eabcbe36793f4a6c1c2254d91ac`. New squashed head `f00e1c4fec6207ed99489947b0180caefaf57c53` includes the test-title correction and has not been run individually. Source review and `git diff --check` passed; they are not native-test coverage. **Regression run** Pending. No retail smoke blocks are claimed. **Not tested** - The full suite and retail regression on this individual PR head, AMD, or launch readiness. A separate seven-fix candidate `5d0833553c68d2afa327c913cd9a22f17ec6f45e` includes this correction; its full suite and release build are pending. Those combined results will be reported separately and will not establish an individual PR smoke run. - This does not implement physical-page clusters, XMemVirtualAlloc flag routing, allocator hooks or native fallback alignment. #1343 owns the separate fallback-alignment issue and retains the older grain. **AI use** Codex (GPT-6) implemented and independently reviewed the change and ran the reported checks. API contracts were checked against local GDK documentation; no SDK code, headers, binaries, samples or documentation text are included. Optional temporary [Discord](https://discord.gg/6B4TykyC4W) for coordinating contributor work, testing and comparing results.
DarkPanda69 commented 2026-11-28 04:04:11 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by DarkPanda69 on 2026-11-28T04:04:11Z.


Update for head f00e1c4 (same parent e48e74c): same command, 62 passed, 0 failed, 1 ignored, the three new tests ok.

Run on a Ryzen 7 5800X PC (the AMD side was listed as untested, but as far as I can see these tests only reserve CPU memory with VirtualAlloc and create no D3D12 device): the three new tests pass, and nothing else in kernelx changes.

Tested: at the PR head d40a154 against its merge-base with nvidia-dev, e48e74c (the diff doesn't apply as a patch on today's nvidia-dev 01b94f5). Debug, Rust 1.100.0, Windows 11 Pro 26200, XCL_ADAPTER=Radeon (RX 9070 XT).

  • cargo test -p xcl --lib -- hle::kernelx::tests:: --test-threads=1 --nocapture: merge-base 59 passed, 0 failed, 1 ignored; PR 62 passed, 0 failed, 1 ignored, no SKIPPED.
  • The only changes are xmem_graphics_page_size_two_uses_two_mib_grain, xmem_graphics_page_grain_preserves_other_codes_and_checks_overflow and xmem_two_mib_layout_accounts_and_releases_owned_memory, all ok.

Not tested: the whole suite, a title, the RTX 3060 (no GPU path in these tests that I could see).

AI use: Claude Code (Claude Opus 5.5) ran the tests on this machine and wrote this report.

<!-- greyfinch-sync:ivall/xcl:comment:7233653634 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3092#issuecomment-7233653634). Originally posted by [DarkPanda69](https://github.com/DarkPanda69) on 2026-11-28T04:04:11Z. --- **Update for head `f00e1c4`** (same parent `e48e74c`): same command, 62 passed, 0 failed, 1 ignored, the three new tests ok. Run on a Ryzen 7 5800X PC (the AMD side was listed as untested, but as far as I can see these tests only reserve CPU memory with `VirtualAlloc` and create no D3D12 device): the three new tests pass, and nothing else in `kernelx` changes. **Tested:** at the PR head `d40a154` against its merge-base with `nvidia-dev`, `e48e74c` (the diff doesn't apply as a patch on today's `nvidia-dev` `01b94f5`). Debug, Rust 1.100.0, Windows 11 Pro 26200, `XCL_ADAPTER=Radeon` (RX 9070 XT). - `cargo test -p xcl --lib -- hle::kernelx::tests:: --test-threads=1 --nocapture`: merge-base 59 passed, 0 failed, 1 ignored; PR 62 passed, 0 failed, 1 ignored, no SKIPPED. - The only changes are `xmem_graphics_page_size_two_uses_two_mib_grain`, `xmem_graphics_page_grain_preserves_other_codes_and_checks_overflow` and `xmem_two_mib_layout_accounts_and_releases_owned_memory`, all ok. **Not tested:** the whole suite, a title, the RTX 3060 (no GPU path in these tests that I could see). AI use: Claude Code (Claude Opus 5.5) ran the tests on this machine and wrote this report.
thehollowedone commented 2026-11-28 04:10:13 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by thehollowedone on 2026-11-28T04:10:13Z.


Independent Windows/NVIDIA check of #3092 head d40a1540, based on nvidia-dev e48e74ca. RTX 3080 Ti / 621.35, Ryzen 7 9800X3D, Windows 11 build 26300, rustc 1.99.1 MSVC, DXC 1.8.2502.11.

The three new allocator fixtures passed on this exact head (3/0/0, no reported skip). The full cargo test --offline --locked -j 4 --workspace --no-fail-fast -- --test-threads=4 finished 1,900 passed, 5 failed, 48 ignored across 40 targets, with 26 explicit SKIPPED notices. Three of the five failures were the test-title e2e cases. All three hit the same stale expectation in tests/testtitle/src/main.rs: it still requires page-size code 2 to return a 4 MiB-aligned allocation and reads its 4 MiB end, while this PR changes that grain to 2 MiB. The observed address was 2 MiB aligned and failed the old check.

I changed only that test-title expectation locally, rebuilt the workspace, and ran cargo test --offline --locked -j 4 -p xcl --test e2e test_title -- --test-threads=1: 3 passed, 0 failed, 0 ignored. git diff --check passed. The candidate is below; please include the updated end-of-allocation zero check along with the alignment wording so the test does not probe beyond the new 2 MiB allocation.

Verified test-title correction
@@
-        // 4 MiB page-size semantics (XALLOC_PAGESIZE_4MB = 2 << 14): 4 MiB-aligned & zeroed
-        let attrs_4m = (1u64 << 29) | (2u64 << 14);
-        let big = XMemAlloc(0x1000, attrs_4m);
-        ensure!(!big.is_null() && (big as usize) % (4 << 20) == 0, "4MB page alloc not 4 MiB aligned: {big:?}");
-        ensure!(*(big as *const u64) == 0 && *((big as usize + (4 << 20) - 8) as *const u64) == 0, "4MB page alloc not zeroed");
-        XMemFree(big, attrs_4m);
+        // Page-size code 2 uses a 2 MiB grain: the returned allocation is aligned and zeroed.
+        let attrs_2m = (1u64 << 29) | (2u64 << 14);
+        let big = XMemAlloc(0x1000, attrs_2m);
+        ensure!(!big.is_null() && (big as usize) % (2 << 20) == 0, "2MB page alloc not 2 MiB aligned: {big:?}");
+        ensure!(*(big as *const u64) == 0 && *((big as usize + (2 << 20) - 8) as *const u64) == 0, "2MB page alloc not zeroed");
+        XMemFree(big, attrs_2m);

The other two suite failures were the mesh-cache test (DXIL not compiled yet, also reproduced on unchanged e48e74ca) and d32s8_targets_take_their_own_size_of_video_memory, which passed an isolated rerun on this head (1/0/0) and also failed in my #3090 concurrent suite. I have not resolved that concurrent failure or run paired retail smoke; this is not a merge-ready verdict.

AI use: Codex (GPT-6.2 Sol) inspected the patch, ran the tests, and verified the test-title correction.

<!-- greyfinch-sync:ivall/xcl:comment:7233764753 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3092#issuecomment-7233764753). Originally posted by [thehollowedone](https://github.com/thehollowedone) on 2026-11-28T04:10:13Z. --- Independent Windows/NVIDIA check of [#3092 head `d40a1540`](https://github.com/xcl-dev/xcl/commit/d40a1540f6497eabcbe36793f4a6c1c2254d91ac), based on [`nvidia-dev` `e48e74ca`](https://github.com/xcl-dev/xcl/commit/e48e74cad7af992f7b472b59f06ad23ae3695166). RTX 3080 Ti / 621.35, Ryzen 7 9800X3D, Windows 11 build 26300, rustc 1.99.1 MSVC, DXC 1.8.2502.11. The three new allocator fixtures passed on this exact head (**3/0/0**, no reported skip). The full `cargo test --offline --locked -j 4 --workspace --no-fail-fast -- --test-threads=4` finished **1,900 passed, 5 failed, 48 ignored** across 40 targets, with 26 explicit `SKIPPED` notices. Three of the five failures were the test-title e2e cases. All three hit the same stale expectation in [`tests/testtitle/src/main.rs`](https://github.com/xcl-dev/xcl/blob/d40a1540f6497eabcbe36793f4a6c1c2254d91ac/tests/testtitle/src/main.rs#L350-L356): it still requires page-size code 2 to return a 4 MiB-aligned allocation and reads its 4 MiB end, while this PR changes that grain to 2 MiB. The observed address was 2 MiB aligned and failed the old check. I changed only that test-title expectation locally, rebuilt the workspace, and ran `cargo test --offline --locked -j 4 -p xcl --test e2e test_title -- --test-threads=1`: **3 passed, 0 failed, 0 ignored**. `git diff --check` passed. The candidate is below; please include the updated end-of-allocation zero check along with the alignment wording so the test does not probe beyond the new 2 MiB allocation. <details><summary>Verified test-title correction</summary> ```diff @@ - // 4 MiB page-size semantics (XALLOC_PAGESIZE_4MB = 2 << 14): 4 MiB-aligned & zeroed - let attrs_4m = (1u64 << 29) | (2u64 << 14); - let big = XMemAlloc(0x1000, attrs_4m); - ensure!(!big.is_null() && (big as usize) % (4 << 20) == 0, "4MB page alloc not 4 MiB aligned: {big:?}"); - ensure!(*(big as *const u64) == 0 && *((big as usize + (4 << 20) - 8) as *const u64) == 0, "4MB page alloc not zeroed"); - XMemFree(big, attrs_4m); + // Page-size code 2 uses a 2 MiB grain: the returned allocation is aligned and zeroed. + let attrs_2m = (1u64 << 29) | (2u64 << 14); + let big = XMemAlloc(0x1000, attrs_2m); + ensure!(!big.is_null() && (big as usize) % (2 << 20) == 0, "2MB page alloc not 2 MiB aligned: {big:?}"); + ensure!(*(big as *const u64) == 0 && *((big as usize + (2 << 20) - 8) as *const u64) == 0, "2MB page alloc not zeroed"); + XMemFree(big, attrs_2m); ``` </details> The other two suite failures were the mesh-cache test (`DXIL not compiled yet`, also reproduced on unchanged `e48e74ca`) and `d32s8_targets_take_their_own_size_of_video_memory`, which passed an isolated rerun on this head (**1/0/0**) and also failed in my #3090 concurrent suite. I have not resolved that concurrent failure or run paired retail smoke; this is not a merge-ready verdict. AI use: Codex (GPT-6.2 Sol) inspected the patch, ran the tests, and verified the test-title correction.
thehollowedone commented 2026-11-28 08:29:21 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by thehollowedone on 2026-11-28T08:29:21Z.


Exact-head Windows/NVIDIA rerun of #3092 f00e1c4fec6207ed99489947b0180caefaf57c53, following my earlier report on the old head. The new head includes the test-title correction.

Windows 11 build 26300, RTX 3080 Ti / 621.35, Ryzen 7 9800X3D, rustc 1.99.1 MSVC. cargo build --offline --locked -j 4 --workspace passed. Then cargo test --offline --locked -j 4 --workspace --no-fail-fast -- --test-threads=4 finished 1,903 passed, 2 failed, 48 ignored across 40 targets, with 26 explicit GPU SKIPPED notices counted among the passes. All four e2e tests, including the three that failed with the old test-title binary, passed. The two failures were console_mesh_caches_hlsl_compute_pass_in_memory_and_on_disk (DXIL not compiled yet, also reproduced on the old parent in my earlier report) and d32s8_targets_take_their_own_size_of_video_memory (passed 1/1 when rerun alone on this head). The full suite is therefore not green locally.

Regression run. I built release XCL separately from clean current main e429936c and the clean PR head, then ran scripts/smoke.ps1 -Seconds 60 -Title sample-title on the same title and RTX 3080 Ti with XCL_PREPARE=0 on both. This documented mode leaves ahead-of-time shader preparation out; the default-mode attempt timed out during startup before a smoke block existed. The two blocks below are the script's output, not hand-written:

xcl-smoke v1
commit: e429936c10a5b8aa09470ff99dfc8c8d3d8c56fd
gpu: NVIDIA GeForce RTX 3080 Ti
title: sample-title
seconds: 60
exit: 0x0
frames shown: 1163 (PresentX 1163)
presents per 2 s (last 3): 55 57 58
device removals: 0
crashes: 0
peak commit: 15107 MB
xcl-smoke v1
commit: f00e1c4fec6207ed99489947b0180caefaf57c53
gpu: NVIDIA GeForce RTX 3080 Ti
title: sample-title
seconds: 60
exit: 0x0
frames shown: 1582 (PresentX 1582)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 16802 MB

The PR run clears the stated frame and peak-commit thresholds (1,582 ≥ 80% of 1,163; 16,802 MB ≤ 125% of 15,107 MB). I would not attribute the frame difference to this change because cache warmth may differ. The author can paste these generated blocks under the PR description's Regression run section. No menu input was sent, so this pair covers startup/menu behavior, not world load or gameplay. AMD and Intel were not tested here.

AI use: Codex (GPT-6.2 Sol) ran the builds, suite and paired smoke, checked the counts, and wrote this report.

<!-- greyfinch-sync:ivall/xcl:comment:7236615199 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3092#issuecomment-7236615199). Originally posted by [thehollowedone](https://github.com/thehollowedone) on 2026-11-28T08:29:21Z. --- Exact-head Windows/NVIDIA rerun of [#3092 `f00e1c4fec6207ed99489947b0180caefaf57c53`](https://github.com/xcl-dev/xcl/commit/f00e1c4fec6207ed99489947b0180caefaf57c53), following [my earlier report on the old head](https://github.com/xcl-dev/xcl/pull/3092#issuecomment-7233764753). The new head includes the test-title correction. Windows 11 build 26300, RTX 3080 Ti / 621.35, Ryzen 7 9800X3D, rustc 1.99.1 MSVC. `cargo build --offline --locked -j 4 --workspace` passed. Then `cargo test --offline --locked -j 4 --workspace --no-fail-fast -- --test-threads=4` finished **1,903 passed, 2 failed, 48 ignored** across 40 targets, with 26 explicit GPU `SKIPPED` notices counted among the passes. All four e2e tests, including the three that failed with the old test-title binary, passed. The two failures were `console_mesh_caches_hlsl_compute_pass_in_memory_and_on_disk` (`DXIL not compiled yet`, also reproduced on the old parent in my earlier report) and `d32s8_targets_take_their_own_size_of_video_memory` (passed **1/1** when rerun alone on this head). The full suite is therefore not green locally. **Regression run.** I built release XCL separately from clean current [`main` `e429936c`](https://github.com/xcl-dev/xcl/commit/e429936c10a5b8aa09470ff99dfc8c8d3d8c56fd) and the clean PR head, then ran `scripts/smoke.ps1 -Seconds 60 -Title sample-title` on the same title and RTX 3080 Ti with `XCL_PREPARE=0` on both. This documented mode leaves ahead-of-time shader preparation out; the default-mode attempt timed out during startup before a smoke block existed. The two blocks below are the script's output, not hand-written: ``` xcl-smoke v1 commit: e429936c10a5b8aa09470ff99dfc8c8d3d8c56fd gpu: NVIDIA GeForce RTX 3080 Ti title: sample-title seconds: 60 exit: 0x0 frames shown: 1163 (PresentX 1163) presents per 2 s (last 3): 55 57 58 device removals: 0 crashes: 0 peak commit: 15107 MB ``` ``` xcl-smoke v1 commit: f00e1c4fec6207ed99489947b0180caefaf57c53 gpu: NVIDIA GeForce RTX 3080 Ti title: sample-title seconds: 60 exit: 0x0 frames shown: 1582 (PresentX 1582) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 16802 MB ``` The PR run clears the stated frame and peak-commit thresholds (1,582 ≥ 80% of 1,163; 16,802 MB ≤ 125% of 15,107 MB). I would not attribute the frame difference to this change because cache warmth may differ. The author can paste these generated blocks under the PR description's **Regression run** section. No menu input was sent, so this pair covers startup/menu behavior, not world load or gameplay. AMD and Intel were not tested here. AI use: Codex (GPT-6.2 Sol) ran the builds, suite and paired smoke, checked the counts, and wrote this report.
thehollowedone commented 2026-11-28 19:41:06 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by thehollowedone on 2026-11-28T19:41:06Z.


The current PR-description check is red because Regression run still says “Pending” and contains neither required smoke block. The Windows build check passed on head f00e1c4.

The two generated, clean-commit 60-second main/head blocks for the same sample title are in my exact-head report. The head has not changed since that run. Please place those blocks verbatim under Regression run and attribute the independent test result in Tested; the current “not run individually” wording is now stale. No source change is needed for this description gate. If the head is pushed again, its smoke must be rerun as CONTRIBUTING.md requires.

AI use: Codex (GPT-6.2 Sol) checked the current head, PR description, and CI job against the previously posted run.

<!-- greyfinch-sync:ivall/xcl:comment:7244728483 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3092#issuecomment-7244728483). Originally posted by [thehollowedone](https://github.com/thehollowedone) on 2026-11-28T19:41:06Z. --- The current [PR-description check](https://github.com/xcl-dev/xcl/actions/runs/46121877931/job/140907964761) is red because **Regression run** still says “Pending” and contains neither required smoke block. The Windows build check passed on [head `f00e1c4`](https://github.com/xcl-dev/xcl/commit/f00e1c4fec6207ed99489947b0180caefaf57c53). The two generated, clean-commit **60-second main/head blocks** for the same sample title are in [my exact-head report](https://github.com/xcl-dev/xcl/pull/3092#issuecomment-7236615199). The head has not changed since that run. Please place those blocks verbatim under **Regression run** and attribute the independent test result in **Tested**; the current “not run individually” wording is now stale. No source change is needed for this description gate. If the head is pushed again, its smoke must be rerun as CONTRIBUTING.md requires. AI use: Codex (GPT-6.2 Sol) checked the current head, PR description, and CI job against the previously posted run.
andrewDoing commented 2026-11-28 19:49:58 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by andrewDoing on 2026-11-28T19:49:58Z.


I checked the public graphics allocation/free path with three mixed-size allocations live at once. On Windows 11 / Ryzen 7 5700X3D, the new grain reduced their recorded sparse allocation lengths by exactly 2 MiB and preserved middle-hole reuse and neighboring contents.

XMemAllocDefault request, in allocation order Parent e48e74ca Head f00e1c4f
1 byte, PageSize=2 4 MiB 2 MiB
64 KiB, PageSize=0 64 KiB 64 KiB
2 MiB + 1 byte, PageSize=2 4 MiB 4 MiB
Total recorded 8,454,144 B 6,356,992 B

An identical test-only fixture called XMemAllocDefault and XMemFreeDefault, confirmed all three returned sparse addresses and read their lengths from Uma::sparse_reservation. Windows VirtualQuery showed committed pages at both ends of each block. Freeing the 64 KiB block returned it to MEM_RESERVE; the next same-size request reused that address, with zeroes at both ends. Freeing the first allocation then preserved both sentinel bytes of the last allocation and the middle allocation's recorded length. After freeing everything, all three addresses were reserved and absent from the sparse allocator's live map.

One fresh process per revision, one passing fixture each, zero skips. This measured the CPU-side sparse allocation path before D3D device creation. It does not measure physical VRAM residency, title memory savings, or native fallback alignment (#1343).

AI assistance: OpenAI Codex (GPT-6) prepared the fixture, ran both revisions and wrote this report.

<!-- greyfinch-sync:ivall/xcl:comment:7244837301 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3092#issuecomment-7244837301). Originally posted by [andrewDoing](https://github.com/andrewDoing) on 2026-11-28T19:49:58Z. --- I checked the public graphics allocation/free path with **three mixed-size allocations live at once**. On Windows 11 / Ryzen 7 5700X3D, the new grain reduced their recorded sparse allocation lengths by exactly 2 MiB and preserved middle-hole reuse and neighboring contents. | XMemAllocDefault request, in allocation order | Parent `e48e74ca` | Head `f00e1c4f` | | --- | ---: | ---: | | 1 byte, PageSize=2 | 4 MiB | 2 MiB | | 64 KiB, PageSize=0 | 64 KiB | 64 KiB | | 2 MiB + 1 byte, PageSize=2 | 4 MiB | 4 MiB | | Total recorded | 8,454,144 B | 6,356,992 B | An identical test-only fixture called `XMemAllocDefault` and `XMemFreeDefault`, confirmed all three returned sparse addresses and read their lengths from `Uma::sparse_reservation`. Windows `VirtualQuery` showed committed pages at both ends of each block. Freeing the 64 KiB block returned it to `MEM_RESERVE`; the next same-size request reused that address, with zeroes at both ends. Freeing the first allocation then preserved both sentinel bytes of the last allocation and the middle allocation's recorded length. After freeing everything, all three addresses were reserved and absent from the sparse allocator's live map. One fresh process per revision, one passing fixture each, zero skips. This measured the CPU-side sparse allocation path before D3D device creation. It does not measure physical VRAM residency, title memory savings, or native fallback alignment (#1343). AI assistance: OpenAI Codex (GPT-6) prepared the fixture, ran both revisions and wrote this report.
bmjask commented 2026-11-28 22:04:23 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by bmjask on 2026-11-28T22:04:23Z.

Review: COMMENTED


The measured allocation benefit is useful, but the semantic basis for changing page-size code 2 from the existing 4 MiB interpretation to 2 MiB needs authoritative evidence. This is an externally visible allocation/alignment contract, not merely an allocator tuning constant; a wrong grain can change alignment, reservation size, and aliasing behavior.

Please cite the permitted source or add black-box allocation tests that establish the 2 MiB behavior across relevant sizes and alignments. Also update the failing PR-description gate before promotion from nvidia-dev.

Reviewed at f00e1c4fec with Codex (GPT-5).

<!-- greyfinch-sync:ivall/xcl:review:6100275475 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3092#pullrequestreview-6100275475). Originally posted by [bmjask](https://github.com/bmjask) on 2026-11-28T22:04:23Z. **Review:** COMMENTED --- The measured allocation benefit is useful, but the semantic basis for changing page-size code 2 from the existing 4 MiB interpretation to 2 MiB needs authoritative evidence. This is an externally visible allocation/alignment contract, not merely an allocator tuning constant; a wrong grain can change alignment, reservation size, and aliasing behavior. Please cite the permitted source or add black-box allocation tests that establish the 2 MiB behavior across relevant sizes and alignments. Also update the failing PR-description gate before promotion from `nvidia-dev`. Reviewed at f00e1c4fec6207ed99489947b0180caefaf57c53 with Codex (GPT-5).
thehollowedone commented 2026-11-29 03:53:58 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by thehollowedone on 2026-11-29T03:53:58Z.


At #3092 head f00e1c4, the test-title check requests 4 KiB but dereferences a word nearly 2 MiB from the returned pointer. That relies on the implementation's rounded allocation rather than the caller's requested range. The alignment assertion is also non-discriminating: main's 4 MiB-aligned result satisfies % (2 << 20) == 0. Thus this check and the measured XCL sparse lengths do not resolve the reviewer's question about the console contract for page-size code 2.

Please bound the zero check to the requested bytes. A permitted native reference or documented contract should establish the 2 MiB extent separately from alignment. A useful comparison would cover 1 byte, 2 MiB, and 2 MiB + 1 byte with natural and explicit 8 MiB alignment; an address merely divisible by 2 MiB cannot distinguish the old 4 MiB interpretation.

Small test-boundary change for consideration
-        ensure!(*(big as *const u64) == 0 && *((big as usize + (2 << 20) - 8) as *const u64) == 0, "2MB page alloc not zeroed");
+        ensure!(*(big as *const u64) == 0 && *((big as usize + 0x1000 - 8) as *const u64) == 0, "page allocation not zeroed in the requested range");

This is a source review; I did not run this proposed edit or a native console comparison. AI use: Codex (GPT-6.2 Sol) checked the test and allocator; Codex (GPT-6.2 Astra) independently traced the contract and free path.

<!-- greyfinch-sync:ivall/xcl:comment:7250326837 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3092#issuecomment-7250326837). Originally posted by [thehollowedone](https://github.com/thehollowedone) on 2026-11-29T03:53:58Z. --- At [#3092 head `f00e1c4`](https://github.com/xcl-dev/xcl/commit/f00e1c4fec6207ed99489947b0180caefaf57c53), the [test-title check](https://github.com/xcl-dev/xcl/blob/f00e1c4fec6207ed99489947b0180caefaf57c53/tests/testtitle/src/main.rs#L350-L356) requests 4 KiB but dereferences a word nearly 2 MiB from the returned pointer. That relies on the implementation's rounded allocation rather than the caller's requested range. The alignment assertion is also non-discriminating: main's 4 MiB-aligned result satisfies `% (2 << 20) == 0`. Thus this check and the measured XCL sparse lengths do not resolve [the reviewer's question](https://github.com/xcl-dev/xcl/pull/3092#pullrequestreview-6100275475) about the console contract for page-size code 2. Please bound the zero check to the requested bytes. A permitted native reference or documented contract should establish the 2 MiB extent separately from alignment. A useful comparison would cover 1 byte, 2 MiB, and 2 MiB + 1 byte with natural and explicit 8 MiB alignment; an address merely divisible by 2 MiB cannot distinguish the old 4 MiB interpretation. <details><summary>Small test-boundary change for consideration</summary> ```diff - ensure!(*(big as *const u64) == 0 && *((big as usize + (2 << 20) - 8) as *const u64) == 0, "2MB page alloc not zeroed"); + ensure!(*(big as *const u64) == 0 && *((big as usize + 0x1000 - 8) as *const u64) == 0, "page allocation not zeroed in the requested range"); ``` </details> This is a source review; I did not run this proposed edit or a native console comparison. AI use: Codex (GPT-6.2 Sol) checked the test and allocator; Codex (GPT-6.2 Astra) independently traced the contract and free path.
vasanex commented 2026-11-29 04:23:19 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by vasanex on 2026-11-29T04:23:19Z.


merge-check
base: fa204595a488c60c6c5f905244f0172072c9c2a9
head: f00e1c4fec6207ed99489947b0180caefaf57c53
merge: clean
build: cargo build --workspace -> ok
tests: not run alone; in a stack of 11 of your PRs on this base: cargo test --workspace --no-fail-fast -- --test-threads=4 -> 2650 passed, 1 failed, 49 ignored; SKIPPED: 27 lines; failing: #3123's private_physical_pages_reach_the_gpu_on_mapping only. Alone: hle::kernelx:: 64 passed, 0 failed, 1 ignored.
review: after this PR the same attribute means two sizes: XMemAlloc turns page-size code 2 into a 2 MiB grain (kernelx.rs:1407 in the merged tree), while XMemVirtualAlloc still maps code 2 to type bit 0x8000_0000 (:1519-1520), which VirtualAlloc rounds and aligns to 4 MiB (:956-957, :977-979). The description does not mention it. The source for "2 MiB" is not something a reviewer can check (bmjask's request for evidence or a black-box test is open). As thehollowedone noted today (issuecomment-7250326837), the changed e2e check also passes on main (a 4 MiB-aligned block satisfies it), so it does not pin the change. Code itself is fine (checked overflow, alignment clamp unchanged).
performance: 60 s smoke of the merged tree (477708b7): 1694 frames, peak commit 18434 MB, 0 removals, 0 crashes (base 1629-1689 frames, 16065-16596 MB; commit is noisy in this series). Memory can only go down per allocation.
verdict: not yet: XMemAlloc (2 MiB) and XMemVirtualAlloc/VirtualAlloc (4 MiB) disagree on page-size code 2 after the change, and the 2 MiB meaning has no checkable evidence
hardware / tool and model: RTX 3080 10 GB 621.40, Ryzen 9 7950X, Windows 11 26200 / Claude Code (Claude Opus 5.5, Claude Fable 5.2)

How this was run: the suite ran once on the 11 of your PRs that build on this base, merged together (#3047 #3048 #3049 #3091 #3092 #3103 #3104 #3105 #3107 #3123 #3125; a local tree, only #3125 needed a resolution in README and the sparse.rs test module); the base alone gave 2608 passed, 0 failed, 49 ignored with the same 27 SKIPPED lines (21 no wave64, 3 refused per-lane f16/f32 forms, 2 heap windows opt-in, 1 driver cache needs Developer Mode). This PR alone was merged onto the base, built (cargo build --workspace, then release), its modules' lib tests run (debug), and smoke-run once for 60 s (scripts/smoke.ps1, retail title, front end, XCL_PREPARE=0). The smoke numbers are for my local merged tree, not a clean-head block for the description.

AI use: Claude Code (Claude Opus 5.5 and Claude Fable 5.2) ran the builds, tests and title runs, reviewed the diff and wrote this; the code points cited were checked against the merged tree.

<!-- greyfinch-sync:ivall/xcl:comment:7250621984 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3092#issuecomment-7250621984). Originally posted by [vasanex](https://github.com/vasanex) on 2026-11-29T04:23:19Z. --- ```text merge-check base: fa204595a488c60c6c5f905244f0172072c9c2a9 head: f00e1c4fec6207ed99489947b0180caefaf57c53 merge: clean build: cargo build --workspace -> ok tests: not run alone; in a stack of 11 of your PRs on this base: cargo test --workspace --no-fail-fast -- --test-threads=4 -> 2650 passed, 1 failed, 49 ignored; SKIPPED: 27 lines; failing: #3123's private_physical_pages_reach_the_gpu_on_mapping only. Alone: hle::kernelx:: 64 passed, 0 failed, 1 ignored. review: after this PR the same attribute means two sizes: XMemAlloc turns page-size code 2 into a 2 MiB grain (kernelx.rs:1407 in the merged tree), while XMemVirtualAlloc still maps code 2 to type bit 0x8000_0000 (:1519-1520), which VirtualAlloc rounds and aligns to 4 MiB (:956-957, :977-979). The description does not mention it. The source for "2 MiB" is not something a reviewer can check (bmjask's request for evidence or a black-box test is open). As thehollowedone noted today (issuecomment-7250326837), the changed e2e check also passes on main (a 4 MiB-aligned block satisfies it), so it does not pin the change. Code itself is fine (checked overflow, alignment clamp unchanged). performance: 60 s smoke of the merged tree (477708b7): 1694 frames, peak commit 18434 MB, 0 removals, 0 crashes (base 1629-1689 frames, 16065-16596 MB; commit is noisy in this series). Memory can only go down per allocation. verdict: not yet: XMemAlloc (2 MiB) and XMemVirtualAlloc/VirtualAlloc (4 MiB) disagree on page-size code 2 after the change, and the 2 MiB meaning has no checkable evidence hardware / tool and model: RTX 3080 10 GB 621.40, Ryzen 9 7950X, Windows 11 26200 / Claude Code (Claude Opus 5.5, Claude Fable 5.2) ``` How this was run: the suite ran once on the 11 of your PRs that build on this base, merged together (#3047 #3048 #3049 #3091 #3092 #3103 #3104 #3105 #3107 #3123 #3125; a local tree, only #3125 needed a resolution in README and the `sparse.rs` test module); the base alone gave 2608 passed, 0 failed, 49 ignored with the same 27 `SKIPPED` lines (21 no wave64, 3 refused per-lane f16/f32 forms, 2 heap windows opt-in, 1 driver cache needs Developer Mode). This PR alone was merged onto the base, built (`cargo build --workspace`, then release), its modules' lib tests run (debug), and smoke-run once for 60 s (`scripts/smoke.ps1`, retail title, front end, `XCL_PREPARE=0`). The smoke numbers are for my local merged tree, not a clean-head block for the description. AI use: Claude Code (Claude Opus 5.5 and Claude Fable 5.2) ran the builds, tests and title runs, reviewed the diff and wrote this; the code points cited were checked against the merged tree.
Prime1997 commented 2026-11-29 11:18:28 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Prime1997 on 2026-11-29T11:18:28Z.


merge-check
base: d8bd9a3820
head: f00e1c4fec
merge: clean
build: cargo build --workspace -> ok
tests: cargo test --workspace --no-fail-fast -- --test-threads=4 -> 2618 passed, 0 failed, 49 ignored, with three uma_driver tests skipped (on this PC's driver they can end the library test process; run alone on the merged tree: 3 passed, 0 failed); SKIPPED: 28 lines (21 no wave64 on this wave32 card, 3 wave32 per-lane forms refused, 2 heap windows opt-in, 1 no dxc.exe, 1 driver cache needs Developer Mode); failing: none
review: the whole diff was read (kernelx.rs xmem_graphics_layout, the D3D_DISPLAY_TARGET comment, three unit tests, the test title, README). (1) Confirmed at this head: after the change one attribute means two sizes. XMemAlloc (xmem_graphics_layout) turns page-size code 2 into a 2 MiB grain, while XMemVirtualAlloc still maps code 2 to type bit 0x8000_0000, which VirtualAlloc rounds and aligns to 4 MiB (it reads 0x2000_0000 as 2 MiB). The description does not mention it. (2) The 2 MiB meaning of code 2 still has no source a reviewer can check (bmjask's request on 2026-11-28 is open). (3) The changed test-title check passes on main too (a 4 MiB-aligned block is 2 MiB-aligned) and reads a word 2 MiB past a 4 KiB request, so it does not pin the change (thehollowedone, 2026-11-29). The arithmetic itself is fine: overflow is checked and larger explicit alignments are kept.
performance: memory per allocation can only go down. 60 s scripts/smoke.ps1 (retail title, front end, no input) of the merged tree e4ac66e9: 1439 frames, peak commit 15340 MB, 0 device removals, 0 crashes; base d8bd9a38: 1424 frames, 15285 MB. The title's world was not reached, so in-game allocation patterns were not exercised.
verdict: not yet: page-size code 2 means 2 MiB in XMemAlloc but still 4 MiB in XMemVirtualAlloc/VirtualAlloc after the change, and the 2 MiB meaning has no checkable evidence
hardware / tool and model: RTX 3060 Ti 8 GB (driver 32.0.16.1714), Intel Core i5-10400, Windows 11 Pro 26200 / Claude Code (model not named: this session cannot tell which model served each turn)

This check was run from the PR author's account (Prime1997), so it does not count as one of #3041's two independent checks. Suite in debug; smokes on release builds of the exact merged and base commits, with a copied profile and shader cache.


Generated by Claude Code

<!-- greyfinch-sync:ivall/xcl:comment:7255021735 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3092#issuecomment-7255021735). Originally posted by [Prime1997](https://github.com/Prime1997) on 2026-11-29T11:18:28Z. --- merge-check base: d8bd9a38204667f3ca7dd9eeffcc2f1c937b07b0 head: f00e1c4fec6207ed99489947b0180caefaf57c53 merge: clean build: cargo build --workspace -> ok tests: cargo test --workspace --no-fail-fast -- --test-threads=4 -> 2618 passed, 0 failed, 49 ignored, with three uma_driver tests skipped (on this PC's driver they can end the library test process; run alone on the merged tree: 3 passed, 0 failed); SKIPPED: 28 lines (21 no wave64 on this wave32 card, 3 wave32 per-lane forms refused, 2 heap windows opt-in, 1 no dxc.exe, 1 driver cache needs Developer Mode); failing: none review: the whole diff was read (kernelx.rs xmem_graphics_layout, the D3D_DISPLAY_TARGET comment, three unit tests, the test title, README). (1) Confirmed at this head: after the change one attribute means two sizes. XMemAlloc (xmem_graphics_layout) turns page-size code 2 into a 2 MiB grain, while XMemVirtualAlloc still maps code 2 to type bit 0x8000_0000, which VirtualAlloc rounds and aligns to 4 MiB (it reads 0x2000_0000 as 2 MiB). The description does not mention it. (2) The 2 MiB meaning of code 2 still has no source a reviewer can check (bmjask's request on 2026-11-28 is open). (3) The changed test-title check passes on main too (a 4 MiB-aligned block is 2 MiB-aligned) and reads a word 2 MiB past a 4 KiB request, so it does not pin the change (thehollowedone, 2026-11-29). The arithmetic itself is fine: overflow is checked and larger explicit alignments are kept. performance: memory per allocation can only go down. 60 s scripts/smoke.ps1 (retail title, front end, no input) of the merged tree e4ac66e9: 1439 frames, peak commit 15340 MB, 0 device removals, 0 crashes; base d8bd9a38: 1424 frames, 15285 MB. The title's world was not reached, so in-game allocation patterns were not exercised. verdict: not yet: page-size code 2 means 2 MiB in XMemAlloc but still 4 MiB in XMemVirtualAlloc/VirtualAlloc after the change, and the 2 MiB meaning has no checkable evidence hardware / tool and model: RTX 3060 Ti 8 GB (driver 32.0.16.1714), Intel Core i5-10400, Windows 11 Pro 26200 / Claude Code (model not named: this session cannot tell which model served each turn) This check was run from the PR author's account (Prime1997), so it does not count as one of #3041's two independent checks. Suite in debug; smokes on release builds of the exact merged and base commits, with a copied profile and shader cache. --- _Generated by Claude Code_
Kalmarv commented 2026-11-29 22:38:31 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Kalmarv on 2026-11-29T22:38:31Z.


merge-check
base: beeb81be4b (mergeable cleanly on current main)
head: f00e1c4fec
merge: clean
build: cargo check -p xcl --all-targets -> ok
tests: non-GPU lib tests of touched module (kernelx: 49 passed, 2 known parallel address-reuse flakes that pass 3/3 alone). Full workspace suite and GPU tests not run.
review: default behaviour change — page-size code 2 changes from main's XALLOC_PAGESIZE_4MB (4 MiB) to 2 MiB for all titles. Please cite the SDK/header or console documentation confirming code 2 = 2 MiB; overflow checks and UMA-window tests look clean.
performance: changes allocation rounding by default; not isolated from the combined run. Tested in a combined 600 s retail run on main beeb81be + 13 PRs (warm cache, defaults) vs baseline: presents/2 s 3.27 vs 3.29, peak commit 35,016 vs 35,767 MB, local video memory 14.19-14.76 vs 14.32-14.95 GB, 0 pipeline waits >= 1 s vs 5, 0 device removals, 0 crashes. Combined result across all 13 PRs, not isolated to this PR.
verdict: not yet: needs source confirming page-size code 2 = 2 MiB; full suite and per-PR memory measurement not run.
hardware / tool and model: NVIDIA GeForce RTX 5070 Ti, driver 32.0.16.1074, AMD Ryzen 9 9950X, Windows 11 Pro 26200 / Claude Code (claude-opus-5-5)

<!-- greyfinch-sync:ivall/xcl:comment:7263835143 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3092#issuecomment-7263835143). Originally posted by [Kalmarv](https://github.com/Kalmarv) on 2026-11-29T22:38:31Z. --- merge-check base: beeb81be4b7e96fce26a54615be9ee170474c19e (mergeable cleanly on current main) head: f00e1c4fec6207ed99489947b0180caefaf57c53 merge: clean build: cargo check -p xcl --all-targets -> ok tests: non-GPU lib tests of touched module (kernelx: 49 passed, 2 known parallel address-reuse flakes that pass 3/3 alone). Full workspace suite and GPU tests not run. review: default behaviour change — page-size code 2 changes from main's XALLOC_PAGESIZE_4MB (4 MiB) to 2 MiB for all titles. Please cite the SDK/header or console documentation confirming code 2 = 2 MiB; overflow checks and UMA-window tests look clean. performance: changes allocation rounding by default; not isolated from the combined run. Tested in a combined 600 s retail run on main beeb81be + 13 PRs (warm cache, defaults) vs baseline: presents/2 s 3.27 vs 3.29, peak commit 35,016 vs 35,767 MB, local video memory 14.19-14.76 vs 14.32-14.95 GB, 0 pipeline waits >= 1 s vs 5, 0 device removals, 0 crashes. Combined result across all 13 PRs, not isolated to this PR. verdict: not yet: needs source confirming page-size code 2 = 2 MiB; full suite and per-PR memory measurement not run. hardware / tool and model: NVIDIA GeForce RTX 5070 Ti, driver 32.0.16.1074, AMD Ryzen 9 9950X, Windows 11 Pro 26200 / Claude Code (claude-opus-5-5)
bmjask commented 2026-11-29 22:44:23 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by bmjask on 2026-11-29T22:44:23Z.

Review: COMMENTED


Critical review of current head f00e1c4f. The new tests establish that the implementation uses a 2 MiB grain, but they do not establish that console PageSize=2 means 2 MiB. This is a guest-visible allocation/alignment contract; choosing the wrong grain changes reservation size and potentially aliasing. Please provide a permitted authoritative source or a black-box comparison on the console for multiple sizes and requested alignments. This remains the concern in my earlier review. No local Windows run.

<!-- greyfinch-sync:ivall/xcl:review:6105194583 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3092#pullrequestreview-6105194583). Originally posted by [bmjask](https://github.com/bmjask) on 2026-11-29T22:44:23Z. **Review:** COMMENTED --- Critical review of current head `f00e1c4f`. The new tests establish that the implementation uses a 2 MiB grain, but they do not establish that console `PageSize=2` *means* 2 MiB. This is a guest-visible allocation/alignment contract; choosing the wrong grain changes reservation size and potentially aliasing. Please provide a permitted authoritative source or a black-box comparison on the console for multiple sizes and requested alignments. This remains the concern in my [earlier review](https://github.com/xcl-dev/xcl/pull/3092). No local Windows run.
Foniass commented 2026-12-01 05:41:39 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Foniass on 2026-12-01T05:41:39Z.


Review (head f00e1c4f, diff read, not a merge-check: PR description fails, so not built or run here yet):

  • Page-size code 2 now means two things. It's 2 MiB in xmem_graphics_layout but still 0x8000_0000 in XMemVirtualAlloc (kernelx.rs ~1523-1524), which VirtualAlloc treats as 4 MiB (~959-960, ~980-982), and main names the code XALLOC_PAGESIZE_4MB. No source is cited for 2 MiB beyond "local GDK documentation". A title relying on 4 MiB alignment would break, and the changed test title and unit tests wouldn't catch it. Either make both paths agree or explain why they differ.
  • CI ran only against nvidia-dev 54225f58 (the base was switched to main afterwards), there are no smoke blocks (why PR description fails), and the head was never run on its own. The same change is on amd-dev as 01a99a40.

Fine: rounding of size 0 and boundary sizes, overflow, alignment larger than the page grain and memory accounting are tested, and the tests fail with the old 4 MiB grain.

AI review: Claude Code (Claude Opus 5.5), posted by Foniass without a human check of each point.

<!-- greyfinch-sync:ivall/xcl:comment:7302037654 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3092#issuecomment-7302037654). Originally posted by [Foniass](https://github.com/Foniass) on 2026-12-01T05:41:39Z. --- Review (head f00e1c4f, diff read, not a merge-check: `PR description` fails, so not built or run here yet): - **Page-size code 2 now means two things.** It's 2 MiB in `xmem_graphics_layout` but still `0x8000_0000` in `XMemVirtualAlloc` (`kernelx.rs` ~1523-1524), which `VirtualAlloc` treats as 4 MiB (~959-960, ~980-982), and main names the code `XALLOC_PAGESIZE_4MB`. No source is cited for 2 MiB beyond "local GDK documentation". A title relying on 4 MiB alignment would break, and the changed test title and unit tests wouldn't catch it. Either make both paths agree or explain why they differ. - CI ran only against nvidia-dev 54225f58 (the base was switched to main afterwards), there are no smoke blocks (why `PR description` fails), and the head was never run on its own. The same change is on amd-dev as 01a99a40. Fine: rounding of size 0 and boundary sizes, overflow, alignment larger than the page grain and memory accounting are tested, and the tests fail with the old 4 MiB grain. AI review: Claude Code (Claude Opus 5.5), posted by Foniass without a human check of each point.
Foniass commented 2026-12-01 17:09:40 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Foniass on 2026-12-01T17:09:40Z.


Test report (not a merge-check: PR description red)
base: b2b1f109d2
head: f00e1c4fec
merge: clean
build: cargo build --workspace -> ok
tests: cargo test --workspace --no-fail-fast -- --test-threads=4 -> 2905 passed, 0 failed, 51 ignored; SKIPPED: 28 (20 no wave64, 2 no d3d12SDKLayers.dll, 1 no D3D12 debug layer, 1 no heap windows, 1 cannot disable the driver cache, 3 others; the same set as on main); failing: none
review: not repeated here; my review of this same head is at https://github.com/xcl-dev/xcl/pull/3092#issuecomment-7302037654, and its findings stand. This run adds what reading couldn't: whether the change merges, builds and passes the whole suite on current main.
performance: no smoke run.
assessment: merges, builds and passes the whole suite on current main (0 failed); the findings in my review stand
hardware / tool and model: RTX 5070 Ti (driver 621.14), Ryzen 7 7800X3D, Windows 11 26300 / Claude Code with Claude Opus 5.5

AI-written and posted by Foniass without a human check of each point.

<!-- greyfinch-sync:ivall/xcl:comment:7318852523 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3092#issuecomment-7318852523). Originally posted by [Foniass](https://github.com/Foniass) on 2026-12-01T17:09:40Z. --- Test report (not a merge-check: `PR description` red) base: b2b1f109d27e746a62ec95b04dd1f9924452e682 head: f00e1c4fec6207ed99489947b0180caefaf57c53 merge: clean build: cargo build --workspace -> ok tests: cargo test --workspace --no-fail-fast -- --test-threads=4 -> 2905 passed, 0 failed, 51 ignored; SKIPPED: 28 (20 no wave64, 2 no d3d12SDKLayers.dll, 1 no D3D12 debug layer, 1 no heap windows, 1 cannot disable the driver cache, 3 others; the same set as on main); failing: none review: not repeated here; my review of this same head is at https://github.com/xcl-dev/xcl/pull/3092#issuecomment-7302037654, and its findings stand. This run adds what reading couldn't: whether the change merges, builds and passes the whole suite on current main. performance: no smoke run. assessment: merges, builds and passes the whole suite on current main (0 failed); the findings in my review stand hardware / tool and model: RTX 5070 Ti (driver 621.14), Ryzen 7 7800X3D, Windows 11 26300 / Claude Code with Claude Opus 5.5 AI-written and posted by Foniass without a human check of each point.
Foniass commented 2026-12-03 16:08:06 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Foniass on 2026-12-03T16:08:06Z.


merge-check
base: 16c2fd082a
head: f00e1c4fec
merge: clean
build: ok
tests: 3015 passed, 0 failed, 56 ignored; 28 skipped, the same as on main
review: 1 high, 2 medium, 1 nit (below)
performance: 60 s smoke run: 1683 → 1654 frames (98 % of main), peak commit 18505 → 18490 MB, no device removal, no crash
title run: retail title on the RTX 5070 Ti (driver 621.14), into the world by scripted presses: 232 s there, 0 device removals, 0 crashes, 2.6 presents/s; run with XCL_SKIP_CS=95cc13288a27a96e (the NVIDIA hang at the end of loading, #3541) and NVIDIA's 2048 MB shader heap (#2590)
verdict: not yet: 1 blocking finding (critical or high, below); also PR description is red
hardware / tool and model: RTX 5070 Ti (driver 621.14), Ryzen 7 7800X3D, Windows 11 26300 / Claude Code with Claude Opus 5.5


In short: Changes the XMemAlloc graphics grain for page-size code 2 from 4 MiB to 2 MiB, with three unit tests and an updated test-title check. The arithmetic is fine. But after the change the same attribute means 2 MiB in XMemAlloc and 4 MiB in XMemVirtualAlloc, and nothing a reviewer can check says code 2 means 2 MiB, so it is not ready (the same point as the two earlier merge-checks).

High

  1. Page-size code 2 means two sizes after the change. xmem_graphics_layout (kernelx.rs ~1365) now uses a 2 MiB grain for code 2. XMemVirtualAlloc (~1480) still turns code 2 into type bit 0x8000_0000, which VirtualAlloc rounds and aligns to 4 MiB (~938, ~959). This guest-visible contract changes on the default path for every page-size-2 graphics allocation, and the only source given is "local GDK documentation"; bmjask's request (two reviews at this head) for a permitted source or a black-box comparison is still open. Change both paths with evidence, or neither, and say so in the description.

Medium

  1. The test-title check does not pin the change. tests/testtitle/src/main.rs ~351-356: a 4 MiB-aligned block from main also passes % (2 << 20) == 0, and the zero check reads a word 2 MiB past a 4 KiB request, so it relies on the rounding. Only the unit tests fail without the change. Limit the zero check to the 0x1000 bytes requested, and test the extent through the allocator (block_len) as the unit test does.
  2. Contradicts open #1343. #1343's new test expects page size 2 to give 4 MiB alignment ((2, 0, 4 << 20)). Whichever PR lands second breaks the other's test or meaning. Settle the contract once.

Nit

  1. Description and comment out of date. Tested still says this head "has not been run individually" and Regression run says "Pending", though others have run it since. The new D3D_DISPLAY_TARGET comment (~1454) says the retail game's back buffers use 2 MiB pages, which nothing in the PR shows.
Checked and fine
  • Overflow is checked (checked_next_multiple_of) and tested at the largest size
  • A larger explicit alignment is kept without enlarging the page grain (8 MiB case tested); codes 0, 1 and 3 are unchanged (tested)
  • The owned-Uma accounting test charges and releases the rounded size and frees each block once
  • Merges cleanly into current origin/main although 972 commits behind; xmem_graphics_layout is unchanged on main since the base, and main does not already do this
  • Memory per allocation can only go down
How this was tested
  • Merged onto main 16c2fd08, then cargo build --workspace and cargo test --workspace --no-fail-fast -- --test-threads=4.
  • The skipped GPU tests are those this card can't run (no wave64 on NVIDIA, no D3D12 debug layer, and similar).
  • scripts/smoke.ps1: 60 s of a retail title on main 16c2fd08 and on this merge; presents per 2 s at the end: 61 60 60.
  • Title run: the release build of this merge launched the retail title with XCL_RUN_SECONDS=300 and scripted A presses counted from the first frame (XCL_PRESS_BASE=frame, #3712) into the world from an existing save; time in the world is counted from the first in-world draw call to the end of the run.

Written by Claude Code (Claude Opus 5.5) and posted by Foniass without a human check of each point.

<!-- greyfinch-sync:ivall/xcl:comment:7384321127 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3092#issuecomment-7384321127). Originally posted by [Foniass](https://github.com/Foniass) on 2026-12-03T16:08:06Z. --- merge-check base: 16c2fd082ae2e96967a2ab553bc2e1032e491f70 head: f00e1c4fec6207ed99489947b0180caefaf57c53 merge: clean build: ok tests: 3015 passed, 0 failed, 56 ignored; 28 skipped, the same as on main review: 1 high, 2 medium, 1 nit (below) performance: 60 s smoke run: 1683 → 1654 frames (98 % of main), peak commit 18505 → 18490 MB, no device removal, no crash title run: retail title on the RTX 5070 Ti (driver 621.14), into the world by scripted presses: 232 s there, 0 device removals, 0 crashes, 2.6 presents/s; run with `XCL_SKIP_CS=95cc13288a27a96e` (the NVIDIA hang at the end of loading, #3541) and NVIDIA's 2048 MB shader heap (#2590) verdict: not yet: 1 blocking finding (critical or high, below); also `PR description` is red hardware / tool and model: RTX 5070 Ti (driver 621.14), Ryzen 7 7800X3D, Windows 11 26300 / Claude Code with Claude Opus 5.5 --- **In short:** Changes the XMemAlloc graphics grain for page-size code 2 from 4 MiB to 2 MiB, with three unit tests and an updated test-title check. The arithmetic is fine. But after the change the same attribute means 2 MiB in XMemAlloc and 4 MiB in XMemVirtualAlloc, and nothing a reviewer can check says code 2 means 2 MiB, so it is not ready (the same point as the two earlier merge-checks). #### High 1. **Page-size code 2 means two sizes after the change.** xmem_graphics_layout (kernelx.rs ~1365) now uses a 2 MiB grain for code 2. XMemVirtualAlloc (~1480) still turns code 2 into type bit 0x8000_0000, which VirtualAlloc rounds and aligns to 4 MiB (~938, ~959). This guest-visible contract changes on the default path for every page-size-2 graphics allocation, and the only source given is "local GDK documentation"; bmjask's request (two reviews at this head) for a permitted source or a black-box comparison is still open. Change both paths with evidence, or neither, and say so in the description. #### Medium 2. **The test-title check does not pin the change.** tests/testtitle/src/main.rs ~351-356: a 4 MiB-aligned block from main also passes `% (2 << 20) == 0`, and the zero check reads a word 2 MiB past a 4 KiB request, so it relies on the rounding. Only the unit tests fail without the change. Limit the zero check to the 0x1000 bytes requested, and test the extent through the allocator (block_len) as the unit test does. 3. **Contradicts open #1343.** #1343's new test expects page size 2 to give 4 MiB alignment (`(2, 0, 4 << 20)`). Whichever PR lands second breaks the other's test or meaning. Settle the contract once. #### Nit 4. **Description and comment out of date.** **Tested** still says this head "has not been run individually" and **Regression run** says "Pending", though others have run it since. The new D3D_DISPLAY_TARGET comment (~1454) says the retail game's back buffers use 2 MiB pages, which nothing in the PR shows. <details><summary>Checked and fine</summary> - Overflow is checked (checked_next_multiple_of) and tested at the largest size - A larger explicit alignment is kept without enlarging the page grain (8 MiB case tested); codes 0, 1 and 3 are unchanged (tested) - The owned-Uma accounting test charges and releases the rounded size and frees each block once - Merges cleanly into current origin/main although 972 commits behind; xmem_graphics_layout is unchanged on main since the base, and main does not already do this - Memory per allocation can only go down </details> <details><summary>How this was tested</summary> - Merged onto main `16c2fd08`, then `cargo build --workspace` and `cargo test --workspace --no-fail-fast -- --test-threads=4`. - The skipped GPU tests are those this card can't run (no wave64 on NVIDIA, no D3D12 debug layer, and similar). - `scripts/smoke.ps1`: 60 s of a retail title on main `16c2fd08` and on this merge; presents per 2 s at the end: 61 60 60. - Title run: the release build of this merge launched the retail title with `XCL_RUN_SECONDS=300` and scripted A presses counted from the first frame (`XCL_PRESS_BASE=frame`, #3712) into the world from an existing save; time in the world is counted from the first in-world draw call to the end of the run. </details> <sub>Written by Claude Code (Claude Opus 5.5) and posted by Foniass without a human check of each point.</sub>
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/3092:upstream-pr/3092'
git switch 'upstream-pr/3092'

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/3092'
git switch 'upstream-pr/3092'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/3092'
git switch 'upstream-pr/3092'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/3092'
git switch 'main'
git merge --squash 'upstream-pr/3092'
git switch 'main'
git merge --ff-only 'upstream-pr/3092'
git switch 'main'
git merge 'upstream-pr/3092'
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!3092
No description provided.