Files
reims-vgpu/docs
Anees Iqbal 03a0ee2cc1 🐎 Wake a lane's idle thread as its long buffer is begun
A command buffer longer than its queue's service thread walks itself goes to
its queue's lane, whose parked thread was woken only once the buffer was begun.
On the Iris Xe host, Geekbench 7.1's Super Resolution hands 4092 buffers a pass
to idle lanes, and each waited 10.1 us at the median, 58.0 ms of the pass, from
the hand-off to its walk's start: nearly all of it the thread's wake.

Now the service thread wakes the lane's last idle thread once the buffer's
turn is taken (Lane::expect), and that thread spins for the job for at most
EXPECT_SPIN, 50 us, which is above the whole begin's 99th percentile of
30.6 us. So the wake happens during the rest of the begin. A long buffer that
is walked in its turn on the service thread withdraws the expectation. Jobs,
their order and turns, and every record and interrupt stay as they were; only
when the thread wakes changes. The spin is timed on the keep's clock
(Keep::passed).

Measured with the SR walk on ms01's Iris Xe, before (m3-max-30439, development
plus the begin tracers) against after (m3-max-30453, this change plus the same
tracers and a spin tracer):
- hand-off to walk start: 58.0 -> 36.0 ms a pass (p50 10.1 -> 4.2 us);
- the begin: +9.1 ms, because the wake's call moved into it;
- take to walk start: 136.7 -> 123.9 ms, -12.8 +- 3.7 ms (8 paired slices);
  over the pass's 11 workloads, -22.0 +- 6.5 ms;
- the spins: 11.3 ms in SR and 27.1 ms over the pass (p50 4.1 us), and 99.3%
  of them ended with their job before the bound;
- SR's wall time and graphics-thread CPU per dispatch are unchanged within
  noise: 44.35 -> 44.37 s, and 198.5 -> 205.4 us per dispatch (+4.8 +- 4.0%
  paired, as walk_ops, which this does not touch, moved +5.8 +- 3.3 us).

Walking such buffers on the service thread at any length was rejected because
three things would wait for the walk: a SCHEDULED_ASK, which only that thread
takes; the queue's later buffers, which would be begun after it and so walk
one at a time, ending the lane's walks ahead; and the submission ring's room.

Tests: a_long_buffer_wakes_its_idle_lane_s_thread_as_it_is_begun, and the
lane's an_expected_job_starts_on_the_thread_woken_for_it,
an_expected_job_that_comes_after_the_spin_wakes_its_thread_as_it_comes,
a_withdrawn_expectation_or_the_close_ends_the_spin_at_once and
an_expectation_wakes_only_an_idle_thread_and_one_at_a_time.
2026-11-14 17:58:31 -08:00
..