startup: prepare graphics translations outside draw_lock #3518
No reviewers
Labels
No labels
accessibility
awaiting author
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
priority: P0
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/R0Y00--Xbox2Windows!3518
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-3516"
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?
@Leyukaka on GitHub · 2026-11-29 20:22 UTC · original
Leyukaka:startup-graphics-load-off-draw-lock→main· +1066 −181 · 7 files · 10 commits · draftRefs #3453 (graphics part, taken over in #3453 and #3453).
Draft, kept as a draft under our open-PR cap in #3516.
Why
In a long local run of the application, presents stopped about 32-37 s before the application's watchdog fault, while cold graphics translations were being loaded and compiled under
draw_lock. #3508 moves this work off the lock for compute only.The approach follows @lukaslw-lab's compute design in #3469 (worker/unlocked translation); this PR is a separate implementation for graphics.
What changes
src/startup_stubs/d3d12_draw.inl: preparing the translation of a cold graphics key now runs on the initiating call withdraw_lockreleased. Preparation covers the key hash and plain-key.txtprobe, request writes, manifest and bytecode reads, eligible native compilation and translated root signature creation, for base keys and RTV variants.attach_device(d3d12_xs_device.cpp) now writes the device global under the lock.CREATE_NEW, renamed without replace.docs/startup-runtime.mdgets a section on the lock scope. The edit also removes the sentence saying native translation covers compute only.What stays under the lock
Translated PSO creation and command recording. Moving PSO creation is a follow-up.
Tests
New, in
tests/cmake/startup_graphics_published_load.cmake, each on WARP and hardware:startup_graphics_published_load_unlock_*: with a cold load paused, a draw on another key and a guest queue submission complete before the load is released.startup_graphics_published_load_concurrent_*: a same-key peer waits and the key is prepared once; an interrupted attempt is retried after its deadline and not before; a result prepared on a superseded device is not installed.startup_graphics_published_load_native_backoff_*: in native-only mode, an abandoned preparation is not re-entered before each deadline and is re-entered after it, for 1, 2, 4, 8, 16, 32 and 32 s.startup_graphics_published_load_precedence_*: published translation before native.Results at
f3793797on main5b86df1d:ctest -j1 -R '^startup_graphics_published_load_': 8/8 passed, no skips.native_backofftakes about 96 s per adapter because it probes the real backoff intervals.ctest -j4 -R '^(startup_indirect_|startup_stream_consumer|startup_native_graphics_draw_|native_rtv_variant_|startup_manifest_retry$)': 106/106 passed.e8ad9ad6,^(startup_indirect_|startup_stream_consumer|startup_slot57_|native_fixed_mesh57_|startup_translated_|startup_draw_): 138 tests, 135 passed, 2 skipped (startup_draw_depth_target_debug_*), 1 failed (native_fixed_mesh57_waterfall_fine_hardware, the known #3491 failure).Environment for these runs. They are host runs of our own code, not runs in an isolated environment.
f3793797e8ad9ad6f3793797on main5b86df1de8ad9ad6on main5b86df1d_hardware)_warp)devpreset,X2W_WITH_OPUS=OFFdevpreset,X2W_WITH_OPUS=OFFMutations, each applied alone and rebuilt:
unlock("independent draw or guest submission stalled behind the graphics load"),concurrentconcurrent(timeout)concurrentconcurrent("interrupted graphics key never retried")concurrentprecedencenative_backoff, both adaptersThe last one and the first were run at or after
e8ad9ad6. The other five were run on an earlier head of this branch (cd49b0cdwith the two fixes that followed), not repeated atf3793797.Not covered
.rtvrequest is not published and native is not tried for that key.native_backoffuses wall-clock margins (250 ms at the 1 s step). It passed with both adapters in parallel, but a heavily loaded host could miss the margin.github-bot referenced this pull request2026-11-29 23:26:38 +00:00
github-bot referenced this pull request2026-11-29 23:38:20 +00:00
@lukaslw-lab on GitHub · 2026-11-30 04:14 UTC · original · reviewed
Reviewed
f3793797by reading the diff, then ran it merged onto main44a3ad5awith #3508, #3466, #3523 and #3097 (no tests run). Reads correct; one point for the rebase.d3d12_draw.inl:774), DXIL and frontend cache writes go through unique temp files and a rename, and the catalog sits behind a mutex.NativeShaderTimer(d3d12_xs_device.cpp:433) assumes both native paths holddraw_lockand logsdraw_lock_ms. After this PR the graphics time is unlocked: 14.5 s over 56 compiles in our run. Rename it or measure only the locked part.max_ticksload-then-store can also lose a maximum now.github-bot referenced this pull request2026-11-30 16:25:40 +00:00
github-bot referenced this pull request2026-11-30 17:48:05 +00:00
github-bot referenced this pull request2026-11-30 18:47:25 +00:00
View command line instructions
Manual merge helper
Use this merge commit message when completing the merge manually.
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.