Repository navigation
Conversation
lukaslw-lab
approved these changes
Nov 30, 2026
lukaslw-lab
left a comment
Contributor
There was a problem hiding this comment.
Reviewed 31be7fb2 (draft, stacked on #3516) by reading f3793797..31be7fb2; not built or run.
Verdict: approve. The PSO handoff holds: reservations clear and wake under draw_lock on every path, including unwind, and the caller rechecks the recording after each wait or unlock. No MUST.
- SHOULD Split 31be7fb into its own PR, as you offered. It fixes a bug on main and has its own mutation evidence (M2). It also changes upload cost on its own: while list A has a texture pending, any other list that binds it stages its own copy (
reusableneeds!pending_list || pending_list == list,src/startup_stubs/d3d12_draw.inl:2451). Titles that record several lists before the first submit now upload such textures once per list, and use more ring space. No counter tells these restages apart from content changes. One counter plus a title run would show whether ring stalls or dedicated pages go up. - NIT
PsoTargetCache's comment says only rectangle geometry varies within a target signature. That holds becauseeffective_blend_stateanduse_depth_stencildepend only onbound,trandkey.targets(:1990-2000). Say so, so a later change that adds pass state to the PSO also adds it toPsoCacheKey. - Checked, no finding:
- Only
install_graphics_translationmakes a translation ready, and it setsready_device, so no ready path returns a null PSO. translated_rect_geometrynever waits on a PSO reservation, so there is no wait cycle.- Upload revisions are global and only increase, so a released texture whose address is reused cannot match an old record. A failed copy leaves revision 0, which
submit_texture_uploadstreats as not done. - Map references across the unlock are safe (
unordered_mapnodes stay put). - The
info_queueswap is underdebug_lock.
- Only
Tests: pso_load_unlock_* proves creation runs with draw_lock released (M1). pso_load_concurrent_* proves waiters, recipe replay and a mismatched recipe, and the upload ordering (M2). The _FAIL and _ABANDON_ONCE variants reach the null result and the unwind path. CI ran none of them (startup_graphics_* is not in the Windows pr filter). The only results are the author's local 12/12 and mutation runs.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Stacked on #3516; review the last six commits (f379379..31be7fb) — this stays a draft until #3516 merges.
Refs #3451
What changes
#3516 moves shader translation off
draw_lock. The first use of a translated PSO still created it with the lock held. This PR moves that creation out too (pipeline_forinsrc/startup_stubs/d3d12_draw.inl).draw_lockand recheck the cache and their own recording after each wake. Recipe replay is reserved once per key, and rect geometry once per translation.completeflag are written together. A failed driver create is cached as a null result. If the device or the recording changed during the unlock, the result is dropped, the entry stays incomplete, and a waiter can retry.draw_lockheld, including on unwind.pipeline_forthen returns null.draw_lock.removal_deviceandinfo_queueatomics, since the device check can now run withoutdraw_lock. 98ff231 fixes the one remaining plain read, inview_slot.startup_graphics_pso_load_{unlock,concurrent}_{warp,hardware}, gated byX2W_TEST_GRAPHICS_PSO_*environment variables that are inert when unset. Docs:docs/experiments/startup-pso-recipe.md.Unrelated recordings and queue submissions can now take
draw_lockwhile a PSO is being created. The draw that started the creation, and draws waiting for the same state, still complete synchronously.Separate fix in 31be7fb: texture uploads are published when their recording submits
This bug exists on main and is independent of the PSO change. A texture upload copied from the shared upload ring was marked done when it was recorded, not when its list was submitted. Only uploads with a dedicated buffer were tracked per list. A second list could therefore treat the texture as already uploaded, skip its own copy, and sample the texture before the first list's copy had executed if it was submitted first.
31be7fb records every texture copy per list (ring or dedicated). Other lists stage their own copy while one is pending, and the queue marks the upload done at submit, only if the recorded revision is still the current one. Records are dropped on Reset, failed Close and final list release.
The concurrent fixture depends on this fix (it submits a list that reuses a texture staged by another list). I can split it into its own PR on request.
Evidence
Local build at 31be7fb (fresh configure, full build,
-DX2W_WITH_OPUS=OFF): exit 0.12/12 passed:
startup_graphics_pso_load_{unlock,concurrent}_{warp,hardware}(this PR) andstartup_graphics_published_load_{unlock,concurrent,native_backoff,precedence}_{warp,hardware}(#3516). The concurrent pair was rerun 5 more times: 5/5.Mutations, each a full rebuild followed by the same filter:
draw_lock(the unlock guard inpipeline_forreplaced by a no-op):pso_load_unlock_{warp,hardware}andpso_load_concurrent_{warp,hardware}fail on gate timeouts.pso_load_concurrent_{warp,hardware}fail withpublication pixel (0,0) format 28: 00000000 expected ff00ff00;pso_load_unlock_*still pass.Restored source: 12/12.
Earlier failures on 98ff231
An offline build and test job run before 31be7fb failed four tests:
startup_graphics_pso_load_concurrent_{warp,hardware}: the00000000 expected ff00ff00readback above. Cause: the upload bug, fixed in 31be7fb and reproduced by M2.startup_graphics_published_load_precedence_{warp,hardware}:FileNotFoundErrorwhen the check script started its child process. That job had not builtstartup_stream_consumer. With the executable built, both pass. Not a code failure.Not covered
!current()paths ofpipeline_for,draw_lockis retaken and then released and retaken again by the guard. Redundant, not incorrect.