Files
metal2vulkan/docs
Anees Iqbal f3390be7f0 RUNTIME 2441: Scheduler: a committing thread's pass keeps only its own command buffer's submission handlers; gated completions post with one look
What: commit_and_submit's own pass (and the pass the lowering thread makes for one left for a
render encoder's end) keeps inline only its own command buffer's submission handlers, which run
on the committing thread inside the call, in their turn, as before. Every other command buffer's
handlers whose last batch the pass submits go to the device's handler threads right after that
submission, as one segment with its Turns ticket; the committing command buffer's ticket is taken
as its batch goes, so submission order holds. Both of submit_plain_ready's places that take
handlers (a submitted last batch and one held in the group) go through keep_or_hand_off.

A transition to Completed or Error whose transition to Scheduled is still owed is posted behind a
gate only where its submission handlers have not run (gate_for_handlers); otherwise plainly. The
gated post pushes the item behind the gate and opens the poster's closing under one lock with one
look for a thread (Contexts::post_gated), where post_behind and open made one each. FAST-PATHS
records the hand-off's own cost (19.1 wakes a frame).

Why: on PHOENIX, in the guest-shaped submit-cost leg after the scheduler-pass hand-off
(RUNTIME 2437), a submission's return to its own handler was p50 991 / p99 5231 us where a
committing thread ran it (978 handlers), against p99 380 on handler threads: a committing pass's
handlers waited for the rest of that pass's submissions. The gated post's second look for a thread
cost 4.4 wakes a frame.

Tests (submission_turns): a_committing_pass_keeps_only_its_own_submission_handlers_{exact,grouped}
(fails at control C2 m3-max-35888, the hand-off reverted: the earlier command buffer's handler ran
on the test thread); a_gated_completion_is_posted_with_one_look_for_a_thread_{exact,grouped} (fails
at control D m3-max-35877, post_behind + open: [(true,2)] against [(true,1)]). The check takes the
device's queue plan.

Verified: msi m3-max-36014 at bd810397db: build, runtime clippy plain and --cfg m2v_gpu, unit
44/44, sigs, lavapipe suites 126/126 (encoder_holds TextureWrite passes). Workspace clippy x3,
rustdoc and lvpval 30/30 at the pre-rebase tip 2d09ed2392 (m3-max-35927). PHOENIX m3-max-35923
(suites at df21628b0f): handler-thread wakes per frame 50.2 -> 48.37 (post_behind + open 8.9 ->
post_gated 6.72); seen to seen-handler p50 11, p99 3658 us.

Degradation kinds added: none.
2026-11-16 03:21:03 -08:00
..