D3D12.X: time ExecuteCommandLists submissions (XCL_GPU_TIMING) #1065
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
goal:world-load
good first issue
help wanted
invalid
keep-open
off-goal
question
stale
test-only
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/xcl-dev--xcl!1065
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-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?
@homerrek on GitHub · 2026-11-24 11:09 UTC · original
homerrek:gpu-submission-timing→main· +45 −0 · 1 files · 1 commits · openPart 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.
@Diskuss on GitHub · 2026-11-24 11:31 UTC · original
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?
@Kalmarv on GitHub · 2026-11-24 15:54 UTC · original
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)
@DavidM1911 on GitHub · 2026-11-25 08:52 UTC · original
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!
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.