D3D12.X: count skipped draws and dispatches by cause #2625
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!2625
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-2625"
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?
@grahamster2 on GitHub · 2026-11-26 02:58 UTC · original
grahamster2:skipcount-by-cause→main· +403 −28 · 3 files · 2 commits · openWorld runs of the retail title on one machine logged 5,347 and 6,803 skipped dispatches (aggregate counts from two runs), but nothing says which path skipped them, which blocks diagnosing a world-load stall. This keeps the two totals (
DRAWS_SKIPPED,DISPATCHES_SKIPPED) and adds a counter per cause. The non-zero ones are appended to the existing periodic "console code so far" log line, e.g....; skipped by cause: building: no wrapper 4, released before submit 1, build failed 56, dropped at submit 1; coherent ...(the format, as printed by a unit test run). That line is printed when a total reaches a power of two (64, 128, ...), and the counters are plain relaxed atomics read without a lock, so a printed line is a snapshot that may be a count or two behind. No behaviour change except the replayed ExecuteIndirect case described below: every other skip site still skips exactly as before.What is in it
crates/xcl/src/hle/d3d12x/bind.rs: aCauseenum with a counter each;skip(total, cause)replacescount(..._SKIPPED)at every skip site, including the ExecuteIndirect ones counted asDRAWS_SKIPPED(so the causes add up to the two totals);dispatch_droppedcounts "dropped at submit". Causes: pipeline still building at record time and the call was not put off, split by why (bundle, predicated, no segments left, no wrapper, segment could not be made; plain "building" when nothing refused it, e.g. a late pipeline), put off but the stand-in was released before the submit, build failed, no translation (nothing builds the pipeline), dropped at submit (no allocator / Reset failed), two-pass pipeline, translated draw or dispatch whose arguments could not be bound. When a call could not be put off, that reason is kept through the wait for the build and is what gets reported, whatever the build did in the meantime (withXCL_PSO_WAIT_MSunset the call blocks until the build is done, so the state read after the wait says nothing about the refusal).crates/xcl/src/hle/d3d12x/list_x.rs:deferreturnsResult<(), Cause>(the reason is worked out from the same checkssplitmakes, after it said no);record_deferredmarks the thread as recording at the submit (restored by a drop guard), which is how "released before submit" is told apart from "no translation".crates/xcl/src/hle/d3d12x/bind.rs,execute_indirect: the one line that is not a counter. A put-off ExecuteIndirect dispatch is replayed at the submit; if the title released its stand-in by then, the release has forgotten the console-compute marker, the check for "this was a console dispatch" failed and the call fell through to the PC ExecuteIndirect. The replay now counts as one (AT_SUBMIT, which is only set for calls that were put off because they were console compute), so it is skipped and counted as released before submit, like the direct Dispatch. That is a behaviour change for that one case.crates/xcl/src/hle/d3d12x/pso_async.rs:build_state(pso)(untracked, building, failed, built).skipped_calls_are_counted_by_cause(failed build, still building with no wrapper for a Dispatch and an ExecuteIndirect dispatch, a refusal that wins over the failed build the wait ended with (checked on the state after the build, with no timing in it), no translation, released at the submit for a Dispatch and for an ExecuteIndirect dispatch whose stand-in was released before the replay, dropped, the guard after a panic),a_dispatch_that_cannot_be_put_off_is_counted_by_why(a bundle list and a predicated list throughdefer, on a real or WARP device),the_log_line_names_only_the_causes_that_happened, and cause assertions in the two-pass test and the deferred-dispatch test. They check each skip moves exactly one cause and that the causes add up to the totals, with per-thread mirrors of the counters (test builds only) so tests running in parallel do not see each other's skips.Tested
cargo test -p xcl --libon the head428750f(rebased onmainb49be183): 1312 passed, 0 failed, 27 ignored in two of three runs; 24 SKIPPED lines (wave64 and f16 GPU tests that this adapter cannot run). The third run failed two tests inhle::d3d12x::sparse::tests(a_tile_decommitted_and_committed_again_keeps_its_video_memory,flush_parked_does_not_free_or_reuse_tiles_while_unmap_is_in_flight);sparse::alone passed 17 of 17, andmainpassed three of three full runs. I did not look into it; no file of this PR is insparse.skipped_calls_are_counted_by_cause, thecausefilter, three runs in a row: pass. With the one-line fix inexecute_indirectremoved, the new released-ExecuteIndirect case fails.a_dispatch_with_a_pipeline_still_building_waits_at_the_submit(an existing timing test) failed now and then when run together with other tests, onmaintoo (4 of 20 runs ofcargo test -p xcl --lib -- d3d12x::bind d3d12x::list_xonmain08db8020); it did not fail in the runs above.Regression run
main:
PR:
Frames 1647 vs 1642 on main, peak commit 14695 MB vs 14891 MB, one 60 s run each, default settings.
Not tested
cargo test --workspace(only-p xcl --libwas run); the e2e tests.AI use
AI-assisted (Claude Code).
@DarkPanda69 on GitHub · 2026-11-26 03:06 UTC · original · edited 2026-11-26 06:55 UTC
Update for head
428750f: rerun onmainb49be18, same cards and--nocapture. Thecausefilter gives 2 passed on both the RX 9070 XT and the RTX 3060.d3d12x::gives 257 passed, 0 failed, 2 ignored, no SKIPPED, on both.AMD run (listed as untested) on an RX 9070 XT, plus an RTX 3060: the new tests pass, and the
d3d12x::tests pass on both cards.Head
f8c774aapplied onmainb49be18, debug, Windows 11 Pro 26200, card chosen withXCL_ADAPTER, run with--nocapture:causefilter (skipped_calls_are_counted_by_cause,the_log_line_names_only_the_causes_that_happened): 2 passed on the RX 9070 XT (RDNA4, driver 32.0.32029.2010). Thepanicked at bind.rs:1876: a panic in a put-off callline in the output is the test's owncatch_unwindcase.cargo test -p xcl --lib -- d3d12x::: 257 passed, 0 failed, 2 ignored, no SKIPPED, on both the RX 9070 XT and the RTX 3060 (driver 32.0.16.1088).a_dispatch_that_cannot_be_put_off_is_counted_by_whyis among them.Not tested: the wave64
gpu::paths (this change is inbind.rs/list_x.rs/pso_async.rs), the e2e tests, the new log line in a world run, Intel.AI use: Claude Code (Claude Opus 5.5) ran the tests on this machine and wrote this report.
@luckyteagirl on GitHub · 2026-11-26 05:00 UTC · original · reviewed
In
skipped_calls_are_counted_by_cause, thewaitedworker sleeps for 50 ms and then fails, but the test relies ondispatchreachingis_pendingbefore that timer expires. If this test thread is descheduled for more than 50 ms under the parallel suite, the worker can finish first;refusedstaysNoneand the skip is counted asBuildFailedinstead of the assertedBuildingNoWrapper.Could the worker wait on an explicit release signal until after the refusal path is entered, or could the precedence be asserted directly with
unbuilt_cause(waited, Some(Cause::BuildingNoWrapper))after a completed failure? This is a source review at headf8c774a3; I did not run the test.@luckyteagirl on GitHub · 2026-11-26 05:50 UTC · original · reviewed
Could deferred compute
ExecuteIndirectretain its console identity when it is put off? A final stand-in release removes both its async record andCONSOLE_COMPUTEmarker. On replay,resolve_waitreturns the original value, both marker checks fail, and this falls into PCExecuteIndirectwithout the newreleased before submitcount. Direct deferredDispatchreaches the classifier in the same situation. A regression that releases a deferred indirect stand-in before replay would cover this; the existingReleasedfixture keeps the console marker and invokes direct dispatch. Exact-head source review atf8c774a3b81cef5a21899af803760ecf7e021927; no runtime release/submit test was run. AI-assisted review with Codex.f8c774a3b8to428750f718@grahamster2 on GitHub · 2026-11-26 06:34 UTC · original
Both points are fixed in
428750f.Timing test: the 50 ms sleep is gone. The refusal-wins-over-build-failure case no longer races a build against the call. It now waits for the build to fail, checks
build_stateisFailedand thatunbuilt_cause(waited, None)isBuildFailed, then checks thatunbuilt_cause(waited, Some(BuildingNoWrapper))isBuildingNoWrapperand counts as exactly one skip (bind.rs:1867). That is your second suggestion. I did not keep a variant that callsdispatchwhile a worker is held, because the call blocks inresolve_waituntil the build ends, and any signal that opens the gate only after the refusal was decided would need a hook into the wait that does not exist. The one thing this no longer exercises is thedispatchcall site passingrefusedthrough, which the "still building, not put off" case above it still covers for the not-waited path.I ran the
causefilter three times in a row and the full lib suite three times. One full run failed twohle::d3d12x::sparsetests that this PR does not touch; they pass alone and in the other runs (details in the description).AI use: Claude Code (Claude Sonnet 5.5) wrote this reply.
@grahamster2 on GitHub · 2026-11-26 06:34 UTC · original
Good catch, it did not keep its identity, and it is fixed in
428750f.What happened: a put-off ExecuteIndirect is recorded only when
signature_dispatches(sig) && is_pending(raw_pso) && is_console_compute(raw_pso)(bind.rs:380). At the submit it is replayed throughat_submit(list_x.rs:2726). If the title released the stand-in in between,standin_released(real.rs:1711) callsforget_pso, which removes theCONSOLE_COMPUTEentry, andpso_async::releaseddrops the pending entry. On the replayresolve_waitreturns the address unchanged,is_console_computeis false for bothraw_psoandpso, so the check at bind.rs:430 did not match and the call went on to the PCExecuteIndirect, with no skip and noreleased before submitcount. A deferred directDispatchwas fine: its branch (!is_translated_compute) does not look at the marker and reachesunbuilt_cause, which reportsReleasedthrough theAT_SUBMITflag (bind.rs:153). The oldReleasedfixture kept the marker, so it only covered that Dispatch path.Fix: the check at bind.rs:430 now also matches when
AT_SUBMITis set, since only a console compute call is ever put off, so the marker is not needed to know what the replayed call was. It is skipped and counted underReleased. This is a behaviour change for that one case: before, the call reached the PCExecuteIndirect; now it is skipped, like the Dispatch.Test:
skipped_calls_are_counted_by_causehas a new case (bind.rs:1883): a console compute pipeline registered then forgotten (marker gone, no stand-in), an ExecuteIndirect with a dispatch signature replayed throughat_submit. It expects one skip underReleasedand no PCExecuteIndirectcall on the fake list. With the one-line fix removed, the test fails. It runs on a fake list, not a real release and submit, so the retail path is not run.The smoke pair is refreshed on the new head (1647 frames vs 1642 on
main, no device removals, no crashes), and the description is updated.AI use: Claude Code (Claude Sonnet 5.5) wrote this reply.
@DavidM1911 on GitHub · 2026-11-26 08:29 UTC · original
Re-verification on RTX 3060 Ti (Windows 11), new head merged with current
main:cargo test -p xcl --lib: all passed, 0 failed, 27 ignored. The earlier merge conflict is resolved.Thanks!
— Devin
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.