Memory: plan the coherent GPU heaps on the commit the page files can grow to #3546
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/3546"
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?
Imported from ivall/xcl. Originally posted by Chrysana on 2026-11-30T21:24:32Z.
XCL reads free commit as
GlobalMemoryStatusEx'sullAvailPageFile, which counts each page file only at its current size. Windows grows a page file only when commit gets close to the current limit. So on a PC whose page files start small (the Windows default, or for example 2 GB growing to 16/32 GB), XCL reads a few GB free while much more is available. The check inuma.rsthat puts the title's GPU heaps in the coherent window wants 17,408 MB of free commit at startup, so it keeps them out. This PR lets that one check count what each page file can still grow by: the heaps are planned once and live the whole run.The compile gates keep reading the commit that is free now. They admit compiles that allocate side by side, and Windows can fail allocations when page-file growth lags behind concurrent demand (Microsoft). Under a job's commit limit the growth isn't counted either, because such a limit doesn't rise with the page files. Both follow thehollowedone's reviews below. Part of #2996, where the plan was posted first (comment).
What #2996 measured on a 32 GB PC with an RX 9070 XT (
amd-devand the hive recipe), with growable page files:What is in it
crates/xcl/src/gpu/recomp/dxc.rs:CommitSource { now, growth, job_limited }.commit_free()isullAvailPageFile, as onmain.commit_capacity()addspage_file_growth(). For each page file that's its maximum minus its current size, fromNtQuerySystemInformation(SystemPageFileInformationEx), capped by the free space on its volume (GetDiskFreeSpaceExW), and 0 when either is unknown. The page files are logged once (commit: the page files can grow by N MB more than their size now (…)).job_commit_limit(): if the process's immediate job setsJOB_OBJECT_LIMIT_PROCESS_MEMORYorJOB_OBJECT_LIMIT_JOB_MEMORY, no growth is added (logged once).ullAvailPageFiledoesn't show job limits: on Windows 11 build 26200 a process in an 8 GB job read the system's 42 GB free.wait_for_memoryadmits throughwait_admitted, which reads only the current value.crates/xcl/src/gpu/uma.rs:heaps_window()takes the capacity query (dxc::commit_capacity). 1 test fromCommitSourceto the window: 4 GiB now and 20 GiB of growth give 4,095 MB outside a job and 512 MB under a job's limit; 17 GiB now is enough on its own; with no stored heaps there's no query.crates/xcl/src/hle/d3d12x/real.rs:big_compile_commit_free()readsdxc::commit_free()instead of callingGlobalMemoryStatusExitself. It's the same value as before.capacity(), orcapacity()to ignore the job limit, fails the matching test.Tested
stable-x86_64-pc-windows-msvc); debug build for the tests, release for the title runscargo test --workspace --no-fail-fast -- --test-threads=4onmaind0832e61merged withae8050f1(clean merge,git diff --checkclean): 2887 passed, 9 failed, 51 ignored. Onmaind0832e61: 2882 passed, 9 failed, 51 ignored. The 5 more passes are this PR's tests. The same 8 tests fail on both, so they come frommainon this card, not this PR:fuzz_validate_and_gpu_1,fuzz_validate_and_gpu_3,gpu_smem_flat_descriptor_windows_and_limits,f32_programs_on_the_gpu,gpu_f32_compares_with_nan,gpu_float_compares_random,gpu_ps_readfirstlane_loop_on_a_primitive_edge_ends, and the e2etwo_pass_driver_cache_reuses_both_passes_and_recovers_corrupt_blobs(counted twice).Regression run
The page-file A/B on this head. Retail title, 60 s smoke runs,
mainand this PR alternated over 2 rounds,XCL_DIRECT_DXIL=1on both sides: on AMD, currentmaincrashes in AMD's shader compiler at ~43 s without it (#3544, fixed by #3455).The page files on C: and D: can grow; X: is fixed at 32 GB. Before each run, a small helper held commit (
VirtualAlloc(MEM_COMMIT), no RAM touched), so every run started at 11.4–12.3 GB of free commit. That's about what this PC has on a normal day with its usual programs open. The runs started from VS Code, inside a job with no memory limit.mainff0c364br1 / r2UMA: 12332 MB/12164 MB of commit free, under 17408 MB: the title's GPU heaps stay outside unified memory(512 MB window)ae8050f1r1 / r2commit: the page files can grow by 22524 MB more than their size now, thenUMA opened (…, 4095 MB coherent window)main's r2 crash is in AMD's shader compiler (amdxc64.dll+0x85f80f, read at address 0x8). It hit the thread building graphics PSO26aa07cb05c04290(310,732 B DXIL). The PR's runs didn't get to that pipeline within 60 s, and neither didmain's r1.cf7d80d2, it crashedmainand this PR alike, 6 times. It went away after AMD's shader cache was cleared, and now it's back on the fresh cache as runs reach that pipeline again. So it's not a damaged cache, as I'd thought: AMD's compiler crashes on that pipeline. It's not #3544's address (+0x735dd8), and withXCL_DIRECT_DXIL=1graphics pipelines stay on the HLSL path.Under a job's commit limit, the same 60 s title run of this head in a job with a 37 GB
JOB_OBJECT_LIMIT_JOB_MEMORY(XCL_PREPARE=0), at 11.6 GB free, logged:It got the 512 MB window and ended by itself (exit 0, job peak commit 16.9 GB).
Not tested
QueryInformationJobObjectwith a null handle gives the immediate job), so the growth is still counted there.maindoesn't see any job limit either.XCL_DIRECT_DXIL(#3544), NVIDIA, Windows 10, a PC with no page file, and page files on a volume whose free space can't be read (the code counts no growth there).amd-dev: it reads free commit separately inuma.rs,pso_async.rsandflight.rs, so this PR doesn't reach it as is.AI use
Imported from ivall/xcl. Originally posted by thehollowedone on 2026-11-30T23:37:56Z.
merge-check
base:
d0832e614fhead:
7bbc9573efmerge: clean
build: cargo build --workspace -> not run after the focused finding
tests: cargo test --workspace --no-fail-fast -- --test-threads=4 -> not run after the focused finding; SKIPPED: 0 in the focused runs. A test-only admission check on the unchanged head failed (0 passed, 1 failed, 0 ignored). With the local candidate below,
cargo test --offline --locked -p xcl --lib memory_gate_tests --target-dir ..\target -- --test-threads=4passed (7 passed, 0 failed, 0 ignored).review: The new
commit_free()adds possible future page-file growth toullAvailPageFilefor every caller. That estimate is useful when planning the coherent GPU heap, butwait_for_memory,big_slots, and the driver compile gates use it to admit concurrent allocations now. In the synthetic gate check, one background DXC compile was active, current headroom was 2 GiB, and the page file could grow by 20 GiB. The unchanged head admitted a second background compile despite a 6 GiB reserve; with this estimate, it can admit many more before the file grows. Microsoft documents allocation failures when page-file growth lags concurrent demand. Keep current commit headroom for compile admission and the growth-aware capacity for long-lived heap planning. Add a regression at the query-to-gate boundary that supplies both values, so the second background worker waits until current headroom reaches the threshold. I read the full three-file diff. A title run and an actual allocation-failure reproduction remain untested.performance: Reasoned risk of additional concurrent compile memory pressure; no frame-time, world-load, or memory delta was measured. The candidate preserves the growth-aware UMA decision.
verdict: not yet: future page-file capacity is used as immediately available commit for parallel compile admission.
hardware / tool and model: NVIDIA RTX 3080 Ti (621.40), Ryzen 7 9800X3D, Windows build 26300, rustc 1.99.1 / OpenAI Codex (GPT-6.2 Sol) traced and tested the candidate; OpenAI Codex (GPT-6.2 Astra) independently checked the memory-budget contract.
Local candidate diff against the PR head
Imported from ivall/xcl. Originally posted by Chrysana on 2026-12-01T03:26:15Z.
Thanks, @thehollowedone, agreed. Counting growth that hasn't happened yet is right for the one-time heap plan but not for admitting compiles side by side. I adopted your split and squashed it into the one commit; new head
cf7d80d2:dxc::commit_free()is current headroom again (ullAvailPageFilealone).wait_for_memory,big_slots,pieces_at_onceand the driver-compile and build-ahead checks throughbig_compile_commit_freeadmit on it, as onmain.dxc::commit_capacity(): current headroom plus the page files' growth. Onlyuma::free_commitreads it, for the coherent-heap decision.wait_for_memorynow goes throughwait_admitted(gate, source, …), which takes aCommitSource { now, growth }and admits onnowonly.a_background_compile_waits_for_commit_free_now_not_the_page_files_growthsupplies 2 GiB now and 20 GiB of growth, with one background compile running and a 6 GiB reserve. The second compile waits, then goes in once 7 GiB are free now. Withwait_admittedreadingcapacity()instead, the test fails ("a second background compile went in on page-file growth that had not happened").I updated the description with the suite, the page-file A/B and the regression runs on the new head. The A/B shows the split keeps the fix: the PR still gets the 4,095 MB coherent window at 11.5–11.9 GB free, where
mainstays at 512 MB. During the regression runs,mainand this PR both started crashing inamdxc64.dll(+0x85f80f) compiling the same graphics PSO,mainfirst. That's not #3544's address. After AMD's shader cache was moved aside, 3 more rounds ran clean on both sides. The details are in the description.Imported from ivall/xcl. Originally posted by thehollowedone on 2026-12-01T04:00:26Z.
One process-limit boundary remains on head
cf7d80d2.CommitSource::capacity()adds system page-file growth toGlobalMemoryStatusEx().ullAvailPageFile. Microsoft defines that field as the maximum this process can still commit, which may be smaller than system-wide headroom; a hard job memory limit does not rise when a page file grows. For example, if a process has 4 GiB left under such a limit and the system page files could grow by 20 GiB, this calculation returns 24 GiB although the process can still commit only 4 GiB.coherent_hint_forcan then clear its 17 GiB threshold and choose a coherent GPU-heap window the process cannot back.Please cap growth-aware capacity by any remaining hard process/job commit limit, or conservatively use current process headroom when that limit is present; keep the page-file growth benefit for unrestricted processes. A synthetic query-to-routing regression can supply 4 GiB process headroom, 20 GiB system growth and a hard job limit, then check that the coherent window does not take the growth path. A control without the hard limit should retain it. This is an API-contract/source finding, not an observed allocation failure on this head. Microsoft's
ullAvailPageFiledefinitionAI use: Codex (GPT-6.2 Sol) checked the PR call path and Microsoft documentation; Codex (GPT-6.2 Astra) independently checked the process-limit case.
Imported from ivall/xcl. Originally posted by thehollowedone on 2026-12-01T04:10:15Z.
One refinement to my process-limit note on head
cf7d80d2: checking onlyQueryInformationJobObject(NULL, JobObjectExtendedLimitInformation)would miss a cap on an ancestor job. Microsoft says the null handle selects the process's immediate job, while nested jobs inherit the most restrictive applicable commit limit.For a conservative fix that preserves growth-aware planning for processes outside jobs, use IsProcessInJob with a null job handle to detect any job. If it reports membership, use current process headroom for the heap decision unless an effective cap for the full job chain is known; otherwise retain the page-file growth estimate. A focused regression should cover an unconstrained immediate child job under a memory-limited parent, as well as a process outside a job. This is a source/API-contract follow-up; I did not run that nested-job regression.
AI use: Codex (GPT-6.2 Sol) checked the Windows API contracts and drafted this note.
Imported from ivall/xcl. Originally posted by Chrysana on 2026-12-01T04:35:24Z.
Thanks for both notes. I checked the API contract on this PC before changing anything, and it doesn't hold here. On Windows 11 build 26200,
ullAvailPageFiledoesn't show job limits:ullAvailPageFileGetPerformanceInfo)JOB_OBJECT_LIMIT_JOB_MEMORYJOB_OBJECT_LIMIT_PROCESS_MEMORYSo
main's check already reads the system figure inside a job: an 8 GB job reads 42 GB, clears 17 GB and takes the window. Nothing in XCL sees a job limit today, and falling back to current headroom wouldn't respect one either.On
IsProcessInJob: everything started from VS Code here is in a job (pwsh ← cmd ← the IDE, breakaway allowed, no memory limit). Only processes started from Explorer are in none, and all my A/B runs ran inside such a job. Dropping the growth for any job would turn the fix off for IDE terminals and launchers that use jobs, without making the limited case right.So head
ae8050f1takes the part that can be read from inside the process:dxc::job_commit_limit(): if the immediate job (QueryInformationJobObjectwith a null handle) setsJOB_OBJECT_LIMIT_PROCESS_MEMORYorJOB_OBJECT_LIMIT_JOB_MEMORY,commit_capacity()adds no growth, and that's logged. A limit on an outer job of nested jobs can't be read from inside, as you say. I haven't written the nested-job regression, because the code can't detect that case; it's listed under Not tested. Honouring job limits in every gate (capping by what the job has left) would be its own change.uma::heaps_window()now takes the capacity query.a_job_commit_limit_keeps_the_gpu_heaps_off_the_page_files_growthgoes fromCommitSourceto the window: 4 GiB now and 20 GiB of growth give 4,095 MB outside a job and 512 MB under a job limit. It fails whencapacity()ignores the limit.JOB_MEMORYjob at 11.6 GB free, the log showscommit: this process's job caps its commit (process 0 MB, job 37888 MB): the page files' growth is not counted for the GPU heaps, then the 512 MB window. Outside a job at the same free commit, this head takes 4,095 MB (A/B in the description).The description is updated for the new head.
Imported from ivall/xcl. Originally posted by thehollowedone on 2026-12-01T04:58:01Z.
On head
ae8050f1, the new compile-admission regression depends on the waiter thread running during a 300 ms sleep. If the worker starts afternowrises to 7 GiB, even a regressedwait_admittedthat admits on page-file growth can pass. This is a test coverage issue; I found no new production-path defect in this review.The fake commit query can return 2 GiB on its first call and 7 GiB on its second. That makes the rejected first attempt and later admission deterministic without another thread. A growth closure that panics also catches an accidental switch from
free()tocapacity(). The candidate below is source-reviewed, not run.Candidate test-only diff
AI use: OpenAI Codex (GPT-6.2 Astra) identified the scheduling gap; OpenAI Codex (GPT-6.2 Sol) checked the admission path and prepared this suggestion.
Imported from ivall/xcl. Originally posted by thehollowedone on 2026-12-01T05:14:28Z.
Correction to my process-limit note and follow-up: I inferred that
GlobalMemoryStatusEx().ullAvailPageFilereflected the process's remaining job-memory allowance. The author's measured probes show that it continued to report system-wide free commit inside both process-limited and job-limited jobs, including a nested job. My proposed fallback toullAvailPageFilefor every job would therefore not enforce those limits, and would discard the page-file-growth benefit for jobs with no memory cap. Please disregard that recommendation.Current head
ae8050f1instead detects the limits it can query on the immediate job and scopes the growth estimate accordingly. An inherited limit on an outer job remains a documented limitation, not a failure I reproduced. My separate compile-admission test finding is unaffected; it concerns whether that regression test can pass without exercising its intended low-headroom state.AI use: OpenAI Codex (GPT-6.2 Sol) rechecked the thread and corrected its earlier inference.
Imported from ivall/xcl. Originally posted by Foniass on 2026-12-01T08:03:33Z.
merge-check
base:
7d86c5d2b7head:
ae8050f163merge: clean
build: cargo build --workspace -> ok
tests: cargo test --workspace --no-fail-fast -- --test-threads=4 -> 2901 passed, 0 failed, 51 ignored; SKIPPED: 28 (20 no wave64, 2 no d3d12SDKLayers.dll, 1 no D3D12 debug layer, 1 no heap windows, 1 cannot disable the driver cache, 3 others; the same set as on main); failing: none
review: read the whole diff (dxc.rs, uma.rs, real.rs). "Can grow to" is current free commit (
ullAvailPageFile) plus, per page file, its maximum minus its current size capped by free space on its volume (NtQuerySystemInformation(SystemPageFileInformationEx)), with no growth counted inside a memory-limited job. It changes the default path only for the heap plan: on a PC whose page files are small now but can grow, the coherent window goes from 512 MB to the title's stored need plus 512 MB (up to 4095 MB at 24 GB of RAM or more, RAM/8 below that); the compile gates still read free commit as on main. Findings: (1) from reading, not measured: this doesn't add commit (the PR's runs peak about where main's does), but the window grows, and perauto_coherent_cap's comment Windows keeps that window resident in RAM, so PCs under 24 GB with small growable page files are the ones whose behaviour changes most, while all the PR's runs are on 32 GB; a 16 GB run or a Not tested line would cover it. (2)uma.rs~1087-1091 still labels the number "MB of commit free" while outside a job it includes the growth. (3) The thread-timing gap ina_background_compile_waits_for_commit_free_now_not_the_page_files_growththat a reviewer raised is still open on this head. (4) #632 edits the same block and callsfree_commit(), which this removes, so whichever lands second needs a rebase. Fine: theSYSTEM_PAGEFILE_INFORMATION_EXlayout (40 bytes, info class 144), sizes in pages, an empty result when the buffer is too small or the volume is unknown, the compile gates andbig_compile_commit_freestill onullAvailPageFile, and the immediate-job query.performance: 60 s smoke of a retail title, main
7d86c5d2vs this merge (2b5a13ad): 1663 -> 1666 frames shown (100 %; last presents per 2 s: 60 60 61), peak commit 17153 -> 18768 MB, 0 device removals, 0 crashes. Peak commit is about 1.6 GB above main here (109 %), consistent with a larger coherent window on this 32 GB machine.verdict: safe to merge (a run on a PC under 24 GB of RAM, or a Not tested line, would cover the case that changes most; the log label should say the number includes page-file growth)
hardware / tool and model: RTX 5070 Ti (driver 621.14), Ryzen 7 7800X3D, Windows 11 26300 / Claude Code with Claude Opus 5.5
AI-written and posted by Foniass without a human check of each point.
Imported from ivall/xcl. Originally posted by Foniass on 2026-12-01T10:11:38Z.
Triage (#1607) – head
ae8050fNo open or merged PR makes the same change: #632 also touches the
NEEDS_FOR_COHERENT_HEAPScheck inuma.rs, but to give a title a whole coherent window in its first run, not to count page-file growth. The compile gates (wait_for_memory,big_compile_commit_free) still admit against commit free now, and theSystemPageFileInformationExstruct layout matches the kernel's (the padding beforePageFileName.Bufferis implicit inrepr(C)).Minor:
page_filesreads into a fixed 4 KiB buffer and treats any non-zero status (includingSTATUS_INFO_LENGTH_MISMATCH) as no page files, so growth falls back to 0. That is the safe side.Recommendation: keep open.
AI review: Claude Code (Claude Opus 5.5), diffs read only, not built or run; not checked by a human.
Imported from ivall/xcl. Originally posted by Chrysana on 2026-12-01T14:23:13Z.
Thanks to both of you. The next head,
9f4160ce, is ready locally and changes only a test and a log line:wait_admittedswitched tocapacity(), it fails on the growth closure's panic, which is the regression it's there to catch.uma.rslabel (Foniass, point 2) now says what the number is:UMA: N MB of commit free, counting the page files' room to grow unless a job caps commit, under 17408 MB: ….auto_coherent_capcaps the window at RAM/8 (1 GiB at least), so on a 16 GB PC this PR can move the window from 512 MB to 2 GB at most, never to 4,095 MB. 2 GB is the size that cap's comment measured on a 16 GB machine.main. It reads the same 17,408 MB check, so if this lands first, itsfree_commit()becomesdxc::commit_capacity(). If #632 lands first, I'll rebase this onto it.Why I haven't pushed it yet: the regression run needs a clean title run of the head, and on AMD current
maincan't give one in either setting:XCL_DIRECT_DXIL, #3544 crashes at ~43 s. #3455 fixes it but isn't merged.XCL_DIRECT_DXIL=1, which the earlier heads were run with, AMD's compiler now crashes building graphics PSO26aa07cb05c04290(amdxc64.dll+0x85f80f) at 10–35 s, onmainb2b1f109and on this head alike.So I'll push
9f4160ce, rebased, with its smoke blocks once #3455 is onmain.As a check in the meantime, RX 9070 XT, default
XCL_DIRECT_DXIL, with #3455 merged on both sides:mainb2b1f109+ #3455: 1692 / 1689 frames, peak 18,107 / 18,668 MB.9f4160ce: 1663 / 1657 frames, peak 18,441 / 18,466 MB.7381166e806847c9, loaded at ~41 s) and got the 4,095 MB window, since free commit was above 17,408 MB at the start.Suite on
mainb2b1f109merged with9f4160ce: 2899 passed, 9 failed, 51 ignored. Onmainb2b1f109alone: 2894 / 9 / 51, with the same 8 tests failing on this card, so none of the failures come from this PR.AI use: Claude Code (Claude Opus 5.5) made the change, ran the tests and the title runs, and drafted this reply.
Imported from ivall/xcl. Originally posted by gut0to on 2026-12-01T15:07:18Z.
Code review location:
crates/xcl/src/gpu/recomp/dxc.rs; line 890Could volume free space be counted once per distinct volume?
page_files()attachesGetDiskFreeSpaceExWfree bytes to each page-file entry, andgrowth_of()caps every entry independently. If two reported page files resolve to the same volume, both can claim the same free bytes, socommit_capacity()may overestimate how much commit can be added and admit a heap plan that later cannot grow. Please aggregate the growth limits by volume and add a test with two page files sharing one volume.Imported from ivall/xcl. Originally posted by gut0to on 2026-12-01T15:07:18Z.
Review: COMMENTED
AI-assisted review: I traced the page-file enumeration, per-path free-space query, and capacity calculation. I used AI assistance and checked the current implementation; I did not run a Windows configuration test.
Imported from ivall/xcl. Originally posted by Chrysana on 2026-12-02T00:29:44Z.
Code review location:
crates/xcl/src/gpu/recomp/dxc.rs; line 890Yes, done locally. The page files' growth is now added up per volume, and each volume's total is capped once by its free space. Each page file still stops at its own maximum.
The volume is now found by its name (
GetVolumePathNameW, thenGetVolumeNameForVolumeMountPointW, giving\\?\Volume{…}\), not by the path's drive letter. Two paths on one volume share one budget that way, and a page file on a volume mounted in a folder (C:\mnt\x\pagefile.sys) is counted against that volume, not againstC:. Before, that case also readC:'s free space.New test
page_files_on_one_volume_share_its_free_space: two page files on one volume with 10 GB free, each able to grow by 14 GB, and one on another volume with 4 GB of room. The result is 14 GB. With the old per-file cap it reads 24 GB, so the test fails; I checked that.On this PC the three page files resolve to three different volume names, each with its free space, so nothing measured so far changes. System Properties sets one page file per drive, so two on one volume would take a hand-edited registry setting; I didn't set one up. The sum is right either way.
This goes into the same push as the changes in my last comment, once #3455 is on
main.AI use: Claude Code (Claude Opus 5.5) made the change, wrote and ran the test, and drafted this reply.
Imported from ivall/xcl. Originally posted by bmjask on 2026-12-02T12:42:29Z.
Code review location:
crates/xcl/src/gpu/uma.rs; line 1076heaps_windownow allows the large coherent window based on page-file growth, butreserve_runtime/with_windowscommit that whole window at startup (MEM_RESERVE|MEM_COMMIT), and growth that hasn't happened yet doesn't back the commit. On the PR's target machine (2 GB page files, 1.7-4 GiB free now, 20 GiB of growth),capacity()is about 22 GiB. The 4-window layout plans 4095 MB, and the 16-window layout plans title+512 MB (~13.5 GiB) committed in 4 GiB chunks. Those single VirtualAlloc commits exceed the current commit limit, and Windows can fail them when the page file can't grow fast enough, the lag the PR cites for the compile gates.reserve_exactlythen fails,reserve_runtimeretries the multi-GB commit at each of ~127 (4-window) or ~15 (16-window) slots, then falls back toUma::new(max(mb, coherent))with the same size. The result can be "could not reserve … plain allocations" (no UMA) after a long startup stall, where main gave a working 512 MB window. Sizing the startup commit from free-now, and growing into page-file growth later, would avoid it.Imported from ivall/xcl. Originally posted by bmjask on 2026-12-02T12:42:29Z.
Code review location:
crates/xcl/src/gpu/recomp/dxc.rs; line 926job_commit_limitreads JobMemoryLimit/ProcessMemoryLimit but only uses it to skip the growth term, andcapacity()still returns system-wideullAvailPageFile, which the PR itself notes doesn't show job limits. With an 8 GB JOB_OBJECT_LIMIT_JOB_MEMORY on a PC with 42 GB of system commit free,capacity()returns 42 GB, so the title's ~13 GiB of heaps go to the coherent window, its commits pass the job's 8 GB limit and fail (no image, or a crash). Capping capacity atmin(now, limit - the job's current commit)would respect it.Imported from ivall/xcl. Originally posted by bmjask on 2026-12-02T12:42:29Z.
Code review location:
crates/xcl/src/gpu/recomp/dxc.rs; line 889Not certain about this one:
growth_ofcaps each page file by its volume's whole free space separately, so several page files on one volume count the same free bytes more than once. With two paging files on C: (allowed through the PagingFiles registry value), each 2 GB of 16 GB, and 10 GB free on C:, growth counts 10+10 = 20 GB where only 10 GB can be had, which can push capacity over the 17 GiB threshold when it shouldn't.Imported from ivall/xcl. Originally posted by bmjask on 2026-12-02T12:42:29Z.
Review: COMMENTED
Review of
ae8050f1: 3 finding(s). 3 are inline.These findings come from an AI-assisted review (Claude Code) and focus on correctness. Each is a candidate; please check it before acting on it.
Imported from ivall/xcl. Originally posted by Chrysana on 2026-12-02T14:11:12Z.
Code review location:
crates/xcl/src/gpu/uma.rs; line 1076I tested this on the case you describe: about 2.4–3 GB of commit free now and 22.5 GB of page-file growth, on Windows 11 build 26200 with an RX 9070 XT. The startup commit went through every time, in under 0.1 s, with no retries.
Title runs. Main
b2b1f109against this PR's next head5e4c76ab, 2 rounds each, 20 s per run, default settings. Before each run, a commit-only filler left 2.4–3.0 GB free. Page files: C: 8,196 of 16,384 MB, D: 2,048 of 16,384 MB, X: fixed 32,768 MB.The PR's window landed at
0x400000000both times. That's the first slot, the same base as main, soreserve_runtimenever retried or fell back. The 4,095 MB commit added 70–90 ms to startup. None of the 4 runs had a crash or a device removal.The same
VirtualAllocwithout a title.MEM_RESERVE | MEM_COMMIT | MEM_WRITE_WATCH,PAGE_READWRITE, timed, with page-file sizes read while it was held:Windows grew the page files inside the call, filling C: to its maximum and then moving on to D:. A commit over the current limit waited for that growth and then succeeded. The page files went back to their minimums once the commit was released.
So on this PC, a startup commit within what the page files can grow to doesn't fail. What would make it fail is growth that can't happen at all: a page file already at its maximum, or a volume without the free space.
capacity()already leaves both out (each page file's growth stops at its maximum, and each volume's total is capped by its free space). The 16-window layout ran only in the probe; I didn't run a title withXCL_UMA_WINDOWS=16.I'd rather not size the startup commit from free-now. Below 17 GiB of free now, that would put the window back to
main's 512 MB on the machines this PR is for. If you know of a setup where a commit within the page files' growth room fails, I can test it here.AI use: Claude Code (Claude Opus 5.5) wrote the probe and runner scripts, ran the tests and drafted this reply.
Imported from ivall/xcl. Originally posted by bmjask on 2026-12-02T14:11:36Z.
@Prime1997 could you take a look at this one for review and merge? My automated review notes are above, if any.
Imported from ivall/xcl. Originally posted by Chrysana on 2026-12-02T14:14:22Z.
Code review location:
crates/xcl/src/gpu/recomp/dxc.rs; line 889Right, and gut0to found the same thing (thread). The fix is in the next head,
5e4c76ab. It's ready locally and goes out in the same push as the other changes, once #3455 is onmain.growth_ofnow adds up the page files' room per volume and caps each volume's total once by its free space. Each page file still stops at its own maximum. The volume comes from its volume name (GetVolumePathNameW, thenGetVolumeNameForVolumeMountPointW), not the drive letter, so a volume mounted in a folder is counted on its own too. In your example, two page files on C: at 2 of 16 GB with 10 GB free on C: now count 10 GB, not 20.The test
page_files_on_one_volume_share_its_free_spacecovers it: two page files on one volume with 10 GB free, each able to grow by 14 GB, plus one on another volume with 4 GB of room, gives 14 GB. With the old per-file cap it reads 24 GB and the test fails.AI use: Claude Code (Claude Opus 5.5) made the change, wrote and ran the test, and drafted this reply.
Imported from ivall/xcl. Originally posted by Chrysana on 2026-12-02T14:14:41Z.
Code review location:
crates/xcl/src/gpu/recomp/dxc.rs; line 926That's right about
capacity()inside a job, but this PR doesn't change it. With a job memory limit,capacity()returnsullAvailPageFilealone, with no growth added. That's the same valuemain'sfree_commit()inuma.rsreads for the same check. So in your 8 GB job with 42 GB of system commit free,mainalso sees 42 GB and picks the same window. The PR only keeps the page files' growth out of that case.In practice, an 8 GB job stops the title with or without the window. In our runs it commits 14–15 GB in its first 20 s with
main's 512 MB window, and 16–18 GB over 60 s. A cap at the job's remaining commit would only change the outcome for a limit in a narrow band: above what the title needs without the window, but below what it needs with it.I'd rather keep that out of this PR, since
mainhas the same gap. Capping it needs the job's current commit, andJOBOBJECT_EXTENDED_LIMIT_INFORMATIONonly has the peaks. For a per-process limit the process'sPrivateUsagewould do; for a job-wide limit it means adding up every process in the job. And only the immediate job can be read, as we found with thehollowedone above. I can open an issue for it, or do a follow-up PR after this one, if you think it's worth having.AI use: Claude Code (Claude Opus 5.5) checked the code paths on
mainand this PR and drafted this reply.Imported from ivall/xcl. Originally posted by ClosetPie107 on 2026-12-02T17:13:16Z.
Linux / AMD RDNA4 (RADV, Wine + vkd3d-proton): full test suite on
ae8050fMerged onto
main5eaadb54(clean merge) and compared withmainrun twice on the same machine.Setup
v3.1-83-gcae8353edand DXVKdxgi.dllfrom GE-Proton11-16, DXC 1.9.2609.5x86_64-pc-windows-msvcwithcargo-xwin; test binaries run under WineTested:
cargo xwin test --workspace --target x86_64-pc-windows-msvc --no-fail-fast -- --test-threads=4 --skip <31 tests>main5eaadb54main:hle::kernelx::tests::a_page_whose_move_fails_stays_mapped_where_it_was.kernelx.rs: the test also fails onmainwhen its module runs on its own (hle::kernelx::tests, 4 threads: 0 of 5 runs pass onmain, 2 of 3 on this PR). It passed in both full-suite runs ofmain, so under Wine it depends on which tests ran before it.page_files_that_start_small_count_what_they_can_grow_by,page_file_growth_stops_at_its_volume_free_space_and_a_fixed_size,the_page_files_read_from_the_kernel_are_within_their_maximum,a_background_compile_waits_for_commit_free_now_not_the_page_files_growth,a_job_commit_limit_keeps_the_gpu_heaps_off_the_page_files_growth).main:gpu::recomp::tests::gpu_qsad_and_mqsad(flaky onmainunder Wine).About the failures on
mainand the 31 skipped tests (same for every PR in this batch)main's 177 failures under Wine come from #175: once a test has set up the real device, vkd3d-proton refuses the command allocators XCL adopts (d3d12_command_list_Reset: Invalid command allocator), and later tests getE_INVALIDARG(0x80070057). Running vkd3d-proton master with its vtable check taken out,hle::d3d12x::sparse::testsgoes from 106 passed / 38 failed to 144 / 0.std::terminate()(Cannot reliably convert LLVM pointer type, we cannot differentiate between Function and Private), which kills the whole test binary. They are the split-wave64, dispatch-chain and bridged-mask GPU tests,gpu_compute_mode_dispatch_abi,gpu_compute_thread_limits_leave_the_lanes_past_them_out, the twogpu_mesh_mode_*tests, andconsole_wave64_compute_through_the_pso_hook_dispatch_and_read_back, plusserialize_root_signature_strips_console_flags_and_preserves_pc_flags, whose null descriptor vkd3d-proton dereferences. The dxil-spirv ones crash the same way with vkd3d-proton master (f8c1cae8, dxil-spirv93ab44c5).mainwas run twice: same counts, same failure set.SKIPPEDlines (same asmain): no heap windows (2), no D3D12 debug layer (2-3), driver cache control not implemented in vkd3d-proton (1).Not tested: Windows, NVIDIA, a retail title /
scripts/smoke.ps1, a review of the diff. This is a test report, not amerge-check.AI use: omp (Claude Opus 5.5) merged, built and ran the suites on this machine, compared the results with
main, and drafted this report. The user asked for it to be posted.View 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.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.