Repository navigation
D3D12.X: GPU profilers time a split program's ExecuteIndirect chain - #3698
tiagonleal wants to merge 1 commit into
Conversation
|
Review (head 3b54c45, diff read, not a merge-check):
Fine: every early exit (the AI review: Claude Code (Claude Opus 5.5), posted by Foniass without a human check of each point. |
An ExecuteIndirect of a split compute program runs its chain
(dispatch_chain::execute_indirect): 16 rounds of {UAV barrier, piece
bind, ExecuteIndirect} for each piece. No gpu_profile span was opened
around it, while a direct dispatch's chain gets one
(bind::translated_dispatch). XCL_GPU_TIMES starts a call's interval at
the previous stamp on the list, so the chain's GPU time was charged to
the next timed call. On an RTX 5070 Ti, main 1c8b551 showed two compute
programs of the Newer Retail Game at 365 and 193 ms a frame. A frame
captured on that commit had 510 chained ExecuteIndirects, with runs of
them on the same lists right before those two programs.
The span opens after the slicer pass and the chain's bind, only when
the bind succeeded, and closes after the pieces and the restore of the
slicer's commands, as bind::translated_dispatch opens a direct chain's
span once it is bound. A call that hands off to the whole form
(Indirect::Whole) is not counted twice, and one whose bind fails (the
caller counts it in DISPATCHES_SKIPPED) is not counted at all. The test
records a timed call, a chained ExecuteIndirect through
bind::execute_indirect_chain and a timed call on one list, and checks
for three spans with the chained program's pipeline in the middle one;
then a chained call whose bind fails, and checks that it opens no span.
3b54c45 to
9f20551
Compare
|
Thanks, you were right: in 9f20551 the span now opens after ~Tiago |
|
Follow-up review (head 9f20551, since 3b54c45, diff read, not a merge-check):
New: none. AI review: Claude Code (Claude Opus 5.5), posted by Foniass without a human check of each point. |
|
merge-check
The test passes both ways, so the pieces still run the right groups. The D3D12 debug layer gives the same 12 messages on base and on the merge, with the profiler on or off, so the span adds none. |
An ExecuteIndirect of a split compute program runs its chain (
dispatch_chain::execute_indirect, from #3499): 16 rounds of a UAV barrier, a piece bind and one PC ExecuteIndirect for each piece. That path opened nogpu_profilespan, while a direct dispatch's chain gets one (bind::translated_dispatch).XCL_GPU_TIMESstarts a call's interval at the previous stamp on the list, so the chain's GPU time went to the next timed call, andXCL_GPU_PROFILEdid not time it at all.How it was found: with
XCL_GPU_TIMESon an RTX 5070 Ti,main1c8b5514showed two compute programs of the Newer Retail Game at 365 and 193 ms a frame. A frame captured on that commit had 510 chained ExecuteIndirects, with runs of them on the same lists right before those two programs. An estimate from their piece counts (not a measurement) puts those runs at about 402 and 208 ms. So most of that time was very probably the chains, not the two programs.This changes no title behaviour. #3528 makes the chain rarer (whole form once built), but the chain still runs while a whole form is being built or after it was refused, so the attribution is needed with it too. No open PR or issue covers this (searched
gpu_profile indirect,GPU times chain,XCL_GPU_TIMES,execute_indirect_chain; #3528 and #3540 do not touch these lines).What is in it
real/dispatch_chain.rs:execute_indirectopens agpu_profilespan (Kind::IndirectDispatch, the program's pipeline, max count 1) after the slicer pass and the chain's bind, only when the bind succeeded, asbind::translated_dispatchdoes for a direct chain. It closes the span after the pieces and the restore of the slicer's commands. A call that hands off to the whole form returns before it, so it is not counted twice. A call whose bind fails runs no piece and is counted as skipped, so it gets no span.XCL_GPU_PROFILEthe span leaves out the slicer pass;XCL_GPU_TIMEScounts it, because its interval starts at the previous stamp on the list.watch::note(ingpu_profile::begin), so they show up in its ring of the last draws and dispatches, which XCL logs on a driver error, a device removal or a stall (TDR).gpu_profile.rs: a#[cfg(test)]thread-local log ofbegin/endcalls for the test.a_chained_indirect_dispatch_is_timed_as_its_own_call(real/dispatch_chain.rs): on one list, a timed call, a chained ExecuteIndirect throughbind::execute_indirect_chain, a timed call; it checks for three spans with the chained program's pipeline in the middle one. Then a chained call whose bind fails, and it checks that this one opens no span.Tested
cargo test -p xcl --lib a_chained_indirect_dispatch_is_timed: 0 passed, 1 failed (two spans, the chain in none). With them: 1 passed.cargo test -p xcl --lib <filter> -- --test-threads=4forgpu_times(5 passed),gpu_profile(2 passed),dispatch_chain(44 passed, 1SKIPPED: no wave64),execute_indirect(12 passed).9f205510(onmain5eaadb54): the full suite ran on39fdef43, whose tree differs only in one comment (a///on the test-onlythread_local!became//to drop an unused-doc-comment warning):cargo build --workspaceok;cargo test --workspace --no-fail-fast -- --test-threads=4: 2975 passed, 0 failed, 52 ignored, 24SKIPPED(22 no wave64, 2 no heap windows). On9f205510,a_chained_indirect_dispatch_is_timed_as_its_own_callpasses.Regression run
scripts/smoke.ps1 -Seconds 60 -Title 9cc6a39e(Newer Retail Game), release builds in clean trees,XCL_PREPARE=0and the same warm DXIL cache, one run each. Themainblock is from earlier today on1c8b5514.main(1c8b5514):This PR (
9f205510):Not tested
XCL_GPU_TIMESorXCL_GPU_PROFILEon this head: the numbers above come from main, and the new split of time between the chain and the next call is not measured yet.AI use
🤖 Generated with Claude Code