Repository navigation
D3D12.X: a skipped ExecuteIndirect inside an occlusion query leaves it visible - #2550
tiagonleal wants to merge 2 commits into
Conversation
There was a problem hiding this comment.
Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.
An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.
|
Full-suite run, since this PR has no test report yet. Tested exact head Tested
Not tested
AI use
|
|
Test run on exact head Tested
Regression run (60 s, default settings, a retail title) main: this PR: No crash or device removal; frames 105 % of Not tested
AI use
|
|
Verification on RTX 3060 Ti (Windows 11), branch merged with current
Thanks! — Devin |
|
Independent AMD RDNA4 (native wave64) verification of exact PR head Tested
(Compare against Not tested
AI use
|
Eliminate the global sparse STATE lock convoy across synchronous GPU fence waits in sparse::readback_now (triggered on ID3D12Resource::Map readbacks) by pooling per-Map ReadbackJob objects (COPY command allocator + list + persistently-mapped READBACK staging buffer + OS fence event) outside STATE. STATE is now only held briefly to flush pending zero/dirty pages and snapshot mapped spans, to submit/signal on the copy queue, and to copy still-committed non-hole bytes back into host memory after the fence wait completes unlocked. Also adapt three upstream fixes cleanly atop our runtime branch: - #2548: use pso_async::resolve (non-blocking) instead of resolve_for_bind in device_x::create_list, list_x::kickoff_x, and list_x::reset_pc so list creation/reset with a compiling compute PSO never stalls the title thread. - #2549: preserve own_alloc when split() reuses a spare segment whose previous recording held deferred dispatches' allocator. - #2550: add pso_async::is_stand_in and bind::note_skipped_indirect to call list_x::note_dropped_draw on skipped graphics ExecuteIndirect paths (including stand-in / two-pass PSOs) so dropped draws stay tracked consistently. Assisted-by: Antigravity (Gemini 4 Neon High)
…ixes Integrates upstream amd-dev 61121fe/xcl-dev#2569 (DirectStorage ordered completion wakeups) plus open PRs xcl-dev#2577 (skip AMD cache-reference driver blobs on disk, xcl-dev#2512), xcl-dev#2578 (clear LAST_CONTENT on placed texture unmap/remap, xcl-dev#2460), xcl-dev#2579 (mark put-off builds wanted immediately), xcl-dev#2556 (NULL-ppv CreateDescriptorHeap test), xcl-dev#2550 (skipped ExecuteIndirect occlusion query), xcl-dev#2549 (reused spare keeps in-flight deferred allocator, with Wine raw fences and UnadoptGuard), and xcl-dev#2548 (Reset/KickoffX/CreateCommandList do not wait on building compute pipelines). Assisted-by: Antigravity (Gemini 4 Neon)
|
Tested: current PR head merged onto current
Not tested: retail titles (no title data on this lane, counts only). AI use: Hermes agent (local Qwen-class) ran both machines and drafted this; I checked it before posting. |
…port upstream xcl-dev#2550) (cherry picked from commit b281526d1017705358eb97cdf83e2c57d97ec007)
|
Independent desktop NVIDIA verification of PR #2550 at head Environment
Targeted release tests & build (
|
| Command | Result |
|---|---|
cargo test --release -p xcl --lib execute_indirect_skipped_inside_an_occlusion_query_reports_visible -- --nocapture (3 consecutive runs) |
1 passed; 0 failed; 0 ignored; 1324 filtered out × 3 (0.00s × 3, 0 skipped) |
cargo test --release -p xcl --lib hle::d3d12x::bind:: -- --test-threads=1 (3 consecutive runs) |
9 passed; 0 failed; 0 ignored; 1316 filtered out × 3 (0.43s × 3, 0 skipped) |
cargo test --release -p xcl --lib hle::d3d12x::list_x:: -- --test-threads=1 (3 consecutive runs) |
40 passed; 0 failed; 0 ignored; 1285 filtered out × 3 (1.17s, 1.15s, 1.13s, 0 skipped) |
cargo test --release -p xcl --lib hle::d3d12x::pso_async:: -- --test-threads=1 (3 consecutive runs) |
14 passed; 0 failed; 0 ignored; 1311 filtered out × 3 (1.19s × 3, 0 skipped) |
cargo build --release -p xcl |
Clean build (1m 08s, exit 0, 0 new warnings) |
Paired quiet 60 s retail smoke (title: 29640639)
Exact parent & merge-base (e1d84b7d9153f86a97d2ec5d209d196046fc0bea, cached baseline on the same machine):
xcl-smoke v1
commit: e1d84b7d9153f86a97d2ec5d209d196046fc0bea
gpu: NVIDIA GeForce RTX 4060
title: 29640639
seconds: 60
exit: 0x0
frames shown: 1531 (PresentX 1531)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 13982 MB
PR #2550 (e033310cd7b91767391f65080629a79c2664b9f8):
xcl-smoke v1
commit: e033310cd7b91767391f65080629a79c2664b9f8
gpu: NVIDIA GeForce RTX 4060
title: 29640639
seconds: 60
exit: 0x0
frames shown: 1598 (PresentX 1599)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 14016 MB
Runtime log observations (xcl.log)
9221log lines,0[ERROR]/ device-removal / panic lines.- Final draw/memory telemetry in log:
19522 draws with translated pipelines (0 skipped, 0 with PC pipelines), 1024 dispatches (0 skipped); last memory sample14015 MB committed by the process; video memory 6115 MB local, 4682 MB non-local.
Limits of coverage
- Marking an active occlusion query visible when an
ExecuteIndirectis skipped (stand-in/untranslated pipeline) was verified viaexecute_indirect_skipped_inside_an_occlusion_query_reports_visible(3/3),hle::d3d12x::bind::(9/9× 3),hle::d3d12x::list_x::(40/40× 3), andhle::d3d12x::pso_async::(14/14× 3). - The warm-cache 60 s retail smoke on
title: 29640639logged0skipped draws/dispatches, so it confirms zero runtime regression on normal occlusion-query / indirect-draw paths (frame-count and commit deltas vs. cached parent reflect single-run startup variance, not this PR).
AI disclosure: test execution and report drafting assisted by Google Antigravity (Gemini 4 Neon).
|
merge-check claim |
|
merge-check |
|
@throny thanks for the check. From reading the code, that test cannot be affected by this PR, and it fails on
Measured afterwards on
AI use: Claude Code. Claude Opus 5.5 traced the test and the PR's hunks; Claude Fable 5.2 checked the lines named here and wrote this. |
|
merge-check claim |
|
merge-check |
7181b4c to
3df4e01
Compare
|
merge-check claim Re-check of the new head (my earlier check was on the head before the rebase). |
|
merge-check |
3df4e01 to
f169911
Compare
|
No open or merged PR makes the same change. main still calls AI review: Claude Code (Claude Opus 5.5), diffs read only, not built or run; not checked by a human. |
| /// An ExecuteIndirect that could have drawn is skipped: an occlusion query open on the list | ||
| /// reads as visible, as for a skipped draw (`graphics_bound`). A Dispatch signature makes no samples. | ||
| fn note_skipped_indirect(this: *mut c_void, signature: IndirectSignatureInfo) { | ||
| if !signature.dispatches() { |
There was a problem hiding this comment.
!dispatches() treats every non-Dispatch signature as draw-capable, but a valid ExecuteIndirect signature can contain only root-argument updates. When that root-only signature is skipped here, note_dropped_draw marks an active occlusion query visible even though no draw produced samples. Could signature classification also record whether a draw argument is present and force visibility only for draw-capable signatures? AI-assisted static review: I used an AI assistant to inspect this path; I checked the signature rules against https://learn.microsoft.com/en-us/windows/win32/api/d3d12/nf-d3d12-id3d12device-createcommandsignature.
There was a problem hiding this comment.
As far as I know D3D12 does not allow a signature with only root-argument updates: it needs exactly one draw or dispatch argument, and it has to be the last one, so that case cannot reach ExecuteIndirect. Your point holds for the classification though. It only recorded Dispatch, so a skipped DispatchRays would have marked the query visible. The signature now notes whether it has a Draw, DrawIndexed or DispatchMesh argument, and only those mark the query. 22d4819 has the change and the tests.
- Tiago
…t visible
A draw that XCL drops while an occlusion query is open marks the query so it
resolves as visible (list_x::note_dropped_draw). A skipped ExecuteIndirect
did not, so a title's occlusion query around skipped indirect draws resolved
to 0 samples and the title could treat the objects as hidden.
execute_indirect now calls note_dropped_draw for the skips that could
have drawn: a pipeline still being built or unavailable, a two-pass mesh
pipeline, a root-changing signature with a translated graphics pipeline,
and a failed ABI bind of a graphics pipeline. A Dispatch signature makes no
samples and is left out, as are the console compute skips. graphics_bound
marks the two-pass skip too, and a draw with a stand-in whose build failed
(pso_async::is_stand_in) like one still being built.
Test execute_indirect_skipped_inside_an_occlusion_query_reports_visible
(pending, Dispatch signature, two-pass, root-changing): before the fix it
fails ("a pipeline still being built"); after it passes 5 of 5 alone. The
failed-ABI path and graphics_bound have no test (they need a real list).
The skipped-ExecuteIndirect check took every signature without a Dispatch argument as one that could draw. A command signature now notes whether it has an argument that makes samples (Draw, DrawIndexed or DispatchMesh). One whose arguments make no samples (Dispatch, DispatchRays, or root arguments only) no longer marks an open occlusion query visible; a drawing signature, or one never noted, still does. Tests: execute_indirect_skipped_inside_an_occlusion_query_reports_visible adds a DispatchRays signature and a root-arguments-only one (not visible), a drawing one and an unknown one (visible); signature_draws_only_with_a_rasterising_argument checks the classification of each argument type and of root arguments alone.
f169911 to
22d4819
Compare
|
Follow-up review (head 22d4819, since f169911, 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. |
A draw that XCL drops while an occlusion query is open marks the query, so ResolveQueryData reports it as visible (
list_x::note_dropped_draw, used bygraphics_bound). An ExecuteIndirect that XCL skips did not do this. A title's occlusion query around skipped indirect draws resolved to 0 samples, and the title could take the objects as hidden. Open PR #1798 lets a draw go on with a stand-in while its graphics pipeline is built, which makes a skipped ExecuteIndirect the usual case during pipeline building; this change does not depend on it, because pipelines that are late, two-pass or without a usable ABI are skipped on main too. No existing PR or issue covers this (searched for "occlusion ExecuteIndirect", "note_dropped_draw", "occlusion query skipped"; #1991 addednote_dropped_drawfor draws only).Rebased onto
main1c8b5514(no conflicts); before that ontod8bd9a38, and the earlier merge checks were one033310c.mainrewrote this code (5b03933's signature snapshot, a pipeline choice before each ExecuteIndirect), so this is a port:note_skipped_indirecttakes theIndirectSignatureInfosnapshot, the note sits onmain'sbound_unbuiltskip and also on its newUnavailableskip (no usable pipeline, asgraphics_boundalready treats it), andis_stand_inreadsbuild.real, wheremainmoved the field.mainnow sends a two-pass pipeline with a signature that is not DispatchMesh to a new skip (dispatch_mesh_sig_ofreturns None); the note is there too. The test registers its signatures throughnote_indirect_signature; with the note switched off it still fails at "a pipeline still being built".What is in it
bind.rs:execute_indirectcallsnote_dropped_drawon the skips that could have drawn: a pipeline still being built, a finished two-pass mesh pipeline, a root-changing signature with a translated graphics pipeline, and a failed ABI bind of a graphics pipeline. A signature that makes no samples is left out (see the next bullet), and so are the console compute skips.graphics_boundalso marks the two-pass skip, and a draw whose pipeline build failed (a stand-in with no real pipeline) is marked like one still being built.bind.rs,device_x.rs(second commit): a command signature notes whether it has a Draw, DrawIndexed or DispatchMesh argument. A skipped ExecuteIndirect whose signature has none (Dispatch, DispatchRays or root arguments only) no longer marks the query visible; a signature never noted still does. Before, only a Dispatch argument was left out. Testsignature_draws_only_with_a_rasterising_argument(device_x.rs) checks each argument type and root arguments alone.pso_async.rs:is_stand_in(pso), true while the pipeline is being built or after its build failed.list_x.rs: two#[cfg(test)]helpers for the test.execute_indirect_skipped_inside_an_occlusion_query_reports_visible(bind.rs): BeginQuery, ExecuteIndirect, EndQuery on a fake list, for a pipeline still being built (reads visible), the same pipeline with a Dispatch or a DispatchRays signature (does not), with a drawing signature and with one never noted (both visible), a two-pass pipeline and a root-changing signature that draws (both read visible), and a root-arguments-only signature (does not).Tested
cargo test -p xcl --lib execute_indirect_skipped_inside: 0 passed, 1 failed ("a pipeline still being built"). After the fix, run 5 times: 1 passed each time.cargo build --workspaceandcargo test --workspace --no-fail-fast -j 4 -- --test-threads=4, run twice: 1420 passed, 4 failed, 46 ignored both times (25SKIPPEDlines). The 4 failures aregpu::dxil::fuzz_tests::fuzz_validate_and_gpu_0..3, which fail the same way onmain.maind8bd9a38(headf169911a):cargo test --workspace --no-fail-fast -j 8 -- --test-threads=4, one run: 2615 passed, 4 failed, 49 ignored (26SKIPPEDlines). The 4 failures aregpu::dxil::fuzz_tests::fuzz_validate_and_gpu_0..3. The 4 are thefuzz_validate_and_gpu_*tests, which fail onmainhere too (Recompiler: LDS ds_sub_u32 hides its negation from the driver (RTX 50 refuses it) #1919 fixes them);main's run had a fifth failure, the intermittent e2e check reported in D3D12.X: a submit misses a CPU write into memory idle for 1.5 s (hot write-watch looks); intermittent e2e failure #3382. Onmaind8bd9a38on this machine the same command gave 2613 passed, 5 failed, 49 ignored (26SKIPPEDlines). The other results in this section are from the earlier heads named in them.22d48190(rebased ontomain1c8b5514, with the second commit), debug:cargo build --workspaceok;cargo test --workspace --no-fail-fast -- --test-threads=4: 2911 passed, 0 failed, 51 ignored, 24SKIPPEDtests (20 of them no wave64). Both tests above pass.Regression run
scripts/smoke.ps1 -Seconds 60 -Title 9cc6a39e(Newer Retail Game), release builds of both commits in clean trees,main1c8b5514first, then this PR's head, one run each. Both runs hadXCL_PREPARE=0and the same warm DXIL cache.main(1c8b5514):This PR (
22d48190):Not tested
execute_indirectand thegraphics_boundchanges have no unit test of their own: they need a real command list and unified memory.AI use
🤖 Generated with Claude Code