kernelx: implement XMemIsToolsMemAvailable answering false on retail #858

Closed
n-romanovich wants to merge 1 commit from upstream-pr/864 into main
n-romanovich commented 2026-11-24 07:00:22 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by n-romanovich on 2026-11-24T07:00:22Z.


On retail consoles, devkit / tooling memory is not available, and
XMemIsToolsMemAvailable answers FALSE (0). Retail game executables
import this from xmem.dll to verify memory status during startup;
without an HLE export, XCL fell back to an unresolved stub.

Unit test covers the return value.

What is in it

  • crates/xcl/src/hle/kernelx.rs: implement XMemIsToolsMemAvailable returning 0, export in KERNELX_EXPORTS, and unit test xmem_tools_mem_unavailable_on_retail

Tested

  • Windows 11 (26300), D3D12 SM 6.6, Rust 1.100.0 MSVC
  • cargo test -p xcl --lib xmem_tools_mem_unavailable_on_retail: 1 passed, 0 failed
  • xcl inspect game_scarlett_master.exe: 587 functions from 68 DLLs, 0 unimplemented stubs (xmem.dll: 12 HLE, 0 stubs)

Regression run
Main (5478c4a7c1ae5adba127c8d27018d7fdbf3a8725):

xcl-smoke v1
commit: 5478c4a7c1ae5adba127c8d27018d7fdbf3a8725
gpu: NVIDIA GeForce RTX 5060 Ti
title: FILES
seconds: 60
exit: 0x0
frames shown: 1541 (PresentX 1541)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 15701 MB

PR (c371d6ec529be7423c8c0c5769655bc99e3fb674):

xcl-smoke v1
commit: c371d6ec529be7423c8c0c5769655bc99e3fb674
gpu: NVIDIA GeForce RTX 5060 Ti
title: FILES
seconds: 60
exit: 0x0
frames shown: 1516 (PresentX 1516)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 15436 MB

Not tested

  • Actual devkit hardware with physical tooling memory enabled

AI use

  • Antigravity, Gemini 4 Carbon
<!-- greyfinch-sync:ivall/xcl:issue:5467633121 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/864). Originally posted by [n-romanovich](https://github.com/n-romanovich) on 2026-11-24T07:00:22Z. --- On retail consoles, devkit / tooling memory is not available, and XMemIsToolsMemAvailable answers FALSE (0). Retail game executables import this from xmem.dll to verify memory status during startup; without an HLE export, XCL fell back to an unresolved stub. Unit test covers the return value. **What is in it** - `crates/xcl/src/hle/kernelx.rs`: implement `XMemIsToolsMemAvailable` returning 0, export in `KERNELX_EXPORTS`, and unit test `xmem_tools_mem_unavailable_on_retail` **Tested** - Windows 11 (26300), D3D12 SM 6.6, Rust 1.100.0 MSVC - `cargo test -p xcl --lib xmem_tools_mem_unavailable_on_retail`: 1 passed, 0 failed - `xcl inspect game_scarlett_master.exe`: 587 functions from 68 DLLs, 0 unimplemented stubs (`xmem.dll`: 12 HLE, 0 stubs) **Regression run** Main (`5478c4a7c1ae5adba127c8d27018d7fdbf3a8725`): ``` xcl-smoke v1 commit: 5478c4a7c1ae5adba127c8d27018d7fdbf3a8725 gpu: NVIDIA GeForce RTX 5060 Ti title: FILES seconds: 60 exit: 0x0 frames shown: 1541 (PresentX 1541) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 15701 MB ``` PR (`c371d6ec529be7423c8c0c5769655bc99e3fb674`): ``` xcl-smoke v1 commit: c371d6ec529be7423c8c0c5769655bc99e3fb674 gpu: NVIDIA GeForce RTX 5060 Ti title: FILES seconds: 60 exit: 0x0 frames shown: 1516 (PresentX 1516) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 15436 MB ``` **Not tested** - Actual devkit hardware with physical tooling memory enabled **AI use** - Antigravity, Gemini 4 Carbon
dcastell1 commented 2026-11-24 08:03:51 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by dcastell1 on 2026-11-24T07:50:58Z.


Verified on Windows 11 10.0.26300, NVIDIA GeForce RTX 5090 (driver 621.24), Rust 1.100.0 MSVC 14.44.35207, debug build, on clean main@beaa245 (713 passed, 0 failed, 41 ignored on this box):

patch -p1 < this PR            # clean, no fuzz
cargo test --workspace -- --test-threads=4
714 passed; 0 failed; 41 ignored   (exit 0)

One more passing test than main: XMemIsToolsMemAvailable answering false is covered; nothing else changes verdict.

Tree restored afterwards (md5 and a full diff against a clean checkout), hardware adapter, no Wine, no game data. AI-assisted (opencode): applied the patch to a built tree, ran the suite, reverted it.

<!-- greyfinch-sync:ivall/xcl:comment:7125439525 --> Imported from [ivall/xcl](https://github.com/ivall/xcl/pull/864#issuecomment-7125439525). Originally posted by [dcastell1](https://github.com/dcastell1) on 2026-11-24T07:50:58Z. --- Verified on Windows 11 10.0.26300, NVIDIA GeForce RTX 5090 (driver 621.24), Rust 1.100.0 MSVC 14.44.35207, debug build, on clean `main@beaa245` (713 passed, 0 failed, 41 ignored on this box): ``` patch -p1 < this PR # clean, no fuzz cargo test --workspace -- --test-threads=4 714 passed; 0 failed; 41 ignored (exit 0) ``` One more passing test than main: XMemIsToolsMemAvailable answering false is covered; nothing else changes verdict. Tree restored afterwards (md5 and a full diff against a clean checkout), hardware adapter, no Wine, no game data. AI-assisted (opencode): applied the patch to a built tree, ran the suite, reverted it.
n-romanovich commented 2026-11-24 08:03:54 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by n-romanovich on 2026-11-24T08:03:35Z.


Thanks for the review!

<!-- greyfinch-sync:ivall/xcl:comment:7125676807 --> Imported from [ivall/xcl](https://github.com/ivall/xcl/pull/864#issuecomment-7125676807). Originally posted by [n-romanovich](https://github.com/n-romanovich) on 2026-11-24T08:03:35Z. --- Thanks for the review!
SlopTart commented 2026-11-24 09:07:00 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by SlopTart on 2026-11-24T08:09:17Z.


Linux / AMD RDNA3 datapoint.

Merged state: head fa01b91 onto main 1ec4c98, clean merge.

Full suite, cargo test --workspace --release --no-fail-fast --target x86_64-pc-windows-gnu -- --test-threads=4: 706 passed, 10 failed, 41 ignored. Failures = the known Wine-lane set from my #42 rows plus #718 trio members and a hit of gpu_mirror_upload_follows_cpu_writes_and_later_mapping_changes (new flake, see #718 addendum). XMemIsToolsMemAvailable green.

Not tested: retail titles (none here), Windows, RDNA4.
Counts only, no game data.

Machine: RX 7900 XT (RADV NAVI31), Mesa 26.2.5, kernel 7.2 (Arch), Proton Experimental (wine-11.0), patched vkd3d-proton v3.1, Rust cross x86_64-pc-windows-gnu, XCL_NETWORK=0, release profile, --test-threads=4. My Linux rows: #42 / #718.

AI use: Hermes agent (local Qwen-class) ran the suite and drafted this; I checked it before posting.

<!-- greyfinch-sync:ivall/xcl:comment:7125789830 --> Imported from [ivall/xcl](https://github.com/ivall/xcl/pull/864#issuecomment-7125789830). Originally posted by [SlopTart](https://github.com/SlopTart) on 2026-11-24T08:09:17Z. --- Linux / AMD RDNA3 datapoint. **Merged state:** head `fa01b91` onto main `1ec4c98`, clean merge. **Full suite, `cargo test --workspace --release --no-fail-fast --target x86_64-pc-windows-gnu -- --test-threads=4`:** **706 passed, 10 failed, 41 ignored**. Failures = the known Wine-lane set from my #42 rows plus #718 trio members and a hit of `gpu_mirror_upload_follows_cpu_writes_and_later_mapping_changes` (new flake, see #718 addendum). `XMemIsToolsMemAvailable` green. **Not tested:** retail titles (none here), Windows, RDNA4. Counts only, no game data. **Machine:** RX 7900 XT (RADV NAVI31), Mesa 26.2.5, kernel 7.2 (Arch), Proton Experimental (wine-11.0), patched vkd3d-proton v3.1, Rust cross `x86_64-pc-windows-gnu`, `XCL_NETWORK=0`, release profile, `--test-threads=4`. My Linux rows: #42 / #718. AI use: Hermes agent (local Qwen-class) ran the suite and drafted this; I checked it before posting.
throny commented 2026-11-24 23:08:38 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by throny on 2026-11-24T22:59:07Z.


Two contributors checked independently and found that this PR makes the same change as #563: #1607, group D60. They suggest keeping #563. If you agree, closing this PR or joining the other one would save the maintainers a review. If the two differ in a way the checks missed, a note in #1607 helps.

This is a hint from the community triage in #1607, not a maintainer decision.

AI use: Claude Code (Claude Opus 5.5), posted by a script from the #1607 table.

<!-- greyfinch-sync:ivall/xcl:comment:7146875781 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/864#issuecomment-7146875781). Originally posted by [throny](https://github.com/throny) on 2026-11-24T22:59:07Z. --- <!-- xcl-1607-hint:D60 --> Two contributors checked independently and found that this PR makes the same change as #563: #1607, group D60. They suggest keeping #563. If you agree, closing this PR or joining the other one would save the maintainers a review. If the two differ in a way the checks missed, a note in #1607 helps. This is a hint from the community triage in #1607, not a maintainer decision. AI use: Claude Code (Claude Opus 5.5), posted by a script from the #1607 table.
JJAutoCompare commented 2026-11-25 06:05:58 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by JJAutoCompare on 2026-11-25T05:45:22Z.


Empirical test report (fa01b911)

Verified xcl-dev/xcl PR #864 at fa01b911183db09a92c5cdda669b1ec5fbdc8e09 in a clean detached worktree.

Hardware / environment

  • Windows x64 build 26200 on an AMD CPU (family 23, model 113, stepping 0) with 12 logical processors.
  • Rust 1.100.0 (0ef1bc386 2026-11-09) and DXC 1.9.2609.5 (01b62ad47). Cargo used the unoptimized test profile with debug info and incremental compilation disabled.
  • The focused run set XCL_ADAPTER=NONE_CPU_ONLY and RUST_TEST_NOCAPTURE=1. Both commands ran outside Invoke-ArcTest.ps1 without acquiring the Arc GPU mutex.

Commands and results

  • cargo test --workspace --no-run built the workspace test executables and exited with code 0.
  • cargo test -p xcl --lib xmem_tools_mem_unavailable_on_retail -- --nocapture exited with code 0. The captured harness summary reported 1 passed, 0 failed, 0 ignored, and 693 filtered out. A case-sensitive scan found 0 SKIPPED lines.
  • Both commands emitted a deprecation warning for AtomicU32::fetch_update in xgameruntime.

Observed behavior

The targeted test called XMemIsToolsMemAvailable() directly and verified that it returned 0 (FALSE). The function and test use no D3D12 or GPU calls.

Not tested

The full GPU workspace suite and game smoke runs were omitted. Title import resolution and startup were outside the scope of the direct unit test.

AI use

Verified with T3 Code / Codex (gpt-6.2-sol, reasoningEffort: high). Coordinator #2 (T3 Code / Antigravity, gemini-4-neon) verified counts against pr864-focused.log and published.

<!-- greyfinch-sync:ivall/xcl:comment:7154107937 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/864#issuecomment-7154107937). Originally posted by [JJAutoCompare](https://github.com/JJAutoCompare) on 2026-11-25T05:45:22Z. --- ### Empirical test report (fa01b911) Verified xcl-dev/xcl PR #864 at `fa01b911183db09a92c5cdda669b1ec5fbdc8e09` in a clean detached worktree. **Hardware / environment** - Windows x64 build 26200 on an AMD CPU (family 23, model 113, stepping 0) with 12 logical processors. - Rust `1.100.0 (0ef1bc386 2026-11-09)` and DXC `1.9.2609.5 (01b62ad47)`. Cargo used the unoptimized test profile with debug info and incremental compilation disabled. - The focused run set `XCL_ADAPTER=NONE_CPU_ONLY` and `RUST_TEST_NOCAPTURE=1`. Both commands ran outside `Invoke-ArcTest.ps1` without acquiring the Arc GPU mutex. **Commands and results** - `cargo test --workspace --no-run` built the workspace test executables and exited with code 0. - `cargo test -p xcl --lib xmem_tools_mem_unavailable_on_retail -- --nocapture` exited with code 0. The captured harness summary reported 1 passed, 0 failed, 0 ignored, and 693 filtered out. A case-sensitive scan found 0 `SKIPPED` lines. - Both commands emitted a deprecation warning for `AtomicU32::fetch_update` in `xgameruntime`. **Observed behavior** The targeted test called `XMemIsToolsMemAvailable()` directly and verified that it returned `0` (`FALSE`). The function and test use no D3D12 or GPU calls. **Not tested** The full GPU workspace suite and game smoke runs were omitted. Title import resolution and startup were outside the scope of the direct unit test. **AI use** Verified with T3 Code / Codex (gpt-6.2-sol, reasoningEffort: high). Coordinator #2 (T3 Code / Antigravity, gemini-4-neon) verified counts against `pr864-focused.log` and published.
DavidM1911 commented 2026-11-25 10:10:43 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by DavidM1911 on 2026-11-25T10:02:21Z.


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:7159138946 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/864#issuecomment-7159138946). Originally posted by [DavidM1911](https://github.com/DavidM1911) on 2026-11-25T10:02:21Z. --- 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!
github-actions[bot] commented 2026-11-29 20:41:48 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by github-actions[bot] on 2026-11-29T20:41:48Z.


Nothing has happened on this PR for 3 days, so it is marked stale and will be closed in 4 days. A push or a comment takes the mark off: rebase it onto main if it conflicts, and say in one line what it still fixes. If it only waits for a maintainer, a comment saying so is enough.

<!-- greyfinch-sync:ivall/xcl:comment:7262285209 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/864#issuecomment-7262285209). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-11-29T20:41:48Z. --- Nothing has happened on this PR for 3 days, so it is marked `stale` and will be closed in 4 days. A push or a comment takes the mark off: rebase it onto `main` if it conflicts, and say in one line what it still fixes. If it only waits for a maintainer, a comment saying so is enough.
Foniass commented 2026-12-01 04:21:16 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Foniass on 2026-12-01T04:21:16Z.


Triage (#1607) – head c371d6e

#563 is merged (commit 70f9fce): kernelx.rs on main already has XMemIsToolsMemAvailable returning 0, routes it through xmem.dll, and tests it in xmem_is_tools_mem_available_returns_false. Against current main this PR only adds xmem_tools_mem_unavailable_on_retail, which asserts the same thing again.
Recommendation: close (superseded by #563 / main commit 70f9fce).

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:7300648456 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/864#issuecomment-7300648456). Originally posted by [Foniass](https://github.com/Foniass) on 2026-12-01T04:21:16Z. --- **Triage (#1607)** – head c371d6e #563 is merged (commit 70f9fce): kernelx.rs on main already has XMemIsToolsMemAvailable returning 0, routes it through xmem.dll, and tests it in xmem_is_tools_mem_available_returns_false. Against current main this PR only adds xmem_tools_mem_unavailable_on_retail, which asserts the same thing again. Recommendation: close (superseded by #563 / main commit 70f9fce). AI review: Claude Code (Claude Opus 5.5), diffs read only, not built or run; not checked by a human.
BBareth commented 2026-12-01 09:38:48 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by BBareth on 2026-12-01T09:38:48Z.


merge-check claim
head: c371d6ec52

<!-- greyfinch-sync:ivall/xcl:comment:7307000780 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/864#issuecomment-7307000780). Originally posted by [BBareth](https://github.com/BBareth) on 2026-12-01T09:38:48Z. --- merge-check claim head: c371d6ec529be7423c8c0c5769655bc99e3fb674
BBareth commented 2026-12-01 09:59:55 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by BBareth on 2026-12-01T09:59:55Z.


merge-check
base: 493dbd3dd0
head: c371d6ec52
merge: clean
build: cargo build --workspace -> ok
tests: cargo test --workspace --no-fail-fast -- --test-threads=4 -> 2901 passed, 0 failed, 51 ignored; 28 SKIPPED lines, as on the base; failing: none. The base alone, same machine, same commit: 2900 passed, 0 failed, 51 ignored, 28 SKIPPED lines (22 no wave64, 2 no heap windows, 2 no d3d12SDKLayers.dll, 1 no D3D12 debug layer, 1 cannot disable the driver cache). The new test xmem_tools_mem_unavailable_on_retail ran and passed.
review: no blocking finding; one file (+7/-0), every line read. The merge result adds only a unit test: XMemIsToolsMemAvailable is already on main (kernelx.rs) and already answers 0, so the title of this PR ("implement ...") no longer describes what it changes. The test pins that answer. If the maintainer wants it, it is safe; it could as well be closed as already done.
performance: none: test code only.
verdict: safe to merge
hardware / tool and model: RTX 5070 Ti 16 GB, driver 621.24 (32.0.16.2124); i7-12700K; Windows 11 26200. Claude Code, Claude Fable 5.2 read the diff, ran the build and the suite and wrote this check.

<!-- greyfinch-sync:ivall/xcl:comment:7307514861 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/864#issuecomment-7307514861). Originally posted by [BBareth](https://github.com/BBareth) on 2026-12-01T09:59:55Z. --- merge-check base: 493dbd3dd0cd50b4c3e8d28f73ab9b504fcd8158 head: c371d6ec529be7423c8c0c5769655bc99e3fb674 merge: clean build: cargo build --workspace -> ok tests: cargo test --workspace --no-fail-fast -- --test-threads=4 -> 2901 passed, 0 failed, 51 ignored; 28 SKIPPED lines, as on the base; failing: none. The base alone, same machine, same commit: 2900 passed, 0 failed, 51 ignored, 28 SKIPPED lines (22 no wave64, 2 no heap windows, 2 no d3d12SDKLayers.dll, 1 no D3D12 debug layer, 1 cannot disable the driver cache). The new test `xmem_tools_mem_unavailable_on_retail` ran and passed. review: no blocking finding; one file (+7/-0), every line read. The merge result adds only a unit test: `XMemIsToolsMemAvailable` is already on `main` (kernelx.rs) and already answers 0, so the title of this PR ("implement ...") no longer describes what it changes. The test pins that answer. If the maintainer wants it, it is safe; it could as well be closed as already done. performance: none: test code only. verdict: safe to merge hardware / tool and model: RTX 5070 Ti 16 GB, driver 621.24 (32.0.16.2124); i7-12700K; Windows 11 26200. Claude Code, Claude Fable 5.2 read the diff, ran the build and the suite and wrote this check.
throny commented 2026-12-01 12:40:10 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by throny on 2026-12-01T12:40:10Z.


Closing as superseded: this change is already on main (70f9fce). XMemIsToolsMemAvailable returning 0 is on main (70f9fce); main test xmem_is_tools_mem_available_returns_false is the same assert; PR only adds a second copy of it

Two independent checks found this: Foniass's close list on #1607 and ours against current main. If something here is still missing on main, say so and reopen it, or ask and I will.

AI use: Claude Code (Claude Opus 5.5); the per-PR comparison was done by Claude Sonnet 5.5 sub-agents.

<!-- greyfinch-sync:ivall/xcl:comment:7311474677 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/864#issuecomment-7311474677). Originally posted by [throny](https://github.com/throny) on 2026-12-01T12:40:10Z. --- Closing as superseded: this change is already on `main` (70f9fce). XMemIsToolsMemAvailable returning 0 is on main (70f9fce); main test xmem_is_tools_mem_available_returns_false is the same assert; PR only adds a second copy of it Two independent checks found this: Foniass's close list on #1607 and ours against current `main`. If something here is still missing on `main`, say so and reopen it, or ask and I will. AI use: Claude Code (Claude Opus 5.5); the per-PR comparison was done by Claude Sonnet 5.5 sub-agents.

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