Skip to content

D3D12.X: count Wait32/64BitValueX waits made on the CPU, by reason - #3323

Open
Prime1997 wants to merge 1 commit into
xcl-dev:mainfrom
Prime1997:contrib/cpu-memory-wait-counter
Open

Prime1997 wants to merge 1 commit into
xcl-dev:mainfrom
Prime1997:contrib/cpu-memory-wait-counter

Conversation

@Prime1997

@Prime1997 Prime1997 commented Nov 29, 2026 •

Copy link
Copy Markdown
Collaborator

Requested by Prime

Only a 64-bit, GREATER_EQUAL, full-mask wait on an address a list wrote with Write64BitValue becomes a GPU queue.Wait; every other Wait32/64BitValueX the memory does not yet hold blocks the submitting thread (up to XCL_WAIT_TIMEOUT_MS). Which kinds a title makes, and how long they hold the submit threads, decides which ones are worth moving to the GPU, and nothing measured it: XCL_STALL_TRACE lumps these waits together with the CPU-write waits.

Each CPU wait is now counted by the first reason try_gpu_wait refuses it (32-bit, not >=, masked, >= 0, untracked address, not monotonic, not recorded yet, other) with its time. At most every 10 s, and only after a CPU wait, one info line gives the counts, the times and the waits that went to the GPU. The cost is two clock reads and a sync-graph lookup on a path that then blocks anyway.

What is in it

  • crates/xcl/src/hle/d3d12x/list_x.rs: CpuWaitWhy, cpu_wait_why, the counters and note_cpu_wait / cpu_wait_report (the D3D12.X: memory waits on the CPU in the last N s line), called from wait_all_on_noting_cpu; tests a_cpu_wait_is_counted_by_why_the_gpu_did_not_take_it and the_cpu_wait_report_names_only_the_kinds_that_happened

Tested

  • RTX 3060 Ti 8 GB (driver 32.0.16.1714), Intel Core i5-10400, 32 GB RAM, Windows 11 Pro build 26200, Rust 1.100.0; the suite in debug, the smoke on a release build of the head commit
  • cargo test --workspace --no-fail-fast -- --test-threads=4 with the three uma_driver tests below skipped, on 60ee4e9: 2607 passed, 0 failed, 49 ignored (SKIPPED GPU tests: 28 lines: 21 no wave64 (this card runs wave32), 3 a wave32 per-lane form refused by the translator (gpu: direct RDNA2 -> DXIL backend (no HLSL / DXC), behind XCL_DIRECT_DXIL #1426), 2 no heap windows (opt-in XCL_HEAP_WINDOWS=1), 1 no dxc.exe, 1 cannot disable the driver cache (needs Windows Developer Mode))
  • the three skipped tests on their own (cargo test -p xcl --lib -- --test-threads=1 uma_driver::tests::a_refused_gpu_upload_segment_becomes_custom uma_driver::tests::mixed_window_keeps_its_bytes_and_the_gpu_sees_every_segment uma_driver::tests::failed_restore_stops_before_importing_an_unbacked_window): 3 passed, 0 failed. They are left out of the whole run because on this PC's driver they can end the library test process (exit 0x7c10003, "coherent window could not be restored"), on main too
  • the library harness twice more (cargo test -p xcl --lib -- --test-threads=4, same skips): 2468 passed, 0 failed; 2468 passed, 0 failed
  • the same whole run on main fa20459: 2605 passed, 0 failed, 49 ignored, 28 SKIPPED lines (own-prs-20261129 run, same command)
  • retail title (60 s scripts/smoke.ps1, no input, copied profile and shader cache): blocks below

Regression run

xcl-smoke v1
commit: fa204595a488c60c6c5f905244f0172072c9c2a9
gpu: NVIDIA GeForce RTX 3060 Ti
title: 419239bf
seconds: 60
exit: 0x0
frames shown: 1334 (PresentX 1334)
presents per 2 s (last 3): 60 60 61
device removals: 0
crashes: 0
peak commit: 15272 MB
xcl-smoke v1
commit: 60ee4e99489e47ef497379ccd48b453ac7f8f33e
gpu: NVIDIA GeForce RTX 3060 Ti
title: 419239bf
seconds: 60
exit: 0x0
frames shown: 1470 (PresentX 1470)
presents per 2 s (last 3): 61 60 60
device removals: 0
crashes: 0
peak commit: 15350 MB

Not tested

  • AMD GPUs (this is an NVIDIA wave32 card)
  • the retail title's world: the 60 s runs end on the title's start-up screens
  • The 60 s smoke made no CPU memory wait, so the new line did not appear in its log; which waits a retail world makes was not measured yet.

AI use

  • Claude Code wrote the change and its test, wrote this description, and ran the tests and the smoke runs on this PC. The model is not named here: this session cannot tell which model served each turn.

Optional temporary Discord for coordinating contributor work, testing and comparing results.

🤖 Generated with Claude Code

Only a 64-bit, GREATER_EQUAL, full-mask wait on an address a list wrote with Write64BitValue
becomes a GPU queue.Wait; every other wait the memory does not yet hold blocks the submitting
thread (up to XCL_WAIT_TIMEOUT_MS). Which kinds a title makes, and how long they hold the
submit threads, decides which ones are worth moving to the GPU, and nothing measured it:
XCL_STALL_TRACE lumps these waits together with the CPU-write waits.

Each CPU wait is now counted by the first reason try_gpu_wait refuses it (32-bit, not >=,
masked, >= 0, untracked address, non-monotonic, not recorded yet, other) with its time, and
at most every 10 s, only after a CPU wait, one info line gives the counts, the times and the
waits that went to the GPU. The cost is two clock reads and a sync-graph lookup on a path that
then blocks anyway.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DaZV7vMq866ni7pGnJC2Ew
@Prime1997 Prime1997 self-assigned this Nov 29, 2026
@github-actions github-actions Bot added area:d3d12 D3D12.X runtime, command lists, resources, sparse memory gpu:both Code affects both AMD and NVIDIA GPUs (scope tag; see needs:*-test for remaining checks) labels Nov 29, 2026
@andrewDoing

Copy link
Copy Markdown
Contributor

Exercised the production reporting interval at 60ee4e99 on RTX 5070 / driver 616.92. Two otherwise identical 32-bit full-mask greater-or-equal waits resolved to 91. An independent D3D12 marker after the producer queue's write-fence signal distinguished their causes:

At wait entry Producer marker Why the CPU cell still held zero
Producer queue B already complete 1 B's deferred store was behind gated queue A on the CPU-write worker
Producer queue B itself gated 0 B had yet to reach its own write-fence signal

I released the respective gate after a deliberate 100 ms observation. Both CPU reads got 91, and repeating each already-satisfied wait added no counter. The actual log line was:

D3D12.X: memory waits on the CPU in the last 10 s: 2 (183.2 ms of submit threads; 32-bit 2 (183.2 ms)), on the GPU: 0

The line measures which wait forms fell back and their accumulated polling time. Here its one bucket combined an already-complete producer with a genuinely pending one. Likewise, "on the GPU: 0" counted zero waits routed to queue.Wait; it cannot establish that both GPU producers were ready. For a world trace, correlating wait entry with a known producer's queue/fence completion and subsequent CPU-cell publication would distinguish the two costs. The measured duration is synthetic and excludes setup before wait_until_satisfied.

The fixture used native queues, production deferred writes, and wait_all_on_noting_cpu with a constructed PendingWait. Guest list decoding and retail execution were outside this test.

AI disclosure: OpenAI Codex built and ran the fixture and drafted this report.

@Aniseto

Aniseto commented Nov 29, 2026

Copy link
Copy Markdown

Ran the CPU-wait accounting tests at 60ee4e99 on an NVIDIA Blackwell desktop part.

System

  • GPU: NVIDIA GeForce RTX 5070 Ti (Blackwell, 32-lane waves only, mesh shaders), driver 32.0.16.2140 (621.40)
  • CPU: Intel Core i5-12400F, 64 GB RAM
  • OS: Windows 11 Pro build 26200 x64
  • Toolchain: rustc 1.100.0 (0ef1bc386 2026-11-09), MSVC 14.44.35207, DXC 1.9.2609.5
  • Build: debug

Results

  • XCL_ADAPTER=NVIDIA cargo test -p xcl --lib a_cpu_wait_is_counted_by_why_the_gpu_did_not_take_it -- --test-threads=1: 1 passed, 0 failed, 0 ignored.
  • XCL_ADAPTER=NVIDIA cargo test -p xcl --lib the_cpu_wait_report_names_only_the_kinds_that_happened -- --test-threads=1: 1 passed, 0 failed, 0 ignored.

What this adds
Both new tests pass: each CPU wait is counted by the first reason the GPU did not take it, and the periodic report names only the kinds that happened. The thread has a note about the reporting interval on an RTX 5070; this adds a 5070 Ti datapoint on driver 32.0.16.2140. These are CPU-side accounting tests, not a title's wait-time measurement.

Not tested
A retail title, a paired smoke run, the full workspace suite, AMD and Intel GPUs, native wave64 hosts, Wine, release profile, game data.

AI-assisted (OpenCode), model: DeepSeek V4.1 Flash Free - ran the commands above on this machine and wrote this report; no game data was used.

@andrewDoing

Copy link
Copy Markdown
Contributor

I tried a narrow opt-in follow-up on 60ee4e99 for the attribution gap above. XCL_WAIT_PRODUCER_STATS=1 samples the producer fence at entry to a blocking 32-bit wait, when there is exactly one overlapping tracked deferred DWORD store whose value satisfies the wait. It preserves the existing wait behavior and keeps the new registry off the default path.

On RTX 5070 / 616.92 and Ryzen 7 5700X3D, the production report showed one pending fence and one complete fence, matching an independent native marker. Both waits returned 91. Two fresh-process controls (a host-only store and two overlapping deferred stores) both reported Unknown in the classifier and returned 91. A repeated already-satisfied wait remained on the fast path. With the switch unset, the paired native run had its original report and no extra diagnostic line. Four stock cpu_wait_ tests passed. Across the four fixture invocations and that filter, 8 tests passed with zero skips.

The new line reports state samples, not an elapsed-time breakdown or proof of the sole producer. Wider writes, multiple overlaps, publication already in progress and registry overflow all fall back to unknown. The registry is capped at 64 jobs with at most 64 write records per job. The fixtures used synthetic writes and native queues. Retail timing, overhead under sustained capture, and address aliases are unmeasured.

Two-file prototype (apply-checked on 60ee4e9)
--- a/crates/xcl/src/hle/d3d12x/cpu_writes.rs
+++ b/crates/xcl/src/hle/d3d12x/cpu_writes.rs
@@ -35,6 +35,7 @@
     value: u64,
     writes: Vec<Write>,
     done: Option<mpsc::Sender<()>>,
+    probe: Option<ProbeTicket>,
 }
 
 // SAFETY: the fence is a free-threaded COM object; the writes are plain data
@@ -49,6 +50,125 @@
 unsafe impl Send for QueueFence {}
 
 static FENCES: Mutex<Option<HashMap<usize, QueueFence>>> = Mutex::new(None);
+
+// Optional diagnostics. Keep snapshots bounded and treat overflow as unknown. A matching job
+// describes what XCL queued; guest CPU stores and writes through aliases may exist as well.
+const PROBE_LIMIT: usize = 64;
+static PROBE_ENABLED: std::sync::LazyLock<bool> = std::sync::LazyLock::new(|| {
+    std::env::var("XCL_WAIT_PRODUCER_STATS").is_ok_and(|v| v.trim() == "1")
+});
+static PROBES: Mutex<Option<Probes>> = Mutex::new(None);
+
+#[derive(Default)]
+struct Probes {
+    jobs: HashMap<u64, ProbeJob>,
+    next: u64,
+    omitted: usize,
+}
+
+struct ProbeJob {
+    fence: ID3D12Fence,
+    value: u64,
+    publishing: bool,
+    writes: Vec<ProbeWrite>,
+}
+
+// SAFETY: ID3D12Fence is free-threaded. The rest of the probe contains only owned data.
+unsafe impl Send for ProbeJob {}
+
+struct ProbeWrite {
+    start: usize,
+    end: usize,
+    word: Option<u32>,
+}
+
+struct ProbeTicket(Option<u64>);
+
+impl ProbeTicket {
+    fn register(job: &Job) -> Option<Self> {
+        if !*PROBE_ENABLED {
+            return None;
+        }
+        let mut guard = PROBES.lock().unwrap();
+        let probes = guard.get_or_insert_with(Probes::default);
+        if probes.jobs.len() >= PROBE_LIMIT || job.writes.len() > PROBE_LIMIT {
+            probes.omitted += 1;
+            return Some(Self(None));
+        }
+        let writes = job.writes.iter().filter_map(|w| {
+            let (start, bytes, word) = match w {
+                Write::Immediate(start, words) => (*start, words.len().saturating_mul(4),
+                    if words.len() == 1 { words.first().copied() } else { None }),
+                Write::ReadbackU64 { va, .. } => (*va, 8, None),
+            };
+            (bytes != 0).then_some(ProbeWrite { start, end: start.saturating_add(bytes), word })
+        }).collect();
+        let id = probes.next;
+        probes.next += 1;
+        probes.jobs.insert(id, ProbeJob { fence: job.fence.clone(), value: job.value, publishing: false, writes });
+        Some(Self(Some(id)))
+    }
+
+    fn mark_publishing(&self) {
+        if let Some(id) = self.0 {
+            if let Some(job) = PROBES.lock().unwrap().as_mut().and_then(|p| p.jobs.get_mut(&id)) {
+                job.publishing = true;
+            }
+        }
+    }
+}
+
+impl Drop for ProbeTicket {
+    fn drop(&mut self) {
+        let mut guard = PROBES.lock().unwrap();
+        let probes = guard.as_mut().unwrap();
+        if let Some(id) = self.0 {
+            let job = probes.jobs.remove(&id);
+            drop(guard);
+            drop(job);
+        } else {
+            probes.omitted -= 1;
+        }
+    }
+}
+
+#[derive(Clone, Copy, Debug, Eq, PartialEq)]
+pub(super) enum WaitProbe {
+    Unknown,
+    FencePending,
+    FenceComplete,
+}
+
+/// Classify one DWORD wait using an exact overlapping XCL store that would satisfy it. Unknown
+/// includes multiple writers, wider writes, GPU-resolved values, and publication in progress.
+pub(super) fn probe_wait32(va: usize, accepts: impl FnOnce(u32) -> bool) -> Option<WaitProbe> {
+    if !*PROBE_ENABLED {
+        return None;
+    }
+    Some(probe_wait32_enabled(va, accepts).unwrap_or(WaitProbe::Unknown))
+}
+
+fn probe_wait32_enabled(va: usize, accepts: impl FnOnce(u32) -> bool) -> Option<WaitProbe> {
+    let end = va.checked_add(4)?;
+    let guard = PROBES.lock().unwrap();
+    let probes = guard.as_ref()?;
+    if probes.omitted != 0 {
+        return None;
+    }
+    let mut overlapping = probes.jobs.values().flat_map(|job| {
+        job.writes.iter().filter(move |w| w.start < end && va < w.end).map(move |w| (job, w))
+    });
+    let (job, write) = overlapping.next()?;
+    if overlapping.next().is_some() || job.publishing || write.start != va || !accepts(write.word?) {
+        return None;
+    }
+    let completed = unsafe { super::real::fence_completed(&job.fence) };
+    match completed {
+        u64::MAX => None,
+        value if value >= job.value => Some(WaitProbe::FenceComplete),
+        _ => Some(WaitProbe::FencePending),
+    }
+}
 
 /// Forget a retired queue's cached fence before its address can be reused. Submitted jobs own
 /// fence clones, so extracting this entry cannot let their writes run early.
@@ -81,6 +201,9 @@
                         }
                     }
                 }
+                if let Some(probe) = &job.probe {
+                    probe.mark_publishing();
+                }
                 for w in &job.writes {
                     match w {
                         Write::Immediate(va, words) => write_now(*va, words),
@@ -90,6 +213,7 @@
                         }
                     }
                 }
+                drop(job.probe);
                 if let Some(done) = job.done {
                     let _ = done.send(());
                 }
@@ -251,7 +375,7 @@
     } else {
         (None, None)
     };
-    let job = {
+    let mut job = {
         let mut g = FENCES.lock().unwrap();
         let m = g.get_or_insert_with(HashMap::new);
         let entry = match m.entry(queue as usize) {
@@ -270,8 +394,9 @@
         if super::real::native_queue_signal(q, &entry.fence, entry.value).is_err() {
             return None;
         }
-        Job { fence: entry.fence.clone(), value: entry.value, writes, done }
+        Job { fence: entry.fence.clone(), value: entry.value, writes, done, probe: None }
     };
+    job.probe = ProbeTicket::register(&job);
     static FIRST: std::sync::Once = std::sync::Once::new();
     FIRST.call_once(|| crate::xlog_info!("D3D12.X: bottom-of-pipe writes outside unified memory are done by the CPU after the GPU ({} in the first submission)", job.writes.len()));
     worker().lock().unwrap().send(job).ok()?;
--- a/crates/xcl/src/hle/d3d12x/list_x.rs
+++ b/crates/xcl/src/hle/d3d12x/list_x.rs
@@ -3395,6 +3395,8 @@
 static CPU_WAITS: [(AtomicU64, AtomicU64); 8] = [const { (AtomicU64::new(0), AtomicU64::new(0)) }; 8];
 /// waits the memory did not hold that went to the GPU since the last report
 static GPU_WAITS: AtomicU64 = AtomicU64::new(0);
+/// Opt-in counts of fence states sampled at the start of DWORD CPU waits.
+static CPU_WAIT_PROBES: [AtomicU64; 3] = [const { AtomicU64::new(0) }; 3];
 /// when the last report was made, in milliseconds since `CPU_WAIT_EPOCH`
 static CPU_WAIT_REPORTED_MS: AtomicU64 = AtomicU64::new(0);
 static CPU_WAIT_EPOCH: OnceLock<Instant> = OnceLock::new();
@@ -3419,6 +3421,13 @@
     let gpu = GPU_WAITS.swap(0, Ordering::Relaxed);
     if let Some(line) = cpu_wait_report(&counts, gpu, Duration::from_millis(now - last)) {
         crate::xlog_info!("{line}");
+    }
+    let [unknown, pending, complete] = CPU_WAIT_PROBES.each_ref().map(|n| n.swap(0, Ordering::Relaxed));
+    if unknown != 0 || pending != 0 || complete != 0 {
+        crate::xlog_info!(
+            "D3D12.X: DWORD CPU wait entry samples: deferred write fence pending {pending}, \
+             deferred write fence complete {complete}, unknown or ambiguous {unknown}"
+        );
     }
 }
 
@@ -3627,6 +3636,13 @@
             let g = SYNC_GRAPH.lock().unwrap();
             g.as_ref().and_then(|gr| gr.cells.get(&w.va)).map(|c| (c.non_monotonic, c.recorded_max))
         });
+        if w.width == 4 {
+            if let Some(probe) = super::cpu_writes::probe_wait32(w.va as usize, |word| {
+                compare_u64(w.comparison, u64::from(word) & w.mask, w.value) == Some(true)
+            }) {
+                CPU_WAIT_PROBES[probe as usize].fetch_add(1, Ordering::Relaxed);
+            }
+        }
         let memory_stall = crate::stall::span(crate::stall::StallKind::MemorySynchronization);
         let started = Instant::now();
         let satisfied = w.wait_until_satisfied(timeout);

AI disclosure: OpenAI Codex (GPT-6.2 Sol) implemented and tested the optional probe using the saved Codex/Astra fixtures and drafted this report.

@KOLESNiii KOLESNiii left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Static review of 60ee4e99 for the stack in the #3041 comparison.

The new counters can misclassify waits. GpuWaitOutcome::Handled also covers waits released on the CPU and waits satisfied by a fence recheck. Both increment the GPU-wait counter. The CPU refusal reason is inferred from a second sync-graph lookup, so a concurrent producer can change the state used to label the refusal. Carrying the outcome and refusal reason from the original attempt would make the counts match the decisions. Counter and classification

Review assisted by Codex (GPT-6, exact variant unavailable). No new build or GPU run for this review.

@bmjask bmjask left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Critical review of current head 60ee4e99. The new telemetry can misattribute waits. GpuWaitOutcome::Handled includes cases resolved on the CPU or by a fence recheck, yet increments GPU_WAITS; the CPU refusal reason is reconstructed from a later sync-graph read and can change under concurrent writes. That makes the displayed GPU/CPU split unsuitable for deciding which waits to move. Return the actual route/reason from try_gpu_wait and count that immutable outcome, with a test for CPU-resolved Handled and a concurrent producer. See the earlier source review. No local Windows run.

@Prime1997
Prime1997 marked this pull request as ready for review November 30, 2026 02:25
@github-actions github-actions Bot added needs-1st-check Passes gates; needs first independent merge-check (#3041) needs:amd-test Needs a test report or merge-check on an AMD GPU needs:nvidia-test Needs a test report or merge-check on an NVIDIA GPU labels Nov 30, 2026
@tiagonleal

tiagonleal commented Nov 30, 2026 •

Copy link
Copy Markdown
Contributor

merge-check
base: cb80246
head: 60ee4e9
merge: clean
build: cargo build --workspace -> ok (also cargo build --release -p xcl)
tests: cargo test --workspace --no-fail-fast -j 8 -- --test-threads=4 -> 2811 passed, 1 failed, 51 ignored; SKIPPED: 27 lines (22 no wave64, 3 f16/f32 per-lane cases refused, 2 no heap windows), the same as on the base; failing: hle::d3d12x::standin::tests::concurrent_shell_miss_reuses_winner_and_releases_loser_pipeline, which fails the same way on the base (it came in with #2369; #3474 fixes it). Base alone on this PC: 2809 passed, 1 failed, 51 ignored.
review: whole diff read (+161/-0, list_x.rs). Diagnostic only: the wait itself, its timeout and its loop are unchanged, and the SYNC_GRAPH lock taken to classify a CPU wait is released before the wait starts. Two notes for the author, neither a blocker. The report line has no switch: note_cpu_wait logs at most one info line per 10 s whenever a wait fell back to the CPU, as the description says, where the other wait diagnostics here sit behind XCL_SYNC_TRACE or XCL_STALL_TRACE. And GPU_WAITS counts every wait try_gpu_wait reports as Handled, so "on the GPU" in the line is wider than waits that went to queue.Wait. The two new tests cover the pure functions (cpu_wait_why, cpu_wait_report) and touch no statics; the counting at the call site has no test. No open PR does the same (searched the titles).
performance: no cost per draw. A wait handled without the CPU adds one relaxed atomic add; a wait that falls back to the CPU adds one mutex lookup, two clock reads and two atomic adds before it blocks anyway. Measured with scripts/smoke.ps1, 60 s of a retail title, release: 1683 frames and 16059 MB peak commit against 1662 and 1684 frames, 16196 and 15752 MB on the base (run before and after). No device removal, no crash.
verdict: safe to merge
hardware / tool and model: RTX 5070 Ti 16 GB (617.42, wave32), Ryzen 7 9800X3D, 32 GB, Windows 11 26300, rustc 1.100.0 / Claude Code (Claude Fable 5.2 ran the build, suite and smoke and wrote this; Claude Opus 5.5 read the diff first, and I checked its main points in the merged source)

  • Tiago

@github-actions github-actions Bot added needs-2nd-check Has 1 safe merge-check; needs second independent check (#3041) and removed needs-1st-check Passes gates; needs first independent merge-check (#3041) needs:nvidia-test Needs a test report or merge-check on an NVIDIA GPU labels Nov 30, 2026
@ClosetPie107

Copy link
Copy Markdown

Test report for #3323 at 60ee4e99489e47ef497379ccd48b453ac7f8f33e, against its merge-base with main, fa204595, under Wine on AMD.

Tested

Not tested

  • native Windows
  • NVIDIA
  • the gpu:: tests in the suite runs
  • the workspace's other crates and integration tests (only -p xcl --lib)
  • a game run (no regression block)

AI use: Claude Code (Claude Opus 5.5) ran the tests and wrote this report.

@brainhay5

Copy link
Copy Markdown

merge-check claim
head: 60ee4e9

@Foniass

Foniass commented Dec 1, 2026

Copy link
Copy Markdown
Contributor

merge-check
base: d0832e6
head: 60ee4e9
merge: clean
build: cargo build --workspace -> ok
tests: cargo test --workspace --no-fail-fast -- --test-threads=4 -> 2892 passed, 0 failed, 51 ignored; SKIPPED: 28 (20 no wave64, 2 no d3d12SDKLayers.dll, 1 no D3D12 debug layer, 1 no heap windows, 1 cannot disable the driver cache, 3 others; the same set as on main); failing: none
review: read the whole diff (list_x.rs, +161). Counting is always on: each wait handled on the GPU adds a relaxed atomic add (~3620); each CPU fallback adds a SYNC_GRAPH lookup, two clock reads and two adds before it blocks anyway (~3625-3633), with one info line at most every 10 s, only when the CPU waited. Findings: (1) GPU_WAITS counts every Handled result, including waits already released on the CPU (~3481, ~3517) and waits whose memory held the value after the fence check (~3521-3525), so "on the GPU" is wider than the waits that went to queue.Wait. (2) The reason is guessed after the fact: cpu_wait_why (~3375-3391) repeats try_gpu_wait's checks and reads the sync graph again after the refusal, so a Write64 recorded in between can turn "not recorded" into "other", a device mismatch (~3514) or a queue without device/type (~3462) ends up as "other" or a cell-based reason, and the two copies can drift. Having try_gpu_wait return the refusal reason fixes both and saves the extra lock. (3) A wait that times out and stops the process (~3681) never reports its last window. (4) The tests cover only the pure functions, not the counting at the call site. Fine: the wait, its timeout and loop are unchanged, the lock is released before blocking, and the CAS-gated report is right.
performance: 60 s smoke of a retail title, main d0832e6 vs this merge (ea8d77b4): 1516 -> 1673 frames shown (110 %; last presents per 2 s: 60 60 61), peak commit 18133 -> 17504 MB, 0 device removals, 0 crashes. The counters add one relaxed atomic per GPU-handled wait; no cost visible here.
verdict: safe to merge (diagnostics only; having try_gpu_wait return the refusal reason would make the counts exact)
hardware / tool and model: RTX 5070 Ti (driver 621.14), Ryzen 7 7800X3D, Windows 11 26300 / Claude Code with Claude Opus 5.5

AI-written and posted by Foniass without a human check of each point.

@github-actions github-actions Bot added ready-to-merge Has 2 independent safe merge-checks on current head (#3041) and removed needs-2nd-check Has 1 safe merge-check; needs second independent check (#3041) needs:amd-test Needs a test report or merge-check on an AMD GPU labels Dec 1, 2026
@brainhay5

Copy link
Copy Markdown

merge-check claim withdrawn
Our automated merge-check loop claimed this PR and then stopped before posting a check — two loops were running at once and both are now shut down. No check from us is coming, so this claim is void and the head is free for someone else to take.

AI use: an agent posted this withdrawal.

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

Labels

area:d3d12 D3D12.X runtime, command lists, resources, sparse memory gpu:both Code affects both AMD and NVIDIA GPUs (scope tag; see needs:*-test for remaining checks) ready-to-merge Has 2 independent safe merge-checks on current head (#3041)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

9 participants