Repository navigation
D3D12.X: count skipped draws and dispatches by cause - #2625
grahamster2 wants to merge 2 commits into
Conversation
|
Update for head AMD run (listed as untested) on an RX 9070 XT, plus an RTX 3060: the new tests pass, and the Head
Not tested: the wave64 |
luckyteagirl
left a comment
There was a problem hiding this comment.
In skipped_calls_are_counted_by_cause, the waited worker sleeps for 50 ms and then fails, but the test relies on dispatch reaching is_pending before that timer expires. If this test thread is descheduled for more than 50 ms under the parallel suite, the worker can finish first; refused stays None and the skip is counted as BuildFailed instead of the asserted BuildingNoWrapper.
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 head f8c774a3; I did not run the test.
luckyteagirl
left a comment
There was a problem hiding this comment.
Could deferred compute ExecuteIndirect retain its console identity when it is put off? A final stand-in release removes both its async record and CONSOLE_COMPUTE marker. On replay, resolve_wait returns the original value, both marker checks fail, and this falls into PC ExecuteIndirect without the new released before submit count. Direct deferred Dispatch reaches the classifier in the same situation. A regression that releases a deferred indirect stand-in before replay would cover this; the existing Released fixture keeps the console marker and invokes direct dispatch. Exact-head source review at f8c774a3b81cef5a21899af803760ecf7e021927; no runtime release/submit test was run. AI-assisted review with Codex.
In world runs of the retail title DISPATCHES_SKIPPED reaches thousands and nothing says which path skipped them. Keep the two totals and add a counter per cause: pipeline still building at record time (split by why the call could not be put off: bundle, predication, no segments left, no wrapper, segment failed), stand-in released before the submit, build failed, no translation, put-off dispatch dropped at the submit, two-pass pipeline, and translated draws or dispatches whose arguments could not be bound. ExecuteIndirect skips counted as DRAWS_SKIPPED are covered too. The non-zero causes are printed in the periodic "console code so far" line.
…stand-in is released before the submit The replayed call no longer asks for the console-compute marker, which the release forgets, and falls through to the PC ExecuteIndirect. The 50 ms sleep in skipped_calls_are_counted_by_cause is replaced by a check on the state after the build.
f8c774a to
428750f
Compare
|
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 I ran the AI use: Claude Code (Claude Sonnet 5.5) wrote this reply. |
|
Good catch, it did not keep its identity, and it is fixed in 428750f. What happened: a put-off ExecuteIndirect is recorded only when Fix: the check at bind.rs:430 now also matches when Test: The smoke pair is refreshed on the new head (1647 frames vs 1642 on AI use: Claude Code (Claude Sonnet 5.5) wrote this reply. |
|
Re-verification on RTX 3060 Ti (Windows 11), new head merged with current
Thanks! — Devin |
|
Review (head 428750f, diff read, not a merge-check; it conflicts with main, so not built or run):
Fine: relaxed counters, the test-only per-thread copies, the log format and AI review: Claude Code (Claude Opus 5.5), posted by Foniass without a human check of each point. |
World 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 onmainb49be18): 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_xonmain08db802); 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).