xcl run: add opt-in XCL_TITLE_COMMIT_CAP_MB job memory limit (#1566) #1831
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
goal:world-load
good first issue
help wanted
invalid
keep-open
off-goal
question
stale
test-only
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/xcl-dev--xcl!1831
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-1831"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
@fixgep on GitHub · 2026-11-24 21:34 UTC · original
fixgep:feat/title-commit-cap-mb→main· +820 −15 · 12 files · 2 commits · openAdds an opt-in process commit cap via
XCL_TITLE_COMMIT_CAP_MB(disabled when unset or0) 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 verifiesJOB_OBJECT_LIMIT_PROCESS_MEMORYenforcement (failing closed on Wine viantdll!wine_get_versionor when a guardedxcl.exechild probe showsVirtualAllocis not 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 namingXCL_TITLE_COMMIT_CAP_MBand current process commit on D3D12 heap OOM refusals, and records allocation-free failure details inxcl.logandreport.jsonbefore fatal Rust OOM fail-fast (0xc0000409). When enforcement is unsupported (such as Wine/Linux), 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 cgroupMemoryMax/ 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 +XCL_COMMIT_CAP_PROBEchild probe viacommit_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 vs64MB cappedVirtualAlloc/Vec::try_reserve, unsupported/Wine fail-closed behavior, 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: logXCL_TITLE_COMMIT_CAP_MB, the configured cap MiB, and current process commit MiB whenCreateHeap/CreateHeap1fails 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: hookstd::alloc::handle_alloc_errorviahook_addr, write an allocation-free emergency line toxcl.log(write_emergency) and an allocation-freereport.json(write_emergency_alloc_errorusing pre-cached startup metadata andStackBuf) before0xc0000409fail-fast, with unit and subprocess tests (asserting active cap reporting on native Windows and no inactive cap advertisement on Wine).README.md: documentXCL_TITLE_COMMIT_CAP_MB=N, its hard-limit outer safety-fuse behavior, and the requirement for Linux cgroupMemoryMaxand/or external free-RAM guards under Wine/Linux.Tested
32.0.15.9144), AMD Ryzen 5 7500F 6-Core Processor, Windows10.0.26200.0,rustc 1.100.0 (0ef1bc386 2026-11-09), debug (cargo test) & release (cargo build --release -p xcl).cargo build --workspace: succeeded with zero new compiler warnings (3 pre-existing warnings:Atomic::fetch_updatedeprecation inreal.rsandxgameruntime/mod.rs,RetiringBatch::heapsdead-code warning invram.rs).3a435628:cargo test -p xcl --lib commit_cap -- --nocapture --test-threads=1: 7 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_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: 8 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=1on releasexcl.exe: exited0.cargo test --workspace --no-fail-fast -- --test-threads=4: 1442 passed, 1 failed (gpu::recomp::tests::gpu_clamp_and_omod_per_instructiononlane 0 v_pk_add_i16 clamp, pre-existing on RTX 3060), 47 ignored (SKIPPEDGPU/driver-cache/heap tests: 21no wave64, 3refusedwave32 per-lane ingpu::recomp::lower_dxil::tests, 1cannot disable the driver cacheinshaders::tests::pso_measurement_compiles_an_exact_synthetic_record, 1no heap windowsinheap_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:
PR:
Not tested
host.rsandeh.rswere verified on Windows viaunsupported_commit_cap_enforcement_fails_closed, and nativeunder_wine() == falsepaths ran end-to-end).no wave64on RTX 3060) andXCL_SAMPLE_*retail test inputs.XCL_TITLE_COMMIT_CAP_MBlimit (covered via synthetic 64 MiB subprocess tests).AI use
upstream/main, implemented Wine/unsupported enforcement detection and fail-closed diagnostics, updated unit/subprocess tests and documentation, ran builds, workspace/targeted tests, and smoke runs, and updated the PR description.@gabrielsteglich on GitHub · 2026-11-24 22:21 UTC · original
Independent Windows/NVIDIA validation of the commit cap.
I merged PR head
f0dbb087f3ec781bc740c816404f723fd7cd4e20ontomainat1d027e5c76c9a86a7ee2ca1cc677edf0be95d331locally, producing1336bdceaa1ba6063b941d6132a51ff44df694af.cargo test --offline --locked -p xcl --lib title_commit_cap -- --test-threads=4 --show-outputpassed both tests.title_commit_cap_mb_parsingandtitle_commit_cap_enforced_only_when_positivepassed, including the capped and uncapped subprocess cases.cargo build --offline --locked --workspacesucceeded.cargo test --offline --locked --workspace --no-fail-fast -- --test-threads=4 --show-outputreported 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
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 on GitHub · 2026-11-24 23:52 UTC · original
Test report on a local merge of
main20cf130+ #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.logconfirms the cap:process commit cap: 24000 MB (XCL_TITLE_COMMIT_CAP_MB).CreateHeap(0x4000000 bytes, type 1, alignment 0x0, flags 0x0) refused (0x8007000e), each followed byno video memory for more pages of title textures (0x8007000E). Those are the last lines of the log.0xC0000409. There is noprocess ends with statusline and no thread dump inxcl.log, andreport.jsonhas"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
xcl.logandreport.jsondo 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.logandreport.json; the run was done by the person posting.@zorde23 on GitHub · 2026-11-25 00:40 UTC · original
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:
f0dbb08cherry-picked ontomain80f4819(one conflict inconfig.rs, where #1053 addedparse_device_typeat 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 themainrun 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.main80f48190xC0000409at 110 s0xC0000409at 101 s), here at 110 s.mainrun. So with this cap the texture pages and pools count against the 20,480 MB too.main, before the cap is reached.Not tested: other caps, NVIDIA, a full
cargo test --workspaceon this build.Written with Claude Code from runs on this machine.
@DavidM1911 on GitHub · 2026-11-25 00:50 UTC · original
Verification on RTX 3060 Ti (Windows 11), branch merged with current
main:cargo test -p xcl --lib: all passed, 0 failed, ~23 ignored. (Intermittent single-test flake / 0xc0000005 abort under parallel scheduling — tracked in #1978; clean on single-threaded rerun.)Thanks!
@thiagocalile on GitHub · 2026-11-25 01:19 UTC · original
Tested commit
f0dbb08locally merged ontomain62265d3(1-spot conflict incrates/xcl/src/config.rswith #1053'sparse_device_type) on an AMD Radeon RX 6600 (8 GB VRAM, native wave64).Tested
32.0.21045.29003;XCL_ADAPTER=radeon), Ryzen 7 5700X3D, 47.9 GB RAM, Windows 11 (26200), Rust1.100.0MSVC, DXC1.8.2502.11.XCL_ADAPTER=radeon cargo test -p xcl --lib title_commit_cap -- --nocapture: 2 passed, 0 failed, 0 ignored (0.04 s).scripts/smoke.ps1world-load sweep (release,XCL_DIRECT_DXIL=1,XCL_PRESS_A_AT=15,25,35):exit 0x0, 2,348 frames (60 60 60), peak commit23,979 MB, 0 crashes.XCL_TITLE_COMMIT_CAP_MB=20480:exit 0x80000003, peak commit20,241 MB(CreateHeap(64 MiB)refused0x8007000Eat58.1 s).XCL_TITLE_COMMIT_CAP_MB=16384:exit 0xc0000409, peak commit16,224 MB(silent__fastfailinside XCL/CRT).Note / possible follow-up (cross-linked with #1566):
We also tested adding a 2 GiB soft title-only headroom in
kernelx.rs(VirtualAllocMEM_COMMIT,XMemAllocDefault,AllocateTitlePhysicalPages) below the hard job cap so XCL's own allocations don't trigger silent0xC0000409(full table & snippet in #1566). That turned0xC0000409into a clean logged refusal at16,384 MB(42.9 s), while confirming that above ~18.4 GB the remaining climb is XCL's ownvram::PagesCreateHeap(64 MiB)pools — so #1831 is best documented as an outer safety fuse against runaway commit (and needs a quick rebase onconfig.rs).Not tested
AI use
@JJAutoCompare on GitHub · 2026-11-25 04:25 UTC · original
XCL PR #1831 verification
Clean detached head
f0dbb087f3ec781bc740c816404f723fd7cd4e20. The diff changesREADME.md,crates/xcl/src/config.rs, andcrates/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 --workspaceandcargo test --workspace --no-runboth succeeded outside the Arc lock. The latter compiled 19 test binaries.cargo test -p xcl --lib commit_capwithXCL_ADAPTER=NONE_CPU_ONLYoutside 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 viaVirtualAllocwith the cap unset or zero. Under the 64 MiB cap, Windows rejected that allocation with a memory-limit error accepted by the test, andVec::try_reservealso failed.cargo test --workspace --no-fail-fast -- --test-threads=4ran once underInvoke-ArcTest.ps1withXCL_ADAPTER=A770andRUST_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 itsRSSetDepthBiasXcheck 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
mainbaseline, retail-title smoke run, and positive-cap enforcement through a livexcl runtitle launch. TheXCL_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.logand published.@pickles976 on GitHub · 2026-11-26 03:23 UTC · original
Wine 11.0 / Linux, 16 GiB system RAM, RTX 4060 Laptop GPU (no GPU exercised by these tests): I built the exact PR head
e8d71df7cd9cd3b4f4dfa88c9d999c6307f53764forx86_64-pc-windows-msvcand rancargo test --locked --target x86_64-pc-windows-msvc -p xcl --lib commit_cap -- --nocapture --test-threads=1under 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 withJOB_OBJECT_LIMIT_PROCESS_MEMORY, but its 128 MiBMEM_RESERVE|MEM_COMMITVirtualAllocsucceeds (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 of0xc0000409. 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_MBrather than advertising an active safety cap, and document that Linux cgroupMemoryMax+ 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.e8d71df7cdto3a43562816github-bot referenced this pull request2026-11-26 06:18:31 +00:00
@fixgep on GitHub · 2026-11-26 04:32 UTC · original
Thanks for testing this under Wine 11.0 / Linux and catching that
JOB_OBJECT_LIMIT_PROCESS_MEMORYassignment succeeds there without constrainingVirtualAlloc,@pickles976. I've rebased ontomain(b49be183) and updatedfeat/title-commit-cap-mb(3a435628) to address this:host.rs,main.rs):apply_commit_cap_mbnow checkscrate::util::under_wine()(ntdll!wine_get_version) before creating/assigning a Job Object or settingACTIVE_COMMIT_CAP_MB, andhost_mainadditionally runs a guarded child-process probe (XCL_COMMIT_CAP_PROBE=1viacommit_cap_probe_main) to verifyVirtualAllocis actually rejected byJOB_OBJECT_LIMIT_PROCESS_MEMORY. When enforcement is unsupported, XCL logs a warning pointing to Linux cgroupMemoryMax/ external free-RAM guards and leaves the cap inactive (active_commit_cap_mb() == 0), so neitherxcl.lognorreport.jsonadvertises an active limit.host.rs,eh.rs): Native Windows still runs the strict 64 MiBVirtualAlloc/Vec::try_reserveand real-OOMalloc_error_hookassertions; under Wine,title_commit_cap_enforced_only_when_positiveverifies fail-closed refusal,alloc_error_hook_logs_active_commit_cap_and_writes_reportexerciseshandle_alloc_erroremergency logging/reporting while assertingXCL_TITLE_COMMIT_CAP_MBis not advertised, andunsupported_commit_cap_enforcement_fails_closed+commit_cap_probe_reports_host_enforcementcover detection directly.README.md,config.rs): Clarified thatXCL_TITLE_COMMIT_CAP_MBis 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 cgroupMemoryMax/ external free-RAM guards remain necessary under Wine/Linux.@DavidM1911 on GitHub · 2026-11-26 06:28 UTC · original
Re-verification on RTX 3060 Ti (Windows 11): still a merge conflict with current
mainon the new head — needs another rebase before it can be tested.@fixgep on GitHub · 2026-11-26 11:47 UTC · original
GitHub shows no conflicts with current
mainand all CI checks are green on3a435628View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.