D3D12.X: instrument submitting-thread call breakdown under XCL_LOOK_STATS=2 #2719

Merged
Decodere merged 1 commit from upstream-pr/2729 into nvidia-dev 2026-11-28 00:36:19 +00:00
Decodere commented 2026-11-26 09:03:41 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Decodere on 2026-11-26T09:03:41Z.


Targets nvidia-dev (eae01502). Adds XCL_LOOK_STATS=2-only submitting-thread and recording-path instrumentation to api_cost so CPU-bound frames on 8 GB GPUs can be broken down into non-overlapping completed top-level call durations per 2 s sample window. Zero behavior change and zero timer/atomic overhead when XCL_LOOK_STATS != 2.

Part of #2688

What is in it

  • crates/xcl/src/hle/api_cost.rs: accumulate durations internally in nanoseconds (exposing microseconds from totals() and submitter_totals()) so high-frequency sub-microsecond calls do not truncate to 0 us; protect ON_SUBMITTER entries with a single-writer seqlock (CounterPair) so submitter_totals() takes coherent (calls, us) snapshots; add #[inline] time_if(on, call) (no clock read, TLS lookup, or atomic write when disabled), 8 XCL_LOOK_STATS=2-only Call variants (DrawRecord, DispatchRecord, BindState, ViewDescriptor, ViewWant, ListBarrier, ListCopy, ListLifecycle), is_sub_call (excluding nested PresentCopyWait, PipelineWait, and ViewWant from top-level completed totals), all_threads_summary_parts, submitter_summary_line(now, before, window_ms) (accounting any nonzero count or duration delta and reporting ; completed X ms (window Y ms) for calls completed since the prior sample without claiming an in-window untimed remainder), and 6 new/updated unit tests (sub_microsecond_calls_accumulate_without_truncation, time_if_disabled_adds_zero_counts_and_zero_time, submitter_summary_excludes_sub_calls_and_reports_completed_window, summary_retains_nonzero_duration_delta_when_count_delta_is_zero, submitter_counter_pair_snapshots_are_coherent_under_concurrent_writes, submitter_summary_describes_straddling_completed_call_without_untimed_claim).
  • crates/xcl/src/host.rs: format calls (2 s, all threads) via api_cost::all_threads_summary_parts (retaining nonzero duration deltas even when count delta is 0), track the actual elapsed window_ms on each periodic activity tick, and log api_cost::submitter_summary_line(&spent, &own_cost, window_ms) when XCL_LOOK_STATS=2 is active.
  • crates/xcl/src/hle/d3d12x/bind.rs: wire time_if(deep(), ...) for DrawRecord (draw_instanced, draw_indexed_instanced, dispatch_mesh), DispatchRecord (dispatch_flags, covering both Dispatch and DispatchX), lazy deep().then(...) in execute_indirect (so signature_dispatches(sig) is never evaluated when disabled), and BindState (root-parameter, descriptor-table, and PSO bindings), preserving capture::op / capture_work and deferred two-pass pipeline queueing on eae01502.
  • crates/xcl/src/hle/d3d12x/list_x.rs: wire time_if(deep(), ...) for DrawRecord, BindState (including set_descriptor_heaps_x), ListBarrier, ListCopy, and ListLifecycle; split out emit_uav_barrier_pc, reset_pc_inner, and copy_buffer_region_inner so internal delegation paths (flush_cache_range_x/flush_pipeline_x, reset_stand_in, copy_resource_x) never double-count while preserving capture::op instrumentation.
  • crates/xcl/src/hle/d3d12x/real.rs: wire Call::FenceWait on blocking SetEventOnCompletion(_, NULL) scoped to drop before settle_readbacks_try() so FenceSettle never nests inside FenceWait; wire ViewDescriptor (splitting dev_create_srv_inner and dev_create_uav_checked_inner so dev_create_srv_at_x and depth_uav twins never double-count, and resolving resource_at before starting ViewDescriptor in dev_create_srv_at_x/dev_create_uav_at_x so CreatePlacedResource never nests inside ViewDescriptor), BindState, ListCopy, and ListLifecycle; guard all unconditional PC-vtable hooks (cl_close, cl_reset, alloc_reset, dev_create_rtv, cl_clear_rtv, cl_om_set_render_targets, fence_set_event_on_completion) with !title_textures::is_own_work() && !present::presenting() while preserving flush_two_pass, gpu_times::before_close, and eb784bc3 submit/sparse lock-holder timing on eae01502.
  • crates/xcl/src/hle/d3d12x/view_want.rs: wire time_if(deep(), Call::ViewWant) in want after the is_view(va) guard.

Tested

  • Hardware and toolchain: Windows 11 Home (build 26200), NVIDIA GeForce RTX 4060 8 GB (32-lane waves, driver 621.14), Intel Core i5-11400F (6C/12T), 32 GB RAM, rustc 1.100.0, DXC 1.9.2609.5, debug (WARP) and release (RTX 4060), rebased cleanly onto origin/nvidia-dev (eae01502).
  • cargo test -p xcl --lib hle::api_cost::tests:: -- --test-threads=4 --nocapture (debug XCL_ADAPTER=warp): 8 passed, 0 failed, 0 ignored (0 skipped, 0.00 s).
  • cargo test --release -p xcl --lib hle::api_cost::tests:: -- --test-threads=4 --nocapture (release RTX 4060): 8 passed, 0 failed, 0 ignored (0 skipped, 0.00 s).
  • Affected module suites on release RTX 4060 (--test-threads=4): 200 passed, 0 failed, 0 ignored across hle::d3d12x::bind:: (53/0/0, 0.35 s, 1 opt-in skip with XCL_HEAP_WINDOWS unset), hle::d3d12x::list_x:: (50/0/0, 0.93 s, 0 skipped), and hle::d3d12x::real:: (97/0/0, 0 skipped).
  • cargo clippy --workspace --all-targets: 0 new warnings and 0 new errors across all added/changed lines in all 6 modified files (pre-existing nvidia-dev clippy errors remain in untouched lower_valu.rs, lower_wide.rs, recomp/lower.rs, and sparse.rs).
  • Live XCL_LOOK_STATS=2 XCL_ACTIVITY=1 25 s RTX 4060 smoke on 4922e39e (title: 29640639): 470 frames (PresentX 470), 1 60 60 presents/2 s, 0 device removals, 0 crashes, 15788 MB peak commit, exit: 0x0.

Regression run
Quiet 60 s scripts/smoke.ps1 runs on RTX 4060 with default flags (XCL_LOOK_STATS unset). Includes main merge-base (b49be183, same-day run on this hardware) for pr_check.py, nvidia-dev target base (eae01502), and rebased PR HEAD (4922e39e):

main (b49be183, merge-base):

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

nvidia-dev (eae01502, target base):

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

PR HEAD (4922e39e, default flags):

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

Not tested

  • Full --workspace test suite on the rebased eae01502 commit (targeted api_cost::tests:: and affected bind::/list_x::/real:: suites plus clippy and smokes ran on 4922e39e).
  • AMD and Intel GPUs, 64-lane wave GPUs, and Linux / Wine / vkd3d-proton.
  • Live retail title hits for Call::FenceWait (blocking SetEventOnCompletion(_, NULL)) and Call::ViewWant (view_want::want), which did not fire during the short menu/intro smoke (covered by deterministic unit tests).
  • Optional-env/sample-pack tests (XCL_HEAP_WINDOWS, XCL_SAMPLE_RPF, d3d12SDKLayers.dll unset/unavailable).

AI use

  • Google Antigravity (Gemini 4 Neon): implemented the api_cost nanosecond accumulation, CounterPair seqlock, XCL_LOOK_STATS=2 submitting-thread instrumentation, and completed-call summary wording, rebased onto origin/nvidia-dev (eae01502), ran the unit/module tests, clippy, and retail smoke runs on the hardware above, and updated this description.
<!-- greyfinch-sync:ivall/xcl:issue:5507055422 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2729). Originally posted by [Decodere](https://github.com/Decodere) on 2026-11-26T09:03:41Z. --- Targets `nvidia-dev` (`eae01502`). Adds `XCL_LOOK_STATS=2`-only submitting-thread and recording-path instrumentation to `api_cost` so CPU-bound frames on 8 GB GPUs can be broken down into non-overlapping completed top-level call durations per 2 s sample window. Zero behavior change and zero timer/atomic overhead when `XCL_LOOK_STATS != 2`. Part of #2688 **What is in it** - `crates/xcl/src/hle/api_cost.rs`: accumulate durations internally in nanoseconds (exposing microseconds from `totals()` and `submitter_totals()`) so high-frequency sub-microsecond calls do not truncate to `0 us`; protect `ON_SUBMITTER` entries with a single-writer seqlock (`CounterPair`) so `submitter_totals()` takes coherent `(calls, us)` snapshots; add `#[inline] time_if(on, call)` (no clock read, TLS lookup, or atomic write when disabled), 8 `XCL_LOOK_STATS=2`-only `Call` variants (`DrawRecord`, `DispatchRecord`, `BindState`, `ViewDescriptor`, `ViewWant`, `ListBarrier`, `ListCopy`, `ListLifecycle`), `is_sub_call` (excluding nested `PresentCopyWait`, `PipelineWait`, and `ViewWant` from top-level completed totals), `all_threads_summary_parts`, `submitter_summary_line(now, before, window_ms)` (accounting any nonzero count or duration delta and reporting `; completed X ms (window Y ms)` for calls completed since the prior sample without claiming an in-window untimed remainder), and 6 new/updated unit tests (`sub_microsecond_calls_accumulate_without_truncation`, `time_if_disabled_adds_zero_counts_and_zero_time`, `submitter_summary_excludes_sub_calls_and_reports_completed_window`, `summary_retains_nonzero_duration_delta_when_count_delta_is_zero`, `submitter_counter_pair_snapshots_are_coherent_under_concurrent_writes`, `submitter_summary_describes_straddling_completed_call_without_untimed_claim`). - `crates/xcl/src/host.rs`: format `calls (2 s, all threads)` via `api_cost::all_threads_summary_parts` (retaining nonzero duration deltas even when count delta is 0), track the actual elapsed `window_ms` on each periodic activity tick, and log `api_cost::submitter_summary_line(&spent, &own_cost, window_ms)` when `XCL_LOOK_STATS=2` is active. - `crates/xcl/src/hle/d3d12x/bind.rs`: wire `time_if(deep(), ...)` for `DrawRecord` (`draw_instanced`, `draw_indexed_instanced`, `dispatch_mesh`), `DispatchRecord` (`dispatch_flags`, covering both `Dispatch` and `DispatchX`), lazy `deep().then(...)` in `execute_indirect` (so `signature_dispatches(sig)` is never evaluated when disabled), and `BindState` (root-parameter, descriptor-table, and PSO bindings), preserving `capture::op` / `capture_work` and deferred two-pass pipeline queueing on `eae01502`. - `crates/xcl/src/hle/d3d12x/list_x.rs`: wire `time_if(deep(), ...)` for `DrawRecord`, `BindState` (including `set_descriptor_heaps_x`), `ListBarrier`, `ListCopy`, and `ListLifecycle`; split out `emit_uav_barrier_pc`, `reset_pc_inner`, and `copy_buffer_region_inner` so internal delegation paths (`flush_cache_range_x`/`flush_pipeline_x`, `reset_stand_in`, `copy_resource_x`) never double-count while preserving `capture::op` instrumentation. - `crates/xcl/src/hle/d3d12x/real.rs`: wire `Call::FenceWait` on blocking `SetEventOnCompletion(_, NULL)` scoped to drop before `settle_readbacks_try()` so `FenceSettle` never nests inside `FenceWait`; wire `ViewDescriptor` (splitting `dev_create_srv_inner` and `dev_create_uav_checked_inner` so `dev_create_srv_at_x` and `depth_uav` twins never double-count, and resolving `resource_at` before starting `ViewDescriptor` in `dev_create_srv_at_x`/`dev_create_uav_at_x` so `CreatePlacedResource` never nests inside `ViewDescriptor`), `BindState`, `ListCopy`, and `ListLifecycle`; guard all unconditional PC-vtable hooks (`cl_close`, `cl_reset`, `alloc_reset`, `dev_create_rtv`, `cl_clear_rtv`, `cl_om_set_render_targets`, `fence_set_event_on_completion`) with `!title_textures::is_own_work() && !present::presenting()` while preserving `flush_two_pass`, `gpu_times::before_close`, and `eb784bc3` submit/sparse lock-holder timing on `eae01502`. - `crates/xcl/src/hle/d3d12x/view_want.rs`: wire `time_if(deep(), Call::ViewWant)` in `want` after the `is_view(va)` guard. **Tested** - Hardware and toolchain: Windows 11 Home (build 26200), NVIDIA GeForce RTX 4060 8 GB (32-lane waves, driver 621.14), Intel Core i5-11400F (6C/12T), 32 GB RAM, `rustc 1.100.0`, DXC `1.9.2609.5`, debug (WARP) and release (RTX 4060), rebased cleanly onto `origin/nvidia-dev` (`eae01502`). - `cargo test -p xcl --lib hle::api_cost::tests:: -- --test-threads=4 --nocapture` (debug `XCL_ADAPTER=warp`): `8 passed, 0 failed, 0 ignored` (`0` skipped, `0.00 s`). - `cargo test --release -p xcl --lib hle::api_cost::tests:: -- --test-threads=4 --nocapture` (release RTX 4060): `8 passed, 0 failed, 0 ignored` (`0` skipped, `0.00 s`). - Affected module suites on release RTX 4060 (`--test-threads=4`): `200 passed, 0 failed, 0 ignored` across `hle::d3d12x::bind::` (`53/0/0`, `0.35 s`, `1` opt-in skip with `XCL_HEAP_WINDOWS` unset), `hle::d3d12x::list_x::` (`50/0/0`, `0.93 s`, `0` skipped), and `hle::d3d12x::real::` (`97/0/0`, `0` skipped). - `cargo clippy --workspace --all-targets`: `0` new warnings and `0` new errors across all added/changed lines in all 6 modified files (pre-existing `nvidia-dev` clippy errors remain in untouched `lower_valu.rs`, `lower_wide.rs`, `recomp/lower.rs`, and `sparse.rs`). - Live `XCL_LOOK_STATS=2 XCL_ACTIVITY=1` 25 s RTX 4060 smoke on `4922e39e` (`title: 29640639`): `470` frames (`PresentX 470`), `1 60 60` presents/2 s, `0` device removals, `0` crashes, `15788 MB` peak commit, `exit: 0x0`. **Regression run** Quiet 60 s `scripts/smoke.ps1` runs on RTX 4060 with default flags (`XCL_LOOK_STATS` unset). Includes `main` merge-base (`b49be183`, same-day run on this hardware) for `pr_check.py`, `nvidia-dev` target base (`eae01502`), and rebased PR `HEAD` (`4922e39e`): `main` (`b49be183`, merge-base): ``` xcl-smoke v1 commit: b49be1836844fe0b0cdb3211dce3cb7fb4e21ac7 gpu: NVIDIA GeForce RTX 4060 title: 29640639 seconds: 60 exit: 0x0 frames shown: 1571 (PresentX 1571) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 13975 MB ``` `nvidia-dev` (`eae01502`, target base): ``` xcl-smoke v1 commit: eae015021c639866ab061cdff2e9daf8ba9daac5 gpu: NVIDIA GeForce RTX 4060 title: 29640639 seconds: 60 exit: 0x0 frames shown: 1585 (PresentX 1585) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 15900 MB ``` PR `HEAD` (`4922e39e`, default flags): ``` xcl-smoke v1 commit: 4922e39e2c56c1de53ecbef4675a4dfa7908ade6 gpu: NVIDIA GeForce RTX 4060 title: 29640639 seconds: 60 exit: 0x0 frames shown: 1559 (PresentX 1559) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 16099 MB ``` **Not tested** - Full `--workspace` test suite on the rebased `eae01502` commit (targeted `api_cost::tests::` and affected `bind::`/`list_x::`/`real::` suites plus clippy and smokes ran on `4922e39e`). - AMD and Intel GPUs, 64-lane wave GPUs, and Linux / Wine / vkd3d-proton. - Live retail title hits for `Call::FenceWait` (blocking `SetEventOnCompletion(_, NULL)`) and `Call::ViewWant` (`view_want::want`), which did not fire during the short menu/intro smoke (covered by deterministic unit tests). - Optional-env/sample-pack tests (`XCL_HEAP_WINDOWS`, `XCL_SAMPLE_RPF`, `d3d12SDKLayers.dll` unset/unavailable). **AI use** - Google Antigravity (Gemini 4 Neon): implemented the `api_cost` nanosecond accumulation, `CounterPair` seqlock, `XCL_LOOK_STATS=2` submitting-thread instrumentation, and completed-call summary wording, rebased onto `origin/nvidia-dev` (`eae01502`), ran the unit/module tests, clippy, and retail smoke runs on the hardware above, and updated this description.
luckyteagirl commented 2026-11-26 09:38:48 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by luckyteagirl on 2026-11-26T09:38:48Z.

Review: COMMENTED


On 5465094, note publishes a submitter call count and its duration in separate atomic writes, while submitter_totals reads them separately. An activity tick can snapshot (1 call, 0 µs) between the writes. The next tick then sees (1 call, 400000 µs) but submitter_summary_line skips that category because the count delta is zero; the host still advances its baseline. That completed 400 ms call disappears from every new accounted window, even though it remains in cumulative totals. Relaxed ordering makes this interleaving possible; stronger ordering on the two independent atomics alone would not make their snapshot coherent.

Could the formatter account a nonzero duration delta independently of count, or take a coherent count/duration snapshot? A deterministic formatter/host fixture with snapshots (0,0) → (1,0) → (1,400000) should retain the 400 ms in the second report. This is exact-head source review; I did not reproduce the race at runtime.

<!-- greyfinch-sync:ivall/xcl:review:6071697094 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2729#pullrequestreview-6071697094). Originally posted by [luckyteagirl](https://github.com/luckyteagirl) on 2026-11-26T09:38:48Z. **Review:** COMMENTED --- On `5465094`, `note` publishes a submitter call count and its duration in separate atomic writes, while `submitter_totals` reads them separately. An activity tick can snapshot `(1 call, 0 µs)` between the writes. The next tick then sees `(1 call, 400000 µs)` but `submitter_summary_line` skips that category because the count delta is zero; the host still advances its baseline. That completed 400 ms call disappears from every new `accounted` window, even though it remains in cumulative totals. Relaxed ordering makes this interleaving possible; stronger ordering on the two independent atomics alone would not make their snapshot coherent. Could the formatter account a nonzero duration delta independently of count, or take a coherent count/duration snapshot? A deterministic formatter/host fixture with snapshots `(0,0) → (1,0) → (1,400000)` should retain the 400 ms in the second report. This is exact-head source review; I did not reproduce the race at runtime.
luckyteagirl commented 2026-11-26 09:39:30 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by luckyteagirl on 2026-11-26T09:39:30Z.

Review: COMMENTED


On 5465094, the new accounted … of … (… untimed) line treats cumulative completed-call durations as time inside the last activity window. A call is added in full at Timer::drop. For example, a 2.5-second blocking fence wait spanning two 2-second samples adds zero to the first window and all 2500 ms to the second. That second report can say accounted 2500 ms of 2000 ms (0 ms untimed) even when no calls overlap, so the stated wall-clock remainder is misleading. This is separate from the count/duration snapshot race I reported earlier.

Could the durations be split by overlap with the measurement window, or the line describe durations of calls completed since the prior sample without claiming an in-window untimed remainder? A synthetic call crossing a tick would make the chosen semantics testable. This is exact-head source review; I did not run a timing fixture.

<!-- greyfinch-sync:ivall/xcl:review:6071707666 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2729#pullrequestreview-6071707666). Originally posted by [luckyteagirl](https://github.com/luckyteagirl) on 2026-11-26T09:39:30Z. **Review:** COMMENTED --- On `5465094`, the new `accounted … of … (… untimed)` line treats cumulative completed-call durations as time inside the last activity window. A call is added in full at `Timer::drop`. For example, a 2.5-second blocking fence wait spanning two 2-second samples adds zero to the first window and all 2500 ms to the second. That second report can say `accounted 2500 ms of 2000 ms (0 ms untimed)` even when no calls overlap, so the stated wall-clock remainder is misleading. This is separate from the count/duration snapshot race I reported earlier. Could the durations be split by overlap with the measurement window, or the line describe durations of calls *completed* since the prior sample without claiming an in-window untimed remainder? A synthetic call crossing a tick would make the chosen semantics testable. This is exact-head source review; I did not run a timing fixture.
emirduran707 commented 2026-11-26 11:05:06 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by emirduran707 on 2026-11-26T10:18:48Z.


Independent AMD RDNA4 (native wave64) verification of exact PR head 546509487103c94e40d423b4e1d778cc54076741 (base: nvidia-dev) on Windows 11 Pro 26300 (AMD Radeon RX 9060 XT 16 GB, driver 32.0.31044.16, Ryzen 5 5600, Rust 1.100.0 MSVC, DXC 1.9.2602.17).

Tested

  • cargo build --workspace (debug): passed (0 errors).
  • cargo test --workspace --no-fail-fast -- --test-threads=4: 1746 passed, 8 failed, 48 ignored (9 SKIPPED: 6 per-lane DXIL forms, 2 no heap windows, 1 pso_measurement_compiles_an_exact_synthetic_record Windows Developer Mode off).
    • All 3 new unit tests passed:
      • hle::api_cost::tests::sub_microsecond_calls_accumulate_without_truncation
      • hle::api_cost::tests::submitter_summary_excludes_sub_calls_from_accounted_and_computes_untimed
      • hle::api_cost::tests::time_if_disabled_adds_zero_counts_and_zero_time
    • The 8 failures are outside api_cost (fuzz_validate_and_gpu_{1,3}, texture_upload x2, console_ms_in_as_slot_and_ms_with_as_are_refused_cleanly, async_compute_pso_registers_real_pso_and_not_standin, two_pass_driver_cache_reuses_both_passes_and_recovers_corrupt_blobs).
  • cargo build --release -p xcl: passed (0 errors).

Not tested

  • 60 s retail-title smoke via scripts/smoke.ps1 (the nvidia-dev branch started inline shader precompilation before printing the log path, so smoke.ps1 aborted early).
  • Runtime XCL_LOOK_STATS=2 output, NVIDIA / Intel GPUs, Linux / Wine.

AI use

  • Verification run and report prepared with Antigravity (Gemini 4 Neon); all build and test results are from live runs on this machine.
<!-- greyfinch-sync:ivall/xcl:comment:7189197471 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2729#issuecomment-7189197471). Originally posted by [emirduran707](https://github.com/emirduran707) on 2026-11-26T10:18:48Z. --- Independent AMD RDNA4 (native wave64) verification of exact PR head `546509487103c94e40d423b4e1d778cc54076741` (`base: nvidia-dev`) on Windows 11 Pro 26300 (AMD Radeon RX 9060 XT 16 GB, driver `32.0.31044.16`, Ryzen 5 5600, Rust 1.100.0 MSVC, DXC `1.9.2602.17`). **Tested** - `cargo build --workspace` (debug): passed (`0` errors). - `cargo test --workspace --no-fail-fast -- --test-threads=4`: `1746 passed, 8 failed, 48 ignored` (`9 SKIPPED`: 6 per-lane DXIL forms, 2 `no heap windows`, 1 `pso_measurement_compiles_an_exact_synthetic_record` Windows Developer Mode off). - All 3 new unit tests passed: - `hle::api_cost::tests::sub_microsecond_calls_accumulate_without_truncation` - `hle::api_cost::tests::submitter_summary_excludes_sub_calls_from_accounted_and_computes_untimed` - `hle::api_cost::tests::time_if_disabled_adds_zero_counts_and_zero_time` - The 8 failures are outside `api_cost` (`fuzz_validate_and_gpu_{1,3}`, `texture_upload` x2, `console_ms_in_as_slot_and_ms_with_as_are_refused_cleanly`, `async_compute_pso_registers_real_pso_and_not_standin`, `two_pass_driver_cache_reuses_both_passes_and_recovers_corrupt_blobs`). - `cargo build --release -p xcl`: passed (`0` errors). **Not tested** - 60 s retail-title smoke via `scripts/smoke.ps1` (the `nvidia-dev` branch started inline shader precompilation before printing the log path, so `smoke.ps1` aborted early). - Runtime `XCL_LOOK_STATS=2` output, NVIDIA / Intel GPUs, Linux / Wine. **AI use** - Verification run and report prepared with Antigravity (Gemini 4 Neon); all build and test results are from live runs on this machine.
MarcosMDev commented 2026-11-26 11:05:13 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by MarcosMDev on 2026-11-26T10:52:51Z.


Test report: 5465094 against its base af2cecc on an RTX 4060 (Windows): full suite, no new failure. No title was run.

cargo build --workspace --locked, then cargo test --workspace --locked --no-fail-fast -- --test-threads=4, debug, each commit in its own worktree and target folder:

  • base af2cecc: 1745 passed, 6 failed, 48 ignored
  • head: 1748 passed, 6 failed, 48 ignored. The 3 new api_cost tests pass.
  • The same 30 SKIPPED lines on both. The failures are the same 5 tests on both (one is counted twice), already listed in this PR's description.

I read the hook changes for the "no behavior change" claim. Each new guard only decides whether a timer starts; the hooks' own calls are unchanged. deep() reads a OnceLock, so with XCL_LOOK_STATS unset each hook adds one branch. The two _inner splits keep the callers' arguments, and the depth-UAV twin now calls the inner function, so it isn't counted twice.

RTX 4060 8 GB (driver 621.01), Ryzen 7 5700X, 24 GB, Windows 11 26200, rustc 1.100.0, DXC 1.9.2609.5.

Not tested: any title, so no XCL_LOOK_STATS=2 lines from a real run; overhead with it off; AMD.

AI use: Claude Code (Claude Opus 5.5) ran the tests, read the diff and drafted this; I read it before posting.

<!-- greyfinch-sync:ivall/xcl:comment:7189961049 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2729#issuecomment-7189961049). Originally posted by [MarcosMDev](https://github.com/MarcosMDev) on 2026-11-26T10:52:51Z. --- **Test report: `5465094` against its base `af2cecc` on an RTX 4060 (Windows): full suite, no new failure.** No title was run. `cargo build --workspace --locked`, then `cargo test --workspace --locked --no-fail-fast -- --test-threads=4`, debug, each commit in its own worktree and target folder: - base `af2cecc`: 1745 passed, 6 failed, 48 ignored - head: 1748 passed, 6 failed, 48 ignored. The 3 new `api_cost` tests pass. - The same 30 SKIPPED lines on both. The failures are the same 5 tests on both (one is counted twice), already listed in this PR's description. I read the hook changes for the "no behavior change" claim. Each new guard only decides whether a timer starts; the hooks' own calls are unchanged. `deep()` reads a `OnceLock`, so with `XCL_LOOK_STATS` unset each hook adds one branch. The two `_inner` splits keep the callers' arguments, and the depth-UAV twin now calls the inner function, so it isn't counted twice. RTX 4060 8 GB (driver 621.01), Ryzen 7 5700X, 24 GB, Windows 11 26200, rustc 1.100.0, DXC 1.9.2609.5. **Not tested:** any title, so no `XCL_LOOK_STATS=2` lines from a real run; overhead with it off; AMD. AI use: Claude Code (Claude Opus 5.5) ran the tests, read the diff and drafted this; I read it before posting.
Decodere commented 2026-11-26 12:06:57 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Decodere on 2026-11-26T11:29:06Z.


Thanks for both reviews, @luckyteagirl! Updated in 93e66c19:

  1. Count/duration snapshot coherence: Protected ON_SUBMITTER entries with a single-writer seqlock (CounterPair, since SUBMITTER latches at most one thread ID) so submitter_totals() returns coherent (calls, us) pairs, and updated both submitter_summary_line and all_threads_summary_parts (host.rs) to retain any category with a nonzero count or duration delta (dc > 0 || dus > 0). Added deterministic tests for both the (0, 0) -> (1, 0) -> (1, 400_000) fixture (summary_retains_nonzero_duration_delta_when_count_delta_is_zero) and concurrent seqlock coherence (submitter_counter_pair_snapshots_are_coherent_under_concurrent_writes).
  2. Completed-call window semantics: Removed the in-window untimed remainder claim in favor of ; completed {ms} ms (window {window_ms} ms) so durations of calls completed since the prior sample are reported honestly even when a long call straddles a 2 s tick, with a deterministic 2.5 s straddling-call test (submitter_summary_describes_straddling_completed_call_without_untimed_claim).

Re-verified hle::api_cost::tests:: (8/8 debug WARP and release RTX 4060), full release workspace (1753 passed, 3 pre-existing nvidia-dev failures), and 60 s RTX 4060 smokes (default + XCL_LOOK_STATS=2).

<!-- greyfinch-sync:ivall/xcl:comment:7190787549 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2729#issuecomment-7190787549). Originally posted by [Decodere](https://github.com/Decodere) on 2026-11-26T11:29:06Z. --- Thanks for both reviews, `@luckyteagirl`! Updated in `93e66c19`: 1. **Count/duration snapshot coherence:** Protected `ON_SUBMITTER` entries with a single-writer seqlock (`CounterPair`, since `SUBMITTER` latches at most one thread ID) so `submitter_totals()` returns coherent `(calls, us)` pairs, and updated both `submitter_summary_line` and `all_threads_summary_parts` (`host.rs`) to retain any category with a nonzero count **or** duration delta (`dc > 0 || dus > 0`). Added deterministic tests for both the `(0, 0) -> (1, 0) -> (1, 400_000)` fixture (`summary_retains_nonzero_duration_delta_when_count_delta_is_zero`) and concurrent seqlock coherence (`submitter_counter_pair_snapshots_are_coherent_under_concurrent_writes`). 2. **Completed-call window semantics:** Removed the in-window `untimed` remainder claim in favor of `; completed {ms} ms (window {window_ms} ms)` so durations of calls completed since the prior sample are reported honestly even when a long call straddles a 2 s tick, with a deterministic 2.5 s straddling-call test (`submitter_summary_describes_straddling_completed_call_without_untimed_claim`). Re-verified `hle::api_cost::tests::` (`8/8` debug WARP and release RTX 4060), full release workspace (`1753 passed, 3 pre-existing nvidia-dev failures`), and 60 s RTX 4060 smokes (`default` + `XCL_LOOK_STATS=2`).
MarcosMDev commented 2026-11-26 12:07:01 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by MarcosMDev on 2026-11-26T11:52:02Z.


Follow-up to my report, on the new head 93e66c1 (same base af2cecc, same RTX 4060 and setup):

  • Full suite, same command: 1751 passed, 6 failed, 48 ignored. The same 5 base failures and the same 30 SKIPPED lines as on the base; the 6 api_cost tests now in the PR pass, the concurrent seqlock one included.

Not tested: any title, so no XCL_LOOK_STATS=2 lines from a real run; AMD.

AI use: Claude Code (Claude Opus 5.5) ran the tests and drafted this; I read it before posting.

<!-- greyfinch-sync:ivall/xcl:comment:7191265186 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2729#issuecomment-7191265186). Originally posted by [MarcosMDev](https://github.com/MarcosMDev) on 2026-11-26T11:52:02Z. --- Follow-up to [my report](https://github.com/xcl-dev/xcl/pull/2729#issuecomment-7189961049), on the new head `93e66c1` (same base `af2cecc`, same RTX 4060 and setup): - Full suite, same command: 1751 passed, 6 failed, 48 ignored. The same 5 base failures and the same 30 SKIPPED lines as on the base; the 6 `api_cost` tests now in the PR pass, the concurrent seqlock one included. **Not tested:** any title, so no `XCL_LOOK_STATS=2` lines from a real run; AMD. AI use: Claude Code (Claude Opus 5.5) ran the tests and drafted this; I read it before posting.
Prime1997 commented 2026-11-26 12:46:34 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Prime1997 on 2026-11-26T12:46:34Z.

Review: COMMENTED


Good within the submitting-thread accounting scope. The current head keeps count/duration snapshots coherent and labels durations as completed-call time rather than claiming an untimed wall-clock remainder. The focused tests cover both earlier review cases, sub-microsecond accumulation, disabled instrumentation and thread separation.

Tested clean PR head 93e66c197c2737c2fa7cbb97645c367cf01b33eb, targeting current nvidia-dev af2cecc40886a8682ecf3267f5328c6dc4b66ad7, in its own worktree and build directory. 8 passed, 0 failed, 0 ignored, 0 skipped. Each filter ran in a fresh process:

  • hle::api_cost::tests::a_call_is_counted_with_its_time
  • hle::api_cost::tests::the_submitting_thread_has_its_own_count
  • hle::api_cost::tests::sub_microsecond_calls_accumulate_without_truncation
  • hle::api_cost::tests::time_if_disabled_adds_zero_counts_and_zero_time
  • hle::api_cost::tests::submitter_summary_excludes_sub_calls_and_reports_completed_window
  • hle::api_cost::tests::summary_retains_nonzero_duration_delta_when_count_delta_is_zero
  • hle::api_cost::tests::submitter_counter_pair_snapshots_are_coherent_under_concurrent_writes
  • hle::api_cost::tests::submitter_summary_describes_straddling_completed_call_without_untimed_claim

Build: cargo test --locked --offline -p xcl --lib --no-run --message-format=json --target-dir <isolated-target>. Execution: <test-exe> <each-exact-name-above> --exact --test-threads=1 --nocapture. Only private executable/target paths are placeholders. Windows 11 Pro 26200, i5-10400, 32 GiB RAM, Rust 1.100.0 MSVC debug tests; no GPU calls in these selected fixtures.

Not tested: No live XCL_LOOK_STATS=2 title output, instrumentation overhead, GPU behavior or full-suite run was measured. This supports retaining the PR; it is not whole-branch or merge certification.

AI use: Codex (GPT-6) reviewed source, ran the exact tests and checked the raw results. Optional temporary Discord for coordinating contributor work, testing and comparing results.

<!-- greyfinch-sync:ivall/xcl:review:6074361884 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2729#pullrequestreview-6074361884). Originally posted by [Prime1997](https://github.com/Prime1997) on 2026-11-26T12:46:34Z. **Review:** COMMENTED --- **Good within the submitting-thread accounting scope.** The current head keeps count/duration snapshots coherent and labels durations as completed-call time rather than claiming an untimed wall-clock remainder. The focused tests cover both earlier review cases, sub-microsecond accumulation, disabled instrumentation and thread separation. Tested clean PR head `93e66c197c2737c2fa7cbb97645c367cf01b33eb`, targeting current `nvidia-dev` `af2cecc40886a8682ecf3267f5328c6dc4b66ad7`, in its own worktree and build directory. **8 passed, 0 failed, 0 ignored, 0 skipped.** Each filter ran in a fresh process: - `hle::api_cost::tests::a_call_is_counted_with_its_time` - `hle::api_cost::tests::the_submitting_thread_has_its_own_count` - `hle::api_cost::tests::sub_microsecond_calls_accumulate_without_truncation` - `hle::api_cost::tests::time_if_disabled_adds_zero_counts_and_zero_time` - `hle::api_cost::tests::submitter_summary_excludes_sub_calls_and_reports_completed_window` - `hle::api_cost::tests::summary_retains_nonzero_duration_delta_when_count_delta_is_zero` - `hle::api_cost::tests::submitter_counter_pair_snapshots_are_coherent_under_concurrent_writes` - `hle::api_cost::tests::submitter_summary_describes_straddling_completed_call_without_untimed_claim` Build: `cargo test --locked --offline -p xcl --lib --no-run --message-format=json --target-dir <isolated-target>`. Execution: `<test-exe> <each-exact-name-above> --exact --test-threads=1 --nocapture`. Only private executable/target paths are placeholders. Windows 11 Pro 26200, i5-10400, 32 GiB RAM, Rust 1.100.0 MSVC debug tests; no GPU calls in these selected fixtures. **Not tested:** No live XCL_LOOK_STATS=2 title output, instrumentation overhead, GPU behavior or full-suite run was measured. This supports retaining the PR; it is not whole-branch or merge certification. AI use: Codex (GPT-6) reviewed source, ran the exact tests and checked the raw results. Optional temporary [Discord](https://discord.gg/gK3y7WRRY) for coordinating contributor work, testing and comparing results.
throny commented 2026-11-26 15:03:43 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by throny on 2026-11-26T14:23:35Z.


Test report: XCL_LOOK_STATS=2 in the world on a 16 GB card. Here the submitting thread's time is in PresentX, not in ExecuteCommandLists.

Tested

  • RTX 4080 16 GB (driver 621.40, 1 GiB shader-heap profile of #2590), i9-12900K, 64 GB RAM, Windows 11 26300, release.
  • This PR's diff at 93e66c1 applied (git apply, as it is) on nvidia-dev af2cecc4 + #684 + #2697 + #2749. One run of the retail title of #505 into the world with XCL_LOOK_STATS=2: world from about 172 s, device removed (0x887a0005) at 607 s, as this card usually ends there.
  • The new line appears every 2 s as described; 103 of them in the run. No crash, no stall from the instrumentation; frames in the world 76 against 40 and 152 in the two runs of the same tree without it (#2749's report), so no visible cost.

What it shows (the calls of the submitting thread lines from 200 s on, 211 s of windows):

call count time share of the window
PresentX 69 195.9 s (2.84 s each; 4.0 s each in the last minute) 93 %
ExecuteCommandLists 1,251 14.5 s (11.6 ms each) 7 %
WaitFrameEventX 139 0.0 s 0 %
wait of a present for the last frame's copy per present 0 ms 0 %
  • So on this card the 110 ms "with no timer" of #2688 is not what limits the frame: the thread sits in the present for seconds. Video memory is 3–4 GB over the budget in that window (18.8–19.4 GB of 15.2 GB), and the log has N of N previous submits of lists submitted again were not done after 2000 ms – they go as they are 130 times, so the GPU is behind by seconds per frame and the present is where the thread meets it.
  • That is the reading for 16 GB: submit-path work (this PR's target, #2749, #2768) cannot show up as frame rate here until the card is back under its budget. On the 5090 of the issue it is the other way round.
  • A split of the present's time (the wait for the GPU against XCL's own work in it) would make the line say that by itself.

Not tested

  • The suite and this PR's tests (others' reports cover them), AMD, a card under its budget. One run.

AI use: Claude Code (Claude Fable 5.2) ran this on the owner's machine and wrote the report.

<!-- greyfinch-sync:ivall/xcl:comment:7194755378 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2729#issuecomment-7194755378). Originally posted by [throny](https://github.com/throny) on 2026-11-26T14:23:35Z. --- **Test report: `XCL_LOOK_STATS=2` in the world on a 16 GB card. Here the submitting thread's time is in `PresentX`, not in `ExecuteCommandLists`.** **Tested** - RTX 4080 16 GB (driver 621.40, 1 GiB shader-heap profile of #2590), i9-12900K, 64 GB RAM, Windows 11 26300, release. - This PR's diff at `93e66c1` applied (`git apply`, as it is) on `nvidia-dev` `af2cecc4` + #684 + #2697 + #2749. One run of the retail title of #505 into the world with `XCL_LOOK_STATS=2`: world from about 172 s, device removed (`0x887a0005`) at 607 s, as this card usually ends there. - The new line appears every 2 s as described; 103 of them in the run. No crash, no stall from the instrumentation; frames in the world 76 against 40 and 152 in the two runs of the same tree without it (#2749's report), so no visible cost. **What it shows** (the `calls of the submitting thread` lines from 200 s on, 211 s of windows): | call | count | time | share of the window | |---|---|---|---| | `PresentX` | 69 | **195.9 s** (2.84 s each; 4.0 s each in the last minute) | 93 % | | `ExecuteCommandLists` | 1,251 | 14.5 s (11.6 ms each) | 7 % | | `WaitFrameEventX` | 139 | 0.0 s | 0 % | | wait of a present for the last frame's copy | per present | 0 ms | 0 % | - So on this card the 110 ms "with no timer" of #2688 is not what limits the frame: the thread sits in the present for seconds. Video memory is 3–4 GB over the budget in that window (18.8–19.4 GB of 15.2 GB), and the log has `N of N previous submits of lists submitted again were not done after 2000 ms – they go as they are` 130 times, so the GPU is behind by seconds per frame and the present is where the thread meets it. - That is the reading for 16 GB: submit-path work (this PR's target, #2749, #2768) cannot show up as frame rate here until the card is back under its budget. On the 5090 of the issue it is the other way round. - A split of the present's time (the wait for the GPU against XCL's own work in it) would make the line say that by itself. **Not tested** - The suite and this PR's tests (others' reports cover them), AMD, a card under its budget. One run. AI use: Claude Code (Claude Fable 5.2) ran this on the owner's machine and wrote the report.
Decodere commented 2026-11-26 18:02:47 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Decodere on 2026-11-26T18:02:47Z.


Rebased cleanly onto origin/nvidia-dev eae01502 in 4922e39e (mergeable, 0 conflicts).

  • Preserved eb784bc3's submit & sparse lock-holder timing (XCL_LOOK_STATS=2) alongside the submitting-thread api_cost breakdown (CounterPair, dc > 0 || dus > 0, ; completed X ms (window Y ms)), eae01502 capture::op/capture_work, deferred two-pass queueing, and gpu_times::before_close.
  • Re-verified on RTX 4060 (Win11, release): debug WARP & release api_cost::tests:: 8/0/0, bind:: 53/0/0 (1 skip), list_x:: 50/0/0, real:: 97/0/0, 0 new clippy warnings, paired 60 s default smoke vs eae01502 (1559 vs 1585 frames, 60 60 60, 16099 vs 15900 MB, 0 rem/crash), and 25 s XCL_LOOK_STATS=2 smoke (470 frames, exit: 0x0).
<!-- greyfinch-sync:ivall/xcl:comment:7199990721 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2729#issuecomment-7199990721). Originally posted by [Decodere](https://github.com/Decodere) on 2026-11-26T18:02:47Z. --- Rebased cleanly onto `origin/nvidia-dev` [`eae01502`](https://github.com/xcl-dev/xcl/commit/eae015021c639866ab061cdff2e9daf8ba9daac5) in [`4922e39e`](https://github.com/xcl-dev/xcl/pull/2729/commits/4922e39e2c56c1de53ecbef4675a4dfa7908ade6) (`mergeable`, `0` conflicts). - Preserved `eb784bc3`'s submit & sparse lock-holder timing (`XCL_LOOK_STATS=2`) alongside the submitting-thread `api_cost` breakdown (`CounterPair`, `dc > 0 || dus > 0`, `; completed X ms (window Y ms)`), `eae01502` `capture::op`/`capture_work`, deferred two-pass queueing, and `gpu_times::before_close`. - Re-verified on RTX 4060 (Win11, release): debug WARP & release `api_cost::tests::` `8/0/0`, `bind::` `53/0/0` (1 skip), `list_x::` `50/0/0`, `real::` `97/0/0`, `0` new clippy warnings, paired 60 s default smoke vs `eae01502` (`1559` vs `1585` frames, `60 60 60`, `16099` vs `15900 MB`, `0` rem/crash), and 25 s `XCL_LOOK_STATS=2` smoke (`470` frames, `exit: 0x0`).
MarcosMDev commented 2026-11-26 18:36:41 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by MarcosMDev on 2026-11-26T18:36:41Z.


Follow-up on the rebased head 4922e39 against its new base eae0150 (same RTX 4060 and setup as my report): no new failure.

  • Full suite, cargo test --workspace --locked --no-fail-fast -- --test-threads=4: base 1816 passed, 9 failed, 48 ignored; head 1822 passed, 9 failed, 48 ignored. The same 7 tests fail on both (split_compute_prefers_the_offline_whole_pipeline and the two-pass one count twice), and the same 30 SKIPPED lines. All 8 api_cost tests pass.

Not tested: any title, so no XCL_LOOK_STATS=2 lines next to eb784bc's lock-holder times from a real run; AMD.

AI use: Claude Code (Claude Opus 5.5) ran the tests and drafted this; I read it before posting.

<!-- greyfinch-sync:ivall/xcl:comment:7200657763 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2729#issuecomment-7200657763). Originally posted by [MarcosMDev](https://github.com/MarcosMDev) on 2026-11-26T18:36:41Z. --- Follow-up on the rebased head `4922e39` against its new base `eae0150` (same RTX 4060 and setup as [my report](https://github.com/xcl-dev/xcl/pull/2729#issuecomment-7189961049)): no new failure. - Full suite, `cargo test --workspace --locked --no-fail-fast -- --test-threads=4`: base 1816 passed, 9 failed, 48 ignored; head 1822 passed, 9 failed, 48 ignored. The same 7 tests fail on both (`split_compute_prefers_the_offline_whole_pipeline` and the two-pass one count twice), and the same 30 SKIPPED lines. All 8 `api_cost` tests pass. **Not tested:** any title, so no `XCL_LOOK_STATS=2` lines next to `eb784bc`'s lock-holder times from a real run; AMD. AI use: Claude Code (Claude Opus 5.5) ran the tests and drafted this; I read it before posting.
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

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