Skip to content

xcl run: add opt-in XCL_TITLE_COMMIT_CAP_MB job memory limit (#1566) - #1831

Open
fixgep wants to merge 2 commits into
xcl-dev:mainfrom
fixgep:feat/title-commit-cap-mb
Open

fixgep wants to merge 2 commits into
xcl-dev:mainfrom
fixgep:feat/title-commit-cap-mb

Conversation

@fixgep

@fixgep fixgep commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

Adds an opt-in process commit cap via XCL_TITLE_COMMIT_CAP_MB (disabled when unset or 0) as an outer native-Windows safety fuse against runaway commit, plus OOM diagnostics when the cap is active. When set to a positive MiB value on native Windows, the host verifies JOB_OBJECT_LIMIT_PROCESS_MEMORY enforcement (failing closed on Wine via ntdll!wine_get_version or unless a guarded xcl.exe child probe exits 0 after confirming VirtualAlloc is constrained), creates and assigns a Windows Job Object (ProcessMemoryLimit = cap_mb * 1024 * 1024) before mapping or starting the title, keeps the handle alive for the host run, logs a clear diagnostic naming XCL_TITLE_COMMIT_CAP_MB and current process commit on D3D12 heap OOM refusals, and records allocation-free failure details in xcl.log and report.json before fatal Rust OOM fail-fast (0xc0000409). When enforcement is unsupported or cannot be verified (such as Wine/Linux or probe failure), XCL warns and leaves the cap inactive so logs and crash/OOM reports never advertise an unenforced limit. Part of #1566.

What is in it

  • crates/xcl/src/config.rs: ENV_TITLE_COMMIT_CAP_MB, parse_title_commit_cap_mb, title_commit_cap_mb_from_env, documentation noting native Windows Job Object dependency vs Linux cgroup MemoryMax / external free-RAM guards, and unit tests for unset/zero/positive/invalid values.
  • crates/xcl/src/host.rs, crates/xcl/src/main.rs, crates/xcl/src/util.rs: CommitCapJob, apply_commit_cap_mb, apply_commit_cap_from_env, check_commit_cap_enforcement (under_wine() check + fail-closed XCL_COMMIT_CAP_PROBE child probe via probe_commit_cap_enforcement, probe_commit_cap_enforcement_with, interpret_commit_cap_probe_outcome, and commit_cap_probe_main), active_commit_cap_mb, current_process_commit_bytes / current_process_commit_mb, format_commit_cap_oom, log_commit_cap_if_active, StackBuf, and unit/subprocess tests verifying uncapped vs 64 MB capped VirtualAlloc/Vec::try_reserve, unsupported/Wine fail-closed behavior, strict exit-0 probe status decoding (commit_cap_probe_requires_exit_zero), probe exit status, and OOM formatting.
  • crates/xcl/src/hle/d3d12x/vram.rs, crates/xcl/src/hle/d3d12x/sparse.rs, crates/xcl/src/hle/d3d12x/real.rs: log XCL_TITLE_COMMIT_CAP_MB, the configured cap MiB, and current process commit MiB when CreateHeap / CreateHeap1 fails with OOM while the cap is active.
  • crates/xcl/src/hooks.rs, crates/xcl/src/eh.rs, crates/xcl/src/log.rs, crates/xcl/src/report.rs: hook std::alloc::handle_alloc_error via hook_addr, write an allocation-free emergency line to xcl.log (write_emergency) and an allocation-free report.json (write_emergency_alloc_error using pre-cached startup metadata and StackBuf) before 0xc0000409 fail-fast, with unit and subprocess tests (asserting active cap reporting on native Windows and no inactive cap advertisement on Wine).
  • README.md: document XCL_TITLE_COMMIT_CAP_MB=N, its hard-limit outer safety-fuse behavior, and the requirement for Linux cgroup MemoryMax and/or external free-RAM guards under Wine/Linux.

Tested

  • Hardware & toolchain: NVIDIA GeForce RTX 3060 (driver 32.0.15.9144), AMD Ryzen 5 7500F 6-Core Processor, Windows 10.0.26200.0, rustc 1.100.0 (0ef1bc386 2026-11-09), debug (cargo test) & release (cargo build --release -p xcl).
  • cargo build --workspace and cargo build --release -p xcl: succeeded with zero new compiler warnings (3 pre-existing warnings: Atomic::fetch_update deprecation in real.rs and xgameruntime/mod.rs, RetiringBatch::heaps dead-code warning in vram.rs).
  • Targeted unit/subprocess tests on c8301f11:
    • cargo test -p xcl --lib commit_cap -- --nocapture --test-threads=1: 8 passed, 0 failed, 0 ignored (title_commit_cap_mb_parsing, alloc_error_hook_logs_active_commit_cap_and_writes_report, commit_cap_probe_reports_host_enforcement, commit_cap_probe_requires_exit_zero, commit_cap_query_and_oom_formatting, rejects_zero_and_overflow_commit_cap, title_commit_cap_enforced_only_when_positive, unsupported_commit_cap_enforcement_fails_closed).
    • cargo test -p xcl --lib host -- --test-threads=4: 9 passed, 0 failed, 0 ignored.
    • cargo test -p xcl --lib emergency_oom_report -- --test-threads=1: 1 passed, 0 failed, 0 ignored.
    • XCL_COMMIT_CAP_PROBE=1 on release xcl.exe: exited 0.
  • cargo test --workspace --no-fail-fast -- --test-threads=4: 1454 passed, 1 failed (gpu::recomp::tests::gpu_clamp_and_omod_per_instruction on lane 0 v_pk_add_i16 clamp, pre-existing on RTX 3060), 47 ignored (SKIPPED GPU/driver-cache/heap tests: 21 no wave64, 3 refused wave32 per-lane in gpu::recomp::lower_dxil::tests, 1 cannot disable the driver cache in shaders::tests::pso_measurement_compiles_an_exact_synthetic_record, 1 no heap windows in heap_window_out_of_memory_falls_back_to_the_switch_form; XCL_SAMPLE_* tests skipped sample bodies because those env vars are unset).

Regression run

main:


xcl-smoke v1
commit: 8b957bec6f82495aec940944c6bf47faa02db590
gpu: NVIDIA GeForce RTX 3060
title: 3c290c16
seconds: 60
exit: 0x0
frames shown: 1528 (PresentX 1528)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 14185 MB

PR:


xcl-smoke v1
commit: c8301f1112feee260d378af96ea072f5d2fe7e8a
gpu: NVIDIA GeForce RTX 3060
title: 3c290c16
seconds: 60
exit: 0x0
frames shown: 1568 (PresentX 1568)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 13987 MB

Not tested

  • Wine / Linux host run on the updated code (the Wine and probe-failure branches in host.rs and eh.rs were verified on Windows via unsupported_commit_cap_enforcement_fails_closed and commit_cap_probe_requires_exit_zero, and native under_wine() == false paths ran end-to-end).
  • AMD / wave64 GPUs (no wave64 on RTX 3060) and XCL_SAMPLE_* retail test inputs.
  • Long multi-minute retail runs hitting a positive XCL_TITLE_COMMIT_CAP_MB limit (covered via synthetic 64 MiB subprocess tests).

AI use

  • Antigravity (Gemini 4 Hydrogen): rebased onto upstream/main, made probe_commit_cap_enforcement strictly fail-closed on non-zero/error probe outcomes with unit tests, ran builds, workspace/targeted tests, release probe check, and smoke runs, and updated the PR description.

@gabrielsteglich

Copy link
Copy Markdown

Independent Windows/NVIDIA validation of the commit cap.

I merged PR head f0dbb087f3ec781bc740c816404f723fd7cd4e20 onto main at 1d027e5c76c9a86a7ee2ca1cc677edf0be95d331 locally, producing 1336bdceaa1ba6063b941d6132a51ff44df694af.

  • Windows 11 Pro build 26300, Intel Core i9-13900K, NVIDIA GeForce RTX 3090 (621.01), Rust 1.97.0 MSVC, and DXC 1.9.2602.17. Debug builds.
  • cargo test --offline --locked -p xcl --lib title_commit_cap -- --test-threads=4 --show-output passed both tests. title_commit_cap_mb_parsing and title_commit_cap_enforced_only_when_positive passed, including the capped and uncapped subprocess cases.
  • cargo build --offline --locked --workspace succeeded. cargo test --offline --locked --workspace --no-fail-fast -- --test-threads=4 --show-output reported 962 passed, 0 failed, and 43 ignored. Cargo's pass count includes cases that returned early. Optional sample-data tests were disabled.
24 SKIPPED messages
SKIPPED gpu::recomp::lower::tests::a_2d_or_3d_group_agrees_with_the_hlsl_path_on_the_gpu: no wave64
SKIPPED gpu::recomp::lower::tests::cross_lane_reads_agree_with_the_hlsl_path_on_the_gpu: no wave64
SKIPPED gpu::recomp::lower::tests::coalesced_guarded_runs_agree_with_the_hlsl_path_on_the_gpu: no wave64
SKIPPED gpu::recomp::lower::tests::the_wave64_lowering_agrees_with_the_hlsl_path_on_the_gpu: no wave64
SKIPPED gpu::recomp::lower_dxil::tests::a_per_lane_2d_or_3d_group_runs_on_the_gpu: no wave64
SKIPPED gpu::recomp::lower_dxil::tests::f16_programs_on_the_gpu: f16 arithmetic, wave32, per-lane form: refused (unsupported V_MUL_F16 (its #1426 semantics differ from the console's))
SKIPPED gpu::recomp::lower_dxil::tests::f16_programs_on_the_gpu: f16 arithmetic, wave64: no wave64
SKIPPED gpu::recomp::lower_dxil::tests::f32_programs_on_the_gpu: f32 arithmetic, wave64: no wave64
SKIPPED gpu::recomp::lower_dxil::tests::f16_programs_on_the_gpu: f16 packed, wave32, per-lane form: refused (unsupported V_PK_MUL_F16: VOP3 modifiers (its #1426 semantics differ from the console's))
SKIPPED gpu::recomp::lower_dxil::tests::f16_programs_on_the_gpu: f16 packed, wave64: no wave64
SKIPPED gpu::recomp::lower_dxil::tests::f32_programs_on_the_gpu: f32 compares, wave64: no wave64
SKIPPED gpu::recomp::lower_dxil::tests::integer_programs_on_the_gpu: integer arithmetic, wave64: no wave64
SKIPPED gpu::recomp::lower_dxil::tests::f32_programs_on_the_gpu: f32 conversions, wave32, per-lane form: refused (unsupported V_CVT_F16_F32 (its #1426 semantics differ from the console's))
SKIPPED gpu::recomp::lower_dxil::tests::f32_programs_on_the_gpu: f32 conversions, wave64: no wave64
SKIPPED gpu::recomp::lower_dxil::tests::f64_programs_on_the_gpu: f64, wave64: no wave64
SKIPPED gpu::recomp::lower_dxil::tests::integer_programs_on_the_gpu: integer carries, wave64: no wave64
SKIPPED gpu::recomp::lower_dxil::tests::f32_programs_on_the_gpu: f32 rounding, wave64: no wave64
SKIPPED gpu::recomp::lower_dxil::tests::f32_programs_on_the_gpu: f32 transcendentals, wave64: no wave64
SKIPPED gpu::recomp::lower_dxil::tests::f32_programs_on_the_gpu: f32 three-source, wave64: no wave64
SKIPPED gpu::recomp::tests::gpu_geometry_wave32_prefix_count_over_a_mask: no wave64
SKIPPED gpu::recomp::tests::gpu_wave32_program_in_wave64_hardware: no wave64
SKIPPED test_title_draws_with_a_root_signature_under_the_debug_layer: no d3d12SDKLayers.dll
SKIPPED heap_window_out_of_memory_falls_back_to_the_switch_form: no heap windows
SKIPPED uploads_start_from_each_subresources_state: no D3D12 debug layer (The application requested an operation that depends on an SDK component that is missing or mismatched. (0x887A002D))

The validation used synthetic tests. Startup and world loading with the cap enabled remain untested on this machine.

AI use — OpenAI's coding agent with GPT-6 ran the local validation and drafted this report.

@tikD1337

Copy link
Copy Markdown

Test report on a local merge of main 20cf130 + #1809, #1852, #1798 and this PR (release build).

Setup: NVIDIA GeForce RTX 4070 Ti SUPER 16 GB, driver 621.01, 31.6 GB RAM, Windows 11 Pro. Retail title, XCL_TITLE_COMMIT_CAP_MB=24000.

What happened

  • xcl.log confirms the cap: process commit cap: 24000 MB (XCL_TITLE_COMMIT_CAP_MB).
  • At 61.15–61.25 s, 28 × CreateHeap(0x4000000 bytes, type 1, alignment 0x0, flags 0x0) refused (0x8007000e), each followed by no video memory for more pages of title textures (0x8007000E). Those are the last lines of the log.
  • Then the process ended with 0xC0000409. There is no process ends with status line and no thread dump in xcl.log, and report.json has "crash": null, "exit_code": null.

What it does not show: whether the 24 GB was really reached or the limit counts more than the title's own commit. The same build without the cap grew by about 30 GB of commit in 100 s in the next two runs, and an external guard stopped them. So the cap likely did stop real growth here.

Two points for this PR

  1. A refusal by the job limit reaches the log as "no video memory", and the cap is not named. A line saying that an allocation failed while the cap is set, with the process's commit at that moment, would tell the two apart.
  2. Reaching the cap ends the title with a fail-fast and no report, so xcl.log and report.json do not say why the run ended.

No game data is included. The report was written with Claude Code (Claude Opus 5.5) from the run's xcl.log and report.json; the run was done by the person posting.

@zorde23

zorde23 commented Nov 25, 2026

Copy link
Copy Markdown

Test report on an AMD RX 6750 XT (12 GB, driver 32.0.21045.29003), Ryzen 7 5700X, 32 GB RAM (45 GB commit limit), Windows build 26200, release build.

What was tested: f0dbb08 cherry-picked onto main 80f4819 (one conflict in config.rs, where #1053 added parse_device_type at the same place; kept both). XCL_TITLE_COMMIT_CAP_MB=20480. The same build also had local diagnostics (memory by kind, a commit guard), which are also in the main run it is compared with.

Run: the retail title, 300 s, A pressed at 15-35 s to reach the world, XCL_PSO_PRELOAD=0, XCL_ACTIVITY=1.

main 80f4819 with #1831 at 20,480 MB
end stopped by my guard at 150 s (system commit) exit 0xC0000409 at 110 s
frames drop to 0-20 per 2 s at 76 s 79 s
process commit at 96 s 21.9 GB 20.5 GB
local video memory at 96 s 10.5 GB 9.2 GB

Not tested: other caps, NVIDIA, a full cargo test --workspace on this build.

Written with Claude Code from runs on this machine.

@DavidM1911

Copy link
Copy Markdown
Contributor

Verification on RTX 3060 Ti (Windows 11), branch merged with current main:

Thanks!

@thiagocalile

Copy link
Copy Markdown

Tested commit f0dbb08 locally merged onto main 62265d3 (1-spot conflict in crates/xcl/src/config.rs with #1053's parse_device_type) on an AMD Radeon RX 6600 (8 GB VRAM, native wave64).

Tested

  • Hardware: AMD Radeon RX 6600 (8146 MiB VRAM, RDNA2, driver 32.0.21045.29003; XCL_ADAPTER=radeon), Ryzen 7 5700X3D, 47.9 GB RAM, Windows 11 (26200), Rust 1.100.0 MSVC, DXC 1.8.2502.11.
  • XCL_ADAPTER=radeon cargo test -p xcl --lib title_commit_cap -- --nocapture: 2 passed, 0 failed, 0 ignored (0.04 s).
  • 90 s scripts/smoke.ps1 world-load sweep (release, XCL_DIRECT_DXIL=1, XCL_PRESS_A_AT=15,25,35):
    • Uncapped: exit 0x0, 2,348 frames (60 60 60), peak commit 23,979 MB, 0 crashes.
    • XCL_TITLE_COMMIT_CAP_MB=20480: exit 0x80000003, peak commit 20,241 MB (CreateHeap(64 MiB) refused 0x8007000E at 58.1 s).
    • XCL_TITLE_COMMIT_CAP_MB=16384: exit 0xc0000409, peak commit 16,224 MB (silent __fastfail inside XCL/CRT).

Note / possible follow-up (cross-linked with #1566):
We also tested adding a 2 GiB soft title-only headroom in kernelx.rs (VirtualAlloc MEM_COMMIT, XMemAllocDefault, AllocateTitlePhysicalPages) below the hard job cap so XCL's own allocations don't trigger silent 0xC0000409 (full table & snippet in #1566). That turned 0xC0000409 into a clean logged refusal at 16,384 MB (42.9 s), while confirming that above ~18.4 GB the remaining climb is XCL's own vram::Pages CreateHeap(64 MiB) pools — so #1831 is best documented as an outer safety fuse against runaway commit (and needs a quick rebase on config.rs).

Not tested

  • Full workspace suite at the merged commit, NVIDIA / Intel GPUs, Linux / Wine.

AI use

  • Antigravity (Gemini 4 Neon) ran the unit tests and 90 s RX 6600 smoke sweep and drafted this report; I checked the output before posting.

@JJAutoCompare

Copy link
Copy Markdown

XCL PR #1831 verification

Clean detached head f0dbb087f3ec781bc740c816404f723fd7cd4e20. The diff changes README.md, crates/xcl/src/config.rs, and crates/xcl/src/host.rs.

STOR-WINLAB ran Windows 11 Enterprise Evaluation x64 build 26200 on a Ryzen 7 3800X with Intel Arc A770 (16 GiB, driver 32.0.101.9175). DXC reported 1.9.2609.5. Rust was rustc 1.100.0 (0ef1bc386 2026-11-09), x86_64-pc-windows-msvc. Cargo used unoptimized dev/test profiles with debug info and incremental compilation disabled.

Tested

  • cargo build --workspace and cargo test --workspace --no-run both succeeded outside the Arc lock. The latter compiled 19 test binaries.
  • cargo test -p xcl --lib commit_cap with XCL_ADAPTER=NONE_CPU_ONLY outside the lock yielded 3 passed, 0 failed, 0 ignored, and 0 explicit skips. The tests covered unset, blank, zero, positive, and invalid input plus zero and overflow rejection by the Windows cap helper. Child processes committed 128 MiB via VirtualAlloc with the cap unset or zero. Under the 64 MiB cap, Windows rejected that allocation with a memory-limit error accepted by the test, and Vec::try_reserve also failed.
  • cargo test --workspace --no-fail-fast -- --test-threads=4 ran once under Invoke-ArcTest.ps1 with XCL_ADAPTER=A770 and RUST_TEST_NOCAPTURE=1. Cargo exited 1. All three PR tests passed again.

Workspace failures and skips

All 20 libtest summaries in pr1831-suite.log (19 binaries and one doctest run) total 941 passed, 19 failed, 42 ignored. The 18 library failures were in GPU DXIL and recompiler tests, including pipeline creation errors and result mismatches. The synthetic-title e2e failed its RSSetDepthBiasX check when a blue pixel was expected to be green.

The log had 25 lines beginning with SKIPPED . Reasons included missing wave64 (17), refused wave32 per-lane cases (3), tiled resources tier below 2 (1), driver cache control (1), unavailable heap windows (1), and missing D3D12 debug-layer support (2). These are excluded from coverage.

Not tested

Matched main baseline, retail-title smoke run, and positive-cap enforcement through a live xcl run title launch. The XCL_SAMPLE_* variables were unset, so game-data paths were outside coverage.

AI use

T3 Code / Codex (gpt-6.2-sol, reasoningEffort: high) ran the build and verification. Coordinator #2 (T3 Code / Antigravity, gemini-4-neon) verified counts against pr1831-suite.log and published.

@throny throny added the goal:world-load Bears on the retail title getting past world loading label Nov 25, 2026
@pickles976

Copy link
Copy Markdown

Wine 11.0 / Linux, 16 GiB system RAM, RTX 4060 Laptop GPU (no GPU exercised by these tests): I built the exact PR head e8d71df7cd9cd3b4f4dfa88c9d999c6307f53764 for x86_64-pc-windows-msvc and ran cargo test --locked --target x86_64-pc-windows-msvc -p xcl --lib commit_cap -- --nocapture --test-threads=1 under Wine. Result: 3 passed, 2 failed.

host::tests::title_commit_cap_enforced_only_when_positive: the child successfully creates/assigns a 64 MiB Job Object with JOB_OBJECT_LIMIT_PROCESS_MEMORY, but its 128 MiB MEM_RESERVE|MEM_COMMIT VirtualAlloc succeeds (host.rs:339), so the cap is not enforced in this Wine environment. eh::tests::alloc_error_hook_logs_active_commit_cap_and_writes_report: the 128 MiB allocation also succeeds, the child panics (allocation unexpectedly succeeded under 64 MB cap, eh.rs:1235), and the parent sees exit 101 instead of 0xc0000409. The OOM hook/report path was therefore not exercised, not independently shown broken. The other three tests (parsing, commit query/formatting, zero/overflow rejection) pass. This is a Wine Job Object limitation observed here, not a native Windows regression or retail-title result.

Please do not report the Windows job cap as an effective Linux/Wine host limit merely because assignment succeeds. Suggested fix: detect unsupported enforcement (small guarded child allocation probe, or explicit Wine detection), warn/fail closed for XCL_TITLE_COMMIT_CAP_MB rather than advertising an active safety cap, and document that Linux cgroup MemoryMax + external free-RAM guard remain necessary. Even with a working cap, low hard limits refuse allocations instead of throttling loading (#1566). Full local log: .compat-xcl/logs/verify-pr1831-wine-commit-cap.log (path on this machine; not attached). No title was launched.

@fixgep

fixgep commented Nov 26, 2026

Copy link
Copy Markdown
Contributor Author

Thanks for testing this under Wine 11.0 / Linux and catching that JOB_OBJECT_LIMIT_PROCESS_MEMORY assignment succeeds there without constraining VirtualAlloc, @pickles976. I've rebased onto main (b49be183) and updated feat/title-commit-cap-mb (3a435628) to address this:

  • Unsupported / Wine enforcement detection & fail-closed behavior (host.rs, main.rs): apply_commit_cap_mb now checks crate::util::under_wine() (ntdll!wine_get_version) before creating/assigning a Job Object or setting ACTIVE_COMMIT_CAP_MB, and host_main additionally runs a guarded child-process probe (XCL_COMMIT_CAP_PROBE=1 via commit_cap_probe_main) to verify VirtualAlloc is actually rejected by JOB_OBJECT_LIMIT_PROCESS_MEMORY. When enforcement is unsupported, XCL logs a warning pointing to Linux cgroup MemoryMax / external free-RAM guards and leaves the cap inactive (active_commit_cap_mb() == 0), so neither xcl.log nor report.json advertises an active limit.
  • Test updates (host.rs, eh.rs): Native Windows still runs the strict 64 MiB VirtualAlloc / Vec::try_reserve and real-OOM alloc_error_hook assertions; under Wine, title_commit_cap_enforced_only_when_positive verifies fail-closed refusal, alloc_error_hook_logs_active_commit_cap_and_writes_report exercises handle_alloc_error emergency logging/reporting while asserting XCL_TITLE_COMMIT_CAP_MB is not advertised, and unsupported_commit_cap_enforcement_fails_closed + commit_cap_probe_reports_host_enforcement cover detection directly.
  • Docs (README.md, config.rs): Clarified that XCL_TITLE_COMMIT_CAP_MB is a native Windows outer safety fuse (low hard limits refuse allocations rather than throttling loading), that XCL disables it with a warning when Job Object limits are not enforced, and that Linux cgroup MemoryMax / external free-RAM guards remain necessary under Wine/Linux.

@DavidM1911

Copy link
Copy Markdown
Contributor

Re-verification on RTX 3060 Ti (Windows 11): still a merge conflict with current main on the new head — needs another rebase before it can be tested.

@fixgep

fixgep commented Nov 26, 2026

Copy link
Copy Markdown
Contributor Author

GitHub shows no conflicts with current main and all CI checks are green on 3a435628

@thehollowedone

Copy link
Copy Markdown
Contributor

Independent Windows/NVIDIA check of head 3a435628 on an RTX 3080 Ti (driver 621.35), Ryzen 7 9800X3D, Windows 11, rustc 1.99.1 MSVC. Synthetic tests only; no title files or retail run.

Tested

  • cargo test --offline --locked -p xcl --lib commit_cap -- --nocapture --test-threads=1: 7 passed, 0 failed, 0 ignored, 0 skips. This includes the native child-process enforcement probe, capped and uncapped allocations, and the OOM log/report subprocess.
  • cargo test --offline --locked -p xcl --lib emergency_oom_report -- --test-threads=1: 1 passed, 0 failed, 0 ignored, 0 skips.
  • cargo test --offline --locked --workspace --no-fail-fast -- --test-threads=4: 1,442 passed, 1 failed, 47 ignored, with 25 explicit GPU skips (21 no wave64, 3 refused per-lane forms, 1 no heap windows). The sole failure was console_mesh_caches_hlsl_compute_pass_in_memory_and_on_disk: cached_only console_mesh hit: "DXIL not compiled yet". The same isolated test fails with the same message on the PR's exact base b49be183 using cargo test --offline --locked -p xcl --lib console_mesh_caches_hlsl_compute_pass_in_memory_and_on_disk -- --test-threads=1 (0 passed, 1 failed). I did not run the full suite on the base.

One source-review point: probe_commit_cap_enforcement accepts any child outcome except exit code 2. If current_exe or child launch fails, the executable is renamed, or the child exits 3 (the probe's own Job setup-failure code), it returns Ok(()). The host can then log the cap as active without the promised enforcement check having succeeded. Native Windows enforcement passed here; I did not reproduce an unsupported host falsely accepting a cap. For the stated fail-closed contract, accept only probe exit 0; warn and leave the cap inactive on every other outcome. A small status-decoding test covering 0, 2, 3, launch error, and missing executable would protect that decision.

Suggested probe decision change
-    let Ok(exe) = std::env::current_exe() else {
-        return Ok(());
-    };
+    let exe = std::env::current_exe().map_err(|e| format!("commit-cap probe: current_exe failed: {e}"))?;
     if !exe.file_stem().and_then(|s| s.to_str()).is_some_and(|s| s.eq_ignore_ascii_case("xcl")) {
-        return Ok(());
+        return Err("commit-cap enforcement probe needs xcl.exe".into());
     }
-    let Ok(status) = std::process::Command::new(&exe)
+    let status = std::process::Command::new(&exe)
         .env("XCL_COMMIT_CAP_PROBE", "1")
         .env_remove("XCL_HOST")
         .env_remove(crate::config::ENV_TITLE_COMMIT_CAP_MB)
         .status()
-    else {
-        return Ok(());
-    };
-    if status.code() == Some(2) {
-        return Err(format!("Job Object assignment succeeded without enforcing VirtualAlloc commit limits; {UNSUPPORTED_COMMIT_CAP_MSG}"));
+        .map_err(|e| format!("commit-cap probe: child launch failed: {e}"))?;
+    match status.code() {
+        Some(0) => Ok(()),
+        Some(2) => Err(format!("Job Object assignment succeeded without enforcing VirtualAlloc commit limits; {UNSUPPORTED_COMMIT_CAP_MSG}")),
+        other => Err(format!("commit-cap probe could not verify enforcement (exit {other:?})")),
     }
-    Ok(())

AI use: Codex (GPT-6.2 Sol) inspected the exact head and base, ran the tests, checked the probe control flow, and drafted this report.

…cl-dev#1566)

Part of xcl-dev#1566.

Record the active XCL_TITLE_COMMIT_CAP_MB limit and current process commit in MiB on D3D12 heap OOM warnings and before fatal Rust alloc-error fail-fast (writing allocation-free diagnostics to xcl.log and report.json).

Detect hosts that do not enforce JOB_OBJECT_LIMIT_PROCESS_MEMORY (via ntdll!wine_get_version and a guarded xcl.exe child probe requiring exit status 0 on startup), warn and fail closed on any probe error or non-zero status without advertising an active cap, update unit tests for native Windows vs Wine and probe status decoding, and document that Linux cgroup MemoryMax / external free-RAM guards remain necessary under Wine/Linux.

Assisted-by: Antigravity (Gemini 4 Hydrogen)
@futurepro62

Copy link
Copy Markdown

NVIDIA and AMD full-suite run, to go with the reports above by thehollowedone, since none of them covers AMD. Tested exact head 3a435628 (on its base b49be18).

Tested

  • NVIDIA GeForce RTX 5070 Ti 16 GB (Blackwell, 32-lane waves only, mesh shaders), driver 621.40, Ryzen 7 9800X3D, Windows 11 Home 26300, Rust 1.100.0 MSVC, DXC + dxil.dll 1.9.2602.17 (Windows SDK 10.0.26100), debug, D3D12 debug layer installed.
  • cargo build --workspace, then XCL_REQUIRE_GPU=mesh cargo test --workspace -- --test-threads=4 --skip heap_window_out_of_memory_falls_back_to_the_switch_form --skip gpu::recomp::lower_dxil::tests::f16_programs_on_the_gpu --skip gpu::recomp::lower_dxil::tests::f32_programs_on_the_gpu --skip gpu::recomp::lower_dxil::tests::integer_programs_on_the_gpu --skip gpu::recomp::lower_dxil::tests::f64_programs_on_the_gpu --skip gpu::recomp::lower_dxil::tests::const_and_null_mask_operands_agree_with_hlsl_on_the_gpu --skip gpu::recomp::lower_dxil::tests::mask_ff0_and_flbit_agree_with_hlsl_on_the_gpu --skip gpu::dxil::fuzz_tests: 1431 passed, 0 failed, 45 ignored. SKIPPED (no wave64): a_2d_or_3d_group_agrees_with_the_hlsl_path_on_the_gpu, a_per_lane_2d_or_3d_group_runs_on_the_gpu, coalesced_guarded_runs_agree_with_the_hlsl_path_on_the_gpu, cross_lane_reads_agree_with_the_hlsl_path_on_the_gpu, dispatch_chain_native_wave64_builds_whole, gpu_geometry_wave32_prefix_count_over_a_mask, gpu_wave32_program_in_wave64_hardware, the_wave64_lowering_agrees_with_the_hlsl_path_on_the_gpu.
  • The new tests ran and passed: title_commit_cap_mb_parsing, alloc_error_hook_logs_active_commit_cap_and_writes_report, rejects_zero_and_overflow_commit_cap, commit_cap_query_and_oom_formatting, unsupported_commit_cap_enforcement_fails_closed, commit_cap_probe_reports_host_enforcement, title_commit_cap_enforced_only_when_positive, emergency_oom_report_json_parses_without_heap_alloc.
  • Same head on the AMD Radeon integrated GPU (iGPU) of the Ryzen 7 9800X3D (RDNA2, XCL_ADAPTER=radeon), cargo test --workspace -- --test-threads=4 --skip gpu::dxil::fuzz_tests::fuzz_validate_and_gpu_1: 1442 passed, 0 failed, 47 ignored. SKIPPED: f16_programs_on_the_gpu (f16 arithmetic, wave32, per-lane form: refused (unsupported V_MUL_F16 (its gpu: direct RDNA2 -> DXIL backend (no HLSL / DXC), behind XCL_DIRECT_DXIL #1426 semantics differ from the console's))), f16_programs_on_the_gpu (f16 arithmetic, wave64, per-lane form: refused (unsupported V_MUL_F16 (its gpu: direct RDNA2 -> DXIL backend (no HLSL / DXC), behind XCL_DIRECT_DXIL #1426 semantics differ from the console's))), f16_programs_on_the_gpu (f16 packed, wave32, per-lane form: refused (unsupported V_PK_MUL_F16: VOP3 modifiers (its gpu: direct RDNA2 -> DXIL backend (no HLSL / DXC), behind XCL_DIRECT_DXIL #1426 semantics differ from the console's))), f16_programs_on_the_gpu (f16 packed, wave64, per-lane form: refused (unsupported V_PK_MUL_F16: VOP3 modifiers (its gpu: direct RDNA2 -> DXIL backend (no HLSL / DXC), behind XCL_DIRECT_DXIL #1426 semantics differ from the console's))), f32_programs_on_the_gpu (f32 conversions, wave32, per-lane form: refused (unsupported V_CVT_F16_F32 (its gpu: direct RDNA2 -> DXIL backend (no HLSL / DXC), behind XCL_DIRECT_DXIL #1426 semantics differ from the console's))), f32_programs_on_the_gpu (f32 conversions, wave64, per-lane form: refused (unsupported V_CVT_F16_F32 (its gpu: direct RDNA2 -> DXIL backend (no HLSL / DXC), behind XCL_DIRECT_DXIL #1426 semantics differ from the console's))), heap_window_out_of_memory_falls_back_to_the_switch_form (no heap windows).
  • --skip leaves out tests that fail on main 8b957bec too, not because of this PR. On NVIDIA: heap_window_out_of_memory_falls_back_to_the_switch_form (Tests: heap_window_out_of_memory_falls_back_to_the_switch_form fails under XCL_REQUIRE_GPU=mesh (opt-in skip counted as missing coverage) #1651), the four gpu::recomp::lower_dxil::tests::*_programs_on_the_gpu tests, const_and_null_mask_operands_agree_with_hlsl_on_the_gpu and mask_ff0_and_flbit_agree_with_hlsl_on_the_gpu (follow-up on #1651) fail because runner::skip_test turns their skips into failures under XCL_REQUIRE_GPU=mesh, and gpu::dxil::fuzz_tests seeds 70, 545, 1019 and 1507 fail CreateComputePipelineState with E_OUTOFMEMORY on this card (drivers 616.64 and 621.40). On AMD: fuzz_validate_and_gpu_1 fails on seed 540 (res[833] 0x7 vs CPU 0x6). The AMD run does not set XCL_REQUIRE_GPU.

Not tested

  • a release build, a game (test run only).

AI use

  • Claude Code (Claude Opus 5.5) ran the tests and wrote this report. I checked it before posting.

@oni-swr

oni-swr commented Nov 26, 2026

Copy link
Copy Markdown
Contributor

Independent AMD report for 3a435628168f1732bb0345b7fd3150ff40c3a59c.

Tested

  • AMD Radeon RX 7800 XT (driver 32.0.31035.1003, XCL_ADAPTER unset), Ryzen 7 5700X3D, 64 GB, Windows 11 build 26200, rustc 1.100.0, debug profile for tests / release for xcl.exe, DXC from the Windows SDK. Exact PR head in a clean detached checkout (not merged onto main), own target directory per checkout; main was 8b957bec, merge-base below. Merge-base: b49be1836844fe0b0cdb3211dce3cb7fb4e21ac7.
  • cargo test --workspace --no-fail-fast -j 4 -- --test-threads=4 --nocapture: 1442 passed, 1 failed, 47 ignored. The one failure is gpu::dxil::fuzz_tests::fuzz_validate_and_gpu_1 (seed 722: res[30] = 0x1, CPU 0x7fffffff); it fails identically on main 6d12f58a on this adapter (cargo test -p xcl --lib fuzz_validate_and_gpu_1), so it is not caused by this PR.
  • The first run had 3 e2e failures from my setup (the test title was not built next to the e2e binary); after cargo build --workspace the e2e test passed (cargo test -p xcl --test e2e), counts below include that rerun.
  • 7 SKIPPED lines: 6 f16_programs_on_the_gpu / f32_programs_on_the_gpu per-lane cases refused for V_MUL_F16, V_PK_MUL_F16 or V_CVT_F16_F32, and heap_window_out_of_memory_falls_back_to_the_switch_form (no heap windows).
  • The commit-cap tests passed (config::tests::title_commit_cap_mb_parsing, host::tests::commit_cap_*, host::tests::unsupported_commit_cap_enforcement_fails_closed, eh::tests::alloc_error_hook_logs_active_commit_cap_and_writes_report). The retail runs did not set XCL_TITLE_COMMIT_CAP_MB, so the cap itself was not exercised on the title; they only show the default path is unchanged.

Regression run (scripts/smoke.ps1 -Seconds 60 -Title retail-title, one 60 s run each, same retail title, built from the merge-base and from this head)

xcl-smoke v1
commit: b49be1836844fe0b0cdb3211dce3cb7fb4e21ac7
gpu: AMD Radeon RX 7800 XT
title: retail-title
seconds: 60
exit: 0x0
frames shown: 1545 (PresentX 1546)
presents per 2 s (last 3): 58 60 59
device removals: 0
crashes: 0
peak commit: 15061 MB
xcl-smoke v1
commit: 3a435628168f1732bb0345b7fd3150ff40c3a59c
gpu: AMD Radeon RX 7800 XT
title: retail-title
seconds: 60
exit: 0x0
frames shown: 1295 (PresentX 1295)
presents per 2 s (last 3): 54 53 60
device removals: 0
crashes: 0
peak commit: 14131 MB

No device removal, no crash; 1295 frames vs 1545 (PresentX 1546) on the merge-base (83.8 %, above the 80 % threshold but the closest of the three), peak commit 14131 MB vs 15061 MB. With one run per build I cannot say how much of the frame difference is run-to-run noise.

Not tested

  • NVIDIA / other adapters, more than one run per build (frame counts vary from run to run), XCL_ADAPTER overrides, any title other than the one retail title. No game data was committed or posted.

AI use

Claude Code (Claude Sonnet 5.5) ran the tests and drafted this report. No game files, dumps, shader names or retail hashes are included; the title in the xcl-smoke blocks is replaced with retail-title.

@fixgep
fixgep force-pushed the feat/title-commit-cap-mb branch from 3a43562 to c8301f1 Compare November 27, 2026 03:48
@fixgep

fixgep commented Nov 27, 2026

Copy link
Copy Markdown
Contributor Author

Good catch, thanks! Rebased onto main (8b957bec) and tightened probe_commit_cap_enforcement in c8301f11 so it fails closed unless the probe exits 0 (covering non-zero exit codes, launch/missing-exe errors, and non-xcl binaries, with a unit test for the status handling). Also refreshed the test and smoke results in the description. @thehollowedone

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

goal:world-load Bears on the retail title getting past world loading

Projects

None yet

Development

Successfully merging this pull request may close these issues.