D3D12.X: time ExecuteCommandLists submissions (XCL_GPU_TIMING) #1058

Closed
homerrek wants to merge 1 commit from upstream-pr/1065 into main
homerrek commented 2026-11-24 11:09:25 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by homerrek on 2026-11-24T11:09:25Z.


Part of #505. Diagnostics only: a switch and three report.json fields, no behaviour change with
the flag off.

What is in it

  • crates/xcl/src/hle/d3d12x/real.rs — D3d12Stats gains submissions, slowest_submission_ms,
    slowest_submission_lists, all #[serde(default)] so an old report.json still parses.
  • crates/xcl/src/hle/d3d12x/real.rs — SUBMISSIONS, SLOWEST_SUBMISSION_US,
    SLOWEST_SUBMISSION_LISTS counters, gpu_timing_on() (XCL_GPU_TIMING=1) and
    slow_submission_us() (XCL_GPU_TIMING_MS, default 50).
  • crates/xcl/src/hle/d3d12x/real.rs — q_execute_command_lists takes one Instant before
    execute_with_waits_on and updates the counters after present::note_execute; any submission
    at or above the threshold logs ExecuteCommandLists: <us> µs on the CPU for <n> list(s).
  • crates/xcl/src/hle/d3d12x/real.rs — stats() fills the three fields.

Why

q_execute_command_lists is the single choke point for every title submission, and nothing
measures it. In #505 the run reaches the world, the title's state reads Game Running, the screen
stays on a spinner and the watchdog ends it 3–14 minutes in. From outside that looks identical
whether the CPU is spending seconds per submission (pipeline builds, allocator pools, texture
refresh) or the CPU is fine and the GPU never completes. presents and frame_boundaries do not
separate the two.

This separates them, cheaply, at the one place both cases pass through.

What it does not measure — stated in the field doc comment

ExecuteCommandLists returns before the GPU is done, so this is CPU submission cost, not GPU
execution time
. It shows pipeline, allocator and texture-refresh cost under the call. Real GPU
time needs fence timestamps per submission, which is a larger change and not in this PR.

Tested

  • Not run. No Windows toolchain, no GPU, no title on this machine.

Regression run

  • Not run. Requires scripts/smoke.ps1 on Windows with a GPU and a retail title.

Not tested

  • No build, no cargo test --workspace, no GPU run, no xcl-smoke blocks (main and head). All are
    required before merge.
  • No test added. CONTRIBUTING lists diagnostics and env-var switches as their own PR kind and
    exempts logging from tests; the counters sit behind OnceLock and a device, so a unit test would
    need a device or a restructure of the statics. Say if you want it restructured to be testable and
    I will do that instead.
  • Not measured with the flag on against a real world load — the numbers that would matter.

Cost when off

One OnceLock read per submission and nothing else: gpu_timing_on() is cached after the first
call, timed is None, and the counters are never touched. A world load submitting thousands of
times pays thousands of atomic-free branch checks.

AI use

  • Written by an AI agent (R9K) at the request of @homerrek. No part of it was executed.

What I would run, if I had the hardware

For the two xcl-smoke blocks, plus:

$env:XCL_GPU_TIMING=1
$env:XCL_GPU_TIMING_MS=200
xcl run <title folder>

Then logs\report.json → d3d12.submissions, d3d12.slowest_submission_ms,
d3d12.slowest_submission_lists, and the warnings in xcl.log. If the slowest submission is a few
ms while frames still do not come, the wall is GPU-side and this PR has done its job by ruling the
CPU out.

If you want the GPU side too, the next PR should be fence-completion timestamps per submission —
say so and I will write it as a stack on top of this one.

<!-- greyfinch-sync:ivall/xcl:issue:5470997390 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1065). Originally posted by [homerrek](https://github.com/homerrek) on 2026-11-24T11:09:25Z. --- Part of #505. Diagnostics only: a switch and three `report.json` fields, no behaviour change with the flag off. **What is in it** - `crates/xcl/src/hle/d3d12x/real.rs` — `D3d12Stats` gains `submissions`, `slowest_submission_ms`, `slowest_submission_lists`, all `#[serde(default)]` so an old `report.json` still parses. - `crates/xcl/src/hle/d3d12x/real.rs` — `SUBMISSIONS`, `SLOWEST_SUBMISSION_US`, `SLOWEST_SUBMISSION_LISTS` counters, `gpu_timing_on()` (`XCL_GPU_TIMING=1`) and `slow_submission_us()` (`XCL_GPU_TIMING_MS`, default 50). - `crates/xcl/src/hle/d3d12x/real.rs` — `q_execute_command_lists` takes one `Instant` before `execute_with_waits_on` and updates the counters after `present::note_execute`; any submission at or above the threshold logs `ExecuteCommandLists: <us> µs on the CPU for <n> list(s)`. - `crates/xcl/src/hle/d3d12x/real.rs` — `stats()` fills the three fields. **Why** `q_execute_command_lists` is the single choke point for every title submission, and nothing measures it. In #505 the run reaches the world, the title's state reads `Game Running`, the screen stays on a spinner and the watchdog ends it 3–14 minutes in. From outside that looks identical whether the CPU is spending seconds per submission (pipeline builds, allocator pools, texture refresh) or the CPU is fine and the GPU never completes. `presents` and `frame_boundaries` do not separate the two. This separates them, cheaply, at the one place both cases pass through. **What it does not measure — stated in the field doc comment** `ExecuteCommandLists` returns before the GPU is done, so this is **CPU submission cost, not GPU execution time**. It shows pipeline, allocator and texture-refresh cost under the call. Real GPU time needs fence timestamps per submission, which is a larger change and not in this PR. **Tested** - **Not run.** No Windows toolchain, no GPU, no title on this machine. **Regression run** - **Not run.** Requires `scripts/smoke.ps1` on Windows with a GPU and a retail title. **Not tested** - No build, no `cargo test --workspace`, no GPU run, no `xcl-smoke` blocks (main and head). All are required before merge. - No test added. CONTRIBUTING lists diagnostics and env-var switches as their own PR kind and exempts logging from tests; the counters sit behind `OnceLock` and a device, so a unit test would need a device or a restructure of the statics. Say if you want it restructured to be testable and I will do that instead. - Not measured with the flag on against a real world load — the numbers that would matter. **Cost when off** One `OnceLock` read per submission and nothing else: `gpu_timing_on()` is cached after the first call, `timed` is `None`, and the counters are never touched. A world load submitting thousands of times pays thousands of atomic-free branch checks. **AI use** - Written by an AI agent (R9K) at the request of @homerrek. No part of it was executed. --- ## What I would run, if I had the hardware For the two `xcl-smoke` blocks, plus: ``` $env:XCL_GPU_TIMING=1 $env:XCL_GPU_TIMING_MS=200 xcl run <title folder> ``` Then `logs\report.json` → `d3d12.submissions`, `d3d12.slowest_submission_ms`, `d3d12.slowest_submission_lists`, and the warnings in `xcl.log`. If the slowest submission is a few ms while frames still do not come, the wall is GPU-side and this PR has done its job by ruling the CPU out. If you want the GPU side too, the next PR should be fence-completion timestamps per submission — say so and I will write it as a stack on top of this one.
Diskuss commented 2026-11-24 12:05:46 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Diskuss on 2026-11-24T11:31:30Z.


Tested on AMD Radeon RX 9070 XT (RDNA4) at 49a3f1a7061a760f9a38fedd0f95fcfe4b30db49

Ryzen 7 5700X3D, 32 GB, Windows 11 Pro 26300.9974, AMD driver 32.0.32015.7029, Rust 1.100.0 msvc, DXC 1.9.2602.17, debug build.

Tested (PR head is 0 commits behind main 47efa2e, so no merge was needed; the bare head was tested):

  • cargo build --workspace: OK (1 existing warning, Atomic::fetch_update deprecation).
  • cargo test --workspace --no-fail-fast -- --test-threads=4: 741 passed, 0 failed, 41 ignored. 0 SKIPPED printed; 2 debug-layer tests skip silently, no Graphics Tools installed. No device removal.
  • Same command again with XCL_GPU_TIMING=1: 741 passed, 0 failed, 41 ignored. No change in behavior, no timing output in the captured logs.
  • The PR adds no tests, so there are no named tests to run. The timing code is only reached through the title's ExecuteCommandLists hook, which no unit test exercises, so the new report.json fields (submissions, slowest_submission_ms, slowest_submission_lists) and the slow-submission warning were not checked.
  • Main 47efa2e baseline: 741/0/41, so the counts are identical.

Not tested: retail title / scripts/smoke.ps1 (no game files), release build.

Report written by Claude Code (Claude Sonnet 5.5) from a real run on this machine.

Do the maintainers find these AMD/RDNA4 test reports useful, or would something else (different tests, a different format) help more?

<!-- greyfinch-sync:ivall/xcl:comment:7130208327 --> Imported from [ivall/xcl](https://github.com/ivall/xcl/pull/1065#issuecomment-7130208327). Originally posted by [Diskuss](https://github.com/Diskuss) on 2026-11-24T11:31:30Z. --- **Tested on AMD Radeon RX 9070 XT (RDNA4) at `49a3f1a7061a760f9a38fedd0f95fcfe4b30db49`** Ryzen 7 5700X3D, 32 GB, Windows 11 Pro 26300.9974, AMD driver 32.0.32015.7029, Rust 1.100.0 msvc, DXC 1.9.2602.17, debug build. **Tested** (PR head is 0 commits behind main 47efa2e, so no merge was needed; the bare head was tested): - `cargo build --workspace`: OK (1 existing warning, `Atomic::fetch_update` deprecation). - `cargo test --workspace --no-fail-fast -- --test-threads=4`: 741 passed, 0 failed, 41 ignored. 0 SKIPPED printed; 2 debug-layer tests skip silently, no Graphics Tools installed. No device removal. - Same command again with `XCL_GPU_TIMING=1`: 741 passed, 0 failed, 41 ignored. No change in behavior, no timing output in the captured logs. - The PR adds no tests, so there are no named tests to run. The timing code is only reached through the title's `ExecuteCommandLists` hook, which no unit test exercises, so the new `report.json` fields (`submissions`, `slowest_submission_ms`, `slowest_submission_lists`) and the slow-submission warning were not checked. - Main 47efa2e baseline: 741/0/41, so the counts are identical. **Not tested**: retail title / `scripts/smoke.ps1` (no game files), release build. Report written by Claude Code (Claude Sonnet 5.5) from a real run on this machine. Do the maintainers find these AMD/RDNA4 test reports useful, or would something else (different tests, a different format) help more?
Kalmarv commented 2026-11-24 16:07:19 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Kalmarv on 2026-11-24T15:54:23Z.


Regression pair for 49a3f1a against main 47efa2e (this PR's base), for the Regression run section. Both runs pass: no device removal, no crash, 99 % of main's frames, 104 % of its peak commit.

Tested

  • NVIDIA GeForce RTX 5070 Ti 16 GB (driver 610.74), AMD Ryzen 9 9950X, Windows 11 Pro 26200.
  • scripts/smoke.ps1, the same retail title for 60 s each: main at 47efa2e (this PR's base) first, then this PR's head, one after the other on the same machine. XCL_GPU_TIMING was unset, so this is the flag-off path.

main 47efa2e:

xcl-smoke v1
commit: 47efa2ecea0a12934719ae69b81930cf02a4b1c3
gpu: NVIDIA GeForce RTX 5070 Ti
title: GTA VI
seconds: 60
exit: 0x0
frames shown: 1309 (PresentX 1309)
presents per 2 s (last 3): 34 36 54
device removals: 0
crashes: 0
peak commit: 27494 MB

this PR, 49a3f1a:

xcl-smoke v1
commit: 49a3f1a7061a760f9a38fedd0f95fcfe4b30db49
gpu: NVIDIA GeForce RTX 5070 Ti
title: GTA VI
seconds: 60
exit: 0x0
frames shown: 1297 (PresentX 1298)
presents per 2 s (last 3): 32 54 4
device removals: 0
crashes: 0
peak commit: 28679 MB
  • With the flag off, this PR's report.json has the three new fields at zero (submissions 0, slowest_submission_ms 0.0, slowest_submission_lists 0), and xcl.log has no ExecuteCommandLists: … on the CPU line. main's report.json doesn't have the fields.

Not tested

  • XCL_GPU_TIMING=1 (the run in your "What I would run"): not run, so there are no submission timings here.
  • World loading and the #505 stop: a 60 s run ends before it.
  • cargo test --workspace, AMD, Linux.

AI use: Claude Code (Claude Opus 5.5)

<!-- greyfinch-sync:ivall/xcl:comment:7136809137 --> Imported from [ivall/xcl](https://github.com/ivall/xcl/pull/1065#issuecomment-7136809137). Originally posted by [Kalmarv](https://github.com/Kalmarv) on 2026-11-24T15:54:23Z. --- Regression pair for `49a3f1a` against `main` `47efa2e` (this PR's base), for the **Regression run** section. Both runs pass: no device removal, no crash, 99 % of `main`'s frames, 104 % of its peak commit. **Tested** - NVIDIA GeForce RTX 5070 Ti 16 GB (driver 610.74), AMD Ryzen 9 9950X, Windows 11 Pro 26200. - `scripts/smoke.ps1`, the same retail title for 60 s each: `main` at `47efa2e` (this PR's base) first, then this PR's head, one after the other on the same machine. `XCL_GPU_TIMING` was unset, so this is the flag-off path. `main` `47efa2e`: ``` xcl-smoke v1 commit: 47efa2ecea0a12934719ae69b81930cf02a4b1c3 gpu: NVIDIA GeForce RTX 5070 Ti title: GTA VI seconds: 60 exit: 0x0 frames shown: 1309 (PresentX 1309) presents per 2 s (last 3): 34 36 54 device removals: 0 crashes: 0 peak commit: 27494 MB ``` this PR, `49a3f1a`: ``` xcl-smoke v1 commit: 49a3f1a7061a760f9a38fedd0f95fcfe4b30db49 gpu: NVIDIA GeForce RTX 5070 Ti title: GTA VI seconds: 60 exit: 0x0 frames shown: 1297 (PresentX 1298) presents per 2 s (last 3): 32 54 4 device removals: 0 crashes: 0 peak commit: 28679 MB ``` - With the flag off, this PR's `report.json` has the three new fields at zero (`submissions` 0, `slowest_submission_ms` 0.0, `slowest_submission_lists` 0), and `xcl.log` has no `ExecuteCommandLists: … on the CPU` line. `main`'s `report.json` doesn't have the fields. **Not tested** - `XCL_GPU_TIMING=1` (the run in your "What I would run"): not run, so there are no submission timings here. - World loading and the #505 stop: a 60 s run ends before it. - `cargo test --workspace`, AMD, Linux. **AI use:** Claude Code (Claude Opus 5.5)
DavidM1911 commented 2026-11-25 09:08:22 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by DavidM1911 on 2026-11-25T08:52:23Z.


Verification on RTX 3060 Ti (Windows 11), branch merged with current main:

  • cargo test -p xcl --lib: 1038 passed, 1 failed in one parallel run; the failing test passes on a single-threaded rerun (1039/0). Intermittent single-test flake / 0xc0000005 abort under parallel scheduling — tracked in #1978; clean on single-threaded rerun.

Thanks!

<!-- greyfinch-sync:ivall/xcl:comment:7157577770 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1065#issuecomment-7157577770). Originally posted by [DavidM1911](https://github.com/DavidM1911) on 2026-11-25T08:52:23Z. --- Verification on RTX 3060 Ti (Windows 11), branch merged with current `main`: - `cargo test -p xcl --lib`: 1038 passed, 1 failed in one parallel run; the failing test passes on a single-threaded rerun (1039/0). Intermittent single-test flake / 0xc0000005 abort under parallel scheduling — tracked in #1978; clean on single-threaded rerun. Thanks!
Foniass commented 2026-12-01 04:44:13 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Foniass on 2026-12-01T04:44:13Z.


Triage (#1607) – head 49a3f1a

Main already has this change: cfc11ab6 "D3D12.X: time native title queue submissions" (merged with #2959) says it adapts this PR to the current submission planner. real.rs on main has XCL_GPU_TIMING=1, the XCL_GPU_TIMING_MS threshold (default 50 ms), the same submissions / slowest_submission_ms / slowest_submission_lists fields in report.json, and the slow-submission warning. It adds mean / p95 / p99 and GPU completion receipts, and README documents it.
Recommendation: close (superseded by main commit cfc11ab6).

AI review: Claude Code (Claude Opus 5.5), diffs read only, not built or run; not checked by a human.

<!-- greyfinch-sync:ivall/xcl:comment:7301044811 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1065#issuecomment-7301044811). Originally posted by [Foniass](https://github.com/Foniass) on 2026-12-01T04:44:13Z. --- **Triage (#1607)** – head 49a3f1a Main already has this change: cfc11ab6 "D3D12.X: time native title queue submissions" (merged with #2959) says it adapts this PR to the current submission planner. `real.rs` on main has `XCL_GPU_TIMING=1`, the `XCL_GPU_TIMING_MS` threshold (default 50 ms), the same `submissions` / `slowest_submission_ms` / `slowest_submission_lists` fields in `report.json`, and the slow-submission warning. It adds mean / p95 / p99 and GPU completion receipts, and README documents it. Recommendation: close (superseded by main commit cfc11ab6). AI review: Claude Code (Claude Opus 5.5), diffs read only, not built or run; not checked by a human.
throny commented 2026-12-01 12:42:20 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by throny on 2026-12-01T12:42:20Z.


Closing as superseded: this change is already on main (cfc11ab6). main real.rs has XCL_GPU_TIMING / XCL_GPU_TIMING_MS, slowest_submission_ms / slowest_submission_lists in the report, README line 450 documents them; adapted from #1065

Two independent checks found this: Foniass's close list on #1607 and ours against current main. If something here is still missing on main, say so and reopen it, or ask and I will.

AI use: Claude Code (Claude Opus 5.5); the per-PR comparison was done by Claude Sonnet 5.5 sub-agents.

<!-- greyfinch-sync:ivall/xcl:comment:7311526954 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1065#issuecomment-7311526954). Originally posted by [throny](https://github.com/throny) on 2026-12-01T12:42:20Z. --- Closing as superseded: this change is already on `main` (cfc11ab6). main real.rs has XCL_GPU_TIMING / XCL_GPU_TIMING_MS, slowest_submission_ms / slowest_submission_lists in the report, README line 450 documents them; adapted from #1065 Two independent checks found this: Foniass's close list on #1607 and ours against current `main`. If something here is still missing on `main`, say so and reopen it, or ask and I will. AI use: Claude Code (Claude Opus 5.5); the per-PR comparison was done by Claude Sonnet 5.5 sub-agents.

Pull request closed

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!1058
No description provided.