runtime: recover the published disk pair after a failed native candidate PSO #3874
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/3874"
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?
Imported from R0Y00/Xbox2Windows. Originally posted by Leyukaka on 2026-12-02T16:54:22Z.
Change
Carries #3139 by @lambirou to
mainwith his commits. #3139 was merged into the former integration branch and never reachedmain; his six commits are kept with their author and messages, rebased onto currentmain, followed by one commit of ours (05eff6113).Fixes #3134. Refs #2978 (the remaining main acceptance described in the 12-02 comment).
On
main, a null result from native candidate graphics PSO creation went topipeline_state_unavailableand the draw exited without reloading the published pair. With this change:pipeline_forfalls back to the published disk pair, and bindings are prepared from the translation thatpipeline_forleaves in place (@lambirou's commits).main, so a pair published later in the same process never drew. A refused manifest ends the retries (05eff6113).Fixture (
startup_native_graphics_draw, source-built, same process):X2W_TEST_NATIVE_GRAPHICS_PSO_FAILURE, gated on the candidate); the disk pair's PSO is created normally.<key>.txt,<key>.vs.csoand<key>.ps.csokeep their bytes and modification times.The test hook from #3139 that moved a file from a path given in an environment variable is removed from the runtime; the RTV variant and invalid pixel blob controls now use the consumer's same-process publication instead.
Shared interface touched:
pipeline_foranddraw_translatedinsrc/startup_stubs/d3d12_draw.inl. Open PRs that editpipeline_forwill conflict with this one.Verification
Windows, MSVC, exact head
05eff6113, GPU tests run serially.startup_native_graphics_draw,startup_mrt_dxc,native_rtv_variant: pass on WARP and on hardware (reported separately by the_warpand_hardwaretests).native_rtv_variant_controls,startup_stream_draw,startup_indirect_requests: pass.startup_indirect_*draw, translated, bucket and mesh-cache tests: pass on WARP and on hardware.Evidence and follow-up
No new fixture files; the existing source-built triangle fixture is extended. All inputs are synthetic and generated by the test.
Known points for review:
057bd7403). An indirect draw that is refused later may create a PSO first, and the order of refusal reasons for indirect draws can change. The indirect suite passes.Checklist
Imported from R0Y00/Xbox2Windows. Originally posted by mumba17 on 2026-12-02T20:03:36Z.
Review: COMMENTED
Reviewed
05eff611by reading the diff againstmain1cd972cd, side by side with #3873 (same #3139 carry, same issue). Not built or run. Comment only: I'm not a maintainer.Summary. Of the two, this one looks like the better base: it keeps @lambirou's commits, removes the runtime file-move hook, and handles a pair published after the candidate fails. No blocker found. Points below, most important first.
X2W_TEST_BUMP_TRANSLATION_REVISIONis read withx2w_local::env_onon every translated draw, underdraw_lock.env_onis uncached (local_log.h:17:GetEnvironmentVariableAplusGet/SetLastErroreach call), and draws are the hot path. A function-localstatic const bool, likesync_mesh_requests()in the same file, keeps it a one-time read.X2W_TEST_NATIVE_GRAPHICS_PSO_FAILUREis read only when a candidate's PSO is created, so it's fine as is.root(raw pointer) alive because a recorded list may still use it. Buttr = std::move(fallback)also move-assignsindexed_signature, which is aComPtr<ID3D12CommandSignature>created against the candidate's root (d3d12_draw.inl:2760) and passed toExecuteIndirect(:4395). In the partial case, the candidate's PSO succeeded for one state key and an indexed indirect draw was recorded, then failed for another. Recovery would then release a signature that an unexecuted list may still reference. The injected failure fails every candidate PSO, so the fixture can't reach this. If the partial case is possible, keepingindexed_signaturealongsideroot(or deferring its release) closes it. If it isn't, a comment saying so would help.recover_published_pairloads through the absent cache. A pair published just before the candidate fails can therefore read as absent until the change feed drains, and the draw then recovers on the first retry (1 s later) instead of immediately. #3873 bypasses the absent cache for this one load (use_absent_cache=false, plusnote_cache_writeafter its own publish). Optional, since the retry already covers it.startup_native_graphics_draw_*timeout goes 120 → 180 s with no note on what takes longer. One line in the PR body would help, e.g. the retry wait in the later-publication control.Checked, no finding:
load_translationcallsmanifest_retry.missed()outside the newcountgate (:718), socandidate_retryis scheduled even withcount=false.due()is false once a manifest is refused (found()clearsat), which matches "a refused manifest ends the retries". Until then, a failed candidate returns null before the bound-pipeline cache lookup, so no null PSO is cached for it.native_candidate=falseandrevision = old + 1. The recursivepipeline_fortherefore can't re-enter recovery and can't reuse a candidate-era cache entry, and recipe replay/recording is skipped whilerevisionis set.geometry_rectis derived from the translationpipeline_forleaves intr, anddraw_translatednow creates the PSO before the d16, formatted-buffer and fixed-vertex bindings, so a fallback that drops the fixed stream gets the right key. As your notes say, this moves PSO creation ahead of those refusals for indirect draws.!trpath keepsindirect && trfortranslation_not_ready, as onmain. #3873 widens it toindirect.Compared with #3873 for whoever picks one:
bound.pipelines[cache_key] = nullptr, so that bound stays null for the rest of the process even after the translator publishes the pair.X2W_TEST_MANIFEST_BEFORE_FALLBACK, which moves<path>.pendingto a path taken from the environment insidepipeline_for. This PR removes it and publishes from the consumer.AI-assisted (Claude Code).
Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-12-02T22:27:07Z.
Review: COMMENTED
I checked the trial merge of
05eff611withmain67862ee4. The two conflict hunks are both ind3d12_draw.inl. Please carry forward #3818's depth-view unbind/rebind helpers and #3821's physical descriptor-table refusal. The latter needs to validate the translation that will actually bind resources after PSO recovery, becausepipeline_forcan replacetrwith the disk pair. Keep the direct-draw and exact guest-root requirements for that final translation. A fallback control that verifies the physical-table refusal would make this merge resolution testable. The other files merge cleanly.Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-12-03T04:49:36Z.
One additional integration point for the #2978 fallback: the trial merge of
05eff611onto9dfe168anow also conflicts with #3527 inCMakeLists.txtandtests/startup_native_graphics_draw_check.py. Please keep the shared triangle/environment helpers and the--fixed-slot57mode and itsstartup_native_graphics_fixed_entry_{warp,hardware}registrations. The longer timeout for the fallback fixture can coexist with the existing fixed-entry timeout. After the merge, run both the original fixed-entry and the new later-publication tests on the same build. The earlier depth rebind and final-translation physical-table checks still apply.Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-12-03T05:14:41Z.
Review: COMMENTED
I tried
05eff611onmain9dfe168a(local tree48afc66070f90f7ffa1a12464b3406c95e23834d). The resolution keeps the depth-view unbind/rebind helpers and both fixed-entry test registrations. It keeps the 180-second fallback timeout and the 120-second fixed-entry timeout. The physical-table root check runs on the translation returned bypipeline_for, before bindings are prepared.MSVC Debug, Windows build 26300, WARP 10.0.26100.9818 and RTX 4060 Laptop 32.0.16.1656, debug layer enabled:
ctest --preset dev --no-tests=error -j 1 -V -R '^startup_native_graphics_(draw|fixed_entry)_(warp|hardware)$'passed 4/4, and'^startup_slot67_indirect_dispatch_(warp|hardware)$'passed 2/2. No capability skips. On both adapters the source-built ordinary cold/hot draw read back 16 red and 16 clear pixels. With native PSO creation faulted, the first draw stayed clear and the same-process retry after publication produced the expected pixels. The existing cache-byte and timestamp checks and missing/invalid pair and native-only controls passed.Separately, I marked only the recovered pair as
physical_tablesimmediately after its successful PSO in a temporary diagnostic. In the same fixture, behind a mismatched guest root, both adapters logged the final-translation root refusal and left all 32 pixels clear on both attempts. This isolates the guard ordering. A full physical-table manifest fixture, the just-published-before-fallback case from #3873, and the command signature lifetime review remain open. The diagnostic was restored and no branch was pushed.Imported from R0Y00/Xbox2Windows. Originally posted by Leyukaka on 2026-12-03T05:20:31Z.
Thanks. Rebased onto
9dfe168a0(new headf5c75f6d8). Both conflicts with #3527 are resolved as a union:tests/startup_native_graphics_draw_check.py:triangle_program(),graphics_env(),CLEARand the--fixed-slot57mode are kept as they are on main. The fallback fixture now builds its environment from the shared helper,dict(graphics_env(sdk, cache), X2W_NATIVE_SHADERS_ONLY="0")(:102).CMakeLists.txt: thestartup_native_graphics_fixed_entry_{warp,hardware}registrations are kept with--fixed-slot57andTIMEOUT 120(:2183-2186).startup_native_graphics_draw_{warp,hardware}usesTIMEOUT 180for the later-publication cases (:2182). That one value is the PR's only change to this file.The earlier checks are still in place after the rebase (
src/startup_stubs/d3d12_draw.inl):depth_target_rebind(:1796) still runs after a depth-unbound draw (:4537).physical_tables_refused(:3762) runs before the PSO (:3827) and again on the translation thatpipeline_forleaves in place when a recovered pair raises the revision (:3838).The points from @mumba17's review are in
f5c75f6d8: the candidate's command signature is retained on recovery (:1824-1828),X2W_TEST_BUMP_TRANSLATION_REVISIONis read once (:3775), and the recovery load bypasses the absent cache (:709,:1814).Validation on Windows (MSVC), WARP and a hardware adapter, one build of
f5c75f6d8for all tests:startup_native_graphics_fixed_entry_*(original fixed-entry)startup_native_graphics_draw_*(later-publication controls)16 of the 21 tests in the set passed. The 5 failures are not from this PR:
startup_indirect_translated_draw_{warp,hardware}startup_indirect_translated_refusal_census_{warp,hardware,control_warp}These five fail the same way on unmodified main since #3776. The fix is in #3890, which is under review. I can rerun the full set on top of #3890 once it lands.
Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-12-03T05:32:13Z.
Review: APPROVED
Independently re-reviewed
f5c75f6din a clean trial merge onto2a280a94(treeca6c7bcf6263d44cd48eb85b43201cac1a26d355). The code preserves the fixed-entry fixtures and depth rebind, retains the earlier indexed command signature alongside its root, bypasses the absent-cache lookup during recovery, and checks the physical-table root both before PSO creation and on the replacement translation. MSVC Debugctest --preset dev --no-tests=error -j 1 -V -R '^startup_(native_graphics_(draw|fixed_entry)|slot67_indirect_dispatch)_(warp|hardware)$'passed 6/6. The same five indirect translated draw/refusal-census tests failed on unmodified main and this trial, with the same missing sampled view and refusal-count diagnostics. No capability skips. Windows 11 build 26300, WARP 10.0.26100.9818, RTX 4060 Laptop 32.0.16.1656, debug layer enabled.For the other publication timing, a local deterministic diagnostic published the source-built pair immediately before the first recovery lookup and simulated a stale negative cache. Both adapters read the pair on that lookup, fenced 16 red and 16 clear pixels, and preserved the cache bytes and mtimes. Re-enabling only the old cache lookup produced 32 clear pixels on both adapters. I restored all diagnostic edits.