kernelx: report the physical memory layout (XMemGetPhysicalMemoryLayout) #3316

Closed
illu0x wants to merge 1 commit from upstream-pr/3316 into main
illu0x commented 2026-11-29 07:38:04 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by illu0x on 2026-11-29T07:38:04Z.


Export XMemGetPhysicalMemoryLayout, which was auto-stubbed. A title that queries the split between standard- and GPU-optimal-bandwidth physical memory (XMEM_PHYSICAL_MEMORY_LAYOUT) now gets an answer instead of a stub. XCL has one memory pool with no bandwidth split on the PC, so both page numbers are 0 — all title memory counts as GPU-optimal from page 0, matching the single fast-memory pool XMemGetWorkingSetStatistics already reports. A null layout returns FALSE with ERROR_INVALID_PARAMETER.

Part of #1833.

What is in it

  • kernelx: report the physical memory layout (XMemGetPhysicalMemoryLayout) — new export, implementation and unit test, in crates/xcl/src/hle/kernelx.rs

Tested

  • Windows 11 x64, Rust stable-x86_64-pc-windows-msvc, debug; GPU AMD Radeon RX 6600
  • cargo test --workspace -- --test-threads=4: 2469 passed, 1 failed, 29 ignored, 0 SKIPPED
  • The new test hle::kernelx::tests::physical_memory_layout_writes_both_page_numbers passes.
  • The one failure, gpu::dxil::fuzz_tests::fuzz_validate_and_gpu_1, is a pre-existing RDNA2-only wave32 WaveReadLaneAt GPU/CPU mismatch (the documented amd_reduced_seeds family, HANDOFF.md). It fails identically on main with this change stashed, and is unrelated to kernelx.

Regression run
Both runs on one retail title (title id b41e6560), AMD RX 6600, 60 s measured, XCL_PREPARE=0 (pipelines built on demand; identical flags for both, so the comparison is fair):

xcl-smoke v1
commit: fa204595a488c60c6c5f905244f0172072c9c2a9
gpu: AMD Radeon RX 6600
title: b41e6560
seconds: 60
exit: 0x0
frames shown: 1501 (PresentX 1501)
presents per 2 s (last 3): 60 61 60
device removals: 0
crashes: 0
peak commit: 17206 MB
xcl-smoke v1
commit: e5776a9a7e0e16666891d7e526e9ccd970f6262a
gpu: AMD Radeon RX 6600
title: b41e6560
seconds: 60
exit: 0x0
frames shown: 1438 (PresentX 1438)
presents per 2 s (last 3): 60 60 61
device removals: 0
crashes: 0
peak commit: 18011 MB

Head vs main: 1438 / 1501 frames = 96%, peak commit 18011 / 17206 MB = 105%, no device removal, no crash. The title does not call XMemGetPhysicalMemoryLayout, so this is a no-regression check on the surrounding runtime rather than a test of the new path.

Not tested

  • NVIDIA, other titles, wave32-only GPUs
  • The new export against a title that actually calls it (none observed yet; this is header-contract completeness)

AI use

  • Claude Code with Claude Opus 4.8: wrote the code, the test, ran the tests and the regression runs, and wrote this description. The author has read and understands the diff.

🤖 Generated with Claude Code

<!-- greyfinch-sync:ivall/xcl:issue:5548691024 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3316). Originally posted by [illu0x](https://github.com/illu0x) on 2026-11-29T07:38:04Z. --- Export `XMemGetPhysicalMemoryLayout`, which was auto-stubbed. A title that queries the split between standard- and GPU-optimal-bandwidth physical memory (`XMEM_PHYSICAL_MEMORY_LAYOUT`) now gets an answer instead of a stub. XCL has one memory pool with no bandwidth split on the PC, so both page numbers are 0 — all title memory counts as GPU-optimal from page 0, matching the single fast-memory pool `XMemGetWorkingSetStatistics` already reports. A null layout returns FALSE with `ERROR_INVALID_PARAMETER`. Part of #1833. **What is in it** - `kernelx: report the physical memory layout (XMemGetPhysicalMemoryLayout)` — new export, implementation and unit test, in `crates/xcl/src/hle/kernelx.rs` **Tested** - Windows 11 x64, Rust `stable-x86_64-pc-windows-msvc`, debug; GPU AMD Radeon RX 6600 - `cargo test --workspace -- --test-threads=4`: 2469 passed, 1 failed, 29 ignored, 0 SKIPPED - The new test `hle::kernelx::tests::physical_memory_layout_writes_both_page_numbers` passes. - The one failure, `gpu::dxil::fuzz_tests::fuzz_validate_and_gpu_1`, is a pre-existing RDNA2-only wave32 `WaveReadLaneAt` GPU/CPU mismatch (the documented `amd_reduced_seeds` family, HANDOFF.md). It fails identically on `main` with this change stashed, and is unrelated to kernelx. **Regression run** Both runs on one retail title (title id `b41e6560`), AMD RX 6600, 60 s measured, `XCL_PREPARE=0` (pipelines built on demand; identical flags for both, so the comparison is fair): ``` xcl-smoke v1 commit: fa204595a488c60c6c5f905244f0172072c9c2a9 gpu: AMD Radeon RX 6600 title: b41e6560 seconds: 60 exit: 0x0 frames shown: 1501 (PresentX 1501) presents per 2 s (last 3): 60 61 60 device removals: 0 crashes: 0 peak commit: 17206 MB ``` ``` xcl-smoke v1 commit: e5776a9a7e0e16666891d7e526e9ccd970f6262a gpu: AMD Radeon RX 6600 title: b41e6560 seconds: 60 exit: 0x0 frames shown: 1438 (PresentX 1438) presents per 2 s (last 3): 60 60 61 device removals: 0 crashes: 0 peak commit: 18011 MB ``` Head vs main: 1438 / 1501 frames = 96%, peak commit 18011 / 17206 MB = 105%, no device removal, no crash. The title does not call `XMemGetPhysicalMemoryLayout`, so this is a no-regression check on the surrounding runtime rather than a test of the new path. **Not tested** - NVIDIA, other titles, wave32-only GPUs - The new export against a title that actually calls it (none observed yet; this is header-contract completeness) **AI use** - Claude Code with Claude Opus 4.8: wrote the code, the test, ran the tests and the regression runs, and wrote this description. The author has read and understands the diff. 🤖 Generated with [Claude Code](https://claude.com/claude-code)

Pull request closed

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!3316
No description provided.