Repository navigation
D3D12.X: cap two-pass buffers by DXGI headroom with wait and shrink - #2817
coolpersonnn wants to merge 3 commits into
Conversation
|
Independent Windows check on the clean stacked head
This covers the targeted synthetic tests on the 12 GB host. In-game tight-budget waits/shrinks, end-to-end rendering with heap windows, and the full workspace suite were outside this run. OpenAI Codex assisted with verification. |
|
In the world on a 12 GB card, over its budget: this stack frees about 1 GB and makes about 98 % of the two-pass draws that were skipped. One run with the stack, against two without. Setup: RTX 4070 Ti 12 GB (621.40), Ryzen 7 7800X3D, 32 GB RAM, Windows 11 26200, release.
One run with the stack. (Claude Code, Claude Opus 5.5) |
|
Update for head Update for head
I didn't catch the panic text for either (14 more runs, all clean, while trying). I didn't run single-threaded on this head. Update for head Update for head Update for head AMD run (listed as untested), with an RTX 3060 in the same PC. Two of the new tests fail now and then on both cards when the tests run in parallel. They pass every time on one thread. Tested: head
The failures:
#2816 has the same two tests and the same failures: 1 of 6 runs on the RX 9070 XT, 1 of 4 on the RTX 3060. #2815 alone passed (46 passed, 0 failed). One more thing I saw: the new Not tested: a title run, AI use: Claude Code (Claude Opus 5.5) ran the tests on this machine and wrote this report. |
|
Test report for the stack (#2815 + #2816 + this PR) in the world on an RTX 4080 16 GB: the buffers no longer wait for allocator resets and far fewer draws are skipped, but on a card that is over its budget the derived cap is 256 MiB and refusals come back as the run goes on. Tested
Not tested
AI use: Claude Code (Claude Fable 5.2) ran this on the owner's machine and wrote the report. |
|
Two Linux/Wine lanes on the full stack, both vendors, release profile. Nobody here has posted Linux numbers for this stack yet. Lanes
Suite verdicts (clean stack
Flake, matches @DarkPanda69's parallel-only observation. On lane A, Vendor-split, predates the stack. Not tested: Windows, native Linux, the in-game evidence items. |
c1bf0e8 to
4eea0ac
Compare
|
Independent RTX 3060 retest of the intermittent feedback failures on #2817. With four test threads, the original revision failed in 3 of 10 runs. The current PR head completed all 10 runs successfully. Tested Windows 11 build 26200, Ryzen 7 5800X, 32 GB RAM, RTX 3060 12 GB, NVIDIA 610.88, rustc 1.100.0 MSVC, debug. No tracked edits. Original PR revision With
Not tested Retail gameplay, FPS, VRAM savings, full workspace suite or other adapters. These results cover the filtered tests on this machine. AI use Codex (GPT-6.2 Astra) ran the tests, checked the revision and logs, and drafted this report. |
|
Independent Windows/NVIDIA check of the current #2817 head With
Not tested: a matched retail world-load run, sustained frame time, AMD/Intel, or Linux/Wine. These synthetic results do not establish the stack's in-world memory or draw-skip improvement on this card. AI use: Codex (GPT-6.2 Sol) ran the tests, checked the current head and parent, compared failures, and drafted this report. |
|
By reading only, not run, at
AI use: Claude Code (Claude Opus 5.5) wrote this; Claude Fable 5.2 rechecked it; checked by a person before posting. |
|
Follow-up to the partial-draw review on current head I added a focused D3D12 WARP allocation regression at this exact head. On the untouched code it failed, 0 passed / 1 failed: expected 48 MiB, got 32 MiB. Walking each bucket in order made it pass, 1 passed / 0 failed; the test also checked 48→32 MiB. Candidate diff against `4eea0ac2`diff --git a/crates/xcl/src/hle/d3d12x/bind.rs b/crates/xcl/src/hle/d3d12x/bind.rs
@@ -453,9 +453,15 @@ unsafe fn acquire_res_buf_with_cap(
let dev_key = dev.as_raw() as usize;
let mut cand = need;
while cand > floor {
- let next = record_buffer_bytes((cand / 2).max(floor));
+ // The buckets alternate between powers of two and 1.5× their half. Halving a power
+ // skips its 1.5× bucket, which may fit the cap and preserve more mesh groups.
+ let next = if cand.is_power_of_two() {
+ cand - (cand >> 2)
+ } else {
+ cand.next_power_of_two() >> 1
+ }.max(floor);
if next >= cand || (existing_cap >= floor && next <= existing_cap) {
break;
}
@@ -5250,8 +5256,26 @@ void ms(uint3 g : SV_GroupID) { o.Store((v * 16u + g.x) * 4u, rec.Load(g.x * 4u)
assert!(TWO_PASS[TP_SHRUNK].load(Ordering::Relaxed) > shrunk_before);
}
+ #[test]
+ fn acquire_res_buf_uses_finer_bucket_when_it_fits_the_cap() {
+ let _warp_guard = lock_warp_tests();
+ let Some(dev) = warp_device_for_test() else { return };
+ let key = dev.as_raw() as usize;
+ while FREE_RES.lock().unwrap().take(key, 0, u64::MAX).is_some() {}
+ let tight_cap = TWO_PASS[TP_ALIVE].load(Ordering::Relaxed) + (48 << 20);
+ let buf = unsafe { acquire_res_buf_with_cap(&dev, 64 << 20, 64 << 10, 0, tight_cap, std::time::Duration::ZERO) }.unwrap().unwrap();
+ assert_eq!(buf.bytes, 48 << 20, "the next smaller bucket fits the available headroom");
+ assert_eq!(record_groups(buf.bytes, 64 << 10, 1), 768);
+ drop(buf);
+ let tight_cap = TWO_PASS[TP_ALIVE].load(Ordering::Relaxed) + (32 << 20);
+ let buf = unsafe { acquire_res_buf_with_cap(&dev, 48 << 20, 64 << 10, 0, tight_cap, std::time::Duration::ZERO) }.unwrap().unwrap();
+ assert_eq!(buf.bytes, 32 << 20, "the bucket below 48 MiB also fits");
+ drop(buf);
+ }
#[test]
fn acquire_res_buf_stops_shrinking_at_existing_buffer_size() {Not tested: a retail title or GPU readback of the resulting mesh. AI use: Codex (GPT-6.2 Sol; GPT-6.2 Astra assisted source review) traced the bucket path, wrote and ran the local candidate and regression, and drafted this comment. I checked the diff and results before posting. |
4eea0ac to
e70a708
Compare
|
Independent Windows/NVIDIA check of #2817 head
Not tested: a retail title or matched world-load run on this card, in-game VRAM savings, draw completeness, frame content, AMD/Intel or Wine. The passing synthetic tests do not establish those outcomes. AI use: Codex (GPT-6.2 Sol) ran the exact-head and parent tests, compared their outputs, and drafted this report. I checked each result and the revisions before posting. |
|
Independent Windows/NVIDIA verification and source audit of PR #2817 at head System
Tested
Regression run Not tested
AI use
|
|
Independent RTX 4060 (8 GB) / Windows 11 release verification of PR #2817 updated head Setup
Targeted RTX 4060 release unit & GPU tests (
|
|
Follow-up, by reading only at AI use: Claude Code (Claude Opus 5.5) checked the new head and wrote this; Claude Fable 5.2 rechecked it; checked by a person before posting. |
e70a708 to
9afb55e
Compare
Sweep expired reusable buffers even when an allocator releases no buffers of its own. The WARP regression seeds the free pool, then checks it directly after an unrelated allocator release. Suggested-by: thehollowedone (xcl-dev#2815 (comment)) Publish the retired batch and its byte charge under the same lock. Otherwise reclamation can subtract a batch before the publisher adds its bytes. Reclaim retired and reset two-pass record, batch, and argument scratch buffers when their recording's submit queue fences pass, without waiting for the owning command allocator to reset. Guard fence polling against device removal (`u64::MAX` / `FenceState::Removed`) so in-flight buffers are never returned to the reuse pool on a lost device, keep closed command lists' buffers intact across idle trims for Reset-less replay, and track upstream `batch_buf` allocations through the same submit fences. Part of xcl-dev#2688 Assisted-by: T3 Code / Antigravity (Gemini Pro Orchestrator Neon) Assisted-by: Codex (GPT-6.2 Sol) Assisted-by: Codex (gpt-6.2-sol)
…uckets Add 256 KiB half-step record buffer buckets and async GPU group-count feedback for two-pass ExecuteIndirect draws (including deferred batch mode), eliminate cold-start clamping so initial indirect draws keep full capacity, keep active frustum-culled PSOs warm over a 16-window history while dropping unused PSOs to 256 KiB, report exact clamped command and dropped group counts, guard feedback readback against device removal (`u64::MAX` / `q.Signal`), and bound reuse growth in `ensure_res_buffer`. Part of xcl-dev#2688 Assisted-by: T3 Code / Antigravity (Gemini Pro Orchestrator Neon) Assisted-by: Codex (GPT-6.2 Sol)
9afb55e to
bc82371
Compare
…port PR xcl-dev#2817) Port upstream PR xcl-dev#2817 (bc82371 / Part of xcl-dev#2688) onto rx580-mesh-vs-fallback: - Add real::video_memory_info() exposing DXGI local VRAM budget alongside usage. - Dynamically cap two-pass pool at 25% of remaining DXGI local headroom with floor (local_budget / 32).clamp(256 MiB, 512 MiB) and ceiling min(local_budget / 4, 2048 MiB) cached for 250 ms (overridable via XCL_TWO_PASS_MB). - Update put_free_bufs to retain up to two_pass_cap().min(FREE_RES_CAP) without halving churn. - Add bounded submit-fence wait (10 ms limit, 250 ms timeout backoff cleared on reclaim, device-removal short-circuit) and half-step bucket shrinking down to a single record before refusing, counting direct DispatchMesh cuts/drops for both uses_vs and hardware MS pass-through.
|
I found a wait-path stall on exact #2817 head I reproduced this with a test-only WARP schedule: queue A keeps a small buffer pending; queue B holds the requested 64 MiB buffer and completes after the eighth poll of A. A stays pending. With the PR logic unchanged, The local candidate rechecks all fenced batches at bounded intervals while polling A, then retries acquisition when a batch is reclaimed. The same test passed (1/0/0/0). Windows 11 build 26300, Ryzen 7 9800X3D, rustc 1.99.1 MSVC. WARP executed the new fixture; the RTX 3080 Ti was present but was not used by that fixture. Synthetic inputs only. Candidate fix and regression diffdiff --git a/crates/xcl/src/hle/d3d12x/bind.rs b/crates/xcl/src/hle/d3d12x/bind.rs
index 12e3c5ea..8716ac85 100644
--- a/crates/xcl/src/hle/d3d12x/bind.rs
+++ b/crates/xcl/src/hle/d3d12x/bind.rs
@@ -474,6 +474,12 @@ fn wait_oldest_fenced_until(deadline: std::time::Instant) -> WaitStep {
if matches!(unsafe { fence_state(fence, *value) }, FenceState::Removed) {
return WaitStep::Stopped;
}
+ // A later batch on another queue may have completed while this oldest
+ // fence remains pending; do not spend the entire wait budget on it.
+ if polls % 64 == 0 && reclaim_fenced() > 0 {
+ note_two_pass(TP_WAITED);
+ return WaitStep::Progressed;
+ }
if std::time::Instant::now() >= deadline {
timed_out = true;
break 'wait;
@@ -7289,9 +7295,15 @@ void ms(uint3 g : SV_GroupID) { o.Store((v * 16u + g.x) * 4u, rec.Load(g.x * 4u)
// Complete only the fences this test has registered, once allocation actually waits.
static FENCES_TO_SIGNAL_ON_WAIT: std::cell::RefCell<Vec<(ID3D12Fence, Arc<AtomicU64>)>> =
const { std::cell::RefCell::new(Vec::new()) };
+ static FENCE_WAIT_POLLS: std::cell::Cell<u32> = const { std::cell::Cell::new(0) };
+ static FENCE_SIGNAL_AFTER_POLLS: std::cell::Cell<u32> = const { std::cell::Cell::new(1) };
}
pub(super) fn signal_fence_on_wait(fence: &ID3D12Fence) {
+ let poll = FENCE_WAIT_POLLS.with(|n| { let poll = n.get() + 1; n.set(poll); poll });
+ if poll < FENCE_SIGNAL_AFTER_POLLS.with(|n| n.get()) {
+ return;
+ }
FENCES_TO_SIGNAL_ON_WAIT.with_borrow_mut(|signals| {
if let Some(index) = signals.iter().position(|(test, _)| test.as_raw() == fence.as_raw()) {
let (_, value) = signals.swap_remove(index);
@@ -7411,6 +7423,58 @@ void ms(uint3 g : SV_GroupID) { o.Store((v * 16u + g.x) * 4u, rec.Load(g.x * 4u)
assert_eq!(got_raw, Some(large_raw));
}
+ #[test]
+ fn later_completed_queue_reclaims_without_waiting_for_oldest() {
+ let _warp_guard = lock_warp_tests();
+ WAIT_BACKOFF_UNTIL_MS.store(0, Ordering::Release);
+ let Some(dev) = warp_device_for_test() else { return };
+ let key = dev.as_raw() as usize;
+ while FREE_RES.lock().unwrap().take(key, 0, u64::MAX).is_some() {}
+ let ids = Box::new([0u8; 8]);
+ let (l1, l2) = (ids.as_ptr() as *mut c_void, (ids.as_ptr() as usize + 1) as *mut c_void);
+ let (a1, a2, a3) = (ids.as_ptr() as usize + 2, ids.as_ptr() as usize + 3, ids.as_ptr() as usize + 4);
+ let (q1, q2) = ((ids.as_ptr() as usize + 5) as *mut c_void, (ids.as_ptr() as usize + 6) as *mut c_void);
+
+ reset(l1, a1, 0);
+ let old = unsafe { TwoPassBuf::make(&dev, RECORD_MIN, "old queue") }.unwrap();
+ with(l1, |s| s.res_buf = Some(old));
+ track_two_pass_list(l1 as usize);
+ let (f1, v1) = make_test_fence(0);
+ unsafe { two_pass_submitted(q1, Some(&f1), 1, &[l1]) };
+ reset(l1, a3, 0);
+
+ reset(l2, a2, 0);
+ let size = 64 << 20;
+ let needed = unsafe { TwoPassBuf::make(&dev, size, "needed queue") }.unwrap();
+ let needed_raw = needed.res.as_raw() as usize;
+ with(l2, |s| s.res_buf = Some(needed));
+ track_two_pass_list(l2 as usize);
+ let (f2, v2) = make_test_fence(0);
+ unsafe { two_pass_submitted(q2, Some(&f2), 1, &[l2]) };
+ reset(l2, a3, 0);
+
+ let cap = TWO_PASS[TP_ALIVE].load(Ordering::Relaxed) + (8 << 20);
+ FENCE_WAIT_POLLS.with(|n| n.set(0));
+ FENCE_SIGNAL_AFTER_POLLS.with(|n| n.set(8));
+ // B completes after polling A begins; A remains pending throughout acquisition.
+ FENCES_TO_SIGNAL_ON_WAIT.with_borrow_mut(|signals| signals.push((f1, v2)));
+ let got = unsafe { acquire_two_pass_buf_with_cap(&dev, size, size * 2, u64::MAX, "needed queue", cap, std::time::Duration::from_millis(100)) }.unwrap();
+ let polls = FENCE_WAIT_POLLS.with(|n| n.get());
+ let got_raw = got.as_ref().map(|b| b.res.as_raw() as usize);
+
+ v1.store(1, Ordering::Release);
+ drop(got);
+ reclaim_fenced();
+ while FREE_RES.lock().unwrap().take(key, 0, u64::MAX).is_some() {}
+ forget(l1);
+ forget(l2);
+ WAIT_BACKOFF_UNTIL_MS.store(0, Ordering::Release);
+ FENCE_SIGNAL_AFTER_POLLS.with(|n| n.set(1));
+ FENCES_TO_SIGNAL_ON_WAIT.with_borrow_mut(|signals| signals.clear());
+ assert_eq!(got_raw, Some(needed_raw));
+ assert!(polls <= 65, "completed later queue must be noticed promptly, not after {polls} polls of the older pending fence");
+ }
+
#[test]
fn acquire_res_buf_shrinks_under_tight_cap_instead_of_skipping() {
let _warp_guard = lock_warp_tests();AI use: Codex (GPT-6.2 Sol) wrote the candidate and regression, ran the tests, and drafted this report. Codex (GPT-6.2 Astra) reviewed the fence and reclamation schedule. |
|
Follow-up independent desktop NVIDIA (natural 8 GB VRAM) verification of PR #2817 at updated head Environment
Targeted release tests & build (
|
| Command | Result |
|---|---|
cargo test --release -p xcl --lib fence_wait_timeout_backs_off_subsequent_waits_until_reclaim -- --nocapture |
1 passed; 0 failed; 0 ignored; 1742 filtered out (0.02s) |
cargo test --release -p xcl --lib put_free_bufs_retains_buffers_up_to_cap_without_halving_churn -- --nocapture |
1 passed; 0 failed; 0 ignored; 1742 filtered out (0.01s) |
cargo test --release -p xcl --lib records_for_falls_back_to_whole_before_shrinking_halves -- --nocapture |
1 passed; 0 failed; 0 ignored; 1742 filtered out (0.01s) |
cargo test --release -p xcl --lib hle::d3d12x::alloc_pool:: -- --test-threads=4 (3 consecutive runs) |
8 passed; 0 failed; 0 ignored; 1735 filtered out × 3 (0.20s, 0.20s, 0.21s) |
cargo test --release -p xcl --lib hle::d3d12x::bind:: -- --test-threads=4 (3 consecutive runs) |
76 passed; 0 failed; 0 ignored; 1667 filtered out × 3 (0.33s, 0.33s, 0.33s; two_pass_binds_set_the_shared_view_heap self-skipped because XCL_HEAP_WINDOWS is opt-in) |
cargo build --release -p xcl --bin xcl |
Clean build (1m 28s, exit 0) |
Paired quiet 60 s retail smoke (title: 29640639)
Merge-base on nvidia-dev (eae015021c639866ab061cdff2e9daf8ba9daac5, cached baseline on the same machine):
xcl-smoke v1
commit: eae015021c639866ab061cdff2e9daf8ba9daac5
gpu: NVIDIA GeForce RTX 4060
title: 29640639
seconds: 60
exit: 0x0
frames shown: 1551 (PresentX 1551)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 15926 MB
PR #2817 (bc82371ee25fa81577173a05c1b255ed2a4ffebf):
xcl-smoke v1
commit: bc82371ee25fa81577173a05c1b255ed2a4ffebf
gpu: NVIDIA GeForce RTX 4060
title: 29640639
seconds: 60
exit: 0x0
frames shown: 1637 (PresentX 1637)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 14817 MB
Runtime log observations (xcl.log)
9387log lines,0[ERROR]/ device-removal / panic lines.- Final draw/memory telemetry in log:
19303 draws with translated pipelines (0 skipped, 0 with PC pipelines), 1024 dispatches (0 skipped); last memory sample14759 MB committed by the process; video memory 6117 MB local, 4748 MB non-local; video memory budget 7012 MB.
Limits of coverage
- DXGI headroom capping, wait-oldest-fenced reclamation, timeout backoff, non-churn free-buffer retention, and whole-before-shrink fallback all passed 3/3 under parallel
--test-threads=4runs ofalloc_pool::andbind::(76/0/0inbind::;two_pass_binds_set_the_shared_view_heapself-skipped becauseXCL_HEAP_WINDOWSis opt-in). - The 60 s menu capture on
title: 29640639logged0live two-pass allocations and stayed below the7012 MBlocal VRAM budget (6117 MBlocal used), confirming clean 8 GB runtime behavior onnvidia-devwithout exercising live in-world VRAM-pressure shrinking; frame-count and peak-commit deltas vs. the cachedeae01502baseline reflect normal single-run startup/worker variance and are not attributed to this PR.
AI disclosure: test execution and report drafting assisted by Google Antigravity (Gemini 4 Neon).
Reclaim completed batches on other queues at elapsed-time intervals during the cap wait. One pending fence must not hide a reusable record buffer until the wait deadline. The WARP regression completes the later batch after polling changes from yields to sleeps. Reported-by: thehollowedone (xcl-dev#2817 (comment)) Assisted-by: Codex (gpt-6.2-sol) Cap the two-pass pool dynamically at 25% of remaining DXGI local VRAM headroom with a card-scaled floor `(local_budget / 32).clamp(256 MiB, 512 MiB)` and a `min(local_budget / 4, 2048 MiB)` ceiling cached for 250 ms, remove the `/ 2` reuse pool clamp in `put_free_bufs` that caused buffer churn, retry oversized reuse candidates before waiting, bound submit-fence waits at 10 ms with 250 ms timeout backoff and device-removal short-circuiting, walk every 256 KiB half-step bucket while shrinking record buffers down to a single record (avoiding unnecessary jumps past 1.5x steps) while counting direct `DispatchMesh` cuts/drops, and let `XCL_TWO_PASS_BATCH` halves and batch-buffer allocations fall back without polluting `TP_REFUSED`. Part of xcl-dev#2688 Assisted-by: T3 Code / Antigravity (Gemini Pro Orchestrator Neon) Assisted-by: Codex (GPT-6.2 Sol)
bc82371 to
a2c10b4
Compare
PR #2817 — late completion on a second queueThe proposed 64-poll rescan can miss a reusable buffer until the next 64-poll boundary. In a WARP fixture, queue A stayed pending and queue B's 64 MiB buffer became reusable on poll 70. The published candidate returned the correct buffer on poll 129. After the initial yields, each unsuccessful poll requests a 200 µs sleep, so 64 such sleeps alone span at least 12.8 ms. Production uses a 10 ms wait budget. The observed defect concerns when a ready buffer is noticed. Both fixtures check that the acquired buffer is the expected one. Original report and candidate
The refinement checks all fenced batches once at the yield-to-sleep transition and again after 1 ms has elapsed since the previous scan. A successful reclaim retries acquisition. The existing fence-completion predicates still govern reuse, including multi-queue marks. The scan runs before the deadline check, so scan time and scheduler delays can still extend the wait. The 1 ms interval has not been benchmarked for CPU cost or lock contention with large queues. The fixtures use WARP allocations and deterministically advanced test fences, a 100 ms deadline and serial execution. No retail workload, physical GPU scheduling, or production wall-clock latency was measured. The refinement's bind module run reported 78 passed, zero failed and zero ignored, including one explicit heap-window skip. The full suite and retail smoke pair remain untested. Baseline log · Published candidate log · Refinement log · Bind module log Reproduce on WindowsUse a separate checkout of
git apply <path-to-one-complete-patch>
cargo test --locked -p xcl --lib later_completed_queue -- --test-threads=1 --nocaptureAt review time on November 26, the live PR remained at this head. The original report's early schedule was the latest of 14 conversation comments. No public follow-up covering the poll-70 case or formal review was visible. PR discussion |
|
Independent budget-pressure check on RTX 5070, NVIDIA driver 616.92; Ryzen 7 5700X3D; Windows build 26300.10075; Rust 1.100.0 MSVC, debug. The test-only fixture supplied a native device and queried the real DXGI budget, with no guest or rendering. On the same adapter (LUID confirmed), allocated 3,520 MiB of non-pool local heaps and then released them; sampled after 350 ms to cross the 250 ms refresh period. Reported process usage rose from 9,371,648 to 3,700,359,168 bytes and returned to 9,371,648 bytes. The reported local budget was 11,717,836,800 bytes.
Each arm passed its fixture with 0 failures, 0 ignored and no reported skips. This tests cap calculation on a 12 GB adapter; it does not measure GTA VI's actual VRAM use, performance or stability. AI use: OpenAI Codex with GPT-6.2 Astra built the test-only fixture and ran the comparison; Codex coordinated and prepared this report. |
|
Retested the late-fence case from my earlier review on updated head The bind module reported 77 passed, 0 failed and 0 ignored, including one explicit opt-in heap-window skip. This validates the synthetic schedule, not retail frame-time impact or queue-scan overhead. AI use: OpenAI Codex with GPT-6.2 Astra inspected the updated code and ran the tests; Codex coordinated and prepared this report. |
|
Tested: Clean Not tested: Live DXGI pressure, retail behavior or full suite. AI use: T3 Code / Codex ( |
|
Follow-up independent desktop NVIDIA (natural 8 GB VRAM) verification of PR #2817 at updated head Environment
Targeted release tests & build (
|
| Command | Result |
|---|---|
cargo test --release -p xcl --lib later_queue_completion_during_sleep_reclaims_before_wait_deadline -- --nocapture (3 consecutive runs) |
1 passed; 0 failed; 0 ignored; 1743 filtered out × 3 (0.02s × 3, 0 skipped) |
cargo test --release -p xcl --lib hle::d3d12x::bind:: -- --test-threads=1 (3 consecutive runs) |
77 passed; 0 failed; 0 ignored; 1667 filtered out × 3 (0.66s, 0.65s, 0.66s; 76 executed + 1 self-skipped two_pass_binds_set_the_shared_view_heap: no heap windows (opt-in: XCL_HEAP_WINDOWS=1)) |
cargo test --release -p xcl --lib hle::d3d12x::alloc_pool:: -- --test-threads=1 (3 consecutive runs) |
8 passed; 0 failed; 0 ignored; 1736 filtered out × 3 (0.28s, 0.30s, 0.28s, 0 skipped) |
cargo build --release -p xcl |
Clean build (1m 37s, exit 0, 0 new warnings in bind.rs/alloc_pool.rs) |
Paired quiet 60 s retail smoke (title: 29640639)
Exact nvidia-dev merge-base (eae015021c639866ab061cdff2e9daf8ba9daac5, cached baseline on the same machine):
xcl-smoke v1
commit: eae015021c639866ab061cdff2e9daf8ba9daac5
gpu: NVIDIA GeForce RTX 4060
title: 29640639
seconds: 60
exit: 0x0
frames shown: 1551 (PresentX 1551)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 15926 MB
PR #2817 (a2c10b4a6d5f0463b69d10e8edde21a85dcaa3cb, XCL_TWO_PASS_MB unset):
xcl-smoke v1
commit: a2c10b4a6d5f0463b69d10e8edde21a85dcaa3cb
gpu: NVIDIA GeForce RTX 4060
title: 29640639
seconds: 60
exit: 0x0
frames shown: 1597 (PresentX 1597)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 14858 MB
Runtime log observations (xcl.log)
9390log lines,0[ERROR]/ device-removal / panic lines.- Final draw/memory telemetry in log:
19303 draws with translated pipelines (0 skipped, 0 with PC pipelines), 1024 dispatches (0 skipped); last memory sample14651 MB committed by the process; video memory 6119 MB local, 4811 MB non-local. 0two-pass cap-refusal / wait / shrink warnings triggered during the 60 s run ontitle: 29640639.
Limits of coverage
- The new periodic cross-queue fence-reclaim rescan (
FENCE_WAIT_RESCAN_INTERVALinwait_oldest_fenced_until) and the full stacked#2815–#2817headroom-cap / wait / shrink logic were verified vialater_queue_completion_during_sleep_reclaims_before_wait_deadline(3/3),hle::d3d12x::bind::(76executed +1opt-inXCL_HEAP_WINDOWS=1skip × 3), andhle::d3d12x::alloc_pool::(8/8× 3). - This 60 s startup smoke on
title: 29640639does not enter heavy two-pass VRAM pressure (0two-pass wait/shrink log lines), so it confirms zero runtime regression on a natural 8 GB RTX 4060 rather than reproducing over-budget world-load two-pass contention (frame-count and peak-commit deltas vs. cachedeae01502reflect single-run startup variance, not this PR). Full CI workspace coverage (note: GitHubBuild and test (Windows, no GPU)is currently failing ona2c10b4a) was not run here.
AI disclosure: test execution and report drafting assisted by Google Antigravity (Gemini 4 Neon).
|
8 GB NVIDIA under real world-load pressure (the case the RTX 4060 smoke above didn't reach): the cap holds two-pass buffers at ≤256 MiB with nothing left waiting, the run lasts longer, but local video memory as a whole is not lower. One run, so the timing is indicative. Tested
Results
Not tested: repeats, the picture under the clamps, AMD. AI use: runs and log analysis by Claude Code agents (Claude Sonnet 5.5), report written and checked against the run logs by Claude Code (Claude Opus 5.5). |
|
Independent paired measurements of the Setup
Summary (180 s paired runs)
All four runs exited xcl-smoke v1 blocks (180 s each)Not tested: longer runs past 180 s on |
Cap the two-pass mesh buffer pool dynamically from DXGI local VRAM headroom, reclaim busy memory via bounded fence waits, and shrink/fallback gracefully before dropping draws.
Stacked on #2816; only the top commit belongs here.
Part of #2688
What is in it
crates/xcl/src/hle/d3d12x/bind.rs:(local_budget / 32).clamp(256 MiB, 512 MiB).min(ceiling)and amin(local_budget / 4, 2048 MiB)ceiling cached for 250 ms (XCL_TWO_PASS_MBstill overrides), and remove the/ 2reuse-pool clamp input_free_bufsthat caused buffer churn.wait_oldest_fenced_until,FENCE_WAIT_LIMIT = 10 ms) with250 mstimeout backoff andFenceState::Removedshort-circuiting (WaitStep::Stopped), and retry oversized reuse candidates before waiting.DispatchMesh/ExecuteIndirectrecord buffers across every 256 KiB half-step bucket down to a single record (records_for_with_cap+try_ensure_res_buffer_exact_with_cap) rather than jumping straight past 1.5x steps, and track exact directDispatchMeshfallback cuts/drops (TP_DIRECT_CUT,TP_DIRECT_GROUPS_DROPPED).XCL_TWO_PASS_BATCHhalves (Halves->Whole) and batch-buffer allocations (batch_region/try_make_with_cap) to fall back cleanly without pollutingTP_REFUSEDor prematurely skipping draws, plus 10 unit/GPU tests covering budget scaling, wait backoff, device removal, half-step shrink selection, and batch fallback.Tested
a2c10b4a.cargo build --offline --locked -j 6 --workspacesucceeded.cargo test --offline --locked -j 6 --workspace --no-fail-fast -- --test-threads=4 --nocapturereported 1839 passed, 13 failed, 48 ignored, and 27 GPU skip notices. The new regression passed. The failure names and counts match the previous head and the earliernvidia-devbaseline.bc82371ewith the test harness alone (0 passed, 1 failed). With the fix,cargo test --offline --locked -j 4 -p xcl --lib -- wait_oldest_fenced later_queue_completion_during_sleep_reclaims_before_wait_deadline fence_wait_timeout --test-threads=1 --nocapturereported 5 passed, 0 failed. Both invocations had zero skips.bc82371e, RTX 5090:cargo build --offline --locked -j 8 --workspacesucceeded.cargo test --offline --locked -j 8 --workspace --no-fail-fast -- --test-threads=4 --nocapturereported 1838 passed, 13 failed, 48 ignored, and 27 GPU skip notices. The failure names and counts match the earliernvidia-devbaseline. The idle-pool regression passed.9afb55e8, RTX 5090:cargo build --offline --locked -j 6 --workspacesucceeded.cargo test --offline --locked -j 6 --workspace --no-fail-fast -- --test-threads=4 --nocapturereported 1836 passed, 14 failed, 48 ignored, and 27 GPU skip notices (excluded from coverage). Additional reported failures compared with that earlier release baseline:hle::d3d12x::sparse::tests::a_tile_decommitted_and_committed_again_keeps_its_video_memory. The sparse tile test passed 5/5 standalone reruns on the same head.9afb55e8, same RTX 5090 and command: 1837 passed, 13 failed, 48 ignored, 27 GPU skip notices. The sparse tile test passed; the 13 failure names and counts match the earliernvidia-devbaseline.32.0.16.2101,32187 MiBVRAM, wave32 / split wave64), WARP (software renderer), AMD Ryzen 9 9950X3D, Windows 11 Pro (10.0.26300),rustc 1.100.0(0ef1bc386 2026-11-09), DXC1.8.2502.11.e70a708b:cargo test --offline --locked -p xcl --lib -- hle::d3d12x::bind hle::d3d12x::alloc_pool --test-threads=4(NVIDIA + WARP):82 passed; 0 failed(1opt-inSKIPPED:hle::d3d12x::bind::tests::two_pass_binds_set_the_shared_view_heap: no heap windows (opt-in: XCL_HEAP_WINDOWS=1)).XCL_HEAP_WINDOWS=1:two_pass_binds_set_the_shared_view_heap1 passed; 0 failed.cargo build --offline --locked --release --workspace && cargo test --offline --locked --release --workspace --no-fail-fast -- --test-threads=4):e70a708bon RTX 5090:total_passed=1833, total_failed=13, total_ignored=48, skips=27(xcllib:1706 passed; 7 failed; 28 ignored) vsnvidia-dev(eae01502):total_passed=1812, total_failed=13, total_ignored=48, skips=27.e70a708bon WARP (XCL_ADAPTER=warp):total_passed=1838, total_failed=6, total_ignored=48, skips=363(xcllib:1711 passed; 2 failed; 28 ignored) vsnvidia-dev(eae01502):total_passed=1817, total_failed=6, total_ignored=48, skips=364.nvidia-devbaseline (fuzz_validate_and_gpu_{0,1,2,3},gpu_compute_thread_limits_leave_the_lanes_past_them_out,texture_upload::{pieces_hold_the_texels_of_their_levels, gpu_parts_of_a_texture_go_up_and_the_rest_stays},console_ms_in_as_slot_and_ms_with_as_are_refused_cleanly,async_compute_pso_registers_real_pso_and_not_standin,split_compute_prefers_the_offline_whole_pipelinex2,two_pass_driver_cache_reuses_both_passes_and_recovers_corrupt_blobsx2); WARP's 6 failures match pre-existing baseline (texture_uploadx2,console_ms_in_as_slot_and_ms_with_as_are_refused_cleanly,test_title_draws_with_a_root_signature_under_the_debug_layer,test_title_runs_under_the_debug_layer_with_dred,test_title_runs_and_game_folder_is_untouched).SKIPPEDGPU tests on RTX 5090:no wave64(20),wave32, per-lane form: refused(3),no heap windows(2),cannot disable the driver cache(1), plus opt-inXCL_HEAP_WINDOWS=1skip above (1).scripts/smoke.ps1,title: a93b40d7, RTX 5090,XCL_PREPARE=0):e70a708bproduced1675frames (PresentX 1675),0device removals,0crashes,16201 MBpeak commit vsnvidia-deveae01502(1628frames,15793 MBpeak commit) andmainb49be183(1654frames,16446 MBpeak commit).title: a93b40d7(RTX 5090,XCL_PREPARE=0, syntheticAinputs entering live world loading withtwo-pass DispatchMeshandtwo-pass ExecuteIndirect(DispatchMesh),0device removals and0crashes across all 5 runs):nvidia-dev(eae01502, default1024 MiBcap):1426frames (PresentX 1426),83made /3taken again /0let go,83alive (1013 MiB),37 MiBwaiting for allocator resets,2420draws refused/skipped past1024 MiB, peak commit36712 MB, peak local VRAM15647 MB.e70a708b(default DXGI headroom ->2048 MiBcap):1432frames (PresentX 1432),105made /6taken again /3let go,102alive (1550 MiB),0 MiBwaiting for fences/resets,0refused/skipped draws,0warnings,0waits/timeouts,0clamped/cut/shrunk, peak commit39579 MB, peak local VRAM16221 MB.e70a708b(XCL_TWO_PASS_MB=1024):1428frames (PresentX 1428),71made /5taken again /2let go (69alive,1023 MiB),489shrunk,2317refused past1024 MiB,0waiting for fences/resets,0waits/timeouts, peak commit37568 MB.e70a708b(XCL_TWO_PASS_MB=256):1432frames (PresentX 1432),24made /3taken again /3let go (21alive,255 MiB),271shrunk,1direct cut (24groups dropped),10164refused past256 MiB,0waits/timeouts, peak commit35055 MB.e70a708b(XCL_TWO_PASS_BATCH=2):1415frames (PresentX 1415),60made /13taken again /3let go (57alive,2022 MiB,7kept for reuse385 MiB),478shrunk,3560refused past2048 MiB,0waits/timeouts, peak commit36466 MB.Regression run
Not tested
XCL_TWO_PASS_MB=1024and256overrides.presentspause after ~60–64 s on bothnvidia-devand this PR while 650 KB–1.5 MB compute/graphics PSOs compile) were not reached within the 120 s scripted world-loading runs, though live world-loadingDispatchMeshandExecuteIndirect(DispatchMesh)draws and DirectStorage streaming executed across all five runs.AI use
gemini-pro-orchestrator-neon) and Codex (GPT-6.2 Sol) wrote and reviewed the budget-capping/fallback fixes, tests, and PR description; all builds, tests, smoke runs, and world-loading runs were executed directly on local hardware.gpt-6.2-sol) reproduced and fixed the fence-accounting race, added the regression test, and reran validation on the revised stack.gpt-6.2-sol) reproduced the idle-pool regression, applied the suggested fix and reran validation on the revised stack.gpt-6.2-sol) adapted the review's fence rescan to elapsed time, reproduced the late completion, and reran the workspace suite and retail smoke.