Repository navigation
D3D12.X: a split program's failed whole build is not tried again - #2629
Royalflamejlh wants to merge 2 commits into
Conversation
`Chain::whole` kept the whole pipeline of a split compute program once it was built, and returned a failure without keeping it. So every later call that needs that form built it again: each `ExecuteIndirect` of the pipeline and each dispatch that gets no scratch, on the title's thread and under the chain's lock. The program is large by construction (splitting is for large programs), so each try can take the driver seconds or more and fail again. The outcome is kept in the `OnceLock`, a failure too. Its `get_or_init` lets one caller build and the others wait, so the separate lock goes. A failure is now final for the program, as a failed build is in `pso_async`. The `ExecuteIndirect` warning for it is capped as the `Dispatch` one is: it now comes at the call rate, not once a compile. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Full-suite run, since this PR has no test report yet. Tested exact head Tested
Not tested
AI use
|
luckyteagirl
left a comment
There was a problem hiding this comment.
Could this avoid caching recoverable pipeline-creation failures as a permanent None? The new OnceLock<Option<_>> stores the result of the first whole build forever, while PipelineBuilder::pipeline drops the HRESULT. D3D12 can return E_OUTOFMEMORY when memory is insufficient. If the first whole build hits temporary pressure and memory later becomes available, subsequent chain dispatches still cannot retry; main would retry. Keeping the HRESULT and retrying or backing off for recoverable failures would retain the intended one-time cache for permanent refusals. A builder that fails once with OOM and then succeeds would cover this path. Source review only at head bf200e16; I did not reproduce live-device OOM. AI-assisted with Codex (GPT-6.2 Sol).
… once more A failed whole build is kept so it is not compiled again at every call that needs it. Out of memory can pass, though, and then a program that failed once under memory pressure never got its whole form for the rest of the run (luckyteagirl's review). Such a failure now waits 10 s and is tried once more; a second failure, and any other, stays final. Once, because a driver can also refuse a program with out of memory every time (`translated_compute_pso_once` records an AMD one, 15 to 23 s a try), and then each try would be seconds on the title's thread again. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
73798ca to
8bfaa12
Compare
|
@luckyteagirl yes: an Once, and not at every pause, because a driver can also refuse a program with out of memory every time: The new test is your case without the success: a builder that always runs out of memory builds once, not again within the pause, once more after it, and then not again. A success after a failure would need a real compute program in the test.
AI use: Claude Code (Claude Opus 5.5) wrote the change, the test and this reply, and ran the tests and the smoke run. Posted without review by a person: the account owner was away and reads replies later. |
…ry (port upstream xcl-dev#2469 + xcl-dev#2532 + xcl-dev#2543 + xcl-dev#2629) (cherry picked from commit bc14f1d8b191b3935c9829a539454b6226c542d0)
Retain deterministic whole-form build failures per exact immutable dispatch chain so repeated Dispatch and ExecuteIndirect calls do not re-enter the driver. Preserve success memoization and cap repeated ExecuteIndirect warnings. Treat E_OUTOFMEMORY as transient: suppress attempts for ten seconds, then serialize one retry and retain success. Recreating the chain receives a fresh outcome. Adapted from xcl-dev#2629. Locally cross-checked with the GNU Windows target; Windows execution and GPU smoke remain untested here. Assisted-by: Codex (GPT-5.6-sol)
|
Independent Windows check of #2629 head Windows 11 build 26300, Ryzen 7 9800X3D, RTX 3080 Ti 12 GB (driver 621.35, active display adapter), rustc 1.99.1 MSVC, DXC 1.8.2502.11.
The tests use synthetic failed pipeline creation. I did not induce a failed whole build in a live title or run a paired retail smoke. Source review of this exact head found no new retry-lock or chain-lifetime issue; the documented second-OOM permanent failure remains a deliberate policy tradeoff, not a result established by a title run. AI use: Codex (GPT-6.2 Sol) checked the exact-head code, ran the commands, and drafted this report. I verified the test counts before posting. |
Retain deterministic whole-form build failures per exact immutable dispatch chain so repeated Dispatch and ExecuteIndirect calls do not re-enter the driver. Preserve success memoization and cap repeated ExecuteIndirect warnings. Treat E_OUTOFMEMORY as transient: suppress attempts for ten seconds, then serialize one retry and retain success. Recreating the chain receives a fresh outcome. Adapted from xcl-dev#2629. Locally cross-checked with the GNU Windows target; Windows execution and GPU smoke remain untested here. Assisted-by: Codex (GPT-5.6-sol)
A split compute program whose whole form fails to build is no longer built again at every call that needs it.
Chain::wholekept the whole pipeline once built, and returned a failure without keeping it. So every later call that needs that form ran the whole compile again, on the title's thread and under the chain's lock. Onmainthat is everyExecuteIndirectof a split program (bind.rs,dispatch_chain::whole) and every dispatch that gets no scratch: a list with no tracked allocator, a bundle, a scratch allocation that failed. The program is large by construction, since splitting is for large programs, so each try can take the driver seconds and fail again.Part of #2088. A failure is now final for that program, as a failed build is in
pso_async(complete, 0 = failed): its later calls skip their dispatch instead of trying again. The exception isE_OUTOFMEMORY, which can pass: such a build is tried once more, 10 s later, and a second failure stays final (a driver can also refuse a program with out of memory every time).What is in it
crates/xcl/src/hle/d3d12x/real/dispatch_chain.rs: the outcome of the whole build, a failure too, is kept in the chain'sOnceLock; a first out-of-memory failure is not kept, andretry_atholds the time of its one more try.PipelineBuilder::pipelinereturns the HRESULT.retry_at's lock lets one caller build while the others wait, in place ofbuild_whole.crates/xcl/src/hle/d3d12x/bind.rs: theExecuteIndirectwarning for a failed whole form is capped at 4, as theDispatchone is: a kept failure now comes at the call rate, not once a compile.a_whole_form_that_fails_to_build_is_not_built_again(the chain's pipeline creation always fails and counts its calls; two calls ofwholemake it build once) anda_whole_form_that_ran_out_of_memory_is_tried_once_more_after_a_pause(it always runs out of memory: one build, none within the pause, one more after it, then none).Other branches
dispatch_chain.rsat its head97a70a7(both changeChain): it adds a background caller ofChain::whole(want_whole), usesbuild_wholeto let a title thread go before that build's turn, and reads theOnceLockinexecute_indirect. The same change for it keeps that lock and only keeps the failure (.flatten()at that read): our fork'sarch/split-whole-failure-on-2404(90f2c1f; itsdispatch_chain::tests, D3D12.X: an ExecuteIndirect of a split program runs its pieces #2404's new one among them: 8 passed on the RTX 2070 SUPER). D3D12.X: an ExecuteIndirect of a split program runs its pieces #2404 has since moved to5b9d4ff, where this conflicts again; the copy for that head builds, and its tests are still to run.nvidia-devaf2cecc(which now containsmainb49be18) conflicts with this inbind.rsanddispatch_chain.rs: it putspso_async::pc_call()around the build and logs a huge program the driver refuses. The same change rebased on it, both commits, isarch/split-whole-failure-nvidia-dev6626347, which keeps both.ExecuteIndirectD3D12.X: an ExecuteIndirect of a split program runs its pieces #2404 cannot chain and by a dispatch whose scratch cannot be made. D3D12.X: keep caller allocator for untracked lists and retain whole PSOs in dispatch_chain #2333 and D3D12.X: compute pipelines not used for a while are released on NVIDIA #2526 merge intomainbut conflict with this indispatch_chain.rs's tests: both add tests at the end of the module, and their tests build aChainwithbuild_whole. Whichever merges after this one drops that field, and D3D12.X: keep caller allocator for untracked lists and retain whole PSOs in dispatch_chain #2333 wraps its pipeline asOnceLock::from(Some(..)).Tested
8bfaa12onmainb49be18.mainwith only the test added: failed, the pipeline was built twice (left: 2,right: 1). On this branch:cargo test --workspace --no-fail-fast -- --test-threads=4: 1,437 passed, 0 failed, 47 ignored, both new tests among them. 29 SKIPPED lines: 21 no wave64, 3 wave32 per-lane forms refused, 3 no D3D12 debug layer, 1 no heap windows, 1pso_measurement_compiles_an_exact_synthetic_record(the driver cache cannot be turned off without Windows Developer Mode).Regression run
main:
PR:
Not tested
XCL_DIRECT_DXIL=1(300 s, RTX 5070 Ti, a tree without this change) met failed whole builds, but only in the second after the device was removed: every pipeline creation then failed with 0x887a0005 in about 1 ms, so building again cost little. The case this is for, a driver that refuses or runs out of memory on a large split program's whole form while the device is alive, no run has shown.XCL_DIRECT_DXIL=1, the only path that splits programs, so they do not reach the changed code; they are a regression check only.AI use