Files
metal2vulkan/docs
Anees Iqbal ce54ad8b25 RUNTIME 2310: an unshared commit on its way goes before another queue's batch whose room came after it
A scheduler pass that found another queue's batch's room let it go while an unshared queue's
commit there, taken in, waited only for the runtime: its host step (handed to the steps'
thread in the same pass), its submission checks, or a shared event's value whose signal was
already submitted and had not landed. Order::next refused the unshared head and sent the
other batch; the unshared command buffer then waited for that whole batch on the GPU. In
reims's traced walk ld91 (um870 Radeon 780M, guest compositor beside gameload) another queue's
batch went in while a compositor's command buffer so waited ahead of 33 of the 46 frames
answered more than a refresh late: 20 at its host step (e.g. take 1794684425.009: gameload
#19392 committed -3.0, submitted +2.6, inside WS #19398's commit +2.3 -> submit +2.8), 13
waiting for the landing of its other unshared queue's signal.

The rule (unshared_hold.rs, "Commits on their way"): each unshared commit carries its place
among those posted on its VkQueue (SlotShare::posted_unshared now answers it). Each look
collects the unshared heads on their way (on_its_way: binary semaphores ready, every event
value reached or reached by a submitted signal, held only for its host step with no pipeline
making pending, or for its checks) that wait behind no earlier commit (is_behind), and a
batch whose room came is held (behind_commits) while one posted before its noted count leads
its line so. The step's end, the checks or the landing wake the scheduler's thread, whose
next pass sends the unshared one first. Each look asks again: a head waiting for anything
else (a value nothing submitted reaches, a binary semaphore, a making, a decode, a rebind) or
behind an earlier commit (the held batch's own included) holds nothing, so neither waits for
the other. Other threads' passes leave such batches to the scheduler's thread
(first_for_the_thread widened to heads on their way), which they wake. Counted in the
existing WorkCounts::heads_held_for_unshared_commits (doc widened). No switch, no public item,
no Degradation kind. Docs: unshared_hold.rs, FAST-PATHS unshared-isolation row, API.md.

Tests: unshared_hold unit test of behind_commits with places on their way; queue_share_device
(lavapipe), each leg by the scheduler's pass and a committing thread's:
an_unshared_head_at_its_host_step_goes_before_work_whose_room_came_after_its_commit,
an_unshared_head_waiting_for_a_signal_to_land_goes_before_work_whose_room_came_after,
an_unshared_head_behind_an_earlier_commit_of_the_held_queue_holds_nothing,
an_unshared_head_waiting_for_a_value_nothing_submitted_reaches_holds_nothing.

RUNTIME_VERSION moves: what a run submits, and in what order, changes.

Verified (msi lavapipe):
- m3-max-30046 at 71c8bf7337 (the rule plus a test-only fix), runtime crate, --all-features
  --all-targets -D warnings:
  - clippy plain and --cfg m2v_cpu_icd: 0;
  - 103/103 tests: unshared_hold, queue_share, queue_share_device, scheduler,
    scheduler_held_wakes, scheduler_wakes, inbox, waiter_submits, commit_and_submit, hold_sites,
    dispatch_pending, queue_limits_device, stall.
- New tests, each run once through the scheduler's pass and once through a committing thread's:
  - at its host step: the other buffer began 0.168 / 0.199 ms after the unshared one;
  - waiting for a signal to land: 0.183 / 0.206 ms after;
  - behind an earlier commit: holds nothing;
  - waiting for an unreached value: holds nothing.
  The RV2303 tests still pass.
- Negative controls:
  - m3-max-30021, rule off: both "goes before" tests fail (the other buffer began 1.519 ms
    before the unshared one);
  - m3-max-30036, the two no-hold exclusions removed: both no-hold tests time out at 20 s.
- Test-only fix in this change: RV2303's committing-thread test held its scheduler thread with an
  application batch that now correctly waits behind the stepping unshared dispatch. Its holder is
  now a command buffer on another unshared queue, which nothing holds back.
2026-11-14 12:22:47 -08:00
..