Repository navigation
Conversation
|
Test report on AMD / Linux (RDNA3, RADV): with #2404 + #2097 no title thread builds a whole form any more, and with Setup: RX 7900 XT 20 GB (Mesa 26.2.5 RADV), Linux 7.2, Proton-CachyOS Wine 11, a local vkd3d-proton build; 24 GB RAM, the game capped at 16 GB. Retail 1.0.2.1,
Not tested: what is on screen (no screenshots of these runs; longer runs with captures are going now), Windows, NVIDIA, this PR without the other carried PRs, a cold cache. AI use: Claude Code (Claude Opus 5.5) ran the builds and runs on this machine, read the logs and thread dumps, and wrote this report. |
|
Added for On an RTX 3060 12 GB, the PR run recorded 177 chained Tested
The single run per build leaves open what drove the late 4.3 GB rise in non-local video memory, why the PR run stalled from 135 to 168 s, and whether Not tested Rendered picture, the suite at AI use Claude Code (Claude Opus 5.5) ran the tests and drafted the report. Claude Fable 5.2 rechecked it. OpenAI Codex (GPT-6, exact serving variant unavailable) checked the live PR and applied the edits. Added for
Not tested: title, debug layer, wave64, AMD. AI use: Claude Code; Claude Opus 5.5 ran and wrote this, a second Claude Opus 5.5 checked it against the logs, Claude Fable 5.2 reviewed the text. RTX 3060 12 GB, 32 GB RAM, Tested
By reading (neither exercised here)
Not tested: picture, same caches without this PR, the suite, AMD. Unknown: exit code, whether our low-commit stop script ended it. AI use: Claude Code. Claude Opus 5.5 ran it and wrote this; a second Claude Opus 5.5 checked the numbers; Claude Fable 5.2 reviewed the text; a person checked it. |
|
Independent test and smoke report for head Tested
Regression run (
PR Not tested: NVIDIA/Intel GPUs, Linux/Wine, or world load past the 60 s smoke window. AI use: Antigravity (Gemini 4 Neon) ran the builds, tests, and smoke runs and drafted this report; the account owner reviewed and approved posting. |
|
Independent AMD RDNA4 (native wave64) test report on exact head Tested
Regression run (60 s retail-title smoke, (Matched Not tested
AI use
|
|
Independent Windows/NVIDIA result on clean 5ca9c23. RTX 3080 Ti (621.35), Ryzen 7 9800X3D, Windows 11 build 26300, Rust 1.99.1 MSVC, DXC/DXIL 1.8.2502.11.
Adjacent controls on the same head: Not tested: full workspace, retail title, other GPUs. AI-assisted. Codex (GPT-6, exact variant unavailable) ran the checks and drafted this report. |
|
Independent retail check on an RTX 5080 (retail 1.0.2.1, 600 s,
at 600 s. Without the stack, the same title's direct runs fell back to ~900 KB whole forms built on title threads at 93, 135, 176, 224, 265, 303, 357, 398, 437, 474, 505 and 580 s — exactly the wall this PR describes. So the ExecuteIndirect whole-form fallback is gone here (0 whole, 0 slabs lost). Caveat on presentation: this first stack run presented to 116 s (14 two-second intervals after 96 s), but it ran on a new base with a cold direct cache (8 cold compiles). A second run is warming it; I will report the number when it finishes. The AI use: OpenCode, Claude Fable 5.2 built the stack, ran the retail title on this machine and wrote this. |
|
Tested: current PR head merged onto current
Not tested: retail titles (no title data on this lane, counts only). AI use: Hermes agent (local Qwen-class) ran both machines and drafted this; I checked it before posting. |
|
Verification on RTX 3060 Ti (Windows 11), branch merged with current
Thanks! |
|
Follow-up after a second (warm) run of the same stack: the ExecuteIndirect whole forms are still 0 of them whole, 0 slabs lost ( AI use: OpenCode, Claude Fable 5.2 ran the second stack run on this machine and wrote this. |
…#2404, xcl-dev#2405 Integrates VRAM top-mip pressure shedding (xcl-dev#2385), DXC wanted-compile prioritization & worker headroom (xcl-dev#2423), inline split pipeline foreground path (xcl-dev#2424), ExecuteIndirect split program dispatch (xcl-dev#2404), and hosted view heap exhaustion null-pair fallback (xcl-dev#2405). Assisted-by: Antigravity (Gemini 4 Neon)
, xcl-dev#2333, and UnadoptGuard test submits Assisted-by: Antigravity (Gemini 4 Neon)
|
Read in full (body, thread, diff). The approach is the one I want for #2088: it removes the whole-form compiles from the title's threads, and the retail reports above agree on that (0 whole). Before it can be merged:
@pvfreis's first point (the Tested on AMD RDNA4 (native wave64), Windows, DXC 1.8.2502.11, debug, Not tested: a title run with this PR, NVIDIA. AI use: Claude Code (Claude Opus 5.5) read the thread and the diff, ran the tests and wrote this on the maintainer's behalf. |
|
Update: this report covers @ivall On point 1, a second NVIDIA card: the same failure on an RTX 3070 8 GB (Ampere, driver 616.56; thehollowedone's 3080 Ti is on 621.35), Windows 11, debug, without the D3D12 debug layer. How many words differ, from the assertion's Added 20:13Z, corrected 20:50Z. Run alone (
(Edited 20:20Z: corrected the counts above. I had first counted the 16 guard words as matching output words, and the time of the addition was a placeholder.) AI-assisted (Claude Code, Claude Opus 5.5). Synthetic tests only. |
Test report: #2372 and #2404 on an RTX 3080, retail title 7952987ASummary: both PRs remove the world-load freeze on this card. With either one applied, every run then hits the silent Setup
Conflicts with current
Base, 6 runs
#2404, 3 runs
#2372, 3 runs
What this says Not tested: AMD, other titles, and runs without (Runs and report by Claude Code with Claude Opus 5.5. The commands and counts above come from these runs.) |
|
For the requested RTX 3080 Ti overflow check on #2404 head I then removed only the two Windows 11 build 26300, NVIDIA RTX 3080 Ti / 621.35, Rust 1.99.1; Update after predicate-isolation controls (same head and GPU): The two-call deletion above left the chain's earlier
These controls narrow the failing path to the piece indirect-command sequence before the fallback. They do not establish whether the cause is command recording, synchronization, or a driver interaction. All edits stayed in the scratch test worktree; no retail run or PR patch was made. |
bmjask
left a comment
There was a problem hiding this comment.
P1: valid ExecuteIndirect work is knowingly truncated when slab count exceeds rounds and no whole form is ready. dispatch_chain.rs:337-355 leaves full=None unless chain.whole already exists, but still records only rounds chain commands. The new test at split.rs:1102-1107 explicitly accepts partial output for that first call. A later background-built whole form does not make the initial valid dispatch correct. Under title predication, full is forced None even when built and feedback is disabled, so over-limit predicated calls are permanently truncated. Please fall back to the original whole ExecuteIndirect whenever complete chain coverage cannot be guaranteed, including predicated cases.
|
Thanks @Natakout for the write-up on #505 (7193547117). Two things from it for this PR:
AI use: Claude Code with Claude Opus 5.5 read the report and wrote this reply. |
|
RTX 3090 24 GB (621.40), retail 1.0.2.1 on Setup
Tests at the merged tree:
What Windows logged (System log,
DRED (all three: page fault at GPU VA
Update: an Nsight Aftermath dump of the fault. Run 6: this PR alone again, same setup, with the Nsight Aftermath Monitor 2026.4 in Global mode (resource tracking and additional shader error reporting on, shader debug info and call stacks off). Removed at 145.4 s (
Not tested: AI use: Claude Code (Claude Opus 5.5) merged the trees, ran the tests and the runs on my machine, read the logs, DRED, the event log and the Aftermath dump, and drafted this. Checked by me before posting. |
|
On This may be what @afpruivo's MMU faults above are (comment): same DRED signature ( Setup:
1. What faults. 8 Aftermath dumps. 7 of them are the same:
2. Which buffer. The address matches a buffer made by 3. Who releases it, and when. In each traced fault, the buffer was dropped by
4. What I ruled out:
5. Not found: the exact path by which the list leaves the backing's
A simple guard would make Side note: with Not tested: other GPUs; this PR alone on AI use: Claude Code (Claude Opus 5.5) wrote the local diagnostics, ran the runs, decoded the Aftermath dumps, matched them to the logs, and wrote this. Edit, added after this comment was first posted (15:25 UTC): one run with
|
|
@Raul-Paiva @Kalmarv: our two unexplained hangs on an RTX 5090 match this signature. Both were on builds with
For contrast, the base So the hang I mentioned in 7184267294 and on #2633 is probably this, not the tail release or #2633 itself. AI use: Gemini (Antigravity) lined up the logs. Claude Code (Claude Opus 5.5) checked that both builds contain |
…l is put off need_by_submit marked a put-off call's pipeline by_submit and moved it ahead of the workers' queue, but not wanted, and the big-compile gate reads only wanted: until record_deferred reached the call and marked the next four, those builds went through the gate one at a time, behind the background slot. In a retail title's world start on Linux (RTX 4060 Ti, with xcl-dev#2404 and xcl-dev#2333) the put-off builds spent 3,153 s waiting at the gate against 320 s in the driver. Since ae00ec7 wanted builds have a hard cap of their own (XCL_HUGE_PSO_WANTED_CONCURRENCY), so marking them all at once no longer lets an unbounded number skip the commit headroom; the look-ahead window of four in record_deferred, and want/want_bound behind it, go. Found by reading the gate waits of Bench E's runs. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Raul-Paiva @Kalmarv: a candidate for why
That fits the trace in 7195594188:
The interleaving itself is inferred; nothing in our logs records it. A fix in the shape the code already uses: take the free backings' AI use: Codex (GPT-6.2-Sol) traced the interleaving. Claude Code (Claude Opus 5.5) checked both paths in the source at |
|
At #2404 head Test machine: RTX 3080 Ti (NVIDIA 621.35), Ryzen 7 9800X3D, Windows 11 build 26300, Rust 1.99.1 MSVC; debug build.
The attached candidate detaches the old bucket while the pool lock still protects the free decision, then drops it after unlocking; a recording destructor can map its commands buffer. The deterministic CPU regression pauses at that boundary, reuses B through the production allocator selection with a mock native reset, and checks that the new marker survives. It failed before the change (0 passed, 1 failed: new marker removed) and passed after (1 passed, 0 failed), using
Not tested: a retail title, an Aftermath run, AMD/Intel, or paired clean-tree smoke. This candidate establishes the code race, not that it resolves the reported device removals. Local candidate diff and regression (uncommitted)diff --git a/crates/xcl/src/hle/d3d12x/alloc_pool.rs b/crates/xcl/src/hle/d3d12x/alloc_pool.rs
index d08a3ca2..6fd7f570 100644
--- a/crates/xcl/src/hle/d3d12x/alloc_pool.rs
+++ b/crates/xcl/src/hle/d3d12x/alloc_pool.rs
@@ -312,16 +312,24 @@ pub unsafe fn forget(alloc: usize) {
/// recording on it, or this is off). `Some(hr)`: done here – the PC allocator in use was put
/// aside with its recordings and another one took its place.
pub unsafe fn title_reset(alloc: *mut c_void) -> Option<HRESULT> {
+ title_reset_with_after_unlock(alloc, || {})
+}
+
+unsafe fn title_reset_with_after_unlock(alloc: *mut c_void, after_unlock: impl FnOnce()) -> Option<HRESULT> {
if !enabled() {
return None;
}
let mut g = STATE.lock().unwrap();
let s = g.get_or_insert_with(State::default);
let hr = title_reset_in(s, alloc, |raw| super::real::reset_pc_allocator(raw));
- let free = free_aside(s);
+ // Detach while the pool lock still protects the free decision: another title Reset may
+ // reuse this backing as soon as the lock is released and record new commands on it.
+ let free: Vec<_> = free_aside(s).into_iter()
+ .filter_map(super::real::dispatch_chain::detach_recordings).collect();
drop(g);
- for b in free {
- super::real::dispatch_chain::allocator_reset(b);
+ after_unlock();
+ for recordings in free {
+ recordings.release();
}
hr
}
@@ -396,6 +404,49 @@ unsafe fn title_reset_in(s: &mut State, alloc: *mut c_void, mut reset: impl FnMu
mod tests {
use super::*;
+ #[test]
+ fn a_free_spare_reused_after_a_sweep_keeps_its_new_chain_recording() {
+ use super::super::real::dispatch_chain::{holds_recordings_for_test as holds, note_recordings_for_test as note};
+ let mut ids = Box::new([0u8; 5]);
+ let base = ids.as_mut_ptr() as usize;
+ let (title, spare, busy, list, trigger) = (base, base + 1, base + 2, base + 3, base + 4);
+ {
+ let mut g = STATE.lock().unwrap();
+ let s = g.get_or_insert_with(State::default);
+ s.aside.insert(title, vec![spare]);
+ s.cur.insert(title, busy);
+ s.types.insert(title, D3D12_COMMAND_LIST_TYPE_DIRECT.0);
+ s.backings.entry(spare).or_default();
+ s.backings.entry(busy).or_default().users.insert(list);
+ }
+ note(spare);
+ unsafe {
+ title_reset_with_after_unlock(trigger as *mut c_void, || {
+ let mut g = STATE.lock().unwrap();
+ let s = g.as_mut().unwrap();
+ let hr = title_reset_in(s, title as *mut c_void, |raw| {
+ assert_eq!(raw as usize, spare);
+ super::super::real::dispatch_chain::allocator_reset(spare);
+ 0
+ });
+ assert_eq!(hr, Some(0));
+ note(spare);
+ });
+ }
+ let kept = holds(spare);
+ {
+ let mut g = STATE.lock().unwrap();
+ let s = g.as_mut().unwrap();
+ s.aside.remove(&title);
+ s.cur.remove(&title);
+ s.types.remove(&title);
+ s.backings.remove(&spare);
+ s.backings.remove(&busy);
+ }
+ super::super::real::dispatch_chain::allocator_reset(spare);
+ assert!(kept, "a sweep removed the chain recording made after the spare was reused");
+ }
+
#[test]
fn a_spare_whose_reset_fails_stays_available_for_retry() {
let (alloc, spare, list) = (0x1000usize, 0x2000usize, 0x3000usize);
diff --git a/crates/xcl/src/hle/d3d12x/real/dispatch_chain.rs b/crates/xcl/src/hle/d3d12x/real/dispatch_chain.rs
index d37feb40..feee1b8d 100644
--- a/crates/xcl/src/hle/d3d12x/real/dispatch_chain.rs
+++ b/crates/xcl/src/hle/d3d12x/real/dispatch_chain.rs
@@ -274,6 +274,19 @@ impl Drop for Recording {
}
static RECORDINGS: LazyLock<Mutex<HashMap<usize, Vec<Arc<Recording>>>>> = LazyLock::new(Default::default);
+
+pub(in crate::hle::d3d12x) struct DetachedRecordings(Vec<Arc<Recording>>);
+
+impl DetachedRecordings {
+ pub(in crate::hle::d3d12x) fn release(self) {
+ drop(self.0);
+ }
+}
+
+pub(in crate::hle::d3d12x) fn detach_recordings(allocator: usize) -> Option<DetachedRecordings> {
+ RECORDINGS.lock().unwrap().remove(&allocator).map(DetachedRecordings)
+}
+
/// list → the allocator it records on and the scratch its chains share: they are dispatched one
/// after another, with a barrier between them (the recordings keep it alive)
static SHARED: LazyLock<Mutex<HashMap<usize, (usize, std::sync::Weak<Scratch>)>>> = LazyLock::new(Default::default);
@@ -341,8 +354,9 @@ unsafe fn scratch_for(dev: &ID3D12Device, list: usize, allocator: usize, needed:
}
pub(in crate::hle::d3d12x) fn allocator_reset(allocator: usize) {
- let recordings = RECORDINGS.lock().unwrap().remove(&allocator);
- drop(recordings);
+ if let Some(recordings) = detach_recordings(allocator) {
+ recordings.release();
+ }
}
#[cfg(test)]AI use: Codex (GPT-6.2 Sol) traced the interleaving, wrote and ran the local patch and tests, and drafted this report; Codex (GPT-6.2 Astra) reviewed the lifetime and lock ordering. |
|
@KDenKC @thehollowedone, thanks. That interleaving fits what I logged: the buffer was dropped 3 ms – 1.1 s after it was recorded, by Two more runs since my comment above, same RTX 3070 Laptop 8 GB, same tree,
If it helps, I can run @thehollowedone's candidate on this machine with Aftermath, AI use: Claude Code (Claude Opus 5.5) ran the runs, read the logs and the dumps, and wrote this. |
|
@Kalmarv a tested patch for the
Not tested: a title run with the patch (it should remove the fault class in 7195594188 if this interleaving is the cause); AMD. patch on 5b9d4ffdiff --git a/crates/xcl/src/hle/d3d12x/alloc_pool.rs b/crates/xcl/src/hle/d3d12x/alloc_pool.rs
index d08a3ca2..359dbe59 100644
--- a/crates/xcl/src/hle/d3d12x/alloc_pool.rs
+++ b/crates/xcl/src/hle/d3d12x/alloc_pool.rs
@@ -312,17 +312,22 @@ pub unsafe fn forget(alloc: usize) {
/// recording on it, or this is off). `Some(hr)`: done here – the PC allocator in use was put
/// aside with its recordings and another one took its place.
pub unsafe fn title_reset(alloc: *mut c_void) -> Option<HRESULT> {
+ title_reset_with(alloc, || {})
+}
+
+unsafe fn title_reset_with(alloc: *mut c_void, after_unlock: impl FnOnce()) -> Option<HRESULT> {
if !enabled() {
return None;
}
let mut g = STATE.lock().unwrap();
let s = g.get_or_insert_with(State::default);
let hr = title_reset_in(s, alloc, |raw| super::real::reset_pc_allocator(raw));
- let free = free_aside(s);
+ // A backing can be reused as soon as STATE is unlocked. Detach its old recordings
+ // now so the sweep cannot remove recordings made by its next user.
+ let retired: Vec<_> = free_aside(s).filter_map(super::real::dispatch_chain::take_recordings).collect();
drop(g);
- for b in free {
- super::real::dispatch_chain::allocator_reset(b);
- }
+ after_unlock();
+ drop(retired);
hr
}
@@ -331,8 +336,8 @@ pub unsafe fn title_reset(alloc: *mut c_void) -> Option<HRESULT> {
/// for takes one of them again, which may not come, so the scratch and commands that chained
/// ExecuteIndirects kept with their recordings (`dispatch_chain::allocator_reset`) go now. Without
/// this a title held 1,887 recordings under 48 allocators 110 s in, and memory grew until removal.
-unsafe fn free_aside(s: &State) -> Vec<usize> {
- s.aside.values().flatten().copied().filter(|b| s.backings.get(b).is_none_or(|x| x.free())).collect()
+unsafe fn free_aside(s: &State) -> impl Iterator<Item = usize> + '_ {
+ s.aside.values().flatten().copied().filter(move |b| s.backings.get(b).is_none_or(|x| x.free()))
}
/// The allocator transition, with the PC Reset supplied so failure/retry needs no GPU in tests.
@@ -396,6 +401,55 @@ unsafe fn title_reset_in(s: &mut State, alloc: *mut c_void, mut reset: impl FnMu
mod tests {
use super::*;
+ #[test]
+ fn aside_sweep_keeps_recordings_made_after_backing_reuse() {
+ use super::super::real::dispatch_chain::{allocator_reset, holds_recordings_for_test as holds, note_recordings_for_test as note};
+
+ let ids = Box::new([0u8; 6]);
+ let title = ids.as_ptr() as usize;
+ let (current, spare, old_list, new_list, trigger) = (title + 1, title + 2, title + 3, title + 4, title + 5);
+ let ty = D3D12_COMMAND_LIST_TYPE_DIRECT.0;
+ {
+ let mut g = STATE.lock().unwrap();
+ let s = g.get_or_insert_with(State::default);
+ s.cur.insert(title, current);
+ s.aside.insert(title, vec![spare]);
+ s.types.insert(title, ty);
+ move_list(s, old_list, current);
+ }
+ note(spare);
+
+ // Pause the sweep after it unlocks and run reuse before it can finish retirement.
+ let hr = unsafe { title_reset_with(trigger as *mut c_void, || {
+ let mut g = STATE.lock().unwrap();
+ let s = g.as_mut().unwrap();
+ let reused = title_reset_in(s, title as *mut c_void, |raw| {
+ assert_eq!(raw as usize, spare);
+ allocator_reset(spare); // what native allocator Reset does after success
+ 0
+ });
+ assert_eq!(reused, Some(0));
+ move_list(s, new_list, spare);
+ note(spare);
+ }) };
+ let kept = holds(spare);
+
+ forget_list(old_list);
+ forget_list(new_list);
+ {
+ let mut g = STATE.lock().unwrap();
+ let s = g.as_mut().unwrap();
+ s.cur.remove(&title);
+ s.aside.remove(&title);
+ s.types.remove(&title);
+ s.backings.remove(¤t);
+ s.backings.remove(&spare);
+ }
+ allocator_reset(spare);
+ assert_eq!(hr, None);
+ assert!(kept, "the earlier sweep erased the reused backing's new recording");
+ }
+
#[test]
fn a_spare_whose_reset_fails_stays_available_for_retry() {
let (alloc, spare, list) = (0x1000usize, 0x2000usize, 0x3000usize);
diff --git a/crates/xcl/src/hle/d3d12x/real/dispatch_chain.rs b/crates/xcl/src/hle/d3d12x/real/dispatch_chain.rs
index d37feb40..87ee632d 100644
--- a/crates/xcl/src/hle/d3d12x/real/dispatch_chain.rs
+++ b/crates/xcl/src/hle/d3d12x/real/dispatch_chain.rs
@@ -222,7 +222,7 @@ impl Drop for Scratch {
}
}
-struct Recording {
+pub(in crate::hle::d3d12x) struct Recording {
scratch: Arc<Scratch>,
first: ID3D12PipelineState,
chain: Arc<Chain>,
@@ -340,9 +340,13 @@ unsafe fn scratch_for(dev: &ID3D12Device, list: usize, allocator: usize, needed:
Some((s, false))
}
+/// Take ownership without running recording readback or releasing COM objects under the lock.
+pub(in crate::hle::d3d12x) fn take_recordings(allocator: usize) -> Option<Vec<Arc<Recording>>> {
+ RECORDINGS.lock().unwrap().remove(&allocator)
+}
+
pub(in crate::hle::d3d12x) fn allocator_reset(allocator: usize) {
- let recordings = RECORDINGS.lock().unwrap().remove(&allocator);
- drop(recordings);
+ drop(take_recordings(allocator));
}
#[cfg(test)]AI use: Codex (GPT-6.2-Sol) wrote the patch and test and ran them. Claude Code (Claude Opus 5.5) reviewed it and wrote this. |
|
I applied the A 600 s retail run with it (2 GiB shader heap, heap windows, precompiled compute cache) had 0 device removals: 1,954 frames, the world reached. At the end: 48,348 chain recordings, 3,555 held (2,126 put aside with a list, 808 busy, 615 in use and free), 0 whole forms. The last 180 s are cold compute/graphics pipeline compiles (18.8 s / 3.2 s), not a recording fault. So the patch holds on a real session; the remaining wall there is the pipelines the used-only precompile skipped and the VRAM overcommit (#2688). AI use: OpenCode, Claude Fable 5.2 applied the patch, ran the tests and the 600 s title, and wrote this. |
|
@b3IKK thank you for running it in the title. Two runs removed at 520 s without the patch against none in 600 s with it (2 GiB heap, RTX 5080) is the in-title result we did not have, and it fits @Raul-Paiva's trace. It is now up to @Kalmarv whether to take it into this PR. AI use: Claude Code (Claude Opus 5.5) wrote this. |
|
Second profile result with the patch: 1 GiB heap + full compute precompile, 600 s retail run = 0 device removals, 0 crashes, 2,014 frames, world reached. At the end 76,155 chain recordings, 4,334 held (3,078 put aside with a list, 909 busy, 347 in use and free), 20.9 GB local video memory. The 2 GiB profile on the same stack gave a host VCRUNTIME AI use: OpenCode, Claude Fable 5.2 ran the 1 GiB run and wrote this. |
|
In-title result for the Setup as in 7195594188:
The three runs then ended on other things:
None of them is the page fault in this PR's chain path. Three runs, one machine. A trap for anyone A/B-testing splitting: my first three runs with the fix showed AI use: Claude Code (Claude Opus 5.5) applied the patch, ran the runs, decoded the dumps and wrote this. |
|
On Linux + NVIDIA, with KDenKC's patch for the Setup: RTX 4060 Ti 16 GB, NVIDIA 615.71.09, Wine 11.21 Staging; vkd3d-proton
Not tested: Windows; the patch on AI use: Claude Code (Claude Opus 5.5) merged the trees, adapted the patch, made and read the runs, and wrote this. Posted without review by a person: the account owner was away and reads replies later. |
…'s reuse title_reset decided which put-aside PC allocators were free under the pool lock, released the lock, and only then dropped each allocator's chain recordings. Another title Reset could reuse such an allocator in between and record a chained ExecuteIndirect on it; the sweep then removed that new recording, and its commands buffer was released while the slicer was still to write it. That is the GPU page fault and device removal reported on this PR (the slicer writing a chain_commands_buffer released 3 ms - 1.1 s after it was recorded). The recordings are now detached while the lock still protects the free decision and dropped after it is released, so destructors that map a buffer still run outside the lock. The lock order stays STATE, then RECORDINGS. Found and fixed in review: the interleaving and this change with its test by thehollowedone (a_free_spare_reused_after_a_sweep_keeps_its_new_chain_recording, which fails without the change), an equivalent patch by KDenKC; in-title runs without the fault by Raul-Paiva, b3IKK and Royalflamejlh. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Thanks all: the Tested on 9620331, RTX 5070 Ti, Windows 11, Rust stable MSVC:
Not tested: a title run of mine that reaches a chained AI use: Claude Code, Claude Opus 5.5 applied the posted patch, ran the tests and wrote this reply. |
|
Independent NVIDIA recheck of #2404 at Windows 11 build 26300, Ryzen 7 9800X3D, RTX 3080 Ti 12 GiB / driver 621.35, Rust 1.99.1 MSVC, DXC 1.8.2502.11:
I checked that the new sweep detaches the old recordings while holding the allocator-pool lock, then drops them after unlocking; the regression covers reuse in that interval. This is a synthetic regression and GPU-output check on the current head. I did not run a retail title, paired smoke, AMD/Intel, or a title case that reaches chained AI use: Codex (GPT-6.2 Sol) inspected the current change, ran the tests, and drafted this report; I checked the source and outputs before posting. |
|
The stack with KDenKC's AI use: OpenCode, Claude Fable 5.2 ran the 600 s stack and wrote this. |
Part of #2088.
On NVIDIA with
XCL_DIRECT_DXIL=1, a retail title's world load stalls on whole-program compiles. Each per-material ray-tracing resolve program is split into 9–14 pieces, and those build fast. The title then dispatches the program throughExecuteIndirect, andbind.rsfalls back to the program's whole form (690–950 KB of DXIL), compiled synchronously on the title's thread. In a 600 s run onmain0829441(RTX 5070 Ti), 11 of these compiles took 16–40 s each, one after another, from 326 s to past the end of the run.This makes such an
ExecuteIndirectrun the program's pieces. The title's group counts are written on the GPU, so the CPU cannot cut them into slabs when recording. A one-thread compute pass (the slicer) reads the title's arguments and count on the GPU. For a fixed number of rounds it writes, for each slab ofdispatch_slabs, one command per piece: the root constantsrecord_dispatch_chainsets, then the slab's group counts. Each piece then runs oneExecuteIndirectper round with a command signature on the chain's root signature, with UAV barriers between them, in the bounded scratch split dispatches already use. Unused rounds dispatch nothing.All of the title's
ExecuteIndirects of split programs (150 in a 360 s run) used one command signature: one Dispatch, stride 12,MaxCommandCount1, no count buffer. Their group counts were 0 when recorded during load.What is in it
Rebased onto
mainb49be18. The hashes in this list are the rebased commits. Under Tested,77cfec2,d76f773and809da30are the same commits before the rebase (now9125edb,f0cef78and3ca9071).D3D12.X: an ExecuteIndirect of a split program runs its pieces(4aadaab):gpu/recomp/pso.rs: the slicer (HLSL compiled once per device), the chain's command signature, a one-Dispatch command signature for the whole form,record_slicer,record_dispatch_chain_indirectandslab_count, with a test thatslab_countmatchesdispatch_slabs.hle/d3d12x/real/dispatch_chain.rs:execute_indirect. The number of rounds comes from the arguments the CPU sees when recording and the most slabs an earlierExecuteIndirectof the program needed, plus a quarter (2 toXCL_SPLIT_INDIRECT_ROUNDS).ExecuteIndirect. Otherwise it leaves those arguments empty, so exactly one of the two has groups. The whole form'sExecuteIndirectis recorded first, and the rounds follow after a UAV barrier. Nothing is predicated: on NVIDIA Ampere cards, the predicated form of this ran the first piece in some skipped rounds and never ran the whole form. On an RTX 3080 Ti the whole form ran right after the slicer alone, but not after the pieces'ExecuteIndirects (review of this PR).ExecuteIndirects of the program get more rounds.compute splitline counts chained, whole and lostExecuteIndirects.hle/d3d12x/bind.rs,device_x.rs: the call site, and which command signatures are a single Dispatch.Tests: a split program's ExecuteIndirect matches the whole program(dbc793d):runner::dispatch_split_indirectrecords it the way the runtime does.dispatch_chain_divergent_forward_edges_3dcompares the memory with the whole program's output and checks the slicer's slab count for:With more slabs than rounds, it checks the slicer's flag and that the output matches with a whole form. That output would not match if the rounds also ran, because the whole form would then read words the pieces had already changed. Without a whole form, it checks that only the rounds' groups run.
D3D12.X: a chained ExecuteIndirect drops slabs only past 32 before its whole form(9125edb), indispatch_chain.rs, after review:ExecuteIndirectof a program with none read back yet gets the most rounds: the arguments the CPU sees when recording read 0 while a title loads.XCL_SPLIT_INDIRECT_ROUNDSdefaults to 32, not 16.ExecuteIndirect. It is built on anxcl-psothread, so a huge one waits for the huge-build gate. It is bound only on an overflow.ExecuteIndirect's rounds and for the gate.In ten title runs of the earlier head
5ca9c23, six lost slabs: 158 over 73,714 chainedExecuteIndirects. All of them came from one program with 17 slabs per run: 15 at its firstExecuteIndirect(2 rounds), then 1 at each later one (16 rounds) until its whole form was built. With this commit none of them would have been lost. More than 32 slabs before the whole form is built are still lost, counted and warned about. Waiting for the whole form when recording would make it exact, but the precompile does not build the whole forms of split programs, so that is a cold 16–40 s compile on the title's thread. A follow-up records which programs a title runs as chainedExecuteIndirects, so that the precompile builds their whole forms; the runtime can then wait.D3D12.X: a chained ExecuteIndirect under the title's predication is not read back(f0cef78), indispatch_chain.rs,bind.rsandlist_x.rs, after review. Under the title's predication the slicer may be skipped, and its zeroed words were then taken as a count: the program counted as measured with 0 slabs, so its nextExecuteIndirectwhose arguments read 0 got 2 rounds instead of 32. Such anExecuteIndirectis no longer read back. Tests: the device test also records one predicated and one plainExecuteIndirect, and thelist_xpredication test checks the state the call reads. Reported by @thehollowedone.Tests: the predicated ExecuteIndirect test binds the chain's root signature(70f687a): the device test off0cef78bound no root signature for the twoExecuteIndirects it records, which gave 258 messages under the debug layer with GPU-based validation (953, 744, 712). It still passed.D3D12.X: once a split program's whole form is built, its last ExecuteIndirect sizes the rounds(3ca9071), indispatch_chain.rs, with a unit test. Each round of a chainedExecuteIndirectis one barrier and oneExecuteIndirectper piece, also when empty, and on the RTX 5070 Ti such a step takes 14.4 µs of GPU time (144 µs a round for 10 pieces; measured with timestamps, review of this PR). The rounds followed the most slabs anyExecuteIndirectof the program had. Once the whole form is built, an overflow runs it, so the rounds now follow the last one read back. The cost per step comes from the barrier before anExecuteIndirectwhose signature sets root constants (0.41 µs with a Dispatch-only signature). A follow-up PR removes the root constants from the pieces'ExecuteIndirects.Tests: the chained ExecuteIndirect device test binds descriptor heaps(0755bd7): under GPU-based validation the device test gave 4 errors (1419) at809da30. Itsbindset the chain's root signature, which indexes the descriptor heaps directly, on a list without heaps. It now sets two shader-visible heaps first, as a title's list has them.D3D12.X: a chained ExecuteIndirect takes on a list the pool does not track(50205bc), inalloc_pool.rsanddispatch_chain.rs, with a unit test.ExecuteIndirectran the whole form. XCL makes such lists itself: a mid-list split's next list is created on the PC allocator the title's allocator stands for, and the pool is not told.ExecuteIndirects. D3D12.X: keep caller allocator for untracked lists and retain whole PSOs in dispatch_chain #2333 keeps such a recording with the title's allocator, which the pool knows nothing of. So the pool can take that allocator for free, and the recording (scratch and commands buffer) is then released while the list still records or runs on the GPU, i.e. memory freed under the GPU. So this PR will not take D3D12.X: keep caller allocator for untracked lists and retain whole PSOs in dispatch_chain #2333'sresolve_allocatorforExecuteIndirect;dispatchstays D3D12.X: keep caller allocator for untracked lists and retain whole PSOs in dispatch_chain #2333's.ExecuteIndirects that declined in a run did so for this reason.D3D12.X: a list made or released at an address drops the chain scratch(073f8ea), indispatch_chain.rsandlist_x.rs, with a unit test. The chains of one recording share one scratch, found by the list's address. Addresses are reused (D3D12.X: a direct list at a released compute list's heap vtable address gets the compute list's methods #2588): a list created where a released one was could share the old list's scratch with work the GPU may still be running.list_xnow forgets the entry when a list is created and when it is released.D3D12.X: a PC allocator put aside lets go of its chain recordings once free(551a75e), inalloc_pool.rs, with three unit tests.reclaim_idle_inresets idle put-aside allocators, except a title's own allocator once put aside, and in their run that case held 2,258 of 11,061 recordings at 170 s. Their candidate, Royalflamejlh/xcl@f4608d7, differs from this commit:Reset) a put-aside allocator, which frees its command memory as well, but only at a Reset of the same title allocator, and only one that was submitted and is done. This commit releases only the chain recordings (scratch and commands buffer), at any title Reset. The allocator itself is still reset when it is reused (or by D3D12.X: reclaim idle put-aside allocators and retire orphaned batches #2138).50205bc, that covers the lists the pool had not seen, which f4608d7 (on D3D12.X: keep caller allocator for untracked lists and retain whole PSOs in dispatch_chain #2333's filing) does not, so the release cannot free a recording under a live list.D3D12.X: a title thread does not wait behind a background whole build's turn(97a70a7), inpso_async.rsanddispatch_chain.rs, with a unit test, after review (@pvfreis, review).want_wholebuilds the whole form on anxcl-pso*thread, so a huge one waits inbig_compile_turnfor a background slot and 3 GB of free commit, holdingChain::build_whole, and nothing told it a title thread waited. A title thread that needed the same form (bind.rs, ordispatchwithout scratch) waited behind that turn, without the wanted cap or the commit skip. Now such a thread counts itself inChain::waitingwhile it waits, and the background build runs inpso_async::build_waited_on, sobuild_is_wantedis true on its thread while one does: the build goes as one the title waits for.D3D12.X: the split-program counter line says what holds chain recordings(99ca688), inalloc_pool.rsanddispatch_chain.rs, with a unit test. Logging only. Every 10 s, with thecompute splitline, a second line splits the recordings held by the PC allocator they are under:compute split: N of M recordings held, under K PC allocators: put aside with a list on it …, put aside with submits on the GPU …, put aside and free …; in use and busy …, in use and free …; not the pool's …(M: all recordings made). In @pvfreis's and @Royalflamejlh's runs of97a70a7the recordings held kept rising (583 of 771 at 190 s, review; 7,410 under 115 allocators at 270 s, only 2,297 of them under ones put aside, review). This line says what holds them; the runs here do not reach that part of the title.D3D12.X: whole forms of split programs are built in turn, not a thread each(c9904d7), indispatch_chain.rs, with a unit test, after review (@Royalflamejlh).want_wholestarted an OS thread for each whole form, and each waited for its turn inbig_compile_turn: at 280 s, 199 of 200 such threads were waiting. The whole forms now queue in three lanes, one for each slot set ofdriver_compile(under 256 KiB, huge, giant). A lane has at most one thread, which builds its forms one after another and ends when its queue is empty. A form whose program was released before its turn is not built. A title thread that needs a whole form still builds it itself.D3D12.X: a chained ExecuteIndirect keeps the most rounds until the whole form is built(5b9d4ff), indispatch_chain.rs, with its unit test changed, after review (@Royalflamejlh).9125edb's 32 rounds held only until a program's first read-back. After it, the most slabs read back set the rounds, so a program whose earlierExecuteIndirects had 1 slab got 2 rounds, and its next one, of 22 slabs, lost 20 (2 of 3 runs in that review). Until the whole form is built, a chainedExecuteIndirectnow recordsXCL_SPLIT_INDIRECT_ROUNDS(32) rounds whatever was read back. Once it is built, the last one read back sizes them, as with3ca9071. The cost is the empty rounds until the whole form is built (14.4 µs per piece step on the RTX 5070 Ti, as under3ca9071; D3D12.X: the pieces of a split program read their slab from a root CBV #2633 makes that step 0.41 µs).D3D12.X: a free_aside sweep keeps recordings made after the allocator's reuse(9620331), inalloc_pool.rsanddispatch_chain.rs, with a unit test, after review.title_resetdecided which put-aside PC allocators were free under the pool lock, released it, and only then dropped their chain recordings; another title Reset could reuse such an allocator in between and record on it, and the sweep then released the new recording's commands buffer while the slicer was still to write it (the page fault in @Raul-Paiva's report). The recordings are now detached under the lock and dropped after it. The interleaving, this change and its testa_free_spare_reused_after_a_sweep_keeps_its_new_chain_recordingare @thehollowedone's (review), applied as posted; @KDenKC posted an equivalent patch and found the same race (7196846147, 7197560233); in-title runs without the fault by @Raul-Paiva, @b3IKK and @Royalflamejlh (below).1211 changed lines (1194 added), over the ~400 target: 121 are the GPU test and its runner, about 390 are unit tests, and 52 are the slicer's HLSL. The runtime part cannot be split further without leaving a commit whose
ExecuteIndirectpath runs nothing or is not called. The last seven commits fix how this PR's own recordings are kept, how its own background builds of the whole form wait and are run, and how many rounds it records before one is built, or count what holds its recordings, so they go with it.Tested
9620331(this head), on the GPU (debug):cargo test --workspace --no-fail-fast -- --test-threads=4: 1446 passed, 2 failed, 47 ignored (the new test among them). The two failed arelink_tests::gpu_linked_memory_accessorsandlink_tests::linked_programs_keep_their_declarations(DXC: "attribute WaveSize only valid on entry point function"); they fail the same way onmainb49be18(cargo test -p xcl --lib link_tests: 0 passed, 2 failed). This machine's tests now take a different DXC than in the runs below: 144 SKIPPED (119 validator 1.7 < 1.8, validation step only; 21 no wave64; 3 refused f16 forms; 1 no heap windows).cargo test -p xcl --lib -- alloc_pool dispatch_chain: 26 passed, 0 failed, 0 ignored.5b9d4ffwith this fix applied by hand (the same change, or @KDenKC's equivalent): @Raul-Paiva, RTX 3070 Laptop 8 GB, 0 page-fault dumps in 3 runs of 900 s against 8 of 10 without it (7199386758); @b3IKK, RTX 5080, 0 device removals in two 600 s runs (7198145884, 7199036830); @Royalflamejlh, RTX 4060 Ti on Linux, 0 of 2 runs lost the device against 2 of 2 without it (7200335602).5b9d4ff(the previous head), on the GPU (debug):cargo test --workspace --no-fail-fast -- --test-threads=4: 1447 passed, 0 failed, 47 ignored (the two new tests among them). 25 SKIPPED notices, as on551a75ebelow.dispatch_chainandalloc_poolunit tests,--test-threads=1: 21 passed.dispatch_chain,split,execute_indirectandslabfilters with the debug layer and GPU-based validation,--nocapture, on the local build described below,--test-threads=1: 50 passed, 0 failed, 1 ignored. 1 SKIPPED:dispatch_chain_native_wave64_builds_whole(no wave64). During the tests: 1 error, 884, frommain'ssplit_compute_program_prebuilds_and_caches_chain_pieces(a deliberately invalid blob); 275 warnings, 195 of 1328 and 80 of 926, as on551a75e.--test-threads=1):the_recordings_held_are_split_by_what_holds_their_allocator,whole_forms_wanted_together_are_built_one_after_another_on_one_threadandonce_the_whole_form_is_built_the_last_execute_indirect_sizes_the_rounds: 1 passed each. WithInTurn::pushstarting a thread for each item, aswant_wholedid: failed, 5 threads for 5 whole forms. With97a70a7's rounds: failed, 2 rounds, not 32, after a read-back of 1 slab.97a70a7, on the GPU (debug):cargo test --workspace --no-fail-fast -- --test-threads=4: 1445 passed, 0 failed, 47 ignored (the new test among them). 25 SKIPPED notices, as on551a75ebelow.a_title_thread_does_not_wait_behind_a_background_whole_build_waiting_for_its_turn, three runs: 1 passed each. With the count left out (Chain::waitingnot raised, as on551a75e): failed, "the title thread waited for the background build's turn" (still waiting after 5 s).dispatch_chainunit tests,--test-threads=1: 7 passed. Thedispatch_chain,split,execute_indirectandslabfilters,--test-threads=1: 48 passed, 0 failed, 1 ignored, 1 SKIPPED (dispatch_chain_native_wave64_builds_whole, no wave64).pso_asyncandbig_compile: 25 passed.551a75e(rebased ontomainb49be18), on the GPU (debug):cargo test --workspace --no-fail-fast -- --test-threads=4: 1444 passed, 0 failed, 47 ignored. 25 SKIPPED notices: 21 for no native wave64 on this card, three per-lane FP16 forms the per-lane lowering refuses, and no heap windows.a_bridged_mask_write_where_one_half_is_elsewhere_meets_no_barrier, which failed on68a284aandd76f773, passes on this base.dispatch_chainunit tests,--test-threads=1: 6 passed, 0 failed.dispatch_chain,split,execute_indirectandslabfilters,--test-threads=1: 47 passed, 0 failed, 1 ignored. 1 SKIPPED:dispatch_chain_native_wave64_builds_whole(no wave64).list_x: 41 passed.alloc_pool: 8 passed (the four new tests among them).--nocapture, on the local build described below: 47 passed, 0 failed, 1 ignored. During the tests: 1 error, 884, frommain'ssplit_compute_program_prebuilds_and_caches_chain_pieces, which feeds the driver a deliberately invalid blob; and 275 warnings, 1328 and 926 as below. The device test's 4 errors (1419) at809da30are gone.cargo check -p xcl --lib --testsbuilds each of50205bc,073f8eaand551a75e. The first of551a75e's tests failed with the release taken out ("a free allocator put aside still held its chain recordings"; run on an earlier version of the same commit, with the same test and release), and passes with it.551a75e, on an RTX 2060 (NVIDIA 595.91) under Wine (wine-staging 11.21) + vkd3d-proton30b0eb9, a releasewindows-gnutest build,--test-threads=1, noXCL_D3D12_DEBUGor GPU-based validation set; correctness only: thedispatch_chainunit tests 6 passed; thedispatch_chain,split,execute_indirectandslabfilters 47 passed, 0 failed, 1 ignored, SKIPPEDdispatch_chain_native_wave64_builds_whole(no wave64);list_x41 passed;alloc_pool8 passed.97a70a7: @LocranKing, RTX 3060 Ti 8 GB (NVIDIA 621.40), Ryzen 5 5500, Windows 11 build 26300, rustc 1.100.0, debug (review).cargo test --workspace --no-fail-fast -- --test-threads=4: 1445 passed, 0 failed, 47 ignored, 27 SKIPPED: 21 no wave64, 3 per-lane FP16/FP32 forms, no heap windows, and two0x887A002D(texture_states'suploads_start_from_each_subresources_state, no D3D12 debug layer;shaders'spso_measurement_compiles_an_exact_synthetic_record, no Developer Mode). Those two aremain's tests of files this PR does not change. A 60 s smoke on their own title, from release builds:mainb49be181409 frames, peak commit 14,032 MB;97a70a71567 frames, 14,026 MB; no device removal or crash. It covers boot, intro and menus, not the world.97a70a7: @pvfreis, RTX 3060 12 GB, 31.9 GB RAM, one release run each of97a70a7andmainb49be18from an empty cache, both with one local logging line (review). With this PR: 177 chainedExecuteIndirects, 0 whole, 0 slabs lost, no whole forms compiled, presenting again after a stall of about 33 s; recordings held rose from 54 at 140 s to 583 of 771 at 190 s, and their 37 GiB guard stopped the run at 192 s, with commit +322 MB/s and non-local video memory +214 MB/s over 170–190 s. Onmain, title threads compiled whole forms from 126.5 s to the 210 s limit and presenting stopped at 112 s. What holds the recordings is open;99ca688's line is for that.97a70a7: @Royalflamejlh, Linux + NVIDIA, 300 s runs from the same caches (review). With this PR: presenting after the title's burst in 3 of 3 runs, 15,299–35,755 chainedExecuteIndirects, 0 whole; 20 slabs lost in 2 runs (5b9d4ffabove); non-local video memory 4.1 → 12.3–13.9 GB, their memory guard stopped 2 of 3. Without it: no presents after 76 s in 2 of 2, a title thread compiling a whole form in all four dumps.97a70a7+ Shaders: --precompile --pipelines also builds a split program's whole form #2551: @KDenKC, RTX 5090 32 GB (NVIDIA 621.24), Windows 11, release (review): 0 slabs lost and 0 whole in 4 runs; the pool's PC allocators made kept growing with the resets (to 549 by 183 s, 710 by 440 s). Their runs ended in NVIDIA: the device is removed when the pipelines in use need more than 512 MB of shader code (0x887a0005) #2403's removals and one device hang they are still looking into.5b9d4ff: @thehollowedone, RTX 3080 Ti (NVIDIA 621.35), Ryzen 7 9800X3D, Windows 11 build 26300, rustc 1.99.1 (review).cargo test --workspace --no-fail-fast -- --test-threads=4: 1447 passed, 0 failed, 47 ignored, 25 SKIPPED.dispatch_chain_divergent_forward_edges_3d,--test-threads=1: 1 passed, no SKIPPED notice, the 32- and 64-thread cases on the card. Synthetic tests only, no title run.97a70a7(this PR's previous head): @jennydeth, RTX 3060 12 GB (NVIDIA 32.0.16.2101), Ryzen 5 5600X, Windows 11, rustc 1.100.0, release (review).cargo test --workspace --release --no-fail-fast -- --test-threads=4: 1445 passed, 0 failed, 47 ignored, 29 SKIPPED (21 no wave64, 3 per-lane FP16/FP32 forms, 3 no D3D12 debug layer, no heap windows, andpso_measurement_compiles_an_exact_synthetic_record). A 600 s smoke pair with default settings:mainb49be182171 frames, peak commit 35,030 MB;97a70a72211 frames, 36,162 MB; no device removal or crash. No program is split with default settings, so this pair does not reach this PR's code. WithXCL_DIRECT_DXIL=1(900 s, warm driver cache), one run of97a70a7logged 397 chainedExecuteIndirects, 0 whole, 0 slabs lost. Every direct run ended in a0x887a0005removal (DRED: page fault at VA 0x0) between 99 and 115 s,main's run too, as in NVIDIA: the device is removed when the pipelines in use need more than 512 MB of shader code (0x887a0005) #2403, so the removal is not from this PR.5b9d4ff: @jennydeth, RTX 3060 12 GB (NVIDIA 32.0.16.2101),XCL_DIRECT_DXIL=1, 900 s, warm caches, one run at the default shader heap and one with xcl run:xcl nvprofileputs xcl.exe in an NVIDIA profile with a bigger shader heap (#2403) #2590's 1 GiB profile (review). Both: 2,474 pieces built, 0 whole, 0 slabs lost; 3,020 and 4,582 chainedExecuteIndirects by 160 s. Both lost the device (0x887a0005, DRED: page fault at VA 0x0), at 166.0 s and 163.6 s. At the default heap that is the removalmainb49be18has with these switches (114.8–216.0 s in their three runs). With the 1 GiB profile, two runs ofb49be18kept the device and this one run lost it; why is open.5b9d4ff+ D3D12.X: detach retired segments and reclaim idle aside allocators #2707 (dff6edc7, D3D12.X: detach retired segments and reclaim idle aside allocators #2707's side of thealloc_pool.rsconflict) + Shaders: --precompile --pipelines also builds a split program's whole form #2551: @KDenKC, RTX 5090, one run to NVIDIA: the device is removed when the pipelines in use need more than 512 MB of shader code (0x887a0005) #2403's removal at 161.4 s (review). At 160 s, against5b9d4ffalone: 32 PC allocators (47), 848 recordings under busy allocators in use (1,719), 530 put aside with a list on it (559). So D3D12.X: detach retired segments and reclaim idle aside allocators #2707 lowers the allocators but not those held by lists: a list stays on its allocator until the title resets it elsewhere or releases it.mainb49be18+ Direct DXIL: compute programs over 1.5 MB of plain DXIL are retried in the compact form #2301 with this PR's5b9d4ffmerged on top: @Natakout, RTX 3060 12 GB (NVIDIA 621.14), i9-13900K, Windows 11 build 26200, release,XCL_DIRECT_DXIL=1, 480 s runs from warm caches (review). Without this PR, presents stopped 3 to 31 s after the title's#101in 5 of 5 runs; a symbolized dump showed one title thread compiling a whole form inChain::wholeand another waiting onbuild_whole. With it, no stall there in 2 of 2, and both lost the device 2 and 11 s after#101(NVIDIA: the device is removed when the pipelines in use need more than 512 MB of shader code (0x887a0005) #2403's code heap). With xcl run:xcl nvprofileputs xcl.exe in an NVIDIA profile with a bigger shader heap (#2403) #2590's 1 GiB profile, 5 runs: the world rendered at about one present every 2 s for 70 to 240 s, then the GPU hung (0x887a0006) in all 5. WithTdrDelay/TdrDdiDelayat 60 s, no removal in 4 runs of 480 s, with world frames of about 0.5–2 s of GPU each (report); so these read as timeouts of long frames, not shown to come from the split. They list this PR among the five things their 3060 needs to get past#101. With splitting off (XCL_DIRECT_SPLIT_INSTRUCTIONS=0) their world ran about 4× faster.5b9d4ff: @ClosetPie107, RX 9070 16 GB (RADV, Mesa 26.3.1), Ryzen 5 9600X, Linux, Proton Experimental with a patched vkd3d-proton (ec207194), releasewindows-gnu(review).dispatch_chain: 16 passed;module::split: 8 passed; 0 failed, 0 SKIPPED. A 300 s run of the retail title withXCL_DIRECT_DXIL=1: exit 0, 1,800 presents, no crash or device removal; at 290 s 221 programs split, 2,355 pieces built, 24,395 chainedExecuteIndirects, 0 whole, 0 slabs lost, scratch 1,648 MiB (most 1,655). Not the full suite, Windows or NVIDIA.77cfec2with D3D12.X: keep caller allocator for untracked lists and retain whole PSOs in dispatch_chain #2333 (RTX 4060 Ti 16 GB, Linux, Wine + vkd3d-proton, 1 run each; review). Recordings held went from 11,061 under 156 allocators at 170 s to 3,316–5,563 under 59–82 allocators between 120 and 200 s, and non-local video memory from 8.7 GB at 169 s to 7.1 GB at 166 s. Their memory guard still stopped that run at 204.5 s for low system RAM.77cfec2,d76f773and809da30, without the GPU:cargo build --release -p xcl: builds on each. Its 2 warnings are deprecations in files this PR does not change (real.rs:3797,xgameruntime/mod.rs:547).cargo clippy -p xcl --lib --tests: no warning on a line this PR changes, on each. It stops at 3approx_constanterrors (6.283_185_3forTAU) inlower_valu.rs,lower_wide.rsandrecomp/lower.rs, which this PR does not touch.cargo test -p xcl --libon the unit tests of the chain that need no GPU: 4 passed, 0 failed on each (slab_countagainstdispatch_slabs, the bounded scratch, the firstExecuteIndirect's rounds, the gate). Ond76f773and809da30alsoset_predication_buffer_state_transitions_and_lifecycle, and on809da30once_the_whole_form_is_built_the_last_execute_indirect_sizes_the_rounds: 1 passed each.cargo fmt: the tree is notrustfmt-clean. The changed lines follow the code around them.d76f773, on the GPU (debug):dispatch_chain_divergent_forward_edges_3d --test-threads=1, three runs: 1 passed, 0 failed each.dispatch_chainunit tests,--test-threads=1: 4 passed, 0 failed (the device test included).dispatch_chain,split,execute_indirectandslabfilters withXCL_D3D12_DEBUG=1,--test-threads=4: 42 passed, 0 failed, 1 ignored. 1 SKIPPED:dispatch_chain_native_wave64_builds_whole(no wave64).cargo test --workspace --no-fail-fast -- --test-threads=4: 1292 passed, 1 failed, 46 ignored. Failed:gpu::recomp::lower_dxil::tests::a_bridged_mask_write_where_one_half_is_elsewhere_meets_no_barrier, as on5ca9c23andmain68a284a(below). 25 SKIPPED notices, as below.--nocapture, on a local build of the test runner that switches GPU-based validation on and prints every layer message (neither is an XCL option): 42 passed, 0 failed, 1 ignored. The messages printed during the tests showed 258 errors (953, 744, 712), all from the device test added ind76f773;54a936afixes that test. Also 266 warnings: 1328 (a buffer's initial state ignored) and 926 (a root view's address in a heap).809da30, on the GPU (debug):dispatch_chain_divergent_forward_edges_3d --test-threads=1, three runs: 1 passed, 0 failed each.dispatch_chainunit tests,--test-threads=1: 5 passed, 0 failed.dispatch_chain,split,execute_indirectandslabfilters withXCL_D3D12_DEBUG=1,--test-threads=4: 43 passed, 0 failed, 1 ignored. 1 SKIPPED:dispatch_chain_native_wave64_builds_whole(no wave64).--nocapture, on the same local build (GPU-based validation and the messages are switched on there, not by an XCL option): 43 passed, 0 failed, 1 ignored. During the tests: 273 warnings, 1328 and 926 as above, and 4 errors, all 1419 and all from the device test: itsbindsets the chain's root signature on a list without descriptor heaps (a title's list has them). No other test gave an error.5ca9c23(onmain68a284a):cargo test --workspace --no-fail-fast -- --test-threads=4(debug): 1289 passed, 1 failed, 46 ignored. Failed:gpu::recomp::lower_dxil::tests::a_bridged_mask_write_where_one_half_is_elsewhere_meets_no_barrier, which fails onmain68a284atoo, with the same assertion and output (lower_dxil.rs:1155); main's CI fails since Recompiler: a bridged mask write in the split form meets no barrier #2074. 25 SKIPPED notices: no native wave64 on this card, three per-lane FP16 forms the per-lane lowering refuses, and no heap windows. An earlier version of this description gave the filters withXCL_D3D12_DEBUG=1as a debug-layer pass. The runner registers no message callback, so such a run shows no layer messages; it showed nothing.5ca9c23. In them noExecuteIndirectneeded more slabs than its rounds.XCL_DIRECT_DXIL=all: this branch, against a 300 s run ofmain68a284awith the same environment.mainrun (300 s) did not get that far: from 168 s to its end, a title thread was in the call for an unsplit 1.39 MB compute build.235 programs split, 2007 pieces built, 439 chained dispatches issued in 3326 slabs; scratch 654 MiB (most 654, largest dispatch 2109 in one slab); ExecuteIndirect: 1303 chained (0 of them whole, 0 slabs lost), 28 whole.ExecuteIndirects (from 499 s on) took one of the paths that keep the whole form; which one is not logged.main68a284awith this PR and Recompiler: split wave64 compute groups of several waves across dispatches #2097: past the loading screen into the intro cutscene, the first such run here on NVIDIA. The device was removed at 154 s (0x887a0005, local video memory full); the cause is open (#505 comment).GetCachedBlob).Regression run
scripts/smoke.ps1 -Seconds 60, the same retail title,XCL_DIRECT_DXIL=1, a private XCL cache started from the sameused-pipelines.txt. Both ran back to back in one queue job on the machine under Tested, from release builds of clean trees. That job ran in the queue's title lane, beside 2 other jobs (builds, suites or precompiles; no other title run or timing job runs at the same time there).mainb49be18(this PR's base):this PR,
9620331, the same recipe, in a title-lane job of its own after the push (themainside above is unchanged, the same base):compute splitcounter at the end of each run:main:compute split: 171 programs split, 1811 pieces built, 0 chained dispatches issued in 0 slabs; scratch 0 MiB (most 0, largest dispatch 0 in one slab)9620331):compute split: 6 programs split, 41 pieces built, 0 chained dispatches issued in 0 slabs; scratch 0 MiB (most 0, largest dispatch 0 in one slab); ExecuteIndirect: 0 chained (0 of them whole, 0 slabs lost), 0 whole. This run split 6 programs where both sides of the earlier pair split 171; I have not looked into why.Neither run reaches a chained
ExecuteIndirect.551a75ealone, 120 s, same setup, in an earlier title-lane job beside other jobs (nomainside: our harness failed it), reaches 6: 1324 frames, peak commit 30,050 MB, 0 device removals, 0 crashes, and the countercompute split: 92 programs split, 935 pieces built, 51 chained dispatches issued in 51 slabs; scratch 390 MiB (most 390, largest dispatch 9 in one slab); ExecuteIndirect: 6 chained (0 of them whole, 0 slabs lost), 0 whole.Its scratch is 390 MiB because a chained
ExecuteIndirecttakes the whole scratch budget (XCL_SPLIT_SCRATCH_MB, 256 MiB) for its list: its group counts are not known when it is recorded.Not tested
9620331's fix in a title run of mine: the 60 s run reaches no chainedExecuteIndirect. The in-title evidence is the runs by others listed under Tested.97a70a7changes in a title: the wait it removes was found by reading the code, and the runs here reach no title thread waiting for a whole form.97a70a7(above), and whether551a75estopped the growth @dhillonjagdeep650-boop saw (review). Two 240 s runs of97a70a7here, one from an empty cache and one from our seeded cache, both with @pvfreis's switches, issued 0 chained dispatches and held 0 recordings, so this card does not show it.99ca688's line is for a run that does; I asked for one each.5b9d4ff's empty rounds before a whole form is built, in a title.Dispatchon a list the pool does not track still runs whole; that is D3D12.X: keep caller allocator for untracked lists and retain whole PSOs in dispatch_chain #2333's.XCL_PSO_WAIT_MS), the path of D3D12.X: the GPU hangs after thousands of dispatches put off to the submit (#2118) when the waits are bounded #2617. This PR does not change whether a call is put off, or skipped there. It changes what a put-offExecuteIndirectof a split program records at the submit (its chain, on the segment). The Reset of a list's own allocator there (record_deferred,reset_own_alloc) now also releases the recordings of free allocators put aside. D3D12.X: the GPU hangs after thousands of dispatches put off to the submit (#2118) when the waits are bounded #2617's hang is onmainwithout this PR (RDNA2); none of our runs of this PR setXCL_PSO_WAIT_MS.77cfec2and at this head5b9d4ffit passed on an RTX 3080 Ti (review, review). At809da30it passed on an RTX 3080 (review) and on two RTX 3070s (review, review). The RTX 3070 Laptop is not confirmed, and we have no Ampere card.ExecuteIndirects took (no scratch left, bundles or another signature).AI use
9620331, @thehollowedone's change and test applied as posted; their AI use is in their review), and ran the tests, the title runs and the regression run on the hardware above.🤖 Generated with Claude Code