Files
metal2vulkan/docs
Anees Iqbal db341427bf RUNTIME 2499: Queue turns: a held head waits for the completion that lets it go, and its bound's wake is no slice
pinreds' lavapipe counts (m3-max-38335) under Fair: submission_turns' committing-pass check had
0 completion wakes, 1 sleep slice and 1 slice rescue; grouped_submissions 4-5 completion wakes
for 6-7 turn holds and 1-2 rescues. Read, not a missed completion wake:

- A sleep the scheduler's thread ended at a held head's bound (await_room's wake_by: the time
  the oldest batch's run brings its queue's work under the budget, the turns' designed wake) was
  counted as a sleep slice and its pass as a slice rescue, though WorkCounts calls a slice the
  thread's longest wait with nothing having woken it. A bound shorter than the slice now ends
  the sleep as no slice does (short, as the idle's length before a driver's stall), on the
  condition variable and on the GPU.
- A turn-held head was gated on the oldest batch in flight, so every completion before the one
  that lets it go woke the thread to hold it again. Flight::own_ahead now gates it on the batch
  whose completion lets it go, or makes the batch of its queue whose run does so the oldest
  (turn_through), so the timer can be set then; a queue of unknown run on its first batch.
  Flight::turn adds the time another queue's last batch is 50 ms old where 2 ms holds the head
  and 16 ms would not, which the oldest's completion caught before.

Tests: queue_turns::a_held_batch_waits_for_the_completion_that_lets_it_go (the gate is the
fifth's predecessor, not each completion); the two turn unit tests' holds now carry the gate and
the quiet timer; queue_share_device's turns test asserts 0 slice rescues, at most a completion
wake per burst command buffer, and each submitted within 20 ms of the GPU end before it.

Verified (msi, at d4074ffeaa): m3-max-38421 runtime clippy --all-targets --all-features 0, unshared_hold|queue_turns 25/25, rustdoc 0, fast_paths 36/36; m3-max-38422 clippy --cfg m2v_gpu 0; m3-max-38423 lavapipe clippy --cfg m2v_cpu_icd 0, unshared_hold|queue_turns|submission_turns|scheduler_held_wakes|queue_share_device 64/64 (the turns test under Fair: 14 looks held, 0 slice rescues, 7 completion wakes for 12 command buffers, each submitted by the previous one's end). Open: validation grouped_submissions 14/15 in m3-max-38424 (a_shared_event_wait_for_a_kept_group_s_signal_ends_at_the_next_completion_turn, "Y completed before X"); its A/B against the parent (m3-max-38439, 38442) runs after the merge.
2026-11-16 17:30:51 -08:00
..