D3D12.X: time ExecuteCommandLists submissions (XCL_GPU_TIMING) #1058
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1065"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from ivall/xcl. Originally posted by homerrek on 2026-11-24T11:09:25Z.
Part of #505. Diagnostics only: a switch and three
report.jsonfields, no behaviour change withthe flag off.
What is in it
crates/xcl/src/hle/d3d12x/real.rs—D3d12Statsgainssubmissions,slowest_submission_ms,slowest_submission_lists, all#[serde(default)]so an oldreport.jsonstill parses.crates/xcl/src/hle/d3d12x/real.rs—SUBMISSIONS,SLOWEST_SUBMISSION_US,SLOWEST_SUBMISSION_LISTScounters,gpu_timing_on()(XCL_GPU_TIMING=1) andslow_submission_us()(XCL_GPU_TIMING_MS, default 50).crates/xcl/src/hle/d3d12x/real.rs—q_execute_command_liststakes oneInstantbeforeexecute_with_waits_onand updates the counters afterpresent::note_execute; any submissionat 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_listsis the single choke point for every title submission, and nothingmeasures it. In #505 the run reaches the world, the title's state reads
Game Running, the screenstays 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.
presentsandframe_boundariesdo notseparate 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
ExecuteCommandListsreturns before the GPU is done, so this is CPU submission cost, not GPUexecution 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
Regression run
scripts/smoke.ps1on Windows with a GPU and a retail title.Not tested
cargo test --workspace, no GPU run, noxcl-smokeblocks (main and head). All arerequired before merge.
exempts logging from tests; the counters sit behind
OnceLockand a device, so a unit test wouldneed a device or a restructure of the statics. Say if you want it restructured to be testable and
I will do that instead.
Cost when off
One
OnceLockread per submission and nothing else:gpu_timing_on()is cached after the firstcall,
timedisNone, and the counters are never touched. A world load submitting thousands oftimes pays thousands of atomic-free branch checks.
AI use
What I would run, if I had the hardware
For the two
xcl-smokeblocks, plus:Then
logs\report.json→d3d12.submissions,d3d12.slowest_submission_ms,d3d12.slowest_submission_lists, and the warnings inxcl.log. If the slowest submission is a fewms 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.
Imported from ivall/xcl. Originally posted by Diskuss on 2026-11-24T11:31:30Z.
Tested on AMD Radeon RX 9070 XT (RDNA4) at
49a3f1a7061a760f9a38fedd0f95fcfe4b30db49Ryzen 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_updatedeprecation).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.XCL_GPU_TIMING=1: 741 passed, 0 failed, 41 ignored. No change in behavior, no timing output in the captured logs.ExecuteCommandListshook, which no unit test exercises, so the newreport.jsonfields (submissions,slowest_submission_ms,slowest_submission_lists) and the slow-submission warning were not checked.47efa2ebaseline: 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?
Imported from ivall/xcl. Originally posted by Kalmarv on 2026-11-24T15:54:23Z.
Regression pair for
49a3f1aagainstmain47efa2e(this PR's base), for the Regression run section. Both runs pass: no device removal, no crash, 99 % ofmain's frames, 104 % of its peak commit.Tested
scripts/smoke.ps1, the same retail title for 60 s each:mainat47efa2e(this PR's base) first, then this PR's head, one after the other on the same machine.XCL_GPU_TIMINGwas unset, so this is the flag-off path.main47efa2e:this PR,
49a3f1a:report.jsonhas the three new fields at zero (submissions0,slowest_submission_ms0.0,slowest_submission_lists0), andxcl.loghas noExecuteCommandLists: … on the CPUline.main'sreport.jsondoesn'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.cargo test --workspace, AMD, Linux.AI use: Claude Code (Claude Opus 5.5)
upstream-sync referenced this pull request2026-11-24 22:05:13 +00:00
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!
upstream-sync referenced this pull request2026-11-25 11:07:09 +00:00
Imported from ivall/xcl. Originally posted by Foniass on 2026-12-01T04:44:13Z.
Triage (#1607) – head
49a3f1aMain 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.rson main hasXCL_GPU_TIMING=1, theXCL_GPU_TIMING_MSthreshold (default 50 ms), the samesubmissions/slowest_submission_ms/slowest_submission_listsfields inreport.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.
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 #1065Two independent checks found this: Foniass's close list on #1607 and ours against current
main. If something here is still missing onmain, 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