D3D12.X: the driver heap's grooming reserves stretches a smaller window fits in #2977
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!2977
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-2977"
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?
@Prime1997 on GitHub · 2026-11-27 06:15 UTC · original
Prime1997:contrib/uma-driver-small-window→main· +69 −4 · 3 files · 2 commits · merged 2026-11-27 08:50 UTCRequested by Prime · project thread
Stacked on #2976; only the top commit belongs here.
The driver-heap remake of the coherent window (#2844) reserves every free stretch of 1 GiB or more so that the driver's mapping of the new heap can only land in the window's hole. A window under 1 GiB (XCL's 512 MB before a title's size is known, and the 16-window layout's) fits in a stretch between its size and 1 GiB that stays free. Stretches the window fits in are reserved now, with a margin under half the window left free for the driver's own mappings.
Why
In a retail title on an RTX 3060 Ti (
nvidia-devwith #2844 ported, 512 MB coherent window) the remake failed with "coherent window 3 stays imported: Map gave 0x4a720000, not the window's 0x1300000000 (133 reservations)", so the window stayed an imported heap, the slow case #2844 is about. With this change the same setup logged "the coherent window at 0x1300000000 (512 MB) is a driver CUSTOM write-back L0 heap mapped at its address".What is in it
crates/xcl/src/hle/d3d12x/uma_driver.rs:groomreserves the free stretches the window fits in (least = min(len, 1 GiB), marginmin(256 MiB, len / 2)).grooming_leaves_a_window_under_1_gib_only_its_hole(in a process of its own, as the restore test: while grooming no other thread could reserve more than the margins): with a 768 MB free stretch between two reservations below the hole, a 512 MB reservation after grooming lands in the hole; with the old 1 GiB rule it landed in the stretch (checked by running the test against the old rule).Tested
cargo test --locked --workspace --no-fail-fast -- --test-threads=4withXCL_DXC_DIRset to DXC 1.9.2609.5: 1455 passed, 3 failed, 47 ignored. The 3 failures are tests that fail onmainc2ee10e4itself (1453passed,3failed,47ignored there, same command):test_title_draws_with_a_root_signature_under_the_debug_layer,test_title_runs_and_game_folder_is_untouched,test_title_runs_under_the_debug_layer_with_dred.Regression run
A commit of
main(b49be183, the last one before the shader preparation of #2555, which prepares every record before the title and does not fit a 60 s run):This PR's head (with
XCL_PREPARE=0, the switch of #2976):Not tested
mainitself in a title run: the smoke below runsmain's default layout, whose coherent window size comes from the title's stored size; the failure and the fix above were seen onnvidia-dev's 16-window layout.AI use
Claude Code (Claude Opus 5.5) wrote the code, ran the suite and the regression runs on the hardware above, and wrote this description; Prime asked for it and owns the account. We coordinate the 8 GB work on the XCL Discord too: https://discord.gg/6B4TykyC4W
🤖 Generated with Claude Code
@thehollowedone on GitHub · 2026-11-27 07:08 UTC · original
Independent RTX 3080 Ti check of #2977 head
f78e05bcc2803becade7e5368b2f0008e5d7c74bagainst currentmain83b008188efbf954b846667f48d75e3fa9310a01. The tree delta is confined touma_driver.rs(the grooming change and its test).Windows 11 build 26300, RTX 3080 Ti (621.35), Ryzen 7 9800X3D, Rust 1.99.1 MSVC, debug. For each tree I ran
cargo build --offline --locked --workspacefirst, thencargo test --offline --locked --workspace --no-fail-fast -- --test-threads=4:main83b00818f78e05bcAll 38 test binaries ran in both suites. The sole failure on both trees is
gpu::recomp::pso::shader_cache_tests::console_mesh_caches_hlsl_compute_pass_in_memory_and_on_disk, atcached_only console_mesh hit: "DXIL not compiled yet". It also failed in a second full-suite run on the PR head, but passed when run alone on both trees; I cannot attribute the suite interaction to this PR. The addedgrooming_leaves_a_window_under_1_gib_only_its_holetest passed in the full PR suite and in a separate focused run (1 passed, 0 failed, 0 ignored). The 43 skip notices are excluded from GPU coverage; most are wave64 cases on this wave32 adapter.No retail title run was performed here. This is a same-machine parent/head test comparison, not a claim that the full suite is green or that the grooming change improves a title on this adapter.
AI use: Codex (GPT-6.2 Sol) checked the exact trees, ran the builds and tests on the hardware above, inspected the failures, and drafted this report.
@thehollowedone on GitHub · 2026-11-27 07:26 UTC · original
Follow-up to my parent/head test report, still against #2977 head
f78e05bcc2803becade7e5368b2f0008e5d7c74b.I found two address-placement edges in the grooming path and tested a candidate correction:
VirtualAllocaccepted the wrong start. With the candidate below it rejects the wrong start and still accepts the intended hole. This proves the address-selection gap; I did not observe a driver heap choose the wrong address in a title.margin = len / 2rounds to zero, so grooming attempts to reserve nearly every free allocation granule while the window is released. The candidate leaves that tiny window committed and returns the existing import fallback instead. A native D3D12 test confirmed the allocation and its marker remain intact; the actual fallback import of that tiny window was not exercised.All six UMA driver tests passed, including the new near-hole and tiny-window cases:
cargo test --offline --locked -j 4 -p xcl --lib hle::d3d12x::uma_driver::tests -- --test-threads=1 --nocapture: 6 passed, 0 failed, 0 ignored, no GPU skips. The near-hole test was 0/1 before the correction and 1/1 after.The suite failure in my earlier report has a separate test-only resolution on current main:
console_mesh_caches_hlsl_compute_pass_in_memory_and_on_diskassumes process-wide caches remain stable between two calls while other tests run. Running that one test in a child process with a private DXC cache keeps every assertion and makes the parallel suite pass. This belongs in a separate test-only PR, not in #2977's grooming change. On main83b00818, the same workspace suite changed from 1,456 passed / 1 failed / 47 ignored to 1,457 / 0 / 47 with only that test-isolation patch.With both local candidates applied to #2977,
cargo build --offline --locked -j 4 --workspacepassed, thencargo test --offline --locked -j 4 --workspace --no-fail-fast -- --test-threads=4ran all 38 binaries: 1,460 passed, 0 failed, 47 ignored, 43 GPU skip notices. That combined result does not claim a green suite for the grooming patch alone. No retail or paired smoke run was performed on these uncommitted candidates; a pushed runtime revision would need new clean-commit smoke blocks.AI use: Codex (GPT-6.2 Sol) wrote and ran the candidates and drafted this report. Codex (GPT-6.2 Astra) independently reviewed the grooming edge cases and correction.
Candidate grooming correction and regressions for #2977
Separate test-only cache isolation candidate for main
@Decodere on GitHub · 2026-11-27 07:48 UTC · original
Independent desktop NVIDIA verification of PR #2977 at head
f78e05bcc2803becade7e5368b2f0008e5d7c74b(2-commit PR stack8617577b67c3b2c67542ff3d47d6e631967c16c6->f78e05bcc2803becade7e5368b2f0008e5d7c74b, where8617577bis merged#2976XCL_PREPARE=0inside83b008188efbf954b846667f48d75e3fa9310a01; exact parent & merge-base onmain:8617577b67c3b2c67542ff3d47d6e631967c16c6).Environment
7956 MiBreported by D3D12), driver32.0.16.2114(NVIDIA621.14, WDDM 3.2)31.9 GiBusable), Windows 11 Home26200(Developer Mode off)rustc 1.100.0 (0ef1bc386 2026-11-09)MSVC, DXC1.9.2609.5,--releaseTargeted release tests & build (
f78e05bc)cargo test --release -p xcl --lib -- hle::d3d12x::uma_driver::tests::grooming_leaves_a_window_under_1_gib_only_its_hole --exact --nocapture(3 consecutive runs)1 passed; 0 failed; 0 ignored; 1356 filtered out× 3 (1.37s,1.36s,1.35s,0skipped — isolated subprocess verified 512 MB reservation lands at the target hole rather than a 768 MB stretch below it)cargo test --release -p xcl --lib -- hle::d3d12x::uma_driver:: --test-threads=1 --nocapture(3 consecutive runs)4 passed; 0 failed; 0 ignored; 1353 filtered out× 3 (1.91s,1.89s,1.89s,0skipped:driver_windows_by_default_on_nvidia_outside_wine,failed_restore_stops_before_importing_an_unbacked_window,failed_write_watch_does_not_release_the_original_window,grooming_leaves_a_window_under_1_gib_only_its_hole)cargo test --release -p xcl --lib -- hle::d3d12x::real:: --test-threads=1 --nocapture(3 consecutive runs)63 passed; 0 failed; 0 ignored; 1294 filtered out× 3 (2.07s,2.08s,2.07s,0runtime skips)cargo build --release -p xcl1m 41s, exit0,0new warnings inuma_driver.rs)Paired quiet 60 s retail smoke (
title: 29640639,XCL_PREPARE=0 XCL_NETWORK=0)Exact parent & merge-base (
8617577b67c3b2c67542ff3d47d6e631967c16c6,XCL_PREPARE=0 XCL_NETWORK=0):PR #2977 (
f78e05bcc2803becade7e5368b2f0008e5d7c74b,XCL_PREPARE=0 XCL_NETWORK=0):Runtime log check on both runs confirmed identical driver-heap placement on RTX 4060:
8617577b:D3D12.X: the coherent window at 0x700000000 (4095 MB) is a driver CUSTOM write-back L0 heap mapped at its address, write-watched (131 reservations, 0 pages kept, 0 KB, 295 ms)f78e05bc:D3D12.X: the coherent window at 0x700000000 (4095 MB) is a driver CUSTOM write-back L0 heap mapped at its address, write-watched (131 reservations, 0 pages kept, 0 KB, 290 ms)Limits of coverage
< 1 GiBgrooming fix (512 MBwindow vs a768 MBfree VA stretch) viagrooming_leaves_a_window_under_1_gib_only_its_hole(3/3,0skipped) along with all 4hle::d3d12x::uma_driver::tests (3/3) andhle::d3d12x::real::(63/63× 3) on Windows 11 + RTX 4060.title: 29640639, the title uses a4095 MBcoherent window (already>= 1 GiB), so both parent8617577band PR #2977 mapped the driver CUSTOM write-back L0 heap at0x700000000cleanly; a live< 1 GiB/ 16-window retail fallback (Map gave ..., not the window's ...) was not reproduced outside the subprocess unit test.XCL_PREPARE=0(XCL_NETWORK=0), bypassing startupprepare_for_launchshader precompilation.AI disclosure: test execution and report drafting assisted by Google Antigravity (Gemini 4 Neon).
@SlopTart on GitHub · 2026-11-27 08:19 UTC · original
Linux (Wine) dual-lane run at
f78e05bc: your new grooming test fails on BOTH vendor stacks.uma_driver::tests::grooming_leaves_a_window_under_1_gib_only_its_hole(new in this PR, not present at mainfa671a2f): FAILED on both lanes. Everything else stayed at baseline.failed_restore...test (separate known red, see that thread) + your grooming test.Head
f78e05bcsits directly on current mainfa671a2f(merge-base verified), compared against same-day baselines on the same machines (rig 609/4 full-suite incl. the uma test, boxb 609/4).Both lanes panic at the same spot:
uma_driver.rs:349:9,left: Some(1), right: Some(0)(identical on rig and boxb). The rig's run also logged its geometry line:window reservation at 0x55015e950000, hole 0x7fffde000000, stretch 0x8fff0000..0xbfff0000.Suite:
cargo test --release --locked -p xcl --lib --target x86_64-pc-windows-gnu -- --test-threads=2 --skip gpu::.AI use: Hermes agent (local Qwen-class) ran the tests and drafted this; I checked it before posting.
@thehollowedone on GitHub · 2026-11-27 08:56 UTC · original
Follow-up after #2977 merged as
623d02e: I checked the mergeduma_driver.rs. The original 512–768 MiB placement gap is fixed, but the two boundary cases in my earlier report, including regressions and a candidate diff remain inmain.groomstill starts the left reservation at the free span's aligned base plusmargin; if that start falls inside the hole, a window-sized allocation can start one 64 KiB granule before the intended address.remakestill enters grooming for a single-granule window, where the margin rounds to zero. The earlier isolated VA regression failed on the unchanged PR head and passed with the candidate; I have not rerun it on the merge commit or observed either case in a retail title.These are follow-up boundary fixes; reopening the merged PR is not possible. The linked diff keeps them together with their regressions so they can be applied or adapted without reconstructing the report.
AI use: Codex (GPT-6.2 Sol) checked the merged source and drafted this follow-up.
@fromthemoonx on GitHub · 2026-11-27 09:04 UTC · original
After the merge (
623d02e), the e2e debug-layer test on NVIDIA gets the coherent window as a driver heap, and the debug layer reports 2 new warnings (id 926) thatmainjust before it (83b0081) did not have. The other messages are unchanged.test_title_draws_with_a_root_signature_under_the_debug_layer, RTX 3060 12 GB (driver 610.88), Windows 11 Pro 26300, Rust 1.100.0 MSVC, debug, test folder kept with a scratch change toTempDir::drop:83b0081623d02e(2 runs)coherent window 3 stays imported: Map gave 0x4a5f0000, not the window's 0x700000000 (131 reservations)the coherent window at 0x700000000 (512 MB) is a driver CUSTOM write-back L0 heap mapped at its address, write-watched (134 reservations, …)The two new ones:
So the fix does what it says on this card: the window that stayed imported before is now a driver heap. The warnings' address
0x2e0030000is not in the coherent window (0x700000000), so I do not know which part of the new path brings them. The debug layer calls the case "may be OK". I note it only so that a later PR is not blamed for these warnings. The test passes on both.AI use: Claude Code (Claude Opus 5.5) ran the comparison and wrote this note.