kernelx: title memory is not made uncached or write-combined on the PC #3300

Merged
Foniass merged 1 commit from upstream-pr/3300 into main 2026-11-29 12:21:22 +00:00
Foniass commented 2026-11-29 06:51:09 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Foniass on 2026-11-29T06:51:09Z.


The title's protections may carry PAGE_NOCACHE (0x200) or
PAGE_WRITECOMBINE (0x400): on the console that is how GPU-visible
memory is mapped. sanitize_protect passed them on to Windows, so the
CPU's own reads of those pages were uncached, and XCL reads title
memory a lot (texture and buffer uploads compare and copy it). The
protection given to Windows now keeps the standard access bits and
PAGE_GUARD only.

From amd-dev 108cbafa (raylitebull), split out of it: that commit also
decodes XMemVirtualAlloc's flags (which raised the retail title's peak
commit from about 16 to 27 GB on an RTX 5070 Ti, left out) and stops
counting PAGE_GRAPHICS_NOACCESS as GPU-visible (a PR of its own).

What is in it

  • crates/xcl/src/hle/kernelx.rs: STD_PROTECT_MASK = standard access bits + PAGE_GUARD; sanitize_protect asserts for 0x2404, 0x1204 and PAGE_GUARD

Tested

  • NVIDIA GeForce RTX 5070 Ti (driver 32.0.16.2114), AMD Ryzen 7 7800X3D, Windows 11 build 26300, Rust 1.100.0 (stable-x86_64-pc-windows-msvc), debug tests, release smoke
  • cargo test --workspace --no-fail-fast -- --test-threads=4 on 5f3e7250: 2604 passed, 4 failed, 49 ignored. The 4 failures are gpu::dxil::fuzz_tests::fuzz_validate_and_gpu_0..3 (E_OUTOFMEMORY from CreateComputePipelineState, seeds 70 / 545 / 1019 / 1507), the same as on main on this machine; they pass on another RTX 5070 Ti. SKIPPED GPU tests: 44 notices, almost all no wave64.
  • Retail title: 60 s smoke run below (no device removal or crash, frames and peak commit within the limits).

Regression run

main:

xcl-smoke v1
commit: b10cc4c6766adc947c2054ada4a2af98be15108d
gpu: NVIDIA GeForce RTX 5070 Ti
title: 3cb1d8e0
seconds: 60
exit: 0x0
frames shown: 1565 (PresentX 1565)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 16026 MB

this PR:

xcl-smoke v1
commit: 5f3e7250554aefdc2de7f29889a221ed16d2290b
gpu: NVIDIA GeForce RTX 5070 Ti
title: 3cb1d8e0
seconds: 60
exit: 0x0
frames shown: 1670 (PresentX 1670)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 16881 MB

Not tested

  • a title whose CPU reads of write-combined memory were slow (not measured)
  • the third part of the amd-dev commit (XMemVirtualAlloc flag decoding) is left out: on an RTX 5070 Ti it raised the retail title's peak commit from about 17 to 27.7 GB in a 60 s run
  • AMD GPUs

AI use

  • Claude Code with Claude Opus 5.5: ported this part of the amd-dev commit named above to main, wrote the commit message and this description, ran the tests and the smoke run.

🤖 Generated with Claude Code

<!-- greyfinch-sync:ivall/xcl:issue:5548403129 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3300). Originally posted by [Foniass](https://github.com/Foniass) on 2026-11-29T06:51:09Z. --- The title's protections may carry PAGE_NOCACHE (0x200) or PAGE_WRITECOMBINE (0x400): on the console that is how GPU-visible memory is mapped. sanitize_protect passed them on to Windows, so the CPU's own reads of those pages were uncached, and XCL reads title memory a lot (texture and buffer uploads compare and copy it). The protection given to Windows now keeps the standard access bits and PAGE_GUARD only. From amd-dev 108cbafa (raylitebull), split out of it: that commit also decodes XMemVirtualAlloc's flags (which raised the retail title's peak commit from about 16 to 27 GB on an RTX 5070 Ti, left out) and stops counting PAGE_GRAPHICS_NOACCESS as GPU-visible (a PR of its own). **What is in it** - `crates/xcl/src/hle/kernelx.rs`: `STD_PROTECT_MASK` = standard access bits + PAGE_GUARD; `sanitize_protect` asserts for 0x2404, 0x1204 and PAGE_GUARD **Tested** - NVIDIA GeForce RTX 5070 Ti (driver 32.0.16.2114), AMD Ryzen 7 7800X3D, Windows 11 build 26300, Rust 1.100.0 (stable-x86_64-pc-windows-msvc), debug tests, release smoke - `cargo test --workspace --no-fail-fast -- --test-threads=4` on 5f3e7250: 2604 passed, 4 failed, 49 ignored. The 4 failures are `gpu::dxil::fuzz_tests::fuzz_validate_and_gpu_0..3` (`E_OUTOFMEMORY` from `CreateComputePipelineState`, seeds 70 / 545 / 1019 / 1507), the same as on main on this machine; they pass on another RTX 5070 Ti. SKIPPED GPU tests: 44 notices, almost all `no wave64`. - Retail title: 60 s smoke run below (no device removal or crash, frames and peak commit within the limits). **Regression run** main: ``` xcl-smoke v1 commit: b10cc4c6766adc947c2054ada4a2af98be15108d gpu: NVIDIA GeForce RTX 5070 Ti title: 3cb1d8e0 seconds: 60 exit: 0x0 frames shown: 1565 (PresentX 1565) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 16026 MB ``` this PR: ``` xcl-smoke v1 commit: 5f3e7250554aefdc2de7f29889a221ed16d2290b gpu: NVIDIA GeForce RTX 5070 Ti title: 3cb1d8e0 seconds: 60 exit: 0x0 frames shown: 1670 (PresentX 1670) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 16881 MB ``` **Not tested** - a title whose CPU reads of write-combined memory were slow (not measured) - the third part of the amd-dev commit (XMemVirtualAlloc flag decoding) is left out: on an RTX 5070 Ti it raised the retail title's peak commit from about 17 to 27.7 GB in a 60 s run - AMD GPUs **AI use** - Claude Code with Claude Opus 5.5: ported this part of the amd-dev commit named above to main, wrote the commit message and this description, ran the tests and the smoke run. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Kalmarv commented 2026-11-29 07:54:03 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Kalmarv on 2026-11-29T07:54:03Z.


merge-check
base: fa204595
head: 5f3e7250
verdict: safe to merge

Merged cleanly onto origin/main (fa204595) in a 5-PR batch (#3288, #3290, #3292, #3294, #3300) and verified on NVIDIA GeForce RTX 5070 Ti with DXC 1.9.2609.5:

  • Targeted hle::kernelx::tests (with --test-threads=1): all passed.
  • gpu::: 853 passed, 0 failed, 24 ignored (10.45 s, including fuzz_validate_and_gpu_0..3).
  • hle::d3d12x:: (--test-threads=1, skipping 2 known main #3187 uma_driver mixed-window tests): 1144 passed, 0 failed, 3 ignored (30.21 s).
  • Remaining xcl --lib (--test-threads=1): 0 failed.
  • -p xcl --test e2e (after rebuilding xcl-testtitle): 5 passed, 0 failed (including D3D12 debug layer + DRED).
  • GitHub CI (Build and test (Windows, no GPU) and PR description): green.
<!-- greyfinch-sync:ivall/xcl:comment:7252760103 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3300#issuecomment-7252760103). Originally posted by [Kalmarv](https://github.com/Kalmarv) on 2026-11-29T07:54:03Z. --- merge-check base: fa204595 head: 5f3e7250 verdict: safe to merge Merged cleanly onto `origin/main` (`fa204595`) in a 5-PR batch (`#3288`, `#3290`, `#3292`, `#3294`, `#3300`) and verified on NVIDIA GeForce RTX 5070 Ti with DXC 1.9.2609.5: - Targeted `hle::kernelx::tests` (with `--test-threads=1`): all passed. - `gpu::`: 853 passed, 0 failed, 24 ignored (10.45 s, including `fuzz_validate_and_gpu_0..3`). - `hle::d3d12x::` (`--test-threads=1`, skipping 2 known `main` `#3187` `uma_driver` mixed-window tests): 1144 passed, 0 failed, 3 ignored (30.21 s). - Remaining `xcl --lib` (`--test-threads=1`): 0 failed. - `-p xcl --test e2e` (after rebuilding `xcl-testtitle`): 5 passed, 0 failed (including D3D12 debug layer + DRED). - GitHub CI (`Build and test (Windows, no GPU)` and `PR description`): green.
throny commented 2026-11-29 09:21:25 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by throny on 2026-11-29T09:21:25Z.


merge-check claim
head: 5f3e725055

<!-- greyfinch-sync:ivall/xcl:comment:7253708147 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3300#issuecomment-7253708147). Originally posted by [throny](https://github.com/throny) on 2026-11-29T09:21:25Z. --- merge-check claim head: 5f3e7250554aefdc2de7f29889a221ed16d2290b
throny commented 2026-11-29 09:36:13 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by throny on 2026-11-29T09:36:13Z.


merge-check
base: d8bd9a38
head: 5f3e725055
merge: clean
build: cargo build --workspace -> ok
tests: cargo test --workspace --no-fail-fast -- --test-threads=4 -> 2618 passed, 0 failed, 49 ignored (27 SKIPPED lines). Base alone at d8bd9a38: 2618 passed, 0 failed, 49 ignored.
review: no finding. PAGE_NOCACHE and PAGE_WRITECOMBINE are dropped by the standard protection mask, so every allocation, protection change, commit and placeholder path strips them; PAGE_GUARD stays. Nothing in crates/xcl/src tests these two bits. The changed asserts fail on main.
performance: not measured here.
verdict: safe to merge
hardware / tool and model: RTX 4080 16 GB (621.40), i9-12900K, Windows 11 26300, Rust 1.100.0, debug. Claude Code; merge, build and suite run by Claude Fable 5.2, diff review by Claude Opus 5.5 (every hunk read; nothing run on the GPU beyond the suite).

<!-- greyfinch-sync:ivall/xcl:comment:7253873174 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3300#issuecomment-7253873174). Originally posted by [throny](https://github.com/throny) on 2026-11-29T09:36:13Z. --- merge-check base: d8bd9a38 head: 5f3e7250554aefdc2de7f29889a221ed16d2290b merge: clean build: cargo build --workspace -> ok tests: cargo test --workspace --no-fail-fast -- --test-threads=4 -> 2618 passed, 0 failed, 49 ignored (27 SKIPPED lines). Base alone at d8bd9a38: 2618 passed, 0 failed, 49 ignored. review: no finding. PAGE_NOCACHE and PAGE_WRITECOMBINE are dropped by the standard protection mask, so every allocation, protection change, commit and placeholder path strips them; PAGE_GUARD stays. Nothing in crates/xcl/src tests these two bits. The changed asserts fail on main. performance: not measured here. verdict: safe to merge hardware / tool and model: RTX 4080 16 GB (621.40), i9-12900K, Windows 11 26300, Rust 1.100.0, debug. Claude Code; merge, build and suite run by Claude Fable 5.2, diff review by Claude Opus 5.5 (every hunk read; nothing run on the GPU beyond the suite).
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!3300
No description provided.