Skip to content

D3D12.X: the driver heap's grooming reserves stretches a smaller window fits in - #2977

Merged
Prime1997 merged 2 commits into
xcl-dev:mainfrom
Prime1997:contrib/uma-driver-small-window
Nov 27, 2026
Merged

Prime1997 merged 2 commits into
xcl-dev:mainfrom
Prime1997:contrib/uma-driver-small-window

Conversation

@Prime1997

@Prime1997 Prime1997 commented Nov 27, 2026 •

Copy link
Copy Markdown
Collaborator

Requested 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-dev with #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: groom reserves the free stretches the window fits in (least = min(len, 1 GiB), margin min(256 MiB, len / 2)).
  • Test 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

  • NVIDIA GeForce RTX 3060 Ti 8 GB (driver 32.0.16.1714), Intel Core i5-10400, Windows 11 26200, rustc 1.100.0; debug tests, release smoke.
  • cargo test --locked --workspace --no-fail-fast -- --test-threads=4 with XCL_DXC_DIR set to DXC 1.9.2609.5: 1455 passed, 3 failed, 47 ignored. The 3 failures are tests that fail on main c2ee10e4 itself (1453 passed, 3 failed, 47 ignored 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.
  • SKIPPED on this adapter: 27 (no wave64: 21, per-lane f16 form refused: 3, no dxc.exe: 1, cannot disable the driver cache (Windows Developer Mode is required): The application requested an operation that depend: 1, no heap windows: 1).

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):

xcl-smoke v1
commit: b49be1836844fe0b0cdb3211dce3cb7fb4e21ac7
gpu: NVIDIA GeForce RTX 3060 Ti
title: 419239bf
seconds: 60
exit: 0x0
frames shown: 363 (PresentX 363)
presents per 2 s (last 3): 16 17 16
device removals: 0
crashes: 0
peak commit: 15320 MB

This PR's head (with XCL_PREPARE=0, the switch of #2976):

xcl-smoke v1
commit: f78e05bcc2803becade7e5368b2f0008e5d7c74b
gpu: NVIDIA GeForce RTX 3060 Ti
title: 419239bf
seconds: 60
exit: 0x0
frames shown: 351 (PresentX 351)
presents per 2 s (last 3): 15 15 15
device removals: 0
crashes: 0
peak commit: 15255 MB

Not tested

  • The remake on main itself in a title run: the smoke below runs main's default layout, whose coherent window size comes from the title's stored size; the failure and the fix above were seen on nvidia-dev's 16-window layout.
  • AMD (the remake is for NVIDIA), Wine.

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

Prime1997 and others added 2 commits November 26, 2026 21:41
Since xcl-dev#2555 every start on main runs the shader preparation before the
title's code, and it has no way out: on a retail title with a shader pack
of 26,503 records and a cold cache that is hours on an RTX 3060 Ti, for a
look at a change that needs a minute of play, and a regression run of
main or of a PR's head sits through it first. nvidia-dev has the switch
(present/preparation.rs, the same place): with XCL_PREPARE=0 the
preparation is left out and the title builds the shaders it uses as it
goes, standing still for those builds, as before xcl-dev#2555. Unset, or any
other value, prepares as now.

Test: only_xcl_prepare_0_leaves_the_preparation_out. README: the switch,
next to the preparation's description.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ow fits in

The driver-heap remake of the coherent window (xcl-dev#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: in a retail title on an RTX
3060 Ti the driver mapped the heap at 0x4a720000, not the window's
0x1300000000, and the window stayed imported ("Map gave ..., not the
window's ..."). Stretches the window fits in are reserved now, with a
margin under half the window left free for the driver's own mappings.

With the fix the window was remade at its address ("a driver CUSTOM
write-back L0 heap mapped at its address").

Test: grooming_leaves_a_window_under_1_gib_only_its_hole (in a process of
its own): 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.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Prime1997 Prime1997 self-assigned this Nov 27, 2026
@Prime1997
Prime1997 marked this pull request as ready for review November 27, 2026 06:42
@thehollowedone

Copy link
Copy Markdown
Contributor

Independent RTX 3080 Ti check of #2977 head f78e05bcc2803becade7e5368b2f0008e5d7c74b against current main 83b008188efbf954b846667f48d75e3fa9310a01. The tree delta is confined to uma_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 --workspace first, then cargo test --offline --locked --workspace --no-fail-fast -- --test-threads=4:

Tree Passed Failed Ignored GPU skip notices
main 83b00818 1,456 1 47 43
#2977 f78e05bc 1,457 1 47 43

All 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, at cached_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 added grooming_leaves_a_window_under_1_gib_only_its_hole test 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

Copy link
Copy Markdown
Contributor

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:

  1. When a free span starts one 64 KiB granule before the released window, the current margin can start inside the hole. It reserves nothing in that span, so a window-sized mapping can start 64 KiB early. An isolated Win32 VA regression failed on the unchanged PR head: VirtualAlloc accepted 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.
  2. An expanded coherent layout can end in a single 64 KiB window. Its new margin = len / 2 rounds 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_disk assumes 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 main 83b00818, 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 --workspace passed, then cargo test --offline --locked -j 4 --workspace --no-fail-fast -- --test-threads=4 ran 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
diff --git a/crates/xcl/src/hle/d3d12x/uma_driver.rs b/crates/xcl/src/hle/d3d12x/uma_driver.rs
index e4c4b8b7..1e485718 100644
--- a/crates/xcl/src/hle/d3d12x/uma_driver.rs
+++ b/crates/xcl/src/hle/d3d12x/uma_driver.rs
@@ -94,8 +94,12 @@ unsafe fn groom(hole: usize, len: usize) -> Vec<usize> {
         if m.State != MEM_FREE || m.RegionSize < least {
             continue;
         }
-        let s = ((base + 0xFFFF) & !0xFFFF) + margin;
-        for (s, e) in [(s, end.min(hole)), (s.max(hole + len), end)] {
+        let first = (base + 0xFFFF) & !0xFFFF;
+        let s = first + margin;
+        // A free granule immediately before the hole lets a window-sized mapping start there.
+        // Keep the driver's margin, but reserve that granule when the margin reaches the hole.
+        let left = if first < hole && hole < end { s.min(hole - 0x1_0000) } else { s };
+        for (s, e) in [(left, end.min(hole)), (s.max(hole + len), end)] {
             let mut s = s;
             while s < e {
                 let n = (e - s).min(1 << 40);
@@ -121,6 +125,11 @@ unsafe fn ungroom(got: Vec<usize>) {
 /// of it, mapped for good. On failure the window is the title's memory again, its pages as they
 /// were.
 pub(super) unsafe fn remake(device: &ID3D12Device, base: usize, size: usize) -> Result<(ID3D12Heap, ID3D12Resource), String> {
+    // Grooming has no room to leave a driver allocation margin around a single granule.
+    // Keep that small window in its original allocation for open_uma to import.
+    if size <= crate::gpu::uma::GRAIN {
+        return Err("single-granule window stays imported".into());
+    }
     remake_with_after_release(device, base, size, || Ok(()))
 }
 
@@ -248,7 +257,7 @@ mod tests {
     fn failed_write_watch_does_not_release_the_original_window() {
         use super::*;
         use windows::Win32::Graphics::Direct3D::D3D_FEATURE_LEVEL_11_0;
-        const SIZE: usize = 1 << 16;
+        const SIZE: usize = 2 * crate::gpu::uma::GRAIN;
         unsafe {
             let base = VirtualAlloc(std::ptr::null(), SIZE, MEM_RESERVE | MEM_COMMIT, PAGE_READWRITE) as usize;
             assert_ne!(base, 0);
@@ -259,7 +268,8 @@ mod tests {
                 return crate::gpu::recomp::runner::skip_test("no D3D12 device");
             }
             // A regular VirtualAlloc block lacks MEM_WRITE_WATCH, forcing GetWriteWatch to fail.
-            assert!(remake(&dev.unwrap(), base, SIZE).is_err());
+            let error = remake(&dev.unwrap(), base, SIZE).unwrap_err();
+            assert!(error.contains("GetWriteWatch"), "{error}");
             let mut info: MEMORY_BASIC_INFORMATION = std::mem::zeroed();
             assert_ne!(VirtualQuery(base as *const c_void, &mut info, std::mem::size_of_val(&info)), 0);
             assert_eq!(info.AllocationBase as usize, base);
@@ -269,11 +279,36 @@ mod tests {
         }
     }
 
+    #[test]
+    fn a_single_granule_window_stays_committed_for_import() {
+        use super::*;
+        use windows::Win32::Graphics::Direct3D::D3D_FEATURE_LEVEL_11_0;
+        const SIZE: usize = crate::gpu::uma::GRAIN;
+        unsafe {
+            let base = VirtualAlloc(std::ptr::null(), SIZE, MEM_RESERVE | MEM_COMMIT | MEM_WRITE_WATCH, PAGE_READWRITE) as usize;
+            assert_ne!(base, 0);
+            (base as *mut u8).write(0x5a);
+            let mut dev = None;
+            if D3D12CreateDevice(None, D3D_FEATURE_LEVEL_11_0, &mut dev).is_err() {
+                VirtualFree(base as *mut c_void, 0, MEM_RELEASE);
+                return crate::gpu::recomp::runner::skip_test("no D3D12 device");
+            }
+            let error = remake(&dev.unwrap(), base, SIZE).unwrap_err();
+            assert_eq!(error, "single-granule window stays imported");
+            let mut info: MEMORY_BASIC_INFORMATION = std::mem::zeroed();
+            assert_ne!(VirtualQuery(base as *const c_void, &mut info, std::mem::size_of_val(&info)), 0);
+            assert_eq!(info.AllocationBase as usize, base);
+            assert_eq!(info.State, MEM_COMMIT);
+            assert_eq!((base as *const u8).read(), 0x5a);
+            assert_ne!(VirtualFree(base as *mut c_void, 0, MEM_RELEASE), 0);
+        }
+    }
+
     #[test]
     fn failed_restore_stops_before_importing_an_unbacked_window() {
         use super::*;
         use windows::Win32::Graphics::Direct3D::D3D_FEATURE_LEVEL_11_0;
-        const SIZE: usize = 1 << 16;
+        const SIZE: usize = 2 * crate::gpu::uma::GRAIN;
         const CODE: i32 = 0x7C1_0003;
         if std::env::var_os("XCL_TEST_RESTORE_COLLISION").is_some() {
             unsafe {
@@ -348,4 +383,44 @@ mod tests {
         let transcript = format!("{}{}", String::from_utf8_lossy(&output.stdout), String::from_utf8_lossy(&output.stderr));
         assert_eq!(output.status.code(), Some(0), "{transcript}");
     }
+
+    /// A free allocation granule immediately before the target must not let a full window
+    /// land one granule too early. Run alone because grooming reserves other free VA ranges.
+    #[test]
+    fn grooming_blocks_a_window_starting_one_granule_before_its_hole() {
+        use super::*;
+        const LEN: usize = 512 << 20;
+        const GRAIN: usize = 0x1_0000;
+        const RUN: &str = "XCL_TEST_GROOM_NEAR_HOLE";
+        if std::env::var_os(RUN).is_some() {
+            unsafe {
+                let reserve = |at: usize, n: usize| VirtualAlloc(at as *const c_void, n, MEM_RESERVE, PAGE_NOACCESS) as usize;
+                let block = reserve(0, LEN + 3 * GRAIN);
+                assert_ne!(block, 0);
+                assert_ne!(VirtualFree(block as *mut c_void, 0, MEM_RELEASE), 0);
+                let hole = block + 2 * GRAIN;
+                let high = hole + LEN;
+                assert_eq!(reserve(block, GRAIN), block);
+                assert_eq!(reserve(high, GRAIN), high);
+                let got = groom(hole, LEN);
+                let wrong = reserve(hole - GRAIN, LEN);
+                assert_eq!(wrong, 0, "a window-sized mapping fit across the hole boundary at {wrong:#x}");
+                let right = reserve(hole, LEN);
+                assert_eq!(right, hole, "the intended hole was blocked");
+                assert_ne!(VirtualFree(right as *mut c_void, 0, MEM_RELEASE), 0);
+                ungroom(got);
+                for p in [block, high] {
+                    assert_ne!(VirtualFree(p as *mut c_void, 0, MEM_RELEASE), 0);
+                }
+            }
+            return;
+        }
+        let output = std::process::Command::new(std::env::current_exe().unwrap())
+            .args(["--exact", "hle::d3d12x::uma_driver::tests::grooming_blocks_a_window_starting_one_granule_before_its_hole", "--nocapture"])
+            .env(RUN, "1")
+            .output()
+            .unwrap();
+        let transcript = format!("{}{}", String::from_utf8_lossy(&output.stdout), String::from_utf8_lossy(&output.stderr));
+        assert!(output.status.success(), "{transcript}");
+    }
 }
Separate test-only cache isolation candidate for main
diff --git a/crates/xcl/src/gpu/recomp/pso.rs b/crates/xcl/src/gpu/recomp/pso.rs
index 5d000775..2b784c35 100644
--- a/crates/xcl/src/gpu/recomp/pso.rs
+++ b/crates/xcl/src/gpu/recomp/pso.rs
@@ -1943,6 +1943,20 @@ mod shader_cache_tests {
     #[test]
     fn console_mesh_caches_hlsl_compute_pass_in_memory_and_on_disk() {
         use std::sync::atomic::{AtomicUsize, Ordering};
+        const RUN: &str = "XCL_TEST_CONSOLE_MESH_CACHE_RUN";
+        if std::env::var_os(RUN).is_none() {
+            // The public entry point uses process-wide caches. Parallel tests can change their
+            // state between the first call and the cached-only assertion.
+            let dir = std::env::temp_dir().join(format!("xcl-mesh-cache-isolated-{}", std::process::id()));
+            let output = std::process::Command::new(std::env::current_exe().unwrap())
+                .args(["gpu::recomp::pso::shader_cache_tests::console_mesh_caches_hlsl_compute_pass_in_memory_and_on_disk", "--exact", "--nocapture"])
+                .env(RUN, "1")
+                .env("XCL_DXIL_CACHE", &dir)
+                .output().unwrap();
+            let _ = std::fs::remove_dir_all(&dir);
+            assert!(output.status.success(), "{}\n{}", String::from_utf8_lossy(&output.stdout), String::from_utf8_lossy(&output.stderr));
+            return;
+        }
         let blob = synthetic_mesh_container();
         let dir = std::env::temp_dir().join(format!("xcl-mesh-hlsl-cache-{}", std::process::id()));
         let _ = std::fs::remove_dir_all(&dir);

@Decodere

Copy link
Copy Markdown
Contributor

Independent desktop NVIDIA verification of PR #2977 at head f78e05bcc2803becade7e5368b2f0008e5d7c74b (2-commit PR stack 8617577b67c3b2c67542ff3d47d6e631967c16c6 -> f78e05bcc2803becade7e5368b2f0008e5d7c74b, where 8617577b is merged #2976 XCL_PREPARE=0 inside 83b008188efbf954b846667f48d75e3fa9310a01; exact parent & merge-base on main: 8617577b67c3b2c67542ff3d47d6e631967c16c6).

Environment

  • GPU: NVIDIA GeForce RTX 4060 (8 GB / 7956 MiB reported by D3D12), driver 32.0.16.2114 (NVIDIA 621.14, WDDM 3.2)
  • CPU / RAM / OS: Intel Core i5-11400F (6C / 12T), 32 GB RAM (31.9 GiB usable), Windows 11 Home 26200 (Developer Mode off)
  • Toolchain: rustc 1.100.0 (0ef1bc386 2026-11-09) MSVC, DXC 1.9.2609.5, --release

Targeted release tests & build (f78e05bc)

Command Result
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, 0 skipped — 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, 0 skipped: 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, 0 runtime skips)
cargo build --release -p xcl Clean build (1m 41s, exit 0, 0 new warnings in uma_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):

xcl-smoke v1
commit: 8617577b67c3b2c67542ff3d47d6e631967c16c6
gpu: NVIDIA GeForce RTX 4060
title: 29640639
seconds: 60
exit: 0x0
frames shown: 1613 (PresentX 1614)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 14030 MB

PR #2977 (f78e05bcc2803becade7e5368b2f0008e5d7c74b, XCL_PREPARE=0 XCL_NETWORK=0):

xcl-smoke v1
commit: f78e05bcc2803becade7e5368b2f0008e5d7c74b
gpu: NVIDIA GeForce RTX 4060
title: 29640639
seconds: 60
exit: 0x0
frames shown: 1623 (PresentX 1623)
presents per 2 s (last 3): 61 60 60
device removals: 0
crashes: 0
peak commit: 14023 MB

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

  • Directly verified the < 1 GiB grooming fix (512 MB window vs a 768 MB free VA stretch) via grooming_leaves_a_window_under_1_gib_only_its_hole (3/3, 0 skipped) along with all 4 hle::d3d12x::uma_driver:: tests (3/3) and hle::d3d12x::real:: (63/63 × 3) on Windows 11 + RTX 4060.
  • In the paired 60 s smoke runs on title: 29640639, the title uses a 4095 MB coherent window (already >= 1 GiB), so both parent 8617577b and PR D3D12.X: the driver heap's grooming reserves stretches a smaller window fits in #2977 mapped the driver CUSTOM write-back L0 heap at 0x700000000 cleanly; a live < 1 GiB / 16-window retail fallback (Map gave ..., not the window's ...) was not reproduced outside the subprocess unit test.
  • Paired 60 s retail smokes ran with XCL_PREPARE=0 (XCL_NETWORK=0), bypassing startup prepare_for_launch shader precompilation.

AI disclosure: test execution and report drafting assisted by Google Antigravity (Gemini 4 Neon).

@SlopTart

Copy link
Copy Markdown

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 main fa671a2f): FAILED on both lanes. Everything else stayed at baseline.

  • Rig (AMD Ryzen 9 9900X, 96 GB DDR5, RX 7900 XT 20 GB, Mesa 26.2.5 RADV, Arch, kernel 7.2.15, wine-11.0 Proton build + vkd3d-proton): 610/4 = standing two (gpu_promoted uav-clear, xma2/FAudio) + a known sparse load flake + your grooming test.
  • Boxb (Intel i5-10600K, 16 GB DDR4, GTX 1070 8 GB, driver 550.163.01, Debian 13, stock wine-10.0, xvfb): 610/5 = standing three (+ write-buffer) + the merged D3D12.X: UMA windows in a driver heap on NVIDIA, 4.9x FPS (0.62 -> 3.03) #2844 failed_restore... test (separate known red, see that thread) + your grooming test.

Head f78e05bc sits directly on current main fa671a2f (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.

@Prime1997
Prime1997 merged commit 623d02e into xcl-dev:main Nov 27, 2026
4 checks passed
@thehollowedone

Copy link
Copy Markdown
Contributor

Follow-up after #2977 merged as 623d02e: I checked the merged uma_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 in main.

groom still starts the left reservation at the free span's aligned base plus margin; if that start falls inside the hole, a window-sized allocation can start one 64 KiB granule before the intended address. remake still 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

fromthemoonx commented Nov 27, 2026 •

Copy link
Copy Markdown

Update on main 06f90c1, for the Wine failures above: on native Windows, on a 16 GB machine, both uma_driver tests pass.

Both tests ran alone 3 times each, and hle::d3d12x::uma_driver:: (4 tests) ran 3 times at --test-threads=4. Same RTX 3060 machine, 16 GB RAM (GlobalMemoryStatusEx reads 15 GiB), debug build:

test result
grooming_leaves_a_window_under_1_gib_only_its_hole passes 3 of 3 (1.0 s)
failed_restore_stops_before_importing_an_unbacked_window passes 3 of 3 (0.4 s)
uma_driver:: module 4 passed, 0 failed, 3 of 3 runs

So 16 GB alone does not make them fail on native Windows. I did not run a release build or Wine, so I cannot say what differs there.


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) that main just 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 to TempDir::drop:

83b0081 623d02e (2 runs)
coherent window 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, …)
debug-layer messages 3× error id 93, 1× error id 1046, 1× warning id 820, 8× id 0 the same, plus 2× warning id 926

The two new ones:

D3D12 debug layer (warning, id 926): WriteBufferImmediate: 1 resources contain the GPU Virtual Address range [0x00000002e0030000, 0x00000002e0030003] on a Heap (0x0000000000C89E30:'Unnamed ID3D12Heap Object').  This may be OK as long as only one of these resources is actively being used. …
D3D12 debug layer (warning, id 926): WriteBufferImmediate: … [0x00000002e0030004, 0x00000002e0030007] …

So the fix does what it says on this card: the window that stayed imported before is now a driver heap. The warnings' address 0x2e0030000 is 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.

@SlopTart

Copy link
Copy Markdown

Post-merge Wine check on main 06f90c19: your grooming test is red in-suite on both Wine lanes, and the merge also made failed_restore... deterministically red on our AMD+Wine lane.

We flagged pre-merge (above) that grooming_leaves_a_window_under_1_gib_only_its_hole failed at f78e05bc. It is now red in main:

  • Grooming test at 06f90c19: FAILED in-suite on BOTH lanes, and FAILED 3/3 solo on both. Identical signature: uma_driver.rs:349:9, left: Some(1), right: Some(0) (rig 22.5 / 13.3 / 18.1 s, boxb 5.4 / 4.9 / 4.7 s). Rig's run logged: window reservation at 0x55015e950000, hole 0x7fffde000000, stretch 0x8fff0000..0xbfff0000. Deterministic on Wine, AMD and NVIDIA alike.
  • failed_restore_stops_before_importing_an_unbacked_window at the same main: boxb (i5-10600K, GTX 1070, 16 GB DDR4, wine-10.0, xvfb) unchanged - 3/3 solo FAILED, uma_driver.rs:304:9 (line moved), Some(1) vs Some(130088963). But our rig (Ryzen 9 9900X, RX 7900 XT, 96 GB, Mesa 26.2.5 RADV, wine-11.0 Proton) went from flaky at fa671a2f (1/4 solo failures, passes taking 36-68 s) to 3/3 fast solo failures at 06f90c19 (8.3 / 6.6 / 6.2 s, rig-side assertion left: 0, right: 20381696). So the reservation math in this PR changed behavior on the AMD+Wine lane too, and not in the passing direction.
  • Suite totals at 06f90c19: boxb 610/5 = standing three + failed_restore + grooming. Rig 611/4 = standing two + a known sparse load flake + grooming (rig failed_restore was green in-suite but red solo x3, odd but recorded as-is).

Ties in with the 16 GiB-cap reproduction above (Some(1) / Some(130088963) under MemoryMax=16G): our boxb IS a 16 GB box, which matches its deterministic red; the rig at 96 GB now also fails, fast, post-merge.

Suite/solo: cargo test --release --locked -p xcl --lib --target x86_64-pc-windows-gnu (+ -- --test-threads=2 --skip gpu:: for suites, --exact solos), same-day fresh-main baselines both machines.

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

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants