D3D12.X: with XCL_LOOK_STATS=2 split a present's time on the submitter #2955

Merged
thisguyStan merged 1 commit from upstream-pr/2955 into main 2026-11-30 09:06:29 +00:00
thisguyStan commented 2026-11-27 04:43:17 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by thisguyStan on 2026-11-27T04:43:17Z.


Part of #2688 (workstream 8). Targets main (b38197ae).

In the world, presents take most of the submitting thread's time on NVIDIA (93 % on an RTX 4080 in #2729), but calls of the submitting thread (2 s) shows a present as one presents entry, with only its wait for frame N−2's copy apart. With XCL_LOOK_STATS=2, like that wait, this adds four entries:

  • the wait for the present before it (PRESENTX_LOCK, PRESENTER),
  • the copy (or composite) recorded and submitted, from the allocator's reset to its Signal,
  • the swap chain's Present (a GPU-bound frame waits there),
  • the wait for a frame dump's copy (XCL_FRAME_DUMP, XCL_DUMP_TARGETS).

The rest of presents is the plane checks, the frame-rate line and the device-removal check. When the fallback presents on a submission (no PresentX), the parts run inside ExecuteCommandLists, as the copy wait does. Like it, they are sub-calls (is_sub_call, #2729), so completed counts each present once. XCL_STALL_TRACE times only the swap chain's Present. Diagnostics only: no change with the switch off.

What is in it

  • crates/xcl/src/hle/api_cost.rs: the four entries, their names in CALLS and in is_sub_call, and a test that a present is counted once.
  • crates/xcl/src/hle/d3d12x/present.rs: the timers around the two lock waits, the recording and submit, Present and the frame-dump wait.

Tested

  • RTX 4070 Ti 12 GB (driver 32.0.16.1088, 32-lane waves), Ryzen 9 5900X, 64 GB RAM, Windows 11 Pro build 26200, rustc 1.100.0, DXC 1.9.2602.17; tests in debug, smokes in release.
  • cargo test --workspace --no-fail-fast -- --test-threads=4 on 80e2ee45 (this PR on main 7db2f391): 2595 passed, 0 failed, 49 ignored. The head 2aeec61c is the same patch rebased onto b38197ae (git range-diff: unchanged); the suite was not rerun on it.
  • SKIPPED: 29 (21 no wave64, 3 per-lane forms refused, 2 no heap windows, 3 no D3D12 debug layer).
  • The runs with the timers on below are from before the rebase, when this PR was based on nvidia-dev (merged into main since). The timers are the same. On main, the present's copy is submitted without XCL's look at the title's memory, so the recording part should be smaller there.
  • The timers on: scripts/smoke.ps1 on 1a6ddc2c (release; the same code as dd85383e) with XCL_LOOK_STATS=2, XCL_PREPARE=0, 60 s in the intro and menus (1354 frames, no device removal, no crash). Every calls of the submitting thread (2 s) line (from 12 s on) has the new entries. From 14 s on, the parts add up to the presents entry within 0–4 ms per 2 s (the rest of a present); the first present (12 s) took 51 ms, of them 1 ms in the parts. From 26 s on, every 2 s:
    • 60 presents in 37–58 ms,
    • 120 waits for the present before (two per present) in 0 ms, 60 waits for the last frame's copy in 0 ms,
    • 60 copies recorded and submitted in 16–30 ms,
    • 60 swap chain Presents in 17–24 ms.
    • The slowest 2 s (at 18 s): 54 presents in 225 ms, of them 124 ms recording and submitting and 98 ms in the swap chain's Present.
    • No frame-dump waits (no XCL_FRAME_DUMP): that entry is not printed.
  • Into the world: two runs of dd85383e with XCL_LOOK_STATS=2, XCL_ACTIVITY=1, XCL_PREPARE=0, played past the intro, were stopped as the world loads by a device removal (0x887a0005, no DRED breadcrumbs) and then the title's breakpoint at the same address (at 228 s and 114 s). its base then, ecc0bb57 (nvidia-dev, now part of main), with the timers off stops the same way (223 s), so the world itself was not reached. In the first run, while the world loaded (178–226 s, 9–13 fps), every 2 s:
    • 1–61 presents in 3–190 ms, of them 1–117 ms recording and submitting and 2–102 ms in the swap chain's Present; the parts add up to presents within 0–4 ms,
    • the waits for the present before and for the last frame's copy stay at 0 ms,
    • ExecuteCommandLists takes 57–1005 ms.

Regression run
60 s runs of scripts/smoke.ps1 (JIT path: the script sets XCL_PREPARE=0) on the same title, with no pipeline cap. Each ran on its own copy of one main shader cache. main is this PR's base (b38197ae). XCL_LOOK_STATS was unset, so these runs show the switched-off path.

main (b38197ae):

xcl-smoke v1
commit: b38197ae60974cf5f280e8dfffc4ce554e815590
gpu: NVIDIA GeForce RTX 4070 Ti
title: 83ce7bf6
seconds: 60
exit: 0x0
frames shown: 1575 (PresentX 1575)
presents per 2 s (last 3): 60 60 61
device removals: 0
crashes: 0
peak commit: 19171 MB

This PR (2aeec61c):

xcl-smoke v1
commit: 2aeec61c045fe315ae3f0ed6e6d4f1e03b05417b
gpu: NVIDIA GeForce RTX 4070 Ti
title: 83ce7bf6
seconds: 60
exit: 0x0
frames shown: 1554 (PresentX 1554)
presents per 2 s (last 3): 60 60 61
device removals: 0
crashes: 0
peak commit: 18715 MB

Not tested

  • A run in the world: on this machine the old base (ecc0bb57, on nvidia-dev before its merge) stopped with a device removal as the world loads (above), so the split in the world is not measured here. The timers-on runs were not repeated on main.
  • The frame-dump wait (XCL_FRAME_DUMP, XCL_DUMP_TARGETS) and the composite path of a present.
  • AMD and Intel GPUs, 64-lane wave GPUs, Linux / Wine.

AI use

  • Claude Code (Claude Opus 5.5): wrote the change and this description, ran the tests and the smoke runs on the machine above.
<!-- greyfinch-sync:ivall/xcl:issue:5521319574 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2955). Originally posted by [thisguyStan](https://github.com/thisguyStan) on 2026-11-27T04:43:17Z. --- Part of #2688 (workstream 8). Targets `main` (`b38197ae`). In the world, presents take most of the submitting thread's time on NVIDIA (93 % on an RTX 4080 in #2729), but `calls of the submitting thread (2 s)` shows a present as one `presents` entry, with only its wait for frame N−2's copy apart. With `XCL_LOOK_STATS=2`, like that wait, this adds four entries: - the wait for the present before it (`PRESENTX_LOCK`, `PRESENTER`), - the copy (or composite) recorded and submitted, from the allocator's reset to its `Signal`, - the swap chain's `Present` (a GPU-bound frame waits there), - the wait for a frame dump's copy (`XCL_FRAME_DUMP`, `XCL_DUMP_TARGETS`). The rest of `presents` is the plane checks, the frame-rate line and the device-removal check. When the fallback presents on a submission (no PresentX), the parts run inside `ExecuteCommandLists`, as the copy wait does. Like it, they are sub-calls (`is_sub_call`, #2729), so `completed` counts each present once. `XCL_STALL_TRACE` times only the swap chain's `Present`. Diagnostics only: no change with the switch off. **What is in it** - `crates/xcl/src/hle/api_cost.rs`: the four entries, their names in `CALLS` and in `is_sub_call`, and a test that a present is counted once. - `crates/xcl/src/hle/d3d12x/present.rs`: the timers around the two lock waits, the recording and submit, `Present` and the frame-dump wait. **Tested** - RTX 4070 Ti 12 GB (driver 32.0.16.1088, 32-lane waves), Ryzen 9 5900X, 64 GB RAM, Windows 11 Pro build 26200, `rustc 1.100.0`, DXC 1.9.2602.17; tests in debug, smokes in release. - `cargo test --workspace --no-fail-fast -- --test-threads=4` on `80e2ee45` (this PR on `main` `7db2f391`): 2595 passed, 0 failed, 49 ignored. The head `2aeec61c` is the same patch rebased onto `b38197ae` (`git range-diff`: unchanged); the suite was not rerun on it. - SKIPPED: 29 (21 no wave64, 3 per-lane forms refused, 2 no heap windows, 3 no D3D12 debug layer). - The runs with the timers on below are from before the rebase, when this PR was based on `nvidia-dev` (merged into `main` since). The timers are the same. On `main`, the present's copy is submitted without XCL's look at the title's memory, so the recording part should be smaller there. - The timers on: `scripts/smoke.ps1` on `1a6ddc2c` (release; the same code as `dd85383e`) with `XCL_LOOK_STATS=2`, `XCL_PREPARE=0`, 60 s in the intro and menus (1354 frames, no device removal, no crash). Every `calls of the submitting thread (2 s)` line (from 12 s on) has the new entries. From 14 s on, the parts add up to the `presents` entry within 0–4 ms per 2 s (the rest of a present); the first present (12 s) took 51 ms, of them 1 ms in the parts. From 26 s on, every 2 s: - 60 presents in 37–58 ms, - 120 waits for the present before (two per present) in 0 ms, 60 waits for the last frame's copy in 0 ms, - 60 copies recorded and submitted in 16–30 ms, - 60 swap chain Presents in 17–24 ms. - The slowest 2 s (at 18 s): 54 presents in 225 ms, of them 124 ms recording and submitting and 98 ms in the swap chain's Present. - No frame-dump waits (no `XCL_FRAME_DUMP`): that entry is not printed. - Into the world: two runs of `dd85383e` with `XCL_LOOK_STATS=2`, `XCL_ACTIVITY=1`, `XCL_PREPARE=0`, played past the intro, were stopped as the world loads by a device removal (`0x887a0005`, no DRED breadcrumbs) and then the title's breakpoint at the same address (at 228 s and 114 s). its base then, `ecc0bb57` (`nvidia-dev`, now part of `main`), with the timers off stops the same way (223 s), so the world itself was not reached. In the first run, while the world loaded (178–226 s, 9–13 fps), every 2 s: - 1–61 presents in 3–190 ms, of them 1–117 ms recording and submitting and 2–102 ms in the swap chain's Present; the parts add up to `presents` within 0–4 ms, - the waits for the present before and for the last frame's copy stay at 0 ms, - `ExecuteCommandLists` takes 57–1005 ms. **Regression run** 60 s runs of `scripts/smoke.ps1` (JIT path: the script sets `XCL_PREPARE=0`) on the same title, with no pipeline cap. Each ran on its own copy of one `main` shader cache. `main` is this PR's base (`b38197ae`). `XCL_LOOK_STATS` was unset, so these runs show the switched-off path. `main` (`b38197ae`): ``` xcl-smoke v1 commit: b38197ae60974cf5f280e8dfffc4ce554e815590 gpu: NVIDIA GeForce RTX 4070 Ti title: 83ce7bf6 seconds: 60 exit: 0x0 frames shown: 1575 (PresentX 1575) presents per 2 s (last 3): 60 60 61 device removals: 0 crashes: 0 peak commit: 19171 MB ``` This PR (`2aeec61c`): ``` xcl-smoke v1 commit: 2aeec61c045fe315ae3f0ed6e6d4f1e03b05417b gpu: NVIDIA GeForce RTX 4070 Ti title: 83ce7bf6 seconds: 60 exit: 0x0 frames shown: 1554 (PresentX 1554) presents per 2 s (last 3): 60 60 61 device removals: 0 crashes: 0 peak commit: 18715 MB ``` **Not tested** - A run in the world: on this machine the old base (`ecc0bb57`, on `nvidia-dev` before its merge) stopped with a device removal as the world loads (above), so the split in the world is not measured here. The timers-on runs were not repeated on `main`. - The frame-dump wait (`XCL_FRAME_DUMP`, `XCL_DUMP_TARGETS`) and the composite path of a present. - AMD and Intel GPUs, 64-lane wave GPUs, Linux / Wine. **AI use** - Claude Code (Claude Opus 5.5): wrote the change and this description, ran the tests and the smoke runs on the machine above.
ettehn commented 2026-11-27 04:51:48 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by ettehn on 2026-11-27T04:51:48Z.


One accounting detail for the #2729 integration, checked at 1a6ddc2c. The submission-driven fallback calls present_now directly, so it emits PresentRecord and PresentSwap without an enclosing Call::Present sample. It runs inside the enclosing ExecuteCommandLists timer. Those samples belong to Submit on that route and to Present on the boundary route. In both cases, #2729’s non-overlapping total should treat them as sub-calls.

A standalone Windows x64 fixture compiled this head’s api_cost.rs and fed it the fallback sequence. It reported Present=0, PresentRecord=12 ms, PresentSwap=20 ms, Submit=40 ms. The durations are fixture inputs. This checks the counters and the source call sites. If the new metrics are meant to break down presents, a route guard or separate fallback labels would keep that interpretation accurate.

OpenAI Codex assisted with verification.

<!-- greyfinch-sync:ivall/xcl:comment:7210155046 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2955#issuecomment-7210155046). Originally posted by [ettehn](https://github.com/ettehn) on 2026-11-27T04:51:48Z. --- One accounting detail for the #2729 integration, checked at `1a6ddc2c`. The [submission-driven fallback](https://github.com/xcl-dev/xcl/blob/1a6ddc2c1c8ee48feb7621eda0dbea638e3ab4bf/crates/xcl/src/hle/d3d12x/present.rs#L365-L379) calls `present_now` directly, so it emits `PresentRecord` and `PresentSwap` without an enclosing `Call::Present` sample. It runs inside the [enclosing `ExecuteCommandLists` timer](https://github.com/xcl-dev/xcl/blob/1a6ddc2c1c8ee48feb7621eda0dbea638e3ab4bf/crates/xcl/src/hle/d3d12x/real.rs#L9069-L9073). Those samples belong to `Submit` on that route and to `Present` on the boundary route. In both cases, #2729’s non-overlapping total should treat them as sub-calls. A standalone Windows x64 fixture compiled this head’s `api_cost.rs` and fed it the fallback sequence. It reported `Present=0`, `PresentRecord=12 ms`, `PresentSwap=20 ms`, `Submit=40 ms`. The durations are fixture inputs. This checks the counters and the source call sites. If the new metrics are meant to break down `presents`, a route guard or separate fallback labels would keep that interpretation accurate. OpenAI Codex assisted with verification.
thisguyStan commented 2026-11-27 06:05:02 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by thisguyStan on 2026-11-27T06:05:02Z.


Thanks, that's right: on the submission-driven fallback present_now runs inside ExecuteCommandLists, so its parts land in Submit, not in Present. The copy wait already did the same. I kept the timing as it is. A Present timer around the fallback would count the same time in both entries, and Call::Present deliberately covers only PresentX and the console-method fallback. Instead, dd85383e says it in the doc comment on the entries, the commit message and the description. For #2729's non-overlapping total, all four new entries belong in is_sub_call along with PresentCopyWait, on both routes. That's in the description too, for whichever PR lands second. (Claude Code with Claude Opus 5.5 checked the call sites.)

<!-- greyfinch-sync:ivall/xcl:comment:7211200937 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2955#issuecomment-7211200937). Originally posted by [thisguyStan](https://github.com/thisguyStan) on 2026-11-27T06:05:02Z. --- Thanks, that's right: on the submission-driven fallback `present_now` runs inside `ExecuteCommandLists`, so its parts land in `Submit`, not in `Present`. The copy wait already did the same. I kept the timing as it is. A `Present` timer around the fallback would count the same time in both entries, and `Call::Present` deliberately covers only PresentX and the console-method fallback. Instead, `dd85383e` says it in the doc comment on the entries, the commit message and the description. For #2729's non-overlapping total, all four new entries belong in `is_sub_call` along with `PresentCopyWait`, on both routes. That's in the description too, for whichever PR lands second. (Claude Code with Claude Opus 5.5 checked the call sites.)
LocranKing commented 2026-11-27 12:21:02 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by LocranKing on 2026-11-27T12:21:02Z.


Tested PR #2955 (dd85383e) on Windows 11 in a 180 s open-world run with XCL_LOOK_STATS=2 to cover the open-world PresentX breakdown noted under Not tested.

Environment

  • GPU: NVIDIA GeForce RTX 3060 Ti (8024 MiB VRAM, driver 32.0.16.2140)
  • CPU / RAM: AMD Ryzen 5 5500 (6C/12T), 32 GB DDR4, Windows 11 Build 26300
  • Shader cache & runtime: Frozen nvidia-dev DXIL cache (XCL_DIRECT_DXIL=1, XCL_HEAP_WINDOWS=1, XCL_TEXTURE_LEVEL_PAGES=1, XCL_PREPARE_GRAPHICS=0, XCL_DRED=1, XCL_LOOK_STATS=2), Series S (lockhart) profile.

180 s Open-World Run (XCL_LOOK_STATS=2)

  • Outcome: exit: 0x0, 0 crashes, 0 device removals, 1760 frames (PresentX 1760), heavy world draws began at 108.55 s, peak commit 29509 MB, peak local VRAM 10279 MB, peak non-local 4982 MB.
  • Aggregated calls of the submitting thread (2 s) breakdown:
Scope Intervals ExecuteCommandLists waits for pipelines being built presents total waits of a present for the one before waits of a present for the last frame's copy copies of a present recorded and submitted swap chain Presents
Full 180 s run 87 4686 (76,902 ms) 64 (3,226 ms) 1760 (32,086 ms) 3520 (0 ms) 1760 (0 ms) 27,148 ms (84.6%) 4,818 ms (15.0%)
In world (t >= 100 s) 47 1382 (50,349 ms) 64 (3,226 ms) 108 (25,543 ms) 216 (0 ms) 108 (0 ms) 22,895 ms (89.6%) 2,624 ms (10.3%)

World observations

  • Once in the world (t >= 100 s), presents (25,543 ms) accounted for ~33.6% of {ExecuteCommandLists + presents} submitter call time (75,892 ms), and copies of a present recorded and submitted dominated presents at 89.6% (22,895 ms across 108 presents), with swap chain Presents at 10.3% (2,624 ms) and lock/copy waits at 0 ms (residual remainder 24 ms / 0.1%).
  • Single 2 s world spikes reached up to 2172 ms for 2 presents (2167 ms in copies of a present recorded and submitted, 4 ms in swap chain Presents, at 144.993 s) and 1654 ms for 1 present (1653 ms in copies of a present recorded and submitted, at 187.661 s).
<!-- greyfinch-sync:ivall/xcl:comment:7218137611 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2955#issuecomment-7218137611). Originally posted by [LocranKing](https://github.com/LocranKing) on 2026-11-27T12:21:02Z. --- Tested PR #2955 (`dd85383e`) on Windows 11 in a **`180 s` open-world run** with `XCL_LOOK_STATS=2` to cover the open-world `PresentX` breakdown noted under **Not tested**. ### Environment - **GPU:** NVIDIA GeForce RTX 3060 Ti (8024 MiB VRAM, driver `32.0.16.2140`) - **CPU / RAM:** AMD Ryzen 5 5500 (6C/12T), 32 GB DDR4, Windows 11 Build 26300 - **Shader cache & runtime:** Frozen `nvidia-dev` DXIL cache (`XCL_DIRECT_DXIL=1`, `XCL_HEAP_WINDOWS=1`, `XCL_TEXTURE_LEVEL_PAGES=1`, `XCL_PREPARE_GRAPHICS=0`, `XCL_DRED=1`, `XCL_LOOK_STATS=2`), Series S (`lockhart`) profile. ### `180 s` Open-World Run (`XCL_LOOK_STATS=2`) - **Outcome:** `exit: 0x0`, `0` crashes, `0` device removals, `1760` frames (`PresentX 1760`), heavy world draws began at `108.55 s`, peak commit `29509 MB`, peak local VRAM `10279 MB`, peak non-local `4982 MB`. - **Aggregated `calls of the submitting thread (2 s)` breakdown:** | Scope | Intervals | `ExecuteCommandLists` | `waits for pipelines being built` | `presents` total | `waits of a present for the one before` | `waits of a present for the last frame's copy` | `copies of a present recorded and submitted` | `swap chain Presents` | |---|---|---|---|---|---|---|---|---| | **Full `180 s` run** | `87` | `4686` (`76,902 ms`) | `64` (`3,226 ms`) | `1760` (`32,086 ms`) | `3520` (`0 ms`) | `1760` (`0 ms`) | **`27,148 ms`** (`84.6%`) | **`4,818 ms`** (`15.0%`) | | **In world (`t >= 100 s`)** | `47` | `1382` (`50,349 ms`) | `64` (`3,226 ms`) | `108` (**`25,543 ms`**) | `216` (`0 ms`) | `108` (`0 ms`) | **`22,895 ms`** (**`89.6%`**) | **`2,624 ms`** (**`10.3%`**) | ### World observations - Once in the world (`t >= 100 s`), `presents` (`25,543 ms`) accounted for ~33.6% of `{ExecuteCommandLists + presents}` submitter call time (`75,892 ms`), and **`copies of a present recorded and submitted`** dominated `presents` at **`89.6%`** (`22,895 ms` across `108` presents), with `swap chain Presents` at `10.3%` (`2,624 ms`) and lock/copy waits at `0 ms` (residual remainder `24 ms` / `0.1%`). - Single 2 s world spikes reached up to `2172 ms` for `2` presents (`2167 ms` in `copies of a present recorded and submitted`, `4 ms` in `swap chain Presents`, at `144.993 s`) and `1654 ms` for `1` present (`1653 ms` in `copies of a present recorded and submitted`, at `187.661 s`).
thehollowedone commented 2026-11-28 01:50:00 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by thehollowedone on 2026-11-28T01:50:00Z.


I rebased #2955 head dd85383e locally onto current nvidia-dev ba9d1f94. The only textual conflict is the CALLS array size in api_cost.rs: the base has 20 calls after #2729, and this PR adds four, so the combined array needs 24 entries.

There is one accompanying accounting step, as you anticipated: add all four new present timers to is_sub_call. They run inside Present or the submission fallback's Submit; leaving them top-level makes #2729's non-overlapping completed duration count their time twice. I extended the existing submitter-summary test with all four nonzero timers and kept its completed total at 400 ms.

On the resolved, uncommitted merge: cargo build --offline --locked -j 4 --workspace passed; cargo test --offline --locked -j 4 -p xcl --lib hle::api_cost::tests -- --test-threads=1 passed 8/0/0, with no skips. Windows 11 build 26300, Ryzen 7 9800X3D, RTX 3080 Ti (621.35), Rust 1.99.1. I did not run the full suite or clean-commit smoke on this local rebase; those remain for the updated PR head.

Minimal rebase resolution and accounting test
--- a/crates/xcl/src/hle/api_cost.rs
+++ b/crates/xcl/src/hle/api_cost.rs
@@
-pub const CALLS: [(Call, &str); 16] = [
+pub const CALLS: [(Call, &str); 24] = [
@@
-    matches!(call, Call::PresentCopyWait | Call::PipelineWait | Call::ViewWant)
+    matches!(call, Call::PresentCopyWait | Call::PresentLockWait | Call::PresentRecord
+        | Call::PresentSwap | Call::PresentDumpWait | Call::PipelineWait | Call::ViewWant)
@@ submitter_summary_excludes_sub_calls_and_reports_completed_window
     now[Call::PresentCopyWait as usize] = (2, 30_000);
+    now[Call::PresentLockWait as usize] = (1, 20_000);
+    now[Call::PresentRecord as usize] = (1, 30_000);
+    now[Call::PresentSwap as usize] = (1, 40_000);
+    now[Call::PresentDumpWait as usize] = (1, 50_000);
     // The summary still ends with completed 400 ms (window 2000 ms).

AI use: Codex (GPT-6.2 Sol) resolved the local merge, reviewed the timer nesting, ran the build and test, and drafted this reply.

<!-- greyfinch-sync:ivall/xcl:comment:7231947358 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2955#issuecomment-7231947358). Originally posted by [thehollowedone](https://github.com/thehollowedone) on 2026-11-28T01:50:00Z. --- I rebased [#2955 head `dd85383e`](https://github.com/xcl-dev/xcl/commit/dd85383eb9a6162b21856463185a5f420c526850) locally onto current `nvidia-dev` `ba9d1f94`. The only textual conflict is the `CALLS` array size in `api_cost.rs`: the base has 20 calls after [#2729](https://github.com/xcl-dev/xcl/pull/2729), and this PR adds four, so the combined array needs **24** entries. There is one accompanying accounting step, as [you anticipated](https://github.com/xcl-dev/xcl/pull/2955#issuecomment-7211200937): add all four new present timers to `is_sub_call`. They run inside `Present` or the submission fallback's `Submit`; leaving them top-level makes #2729's non-overlapping `completed` duration count their time twice. I extended the existing submitter-summary test with all four nonzero timers and kept its completed total at 400 ms. On the resolved, uncommitted merge: `cargo build --offline --locked -j 4 --workspace` passed; `cargo test --offline --locked -j 4 -p xcl --lib hle::api_cost::tests -- --test-threads=1` passed **8/0/0**, with no skips. Windows 11 build 26300, Ryzen 7 9800X3D, RTX 3080 Ti (621.35), Rust 1.99.1. I did not run the full suite or clean-commit smoke on this local rebase; those remain for the updated PR head. <details><summary>Minimal rebase resolution and accounting test</summary> ```diff --- a/crates/xcl/src/hle/api_cost.rs +++ b/crates/xcl/src/hle/api_cost.rs @@ -pub const CALLS: [(Call, &str); 16] = [ +pub const CALLS: [(Call, &str); 24] = [ @@ - matches!(call, Call::PresentCopyWait | Call::PipelineWait | Call::ViewWant) + matches!(call, Call::PresentCopyWait | Call::PresentLockWait | Call::PresentRecord + | Call::PresentSwap | Call::PresentDumpWait | Call::PipelineWait | Call::ViewWant) @@ submitter_summary_excludes_sub_calls_and_reports_completed_window now[Call::PresentCopyWait as usize] = (2, 30_000); + now[Call::PresentLockWait as usize] = (1, 20_000); + now[Call::PresentRecord as usize] = (1, 30_000); + now[Call::PresentSwap as usize] = (1, 40_000); + now[Call::PresentDumpWait as usize] = (1, 50_000); // The summary still ends with completed 400 ms (window 2000 ms). ``` </details> AI use: Codex (GPT-6.2 Sol) resolved the local merge, reviewed the timer nesting, ran the build and test, and drafted this reply.
tiagonleal commented 2026-11-30 02:49:07 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by tiagonleal on 2026-11-30T02:49:07Z.


merge-check
base: cb8024684c
head: 2aeec61c04
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 -> 2810 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 (+55/-5, api_cost.rs, present.rs). Diagnostic only. The four new timers (PresentLockWait, PresentRecord, PresentSwap, PresentDumpWait) are each created through look_stats::deep().then(...), so with XCL_LOOK_STATS unset or at 1 a present takes no clock read and writes no counter. All four are in is_sub_call, so they are not counted twice in completed, and the new test checks that. The parts do not add up to presents exactly; the comment in present.rs says so. Checked on NVIDIA as the label asks: a 60 s run of the merged tree with XCL_LOOK_STATS=2 prints, in the existing 2 s line of the submitting thread, 60 presents in 21 ms, ... 120 waits of a present for the one before in 0 ms, 60 copies of a present recorded and submitted in 7 ms, 60 swap chain Presents in 12 ms, so 19 of the 21 ms are attributed. At level 2 the line gains entries, which matters only to a script that expects a fixed number of them.
performance: default path: a few level checks per present, no clock and no atomics. Measured with scripts/smoke.ps1, 60 s of a retail title, release: 1683 frames and 15318 MB peak commit with the switch unset, 1678 frames and 15738 MB with XCL_LOOK_STATS=2, against 1662 and 1684 frames, 16196 and 15752 MB on the base. 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
<!-- greyfinch-sync:ivall/xcl:comment:7267344446 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2955#issuecomment-7267344446). Originally posted by [tiagonleal](https://github.com/tiagonleal) on 2026-11-30T02:49:07Z. --- merge-check base: cb8024684c7babcb0569ecda2217a54b8bedafb1 head: 2aeec61c045fe315ae3f0ed6e6d4f1e03b05417b 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 -> 2810 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 (+55/-5, `api_cost.rs`, `present.rs`). Diagnostic only. The four new timers (`PresentLockWait`, `PresentRecord`, `PresentSwap`, `PresentDumpWait`) are each created through `look_stats::deep().then(...)`, so with `XCL_LOOK_STATS` unset or at 1 a present takes no clock read and writes no counter. All four are in `is_sub_call`, so they are not counted twice in `completed`, and the new test checks that. The parts do not add up to `presents` exactly; the comment in `present.rs` says so. Checked on NVIDIA as the label asks: a 60 s run of the merged tree with `XCL_LOOK_STATS=2` prints, in the existing 2 s line of the submitting thread, `60 presents in 21 ms, ... 120 waits of a present for the one before in 0 ms, 60 copies of a present recorded and submitted in 7 ms, 60 swap chain Presents in 12 ms`, so 19 of the 21 ms are attributed. At level 2 the line gains entries, which matters only to a script that expects a fixed number of them. performance: default path: a few level checks per present, no clock and no atomics. Measured with `scripts/smoke.ps1`, 60 s of a retail title, release: 1683 frames and 15318 MB peak commit with the switch unset, 1678 frames and 15738 MB with `XCL_LOOK_STATS=2`, against 1662 and 1684 frames, 16196 and 15752 MB on the base. 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
jsalzy commented 2026-11-30 04:10:30 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by jsalzy on 2026-11-30T04:10:30Z.


merge-check claim
head: 2aeec61c04

<!-- greyfinch-sync:ivall/xcl:comment:7268534538 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2955#issuecomment-7268534538). Originally posted by [jsalzy](https://github.com/jsalzy) on 2026-11-30T04:10:30Z. --- merge-check claim head: 2aeec61c045fe315ae3f0ed6e6d4f1e03b05417b
jsalzy commented 2026-11-30 04:18:37 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by jsalzy on 2026-11-30T04:18:37Z.


merge-check
base: 7c01208
head: 2aeec61
merge: clean (also clean on main bfbb4db)
build: cargo build --workspace -> ok
tests: cargo test --workspace --no-fail-fast -- --test-threads=4 -> 2851 passed, 0 failed, 51 ignored; SKIPPED: 25 (22 no wave64 on this GPU; 2 no heap windows (opt-in XCL_HEAP_WINDOWS=1); 1 driver cache cannot be disabled without Windows Developer Mode); failing: none
review: whole diff read (+55/-5, api_cost.rs and present.rs). Diagnostic only: each of the four new timers (PresentLockWait, PresentRecord, PresentSwap, PresentDumpWait) is created through look_stats::deep().then(...), so without XCL_LOOK_STATS=2 a present gets no clock read and no counter write. All four are in is_sub_call, so completed counts a present once; the new test the_parts_of_a_present_are_not_counted_twice passes, and a_call_is_counted_with_its_time still confirms CALLS is in enum order. Minor, not blocking: the PresentRecord timer starts before the allocator Reset and is dropped on the early returns before the Signal (Reset, cast or Signal failure), so a present that fails there still counts as a copy recorded and submitted. The timer placement in present.rs has no test (it needs a real present); the unit test covers the accounting only. No duplicate found: #2729 (merged) is what this extends; #3192 and #3104 touch api_cost but not the present timers; no #1607 group.
performance: not measured. Default path: one cached level check per timer site, no clock read, no atomics.
verdict: safe to merge
hardware / tool and model: RTX 4070 SUPER 12 GB (621.24 / 32.0.16.2124), Ryzen 7 7800X3D, 32 GB, Windows 11 Pro 25H2 26200.9974, Rust 1.100.0, debug / Claude app (Claude Opus 5.5): merge, build and suite run on this PC with git and cargo only; diff review by Claude Opus 5.5.

<!-- greyfinch-sync:ivall/xcl:comment:7268657959 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2955#issuecomment-7268657959). Originally posted by [jsalzy](https://github.com/jsalzy) on 2026-11-30T04:18:37Z. --- merge-check base: 7c01208 head: 2aeec61 merge: clean (also clean on main bfbb4db) build: cargo build --workspace -> ok tests: cargo test --workspace --no-fail-fast -- --test-threads=4 -> 2851 passed, 0 failed, 51 ignored; SKIPPED: 25 (22 no wave64 on this GPU; 2 no heap windows (opt-in XCL_HEAP_WINDOWS=1); 1 driver cache cannot be disabled without Windows Developer Mode); failing: none review: whole diff read (+55/-5, api_cost.rs and present.rs). Diagnostic only: each of the four new timers (PresentLockWait, PresentRecord, PresentSwap, PresentDumpWait) is created through look_stats::deep().then(...), so without XCL_LOOK_STATS=2 a present gets no clock read and no counter write. All four are in is_sub_call, so completed counts a present once; the new test the_parts_of_a_present_are_not_counted_twice passes, and a_call_is_counted_with_its_time still confirms CALLS is in enum order. Minor, not blocking: the PresentRecord timer starts before the allocator Reset and is dropped on the early returns before the Signal (Reset, cast or Signal failure), so a present that fails there still counts as a copy recorded and submitted. The timer placement in present.rs has no test (it needs a real present); the unit test covers the accounting only. No duplicate found: #2729 (merged) is what this extends; #3192 and #3104 touch api_cost but not the present timers; no #1607 group. performance: not measured. Default path: one cached level check per timer site, no clock read, no atomics. verdict: safe to merge hardware / tool and model: RTX 4070 SUPER 12 GB (621.24 / 32.0.16.2124), Ryzen 7 7800X3D, 32 GB, Windows 11 Pro 25H2 26200.9974, Rust 1.100.0, debug / Claude app (Claude Opus 5.5): merge, build and suite run on this PC with git and cargo only; diff review by Claude Opus 5.5.
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!2955
No description provided.