D3D12.X: stop sparse upload_dirty ring wait when fence times out #1267

Closed
ExoCalibra wants to merge 1 commit from upstream-pr/1277 into main
ExoCalibra commented 2026-11-24 14:08:47 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by ExoCalibra on 2026-11-24T14:08:47Z.


sparse::State::wait_for returns after 5 s with a warning if the sparse upload queue stalls, but upload_dirty called wait_for(fv) inside a while loop waiting for staging ring space. When the oldest in-flight fence failed to advance, reclaim_ring freed nothing and upload_dirty looped forever while holding the global STATE mutex, hanging xcl-activity (sparse::pool_bytes) and every subsequent submit thread permanently.

What is in it

  • crates/xcl/src/hle/d3d12x/sparse.rs: return whether wait_for reached its target fence value, break out of upload_dirty with a bounded warning on timeout so STATE is released cleanly, and add GPU regression test upload_dirty_exits_when_ring_fence_wait_times_out.

Tested

  • Hardware / OS / toolchain: NVIDIA GeForce RTX 3080 Ti (driver 32.0.16.1088), AMD Ryzen 7 7800X3D, Windows 11 Pro Build 26200, rustc 1.100.0 (0ef1bc386 2026-11-09), debug (scripts/test.ps1) + release (cargo build --release -p xcl).
  • .\scripts\test.ps1 (cargo test --workspace -- --test-threads=4): 742 passed, 0 failed, 41 ignored.
  • SKIPPED GPU tests on this adapter: 2 (no wave64 — gpu_geometry_wave32_prefix_count_over_a_mask, gpu_wave32_program_in_wave64_hardware).

Regression run

Main (67a3735):

xcl-smoke v1
commit: 67a3735177f42cf8e5c886e67a974da7f87541b3
gpu: NVIDIA GeForce RTX 3080 Ti
title: 9cc6a39e
seconds: 60
exit: 0x0
frames shown: 1084 (PresentX 1084)
presents per 2 s (last 3): 59 59 56
device removals: 0
crashes: 0
peak commit: 16561 MB

PR (0f66820):

xcl-smoke v1
commit: 0f66820065129bca1e0cd7f3ae0125e140d835f3
gpu: NVIDIA GeForce RTX 3080 Ti
title: 9cc6a39e
seconds: 60
exit: 0x0
frames shown: 1090 (PresentX 1091)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 15699 MB

Not tested

  • The timeout bail-out branch is exercised by the GPU unit test (upload_dirty_exits_when_ring_fence_wait_times_out) and did not trigger during the healthy 60 s retail smoke run.
  • AMD RDNA / wave64 GPUs and Intel GPUs.
  • XCL_SAMPLE_* tests on local sample files (not set).

AI use

  • Antigravity (Gemini 4 Neon): assisted with root-cause analysis, fix, GPU regression test, audit, rebase verification, and PR description. All code, tests, and smoke logs reviewed by the author.
<!-- greyfinch-sync:ivall/xcl:issue:5473737454 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1277). Originally posted by [ExoCalibra](https://github.com/ExoCalibra) on 2026-11-24T14:08:47Z. --- `sparse::State::wait_for` returns after 5 s with a warning if the sparse upload queue stalls, but `upload_dirty` called `wait_for(fv)` inside a `while` loop waiting for staging ring space. When the oldest in-flight fence failed to advance, `reclaim_ring` freed nothing and `upload_dirty` looped forever while holding the global `STATE` mutex, hanging `xcl-activity` (`sparse::pool_bytes`) and every subsequent submit thread permanently. **What is in it** - `crates/xcl/src/hle/d3d12x/sparse.rs`: return whether `wait_for` reached its target fence value, break out of `upload_dirty` with a bounded warning on timeout so `STATE` is released cleanly, and add GPU regression test `upload_dirty_exits_when_ring_fence_wait_times_out`. **Tested** - Hardware / OS / toolchain: NVIDIA GeForce RTX 3080 Ti (driver 32.0.16.1088), AMD Ryzen 7 7800X3D, Windows 11 Pro Build 26200, `rustc 1.100.0 (0ef1bc386 2026-11-09)`, debug (`scripts/test.ps1`) + release (`cargo build --release -p xcl`). - `.\scripts\test.ps1` (`cargo test --workspace -- --test-threads=4`): 742 passed, 0 failed, 41 ignored. - `SKIPPED` GPU tests on this adapter: 2 (`no wave64` — `gpu_geometry_wave32_prefix_count_over_a_mask`, `gpu_wave32_program_in_wave64_hardware`). **Regression run** Main (`67a3735`): ``` xcl-smoke v1 commit: 67a3735177f42cf8e5c886e67a974da7f87541b3 gpu: NVIDIA GeForce RTX 3080 Ti title: 9cc6a39e seconds: 60 exit: 0x0 frames shown: 1084 (PresentX 1084) presents per 2 s (last 3): 59 59 56 device removals: 0 crashes: 0 peak commit: 16561 MB ``` PR (`0f66820`): ``` xcl-smoke v1 commit: 0f66820065129bca1e0cd7f3ae0125e140d835f3 gpu: NVIDIA GeForce RTX 3080 Ti title: 9cc6a39e seconds: 60 exit: 0x0 frames shown: 1090 (PresentX 1091) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 15699 MB ``` **Not tested** - The timeout bail-out branch is exercised by the GPU unit test (`upload_dirty_exits_when_ring_fence_wait_times_out`) and did not trigger during the healthy 60 s retail smoke run. - AMD RDNA / wave64 GPUs and Intel GPUs. - `XCL_SAMPLE_*` tests on local sample files (not set). **AI use** - Antigravity (Gemini 4 Neon): assisted with root-cause analysis, fix, GPU regression test, audit, rebase verification, and PR description. All code, tests, and smoke logs reviewed by the author.
DavidM1911 commented 2026-11-24 15:05:43 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by DavidM1911 on 2026-11-24T14:10:02Z.


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

  • cargo test -p xcl --lib sparse: 17 passed, 0 failed, 1 ignored.

Thanks!

<!-- greyfinch-sync:ivall/xcl:comment:7133943389 --> Imported from [ivall/xcl](https://github.com/ivall/xcl/pull/1277#issuecomment-7133943389). Originally posted by [DavidM1911](https://github.com/DavidM1911) on 2026-11-24T14:10:02Z. --- Verification on RTX 3060 Ti (Windows 11), branch merged with current `main`: - `cargo test -p xcl --lib sparse`: 17 passed, 0 failed, 1 ignored. Thanks!
futurepro62 commented 2026-11-24 15:05:59 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by futurepro62 on 2026-11-24T14:38:03Z.


Full-suite run to go with the subset check above. Tested exact head 0f66820 (on its base 47efa2e).

Tested

  • NVIDIA GeForce RTX 5070 Ti 16 GB (Blackwell, 32-lane waves only, mesh shaders), driver 616.64, Ryzen 7 9800X3D, Windows 11 Home 26300, Rust 1.100.0 MSVC, debug, D3D12 debug layer installed.
  • cargo build --workspace, then XCL_REQUIRE_GPU=mesh cargo test --workspace -- --test-threads=4: 742 passed, 0 failed, 41 ignored. SKIPPED (no wave64): gpu_geometry_wave32_prefix_count_over_a_mask, gpu_wave32_program_in_wave64_hardware.
  • The new tests ran and passed: upload_dirty_exits_when_ring_fence_wait_times_out.
  • Same head on the AMD Radeon iGPU of the 9800X3D (RDNA2, XCL_ADAPTER=radeon), cargo test --workspace -- --test-threads=4: 742 passed, 0 failed, 41 ignored, no skips.

Not tested

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

AI use

  • Claude Code (Claude Opus 5.5) ran the tests and wrote this report. I checked it before posting.
<!-- greyfinch-sync:ivall/xcl:comment:7134695670 --> Imported from [ivall/xcl](https://github.com/ivall/xcl/pull/1277#issuecomment-7134695670). Originally posted by [futurepro62](https://github.com/futurepro62) on 2026-11-24T14:38:03Z. --- Full-suite run to go with the subset check above. Tested exact head `0f66820` (on its base `47efa2e`). **Tested** - NVIDIA GeForce RTX 5070 Ti 16 GB (Blackwell, 32-lane waves only, mesh shaders), driver 616.64, Ryzen 7 9800X3D, Windows 11 Home 26300, Rust 1.100.0 MSVC, debug, D3D12 debug layer installed. - `cargo build --workspace`, then `XCL_REQUIRE_GPU=mesh cargo test --workspace -- --test-threads=4`: **742 passed, 0 failed, 41 ignored**. SKIPPED (no wave64): `gpu_geometry_wave32_prefix_count_over_a_mask`, `gpu_wave32_program_in_wave64_hardware`. - The new tests ran and passed: `upload_dirty_exits_when_ring_fence_wait_times_out`. - Same head on the AMD Radeon iGPU of the 9800X3D (RDNA2, `XCL_ADAPTER=radeon`), `cargo test --workspace -- --test-threads=4`: **742 passed, 0 failed, 41 ignored**, no skips. **Not tested** - a release build, a game (test run only). **AI use** - Claude Code (Claude Opus 5.5) ran the tests and wrote this report. I checked it before posting.
WebIdentity1 commented 2026-11-24 18:08:56 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by WebIdentity1 on 2026-11-24T17:08:14Z.


Independent native recovery check: this branch reproduces the dropped-upload risk already described by #1385's author. Exact head 0f66820065129bca1e0cd7f3ae0125e140d835f3; exact parent 47efa2ecea0a12934719ae69b81930cf02a4b1c3.

Tested
The same fixture used for #1495, unchanged (SHA256 1fd8f7d154e9663b25d9fe98153fccd2bc8de5291db5aa24414e48f3ddfaa958): fill the real64MiB staging ring behind a controlled queue fence with0x11, change a4KiB page to0x22, wait through the actual5-second timeout, release the gate, explicitly retry that same dirty page, then read all1,024words from the GPU. A six-second recovery guard lets the parent finish without an infinite wait.

Source GPU passed / failed / ignored Wait Wrong words after retry
parent47efa2e RTX3090 1 /0 /0 6015ms 0 /1024
head0f66820 RTX3090 0 /1 /0 5015ms 1024 /1024
parent47efa2e AMD integrated 1 /0 /0 6018ms 0 /1024
head0f66820 AMD integrated 0 /1 /0 5002ms 1024 /1024

No skips or harness timeouts. Head exits101 on the byte assertion; parent exits0. All wrong head words are the old0x11111111. Head ring_write stays67108864 through timeout and retry; parent advances to67112960. Invalidating only the page's sent hashes and explicitly retrying the unchanged bytes yields0wrong on both GPUs. Queue drain/device-removal checks succeed; cleanup occurs before the failing assertion.

scan_page updates the hashes before upload, and the new early return loses the remaining bytes while before_execute clears its dirty runs. The next same-page retry sees matching hashes and stages nothing. Invalidation alone is not a complete fix: normal write-watch scans reset their records, so the next dirty-page list need not include the page. Retain pending uploads or propagate the failure. #1385 already proposes keeping pending work while releasing STATE during waits; native validation of that alternative now passes the byte-recovery and existing lock-progress tests on RTX3090 and AMD, with exact-parent controls. These focused results do not establish full merge readiness.

Fresh process for each run, XCL_ADAPTER=3090 / AMD:
cargo test --locked -p xcl --lib timed_out_sparse_upload_retries_unsent_bytes -- --test-threads=1 --show-output --nocapture

Windows10 Home19045, Ryzen7 7800X3D, RTX3090 driver591.74 / AMD Radeon integrated32.0.21030.2001, Rust1.98.1 MSVC, Agility1.620.2, debug, SSH Session0. All222source-file hashes match each tree; parent/head differ only in sparse.rs, plus identical diagnostic wiring. Restored head verified. Patch reverse-apply and diff checks pass.

Not tested
Full workspace with this fixture, retail / xcl-smoke, actual device loss, partial multi-run suffixes, release, Linux/Wine. The existing timeout test demonstrates bounded return; this additional test checks recovery bytes. The parent control does not endorse repeated waits under STATE. Run alone because the fixture initializes sparse globals. No competing runtime implementation or PR.

AI use
Codex (GPT-6) inspected the overlap, adapted diagnostic wiring, ran tests and prepared this report. Synthetic bytes/public source only.

Complete diagnostic patch against0f66820
diff --git a/crates/xcl/src/hle/d3d12x/sparse.rs b/crates/xcl/src/hle/d3d12x/sparse.rs
index 9b992d8..9a89710 100644
--- a/crates/xcl/src/hle/d3d12x/sparse.rs
+++ b/crates/xcl/src/hle/d3d12x/sparse.rs
@@ -2311,3 +2311,7 @@ mod tests {
         }
     }
 }
+
+#[cfg(test)]
+#[path = "sparse_timeout_probe.rs"]
+mod sparse_timeout_probe;
diff --git a/crates/xcl/src/hle/d3d12x/sparse_timeout_probe.rs b/crates/xcl/src/hle/d3d12x/sparse_timeout_probe.rs
new file mode 100644
--- /dev/null
+++ b/crates/xcl/src/hle/d3d12x/sparse_timeout_probe.rs
@@ -0,0 +1,108 @@
+//! Local PR1495 diagnostic; run alone in a fresh process (initializes sparse globals).
+use super::*;
+use windows::Win32::Graphics::{Direct3D::D3D_FEATURE_LEVEL_12_0, Dxgi::*};
+
+unsafe fn drain(queue: &ID3D12CommandQueue, dev: &ID3D12Device) {
+    let done: ID3D12Fence = dev.CreateFence(0, D3D12_FENCE_FLAG_NONE).unwrap();
+    queue.Signal(&done, 1).unwrap();
+    let start = std::time::Instant::now();
+    while done.GetCompletedValue() == 0 && start.elapsed().as_secs() < 10 {
+        std::thread::sleep(std::time::Duration::from_millis(1));
+    }
+    assert_eq!(done.GetCompletedValue(), 1, "queue drained");
+    dev.GetDeviceRemovedReason().unwrap();
+}
+
+unsafe fn read_page(dev: &ID3D12Device, queue: &ID3D12CommandQueue, source: &ID3D12Resource, offset: u64) -> Vec<u32> {
+    let mut rb: Option<ID3D12Resource> = None;
+    let mut desc = buffer_desc(PAGE as u64);
+    desc.Flags = D3D12_RESOURCE_FLAG_NONE;
+    dev.CreateCommittedResource(&D3D12_HEAP_PROPERTIES { Type: D3D12_HEAP_TYPE_READBACK, ..Default::default() },
+        D3D12_HEAP_FLAG_NONE, &desc, D3D12_RESOURCE_STATE_COPY_DEST, None, &mut rb).unwrap();
+    let rb = rb.unwrap();
+    let alloc: ID3D12CommandAllocator = dev.CreateCommandAllocator(D3D12_COMMAND_LIST_TYPE_DIRECT).unwrap();
+    let list: ID3D12GraphicsCommandList = dev.CreateCommandList(0, D3D12_COMMAND_LIST_TYPE_DIRECT, &alloc, None).unwrap();
+    list.CopyBufferRegion(&rb, 0, source, offset, PAGE as u64);
+    list.Close().unwrap();
+    queue.ExecuteCommandLists(&[Some(list.cast::<ID3D12CommandList>().unwrap())]);
+    drain(queue, dev);
+    let mut p = std::ptr::null_mut();
+    rb.Map(0, Some(&D3D12_RANGE { Begin: 0, End: PAGE }), Some(&mut p)).unwrap();
+    let words = std::slice::from_raw_parts(p as *const u32, PAGE / 4).to_vec();
+    rb.Unmap(0, Some(&D3D12_RANGE { Begin: 0, End: 0 }));
+    words
+}
+
+#[test]
+fn timed_out_sparse_upload_retries_unsent_bytes() {
+    unsafe {
+        let factory: IDXGIFactory6 = CreateDXGIFactory2(DXGI_CREATE_FACTORY_FLAGS(0)).unwrap();
+        let sel = crate::gpu::adapter::Selector::from_env_or("auto");
+        let Some((adapter, desc)) = crate::gpu::adapter::candidates(&factory, &sel).into_iter().next() else {
+            return crate::gpu::recomp::runner::skip_test("no GPU");
+        };
+        println!("adapter={}", crate::gpu::adapter::name(&desc));
+        let dev = crate::gpu::agility::create_device(&adapter, D3D_FEATURE_LEVEL_12_0).unwrap();
+        let windows = init(&dev);
+        assert!(!windows.is_empty(), "sparse windows initialized");
+        for (_, raw, _) in windows { drop(ID3D12Resource::from_raw(raw as *mut c_void)); }
+        let (p, bytes) = alloc(STAGING, TILE).expect("64 MiB sparse allocation");
+        assert_eq!(bytes, STAGING);
+        let title: ID3D12CommandQueue = dev.CreateCommandQueue(&D3D12_COMMAND_QUEUE_DESC::default()).unwrap();
+        let sparse = queue().unwrap();
+        drain(&sparse, &dev);
+        let gate: ID3D12Fence = dev.CreateFence(0, D3D12_FENCE_FLAG_NONE).unwrap();
+        // Ensure a panic never leaves our synthetic queue blocked.
+        struct Unblock(ID3D12Fence);
+        impl Drop for Unblock { fn drop(&mut self) { unsafe { let _ = self.0.Signal(1); } } }
+        let unblock = Unblock(gate.clone());
+        sparse.Wait(&gate, 1).unwrap();
+        std::ptr::write_bytes(p as *mut u8, 0x11, bytes);
+        let pages: Vec<usize> = (p..p + bytes).step_by(PAGE).collect();
+        before_execute(&title, &pages, PAGE);
+        let (source, offset, before_write) = {
+            let g = STATE.lock().unwrap();
+            let s = g.as_ref().unwrap();
+            assert_eq!(s.ring_write - s.ring_free, STAGING as u64, "real ring filled behind gate");
+            assert!(!s.inflight.is_empty());
+            assert!(s.fence.GetCompletedValue() < s.inflight.front().unwrap().0);
+            let wi = s.window_index(p).unwrap();
+            (s.windows[wi].1.clone(), (p - s.windows[wi].0) as u64, s.ring_write)
+        };
+        std::ptr::write_bytes(p as *mut u8, 0x22, PAGE);
+        // Bound the old implementation too: recover after six seconds if it keeps waiting.
+        let rescue = gate.clone();
+        let (tx, rx) = std::sync::mpsc::channel::<()>();
+        let recover = std::thread::spawn(move || {
+            let _ = rx.recv_timeout(std::time::Duration::from_secs(6));
+            rescue.Signal(1).unwrap();
+        });
+        let start = std::time::Instant::now();
+        before_execute(&title, &[p], PAGE);
+        let elapsed = start.elapsed();
+        let after_timeout = STATE.lock().unwrap().as_ref().unwrap().ring_write;
+        drop(unblock);
+        let _ = tx.send(());
+        recover.join().unwrap();
+        drain(&sparse, &dev);
+        assert!(elapsed >= std::time::Duration::from_secs(4) && elapsed < std::time::Duration::from_secs(10), "one bounded fence timeout: {elapsed:?}");
+        // Stronger than the next empty write-watch: explicitly offer the same dirty page again.
+        before_execute(&title, &[p], PAGE);
+        let after_retry = STATE.lock().unwrap().as_ref().unwrap().ring_write;
+        let got = read_page(&dev, &title, &source, offset);
+        let wrong = got.iter().filter(|&&v| v != 0x22222222).count();
+        let old = got.iter().filter(|&&v| v == 0x11111111).count();
+        // Diagnostic positive control: invalidate only this page's sent hashes, retry unchanged bytes.
+        STATE.lock().unwrap().as_mut().unwrap().clear_sent_range(p, PAGE);
+        before_execute(&title, &[p], PAGE);
+        let repaired = read_page(&dev, &title, &source, offset);
+        let control_wrong = repaired.iter().filter(|&&v| v != 0x22222222).count();
+        println!("timeout_ms={} ring_before={before_write} ring_after_timeout={after_timeout} ring_after_retry={after_retry}", elapsed.as_millis());
+        println!("words_checked={} wrong_after_retry={wrong} old_words={old} wrong_after_hash_invalidation={control_wrong}", PAGE / 4);
+        drain(&sparse, &dev);
+        assert!(free(p));
+        drain(&sparse, &dev);
+        assert_eq!(control_wrong, 0, "same-byte upload succeeds when hashes are invalidated");
+        assert_eq!(wrong, 0, "retry must upload bytes that timed out before staging");
+    }
+}
<!-- greyfinch-sync:ivall/xcl:comment:7138740183 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1277#issuecomment-7138740183). Originally posted by [WebIdentity1](https://github.com/WebIdentity1) on 2026-11-24T17:08:14Z. --- Independent native recovery check: **this branch reproduces the dropped-upload risk already described by #1385's author.** Exact head `0f66820065129bca1e0cd7f3ae0125e140d835f3`; exact parent `47efa2ecea0a12934719ae69b81930cf02a4b1c3`. **Tested** The same fixture used for [#1495](https://github.com/ivall/xcl/pull/1495#issuecomment-7138616572), unchanged (SHA256 `1fd8f7d154e9663b25d9fe98153fccd2bc8de5291db5aa24414e48f3ddfaa958`): fill the real64MiB staging ring behind a controlled queue fence with0x11, change a4KiB page to0x22, wait through the actual5-second timeout, release the gate, explicitly retry that same dirty page, then read all1,024words from the GPU. A six-second recovery guard lets the parent finish without an infinite wait. | Source | GPU | passed / failed / ignored | Wait | Wrong words after retry | |---|---|---|---|---| | parent47efa2e | RTX3090 |1 /0 /0|6015ms|0 /1024| | head0f66820 | RTX3090 |0 /1 /0|5015ms|1024 /1024| | parent47efa2e | AMD integrated |1 /0 /0|6018ms|0 /1024| | head0f66820 | AMD integrated |0 /1 /0|5002ms|1024 /1024| No skips or harness timeouts. Head exits101 on the byte assertion; parent exits0. All wrong head words are the old0x11111111. Head ring_write stays67108864 through timeout and retry; parent advances to67112960. Invalidating only the page's `sent` hashes and explicitly retrying the unchanged bytes yields0wrong on both GPUs. Queue drain/device-removal checks succeed; cleanup occurs before the failing assertion. `scan_page` updates the hashes before upload, and the new early return loses the remaining bytes while `before_execute` clears its dirty runs. The next same-page retry sees matching hashes and stages nothing. Invalidation alone is not a complete fix: normal write-watch scans reset their records, so the next dirty-page list need not include the page. Retain pending uploads or propagate the failure. #1385 already proposes keeping pending work while releasing STATE during waits; [native validation of that alternative](https://github.com/ivall/xcl/pull/1385#issuecomment-7138790462) now passes the byte-recovery and existing lock-progress tests on RTX3090 and AMD, with exact-parent controls. These focused results do not establish full merge readiness. Fresh process for each run, `XCL_ADAPTER=3090` / `AMD`: `cargo test --locked -p xcl --lib timed_out_sparse_upload_retries_unsent_bytes -- --test-threads=1 --show-output --nocapture` Windows10 Home19045, Ryzen7 7800X3D, RTX3090 driver591.74 / AMD Radeon integrated32.0.21030.2001, Rust1.98.1 MSVC, Agility1.620.2, debug, SSH Session0. All222source-file hashes match each tree; parent/head differ only in sparse.rs, plus identical diagnostic wiring. Restored head verified. Patch reverse-apply and diff checks pass. **Not tested** Full workspace with this fixture, retail / `xcl-smoke`, actual device loss, partial multi-run suffixes, release, Linux/Wine. The existing timeout test demonstrates bounded return; this additional test checks recovery bytes. The parent control does not endorse repeated waits under STATE. Run alone because the fixture initializes sparse globals. No competing runtime implementation or PR. **AI use** Codex (GPT-6) inspected the overlap, adapted diagnostic wiring, ran tests and prepared this report. Synthetic bytes/public source only. <details> <summary>Complete diagnostic patch against0f66820</summary> ```diff diff --git a/crates/xcl/src/hle/d3d12x/sparse.rs b/crates/xcl/src/hle/d3d12x/sparse.rs index 9b992d8..9a89710 100644 --- a/crates/xcl/src/hle/d3d12x/sparse.rs +++ b/crates/xcl/src/hle/d3d12x/sparse.rs @@ -2311,3 +2311,7 @@ mod tests { } } } + +#[cfg(test)] +#[path = "sparse_timeout_probe.rs"] +mod sparse_timeout_probe; diff --git a/crates/xcl/src/hle/d3d12x/sparse_timeout_probe.rs b/crates/xcl/src/hle/d3d12x/sparse_timeout_probe.rs new file mode 100644 --- /dev/null +++ b/crates/xcl/src/hle/d3d12x/sparse_timeout_probe.rs @@ -0,0 +1,108 @@ +//! Local PR1495 diagnostic; run alone in a fresh process (initializes sparse globals). +use super::*; +use windows::Win32::Graphics::{Direct3D::D3D_FEATURE_LEVEL_12_0, Dxgi::*}; + +unsafe fn drain(queue: &ID3D12CommandQueue, dev: &ID3D12Device) { + let done: ID3D12Fence = dev.CreateFence(0, D3D12_FENCE_FLAG_NONE).unwrap(); + queue.Signal(&done, 1).unwrap(); + let start = std::time::Instant::now(); + while done.GetCompletedValue() == 0 && start.elapsed().as_secs() < 10 { + std::thread::sleep(std::time::Duration::from_millis(1)); + } + assert_eq!(done.GetCompletedValue(), 1, "queue drained"); + dev.GetDeviceRemovedReason().unwrap(); +} + +unsafe fn read_page(dev: &ID3D12Device, queue: &ID3D12CommandQueue, source: &ID3D12Resource, offset: u64) -> Vec<u32> { + let mut rb: Option<ID3D12Resource> = None; + let mut desc = buffer_desc(PAGE as u64); + desc.Flags = D3D12_RESOURCE_FLAG_NONE; + dev.CreateCommittedResource(&D3D12_HEAP_PROPERTIES { Type: D3D12_HEAP_TYPE_READBACK, ..Default::default() }, + D3D12_HEAP_FLAG_NONE, &desc, D3D12_RESOURCE_STATE_COPY_DEST, None, &mut rb).unwrap(); + let rb = rb.unwrap(); + let alloc: ID3D12CommandAllocator = dev.CreateCommandAllocator(D3D12_COMMAND_LIST_TYPE_DIRECT).unwrap(); + let list: ID3D12GraphicsCommandList = dev.CreateCommandList(0, D3D12_COMMAND_LIST_TYPE_DIRECT, &alloc, None).unwrap(); + list.CopyBufferRegion(&rb, 0, source, offset, PAGE as u64); + list.Close().unwrap(); + queue.ExecuteCommandLists(&[Some(list.cast::<ID3D12CommandList>().unwrap())]); + drain(queue, dev); + let mut p = std::ptr::null_mut(); + rb.Map(0, Some(&D3D12_RANGE { Begin: 0, End: PAGE }), Some(&mut p)).unwrap(); + let words = std::slice::from_raw_parts(p as *const u32, PAGE / 4).to_vec(); + rb.Unmap(0, Some(&D3D12_RANGE { Begin: 0, End: 0 })); + words +} + +#[test] +fn timed_out_sparse_upload_retries_unsent_bytes() { + unsafe { + let factory: IDXGIFactory6 = CreateDXGIFactory2(DXGI_CREATE_FACTORY_FLAGS(0)).unwrap(); + let sel = crate::gpu::adapter::Selector::from_env_or("auto"); + let Some((adapter, desc)) = crate::gpu::adapter::candidates(&factory, &sel).into_iter().next() else { + return crate::gpu::recomp::runner::skip_test("no GPU"); + }; + println!("adapter={}", crate::gpu::adapter::name(&desc)); + let dev = crate::gpu::agility::create_device(&adapter, D3D_FEATURE_LEVEL_12_0).unwrap(); + let windows = init(&dev); + assert!(!windows.is_empty(), "sparse windows initialized"); + for (_, raw, _) in windows { drop(ID3D12Resource::from_raw(raw as *mut c_void)); } + let (p, bytes) = alloc(STAGING, TILE).expect("64 MiB sparse allocation"); + assert_eq!(bytes, STAGING); + let title: ID3D12CommandQueue = dev.CreateCommandQueue(&D3D12_COMMAND_QUEUE_DESC::default()).unwrap(); + let sparse = queue().unwrap(); + drain(&sparse, &dev); + let gate: ID3D12Fence = dev.CreateFence(0, D3D12_FENCE_FLAG_NONE).unwrap(); + // Ensure a panic never leaves our synthetic queue blocked. + struct Unblock(ID3D12Fence); + impl Drop for Unblock { fn drop(&mut self) { unsafe { let _ = self.0.Signal(1); } } } + let unblock = Unblock(gate.clone()); + sparse.Wait(&gate, 1).unwrap(); + std::ptr::write_bytes(p as *mut u8, 0x11, bytes); + let pages: Vec<usize> = (p..p + bytes).step_by(PAGE).collect(); + before_execute(&title, &pages, PAGE); + let (source, offset, before_write) = { + let g = STATE.lock().unwrap(); + let s = g.as_ref().unwrap(); + assert_eq!(s.ring_write - s.ring_free, STAGING as u64, "real ring filled behind gate"); + assert!(!s.inflight.is_empty()); + assert!(s.fence.GetCompletedValue() < s.inflight.front().unwrap().0); + let wi = s.window_index(p).unwrap(); + (s.windows[wi].1.clone(), (p - s.windows[wi].0) as u64, s.ring_write) + }; + std::ptr::write_bytes(p as *mut u8, 0x22, PAGE); + // Bound the old implementation too: recover after six seconds if it keeps waiting. + let rescue = gate.clone(); + let (tx, rx) = std::sync::mpsc::channel::<()>(); + let recover = std::thread::spawn(move || { + let _ = rx.recv_timeout(std::time::Duration::from_secs(6)); + rescue.Signal(1).unwrap(); + }); + let start = std::time::Instant::now(); + before_execute(&title, &[p], PAGE); + let elapsed = start.elapsed(); + let after_timeout = STATE.lock().unwrap().as_ref().unwrap().ring_write; + drop(unblock); + let _ = tx.send(()); + recover.join().unwrap(); + drain(&sparse, &dev); + assert!(elapsed >= std::time::Duration::from_secs(4) && elapsed < std::time::Duration::from_secs(10), "one bounded fence timeout: {elapsed:?}"); + // Stronger than the next empty write-watch: explicitly offer the same dirty page again. + before_execute(&title, &[p], PAGE); + let after_retry = STATE.lock().unwrap().as_ref().unwrap().ring_write; + let got = read_page(&dev, &title, &source, offset); + let wrong = got.iter().filter(|&&v| v != 0x22222222).count(); + let old = got.iter().filter(|&&v| v == 0x11111111).count(); + // Diagnostic positive control: invalidate only this page's sent hashes, retry unchanged bytes. + STATE.lock().unwrap().as_mut().unwrap().clear_sent_range(p, PAGE); + before_execute(&title, &[p], PAGE); + let repaired = read_page(&dev, &title, &source, offset); + let control_wrong = repaired.iter().filter(|&&v| v != 0x22222222).count(); + println!("timeout_ms={} ring_before={before_write} ring_after_timeout={after_timeout} ring_after_retry={after_retry}", elapsed.as_millis()); + println!("words_checked={} wrong_after_retry={wrong} old_words={old} wrong_after_hash_invalidation={control_wrong}", PAGE / 4); + drain(&sparse, &dev); + assert!(free(p)); + drain(&sparse, &dev); + assert_eq!(control_wrong, 0, "same-byte upload succeeds when hashes are invalidated"); + assert_eq!(wrong, 0, "retry must upload bytes that timed out before staging"); + } +} ``` </details>
xpatfussy69x commented 2026-11-25 12:06:26 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by xpatfussy69x on 2026-11-25T11:42:17Z.


Test report for head 0f66820 as pushed (not merged onto current main) – NVIDIA, wave32.

Tested

  • NVIDIA GeForce RTX 3060 12 GB (Ampere, 32-lane waves only), driver 32.0.16.2124; AMD Ryzen 5 7500F; 32 GB RAM; Windows NT 10.0.26300; Rust 1.100.0 (stable-x86_64-pc-windows-msvc); debug; DXC 1.9.2609.5
  • .\scripts\test.ps1 (cargo build --workspace + cargo test --workspace -- --test-threads=4): 742 passed, 0 failed, 41 ignored
  • SKIPPED GPU tests on this adapter: 2 (no wave64)
  • this PR's tests: upload_dirty_exits_when_ring_fence_wait_times_out ran and passed
  • no XCL_SAMPLE_* data set (game-data tests not run)

Not tested

  • a smoke run on a title; AMD / native wave64; release build; the head merged onto current main

AI use

  • Claude (Claude Opus 5.5) wrote the script that ran the suite on my PC, read the log and wrote and posted this report with my approval; the run is mine.
<!-- greyfinch-sync:ivall/xcl:comment:7161390657 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1277#issuecomment-7161390657). Originally posted by [xpatfussy69x](https://github.com/xpatfussy69x) on 2026-11-25T11:42:17Z. --- Test report for head `0f66820` as pushed (not merged onto current `main`) – NVIDIA, wave32. **Tested** - NVIDIA GeForce RTX 3060 12 GB (Ampere, 32-lane waves only), driver 32.0.16.2124; AMD Ryzen 5 7500F; 32 GB RAM; Windows NT 10.0.26300; Rust 1.100.0 (stable-x86_64-pc-windows-msvc); debug; DXC 1.9.2609.5 - `.\scripts\test.ps1` (`cargo build --workspace` + `cargo test --workspace -- --test-threads=4`): 742 passed, 0 failed, 41 ignored - SKIPPED GPU tests on this adapter: 2 (no wave64) - this PR's tests: `upload_dirty_exits_when_ring_fence_wait_times_out` ran and passed - no `XCL_SAMPLE_*` data set (game-data tests not run) **Not tested** - a smoke run on a title; AMD / native wave64; release build; the head merged onto current `main` **AI use** - Claude (Claude Opus 5.5) wrote the script that ran the suite on my PC, read the log and wrote and posted this report with my approval; the run is mine.
4usphs commented 2026-11-25 12:06:29 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by 4usphs on 2026-11-25T11:52:39Z.


AMD run on the exact head 0f66820 (0f66820065), as pushed on its base 47efa2e (not merged onto current main), on two AMD adapters with native 64-lane waves: RDNA4 and the console's generation, RDNA2.

Tested

  • Ryzen 7 9800X3D, Windows 11 Pro 26200, Rust 1.100.0 MSVC, DXC 1.9.2602.17, debug, clean checkout, XCL_TRANSLATED_CACHE=0; adapter picked with XCL_ADAPTER.
  • cargo build --workspace && cargo test --workspace --no-fail-fast -- --test-threads=4:
    • AMD Radeon RX 9070 XT (RDNA4), driver 32.0.32029.2010: 742 passed, 0 failed, 41 ignored
    • AMD Radeon(TM) Graphics, the 9800X3D's iGPU (RDNA2, gfx1036), driver 32.0.21045.29003: 742 passed, 0 failed, 41 ignored
  • No SKIPPED tests on either adapter.
  • This PR's test upload_dirty_exits_when_ring_fence_wait_times_out runs and passes on both adapters.

Not tested

  • smoke or a retail title (I have none), a release build, Linux.

AI use

  • Claude Code (Claude Opus 5.5) read the diff, ran the tests and the base-commit controls on my PC and wrote this report. I have not reviewed the code.
<!-- greyfinch-sync:ivall/xcl:comment:7161622572 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1277#issuecomment-7161622572). Originally posted by [4usphs](https://github.com/4usphs) on 2026-11-25T11:52:39Z. --- AMD run on the exact head `0f66820` (0f66820065129bca1e0cd7f3ae0125e140d835f3), as pushed on its base `47efa2e` (not merged onto current `main`), on two AMD adapters with native 64-lane waves: RDNA4 and the console's generation, RDNA2. **Tested** - Ryzen 7 9800X3D, Windows 11 Pro 26200, Rust 1.100.0 MSVC, DXC 1.9.2602.17, debug, clean checkout, `XCL_TRANSLATED_CACHE=0`; adapter picked with `XCL_ADAPTER`. - `cargo build --workspace && cargo test --workspace --no-fail-fast -- --test-threads=4`: - AMD Radeon RX 9070 XT (RDNA4), driver 32.0.32029.2010: **742 passed, 0 failed, 41 ignored** - AMD Radeon(TM) Graphics, the 9800X3D's iGPU (RDNA2, `gfx1036`), driver 32.0.21045.29003: **742 passed, 0 failed, 41 ignored** - No `SKIPPED` tests on either adapter. - This PR's test `upload_dirty_exits_when_ring_fence_wait_times_out` runs and passes on both adapters. **Not tested** - smoke or a retail title (I have none), a release build, Linux. **AI use** - Claude Code (Claude Opus 5.5) read the diff, ran the tests and the base-commit controls on my PC and wrote this report. I have not reviewed the code.
ClosetPie107 commented 2026-11-25 13:05:04 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by ClosetPie107 on 2026-11-25T12:19:36Z.


Linux / AMD RDNA4 (RADV) test report for head 0f66820 merged locally onto main 1a0bbe3 (clean merge).

Environment

  • AMD Radeon RX 9070 16 GB (RDNA4, RADV GFX1201, Mesa 26.3.1, native wave64), Ryzen 5 9600X, 30 GiB RAM, CachyOS
  • Proton Experimental (experimental-11.0-20261112), vkd3d-proton v3.1 (#257 + dxil-spirv 53aac418), DXVK v3.1.1-209, DXC 1.9.2609.5, x86_64-pc-windows-gnu cross-compile

Tested (debug test binary under Wine, XCL_ADAPTER=9070 XCL_REQUIRE_GPU=wave64, --test-threads=1 --nocapture)

  • hle::d3d12x::sparse: 16 passed, 0 failed, 1 ignored (early_commit_timing), 0 skipped (2.31 s), including upload_dirty_exits_when_ring_fence_wait_times_out on RX 9070 / RADV.

Not tested: full workspace suite, retail title run, native Windows.

AI use: T3 Code / Antigravity (Gemini 4 Neon) merged, built, ran the tests on this machine, and drafted this report.

<!-- greyfinch-sync:ivall/xcl:comment:7162222598 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1277#issuecomment-7162222598). Originally posted by [ClosetPie107](https://github.com/ClosetPie107) on 2026-11-25T12:19:36Z. --- Linux / AMD RDNA4 (RADV) test report for head `0f66820` merged locally onto `main` `1a0bbe3` (clean merge). **Environment** - AMD Radeon RX 9070 16 GB (RDNA4, RADV GFX1201, Mesa 26.3.1, native wave64), Ryzen 5 9600X, 30 GiB RAM, CachyOS - Proton Experimental (`experimental-11.0-20261112`), vkd3d-proton v3.1 (`#257` + `dxil-spirv` `53aac418`), DXVK `v3.1.1-209`, DXC `1.9.2609.5`, `x86_64-pc-windows-gnu` cross-compile **Tested** (debug test binary under Wine, `XCL_ADAPTER=9070 XCL_REQUIRE_GPU=wave64`, `--test-threads=1 --nocapture`) - `hle::d3d12x::sparse`: **16 passed, 0 failed, 1 ignored (`early_commit_timing`), 0 skipped** (2.31 s), including `upload_dirty_exits_when_ring_fence_wait_times_out` on RX 9070 / RADV. **Not tested:** full workspace suite, retail title run, native Windows. **AI use:** T3 Code / Antigravity (Gemini 4 Neon) merged, built, ran the tests on this machine, and drafted this report.
oni-swr commented 2026-11-25 14:09:58 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by oni-swr on 2026-11-25T13:19:13Z.


AMD RDNA3 (native wave64) test report for exact head 0f66820065129bca1e0cd7f3ae0125e140d835f3, as pushed on its base 47efa2e (not merged onto current main).

Tested

  • AMD Radeon RX 7800 XT (RDNA3, native wave64), driver 32.0.31035.1003; Windows 11 Pro 10.0.26200; Rust 1.100.0 (stable-x86_64-pc-windows-msvc); debug; DXC 1.9.0.5512 (dxcompiler.dll)
  • cargo build --workspace: ok
  • Targeted: upload_dirty_exits_when_ring_fence_wait_times_out: 1 passed; sparse filter: 17 passed, 0 failed, 1 ignored
  • cargo test --workspace --no-fail-fast -- --test-threads=4: 742 passed, 0 failed, 41 ignored (summed over all test binaries)
  • SKIPPED lines: none in the output

Not tested

  • No game title, no scripts/smoke.ps1 regression run (synthetic GPU/unit tests only)
  • Not merged onto current main; other GPUs (NVIDIA / Intel / RDNA2 / RDNA4)
  • Whether the new test fails without the fix; the dropped-upload risk raised in earlier comments (this run only checks the tests pass)

AI use: Claude Code (Claude Sonnet 5.5) ran the build and tests and wrote this report; the numbers are from the runs above.

<!-- greyfinch-sync:ivall/xcl:comment:7163605441 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1277#issuecomment-7163605441). Originally posted by [oni-swr](https://github.com/oni-swr) on 2026-11-25T13:19:13Z. --- AMD RDNA3 (native wave64) test report for exact head `0f66820065129bca1e0cd7f3ae0125e140d835f3`, as pushed on its base `47efa2e` (not merged onto current `main`). **Tested** - AMD Radeon RX 7800 XT (RDNA3, native wave64), driver 32.0.31035.1003; Windows 11 Pro 10.0.26200; Rust 1.100.0 (stable-x86_64-pc-windows-msvc); debug; DXC 1.9.0.5512 (dxcompiler.dll) - `cargo build --workspace`: ok - Targeted: `upload_dirty_exits_when_ring_fence_wait_times_out`: 1 passed; `sparse` filter: 17 passed, 0 failed, 1 ignored - `cargo test --workspace --no-fail-fast -- --test-threads=4`: 742 passed, 0 failed, 41 ignored (summed over all test binaries) - SKIPPED lines: none in the output **Not tested** - No game title, no `scripts/smoke.ps1` regression run (synthetic GPU/unit tests only) - Not merged onto current `main`; other GPUs (NVIDIA / Intel / RDNA2 / RDNA4) - Whether the new test fails without the fix; the dropped-upload risk raised in earlier comments (this run only checks the tests pass) **AI use**: Claude Code (Claude Sonnet 5.5) ran the build and tests and wrote this report; the numbers are from the runs above.
DavidM1911 commented 2026-11-26 05:05:36 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by DavidM1911 on 2026-11-26T04:40:56Z.


Re-verification on RTX 3060 Ti (Windows 11), new head merged with current main:

  • cargo test -p xcl --lib: all passed, 0 failed, 27 ignored. The earlier merge conflict is resolved.

Thanks!

— Devin

<!-- greyfinch-sync:ivall/xcl:comment:7182809036 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1277#issuecomment-7182809036). Originally posted by [DavidM1911](https://github.com/DavidM1911) on 2026-11-26T04:40:56Z. --- Re-verification on RTX 3060 Ti (Windows 11), new head merged with current `main`: - `cargo test -p xcl --lib`: all passed, 0 failed, 27 ignored. The earlier merge conflict is resolved. Thanks! — Devin
Decodere commented 2026-11-27 13:08:40 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Decodere on 2026-11-27T13:08:40Z.


Independent desktop NVIDIA verification of PR #1277 at head 0f66820065129bca1e0cd7f3ae0125e140d835f3 (1 commit; exact parent & merge-base: 47efa2ecea0a12934719ae69b81930cf02a4b1c3, pre-#2555 ancestor of main).

Environment

  • GPU: NVIDIA GeForce RTX 4060 (8 GB / 7956 MiB reported by D3D12, Wave32-only Ada), 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 tests & build (0f668200)

Command Result
cargo test --release -p xcl --lib -- --nocapture upload_dirty_exits_when_ring_fence_wait_times_out (3 consecutive runs) 1 passed; 0 failed; 0 ignored; 719 filtered out × 3 (0.30s, 0.28s, 0.27s, 0 skipped; live RTX 4060 D3D12 device + reserved buffer, timed out after 50 ms on unsignaled fence 1 and returned cleanly with ring/inflight invariants intact)
cargo test --release -p xcl --lib -- --nocapture hle::d3d12x::sparse:: (3 consecutive runs) 14 passed; 0 failed; 1 ignored; 705 filtered out × 3 (0.34s, 0.34s, 0.35s, 0 runtime skips; 1 pre-existing #[ignore] timing harness early_commit_timing)
cargo build --release -p xcl Clean build (1m 13s, exit 0, 0 new warnings in sparse.rs)

Paired quiet 60 s retail smoke (title: 29640639)

(Note: scripts/smoke.ps1 at 47efa2ec predates 9683e7a6 and printed the local folder basename on title:; replaced below with the standard 9683e7a6 title hash 29640639, with all measured fields verbatim.)

Exact parent & merge-base (47efa2ecea0a12934719ae69b81930cf02a4b1c3, cached baseline on the same machine):

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

PR #1277 (0f66820065129bca1e0cd7f3ae0125e140d835f3):

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

Limits of coverage

  • upload_dirty_exits_when_ring_fence_wait_times_out and all 14 active hle::d3d12x::sparse:: tests (14/14 executed, 0 runtime skips; 1 pre-existing #[ignore] early_commit_timing) passed 3/3 on live RTX 4060 D3D12 reserved resources, directly verifying wait_for_ms timeout handling and clean upload_dirty_with_timeout bail-out under a synthetic 50 ms stalled-fence condition.
  • The 60 s retail smoke confirms normal sparse VRAM upload stability (0 device removals, 0 crashes, steady 60 Hz) without encountering a real 5 s GPU queue stall in flight; single-run frame/commit delta vs. the cached parent reflects normal startup variance.

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

<!-- greyfinch-sync:ivall/xcl:comment:7219112831 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1277#issuecomment-7219112831). Originally posted by [Decodere](https://github.com/Decodere) on 2026-11-27T13:08:40Z. --- Independent desktop NVIDIA verification of **PR #1277** at head `0f66820065129bca1e0cd7f3ae0125e140d835f3` (`1` commit; exact parent & merge-base: `47efa2ecea0a12934719ae69b81930cf02a4b1c3`, pre-`#2555` ancestor of `main`). ### Environment - **GPU:** NVIDIA GeForce RTX 4060 (8 GB / `7956 MiB` reported by D3D12, Wave32-only Ada), 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 tests & build (`0f668200`) | Command | Result | | --- | --- | | `cargo test --release -p xcl --lib -- --nocapture upload_dirty_exits_when_ring_fence_wait_times_out` (3 consecutive runs) | `1 passed; 0 failed; 0 ignored; 719 filtered out` × 3 (`0.30s`, `0.28s`, `0.27s`, `0` skipped; live RTX 4060 D3D12 device + reserved buffer, timed out after 50 ms on unsignaled fence 1 and returned cleanly with ring/inflight invariants intact) | | `cargo test --release -p xcl --lib -- --nocapture hle::d3d12x::sparse::` (3 consecutive runs) | `14 passed; 0 failed; 1 ignored; 705 filtered out` × 3 (`0.34s`, `0.34s`, `0.35s`, `0` runtime skips; `1` pre-existing `#[ignore]` timing harness `early_commit_timing`) | | `cargo build --release -p xcl` | Clean build (`1m 13s`, exit `0`, `0` new warnings in `sparse.rs`) | ### Paired quiet 60 s retail smoke (`title: 29640639`) *(Note: `scripts/smoke.ps1` at `47efa2ec` predates `9683e7a6` and printed the local folder basename on `title:`; replaced below with the standard `9683e7a6` title hash `29640639`, with all measured fields verbatim.)* Exact parent & merge-base (`47efa2ecea0a12934719ae69b81930cf02a4b1c3`, cached baseline on the same machine): ``` xcl-smoke v1 commit: 47efa2ecea0a12934719ae69b81930cf02a4b1c3 gpu: NVIDIA GeForce RTX 4060 title: 29640639 seconds: 60 exit: 0x0 frames shown: 1527 (PresentX 1527) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 14723 MB ``` PR #1277 (`0f66820065129bca1e0cd7f3ae0125e140d835f3`): ``` xcl-smoke v1 commit: 0f66820065129bca1e0cd7f3ae0125e140d835f3 gpu: NVIDIA GeForce RTX 4060 title: 29640639 seconds: 60 exit: 0x0 frames shown: 1504 (PresentX 1504) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 14711 MB ``` ### Limits of coverage - `upload_dirty_exits_when_ring_fence_wait_times_out` and all `14` active `hle::d3d12x::sparse::` tests (`14/14` executed, `0` runtime skips; `1` pre-existing `#[ignore]` `early_commit_timing`) passed `3/3` on live RTX 4060 D3D12 reserved resources, directly verifying `wait_for_ms` timeout handling and clean `upload_dirty_with_timeout` bail-out under a synthetic 50 ms stalled-fence condition. - The 60 s retail smoke confirms normal sparse VRAM upload stability (`0` device removals, `0` crashes, steady 60 Hz) without encountering a real 5 s GPU queue stall in flight; single-run frame/commit delta vs. the cached parent reflects normal startup variance. *AI disclosure: test execution and report drafting assisted by Google Antigravity (Gemini 4 Neon).*
Foniass commented 2026-12-01 05:18:52 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Foniass on 2026-12-01T05:18:52Z.


Triage (#1607) – head 0f66820

Main already has this fix. Commit 711ff3ef 'D3D12.X: stop stalled sparse ring reclaim cleanly' adapts the bounded exit from this PR and credits #1277. It also marks the unsubmitted chunks for retry, where this patch's early return from upload_dirty_with_timeout leaves them stale. Since then, 86bad822 has replaced the ring wait entirely: ring_room in sparse.rs returns a wait ticket and releases the sparse state, and wait_for_ms now returns bool. The branch also conflicts with main.
#1495 (closed) attempted the same bounded wait.
Recommendation: close (superseded by main commit 711ff3ef).

AI review: Claude Code (Claude Opus 5.5), diffs read only, not built or run; not checked by a human.

<!-- greyfinch-sync:ivall/xcl:comment:7301640320 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1277#issuecomment-7301640320). Originally posted by [Foniass](https://github.com/Foniass) on 2026-12-01T05:18:52Z. --- **Triage (#1607)** – head 0f66820 Main already has this fix. Commit 711ff3ef 'D3D12.X: stop stalled sparse ring reclaim cleanly' adapts the bounded exit from this PR and credits #1277. It also marks the unsubmitted chunks for retry, where this patch's early `return` from `upload_dirty_with_timeout` leaves them stale. Since then, 86bad822 has replaced the ring wait entirely: `ring_room` in sparse.rs returns a wait ticket and releases the sparse state, and `wait_for_ms` now returns bool. The branch also conflicts with main. #1495 (closed) attempted the same bounded wait. Recommendation: close (superseded by main commit 711ff3ef). AI review: Claude Code (Claude Opus 5.5), diffs read only, not built or run; not checked by a human.
throny commented 2026-12-01 12:44:12 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by throny on 2026-12-01T12:44:12Z.


Closing as superseded: this change is already on main (711ff3ef). 711ff3ef (adapts #1277, credits it) bounds the sparse ring wait; main since moved to wait tickets (86bad822, sparse.rs ring_room returns UploadStep::Wait) so STATE is no longer held forever

Two independent checks found this: Foniass's close list on #1607 and ours against current main. If something here is still missing on main, say so and reopen it, or ask and I will.

AI use: Claude Code (Claude Opus 5.5); the per-PR comparison was done by Claude Sonnet 5.5 sub-agents.

<!-- greyfinch-sync:ivall/xcl:comment:7311571595 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1277#issuecomment-7311571595). Originally posted by [throny](https://github.com/throny) on 2026-12-01T12:44:12Z. --- Closing as superseded: this change is already on `main` (711ff3ef). 711ff3ef (adapts #1277, credits it) bounds the sparse ring wait; main since moved to wait tickets (86bad822, sparse.rs ring_room returns UploadStep::Wait) so STATE is no longer held forever Two independent checks found this: Foniass's close list on #1607 and ours against current `main`. If something here is still missing on `main`, say so and reopen it, or ask and I will. AI use: Claude Code (Claude Opus 5.5); the per-PR comparison was done by Claude Sonnet 5.5 sub-agents.

Pull request closed

Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
xcl-dev/xcl!1267
No description provided.