RUNTIME 2275: the unshared hold's budget is 2 ms only while the unshared queue committed within 50 ms, else 16 ms

The unshared-isolation hold kept other queues' batches to about 2 ms of expected work ahead of an
unshared (compositor) queue on the same VkQueue at all times. On the 780M that stretched Super
Resolution's command buffers (reims gbo-780m A/B with isolation Off: SR 27.78 -> 24.78 s; 5772 holds).
Now the 2 ms budget applies only while an unshared queue on that VkQueue committed within the last
50 ms; otherwise the budget is 16 ms (the intolerable-wait line), so a quiet compositor's first
frame waits at most about 16 ms plus one batch.

- SlotShare::unshared_committed: one relaxed atomic store per VkQueue at the commit call.
- Flight::ahead takes the budget; Flight::room returns Room::Idle where only the 16 ms budget let a
  batch go; batches enter the flight either way, so the 2 ms bound is exact from the compositor's
  next commit.
- WorkCounts::heads_let_go_unshared_idle (new). No new Degradation kind, no refusal change.
- docs: FAST-PATHS unshared-isolation row (both budgets, reasons, trade, a replay over reims's
  hold-off trace: SR at 2 ms would hold 3,168 of 6,855 CBs, at 16 ms 0), API.md, the
  UnsharedIsolationPolicy::Bounded and new_command_queue_unshared docs.
- queue_share_device: the held-work runs settle their queue's expected run before measuring.

Verified (isohold): lavapipe m3-max-28760 at 337f244d25: unshared_hold, queue_share_device,
scheduler_held_wakes 28/28; quiet compositor: second long CB let go 13.5 ms before the first ended,
the compositor's CB ran between the second and third; active compositor: ran before the second long
CB (Off: after the third). Negative control (window check removed) m3-max-28762: CONTROL_EXIT=100
(device test + 2 unit tests fail). The SR A/B on a 780M is owed. Clippy and the suites run after landing.
This commit is contained in:
Anees Iqbal committed 2026-11-14 02:30:03 -08:00
1 parent 49d0f2a71c
commit 3b2443c8fe
13 files changed
+467 -81

No files matched your search

+8 -1
View File
@@ -282,7 +282,14 @@ compile does. `DevicePolicy::default()` is `DevicePolicy::UNTRUSTED`:
in time, and the unshared queue's command buffer waits behind about one batch of theirs: the
whole of one, however long, as a submission runs to its end. A scheduler pass that finds a held
batch let go and the unshared queue's command buffer ready together (a pass the host ran late)
sends the unshared one first. Beside an application keeping three
sends the unshared one first. The 2 ms holds while an unshared queue there committed a command
buffer within the last 50 ms, so a compositor drawing 20 frames a second or more (a 24-frame
video's, a 30-frame game's) keeps it; while none has, the budget is 16 ms: an application
keeping less queued beside a quiet compositor is not held, and the compositor's first command
buffer after its quiet stretch waits behind at most about 16 ms of the other queues' expected
work and one batch, the 2 ms applying from that commit on
(`WorkCounts::heads_let_go_unshared_idle` counts the heads the 16 ms let go where 2 ms would
hold them). Beside an application keeping three
30 ms command buffers in flight, a compositor's median wait fell from 75 to 17.5 ms on the Iris
Xe and from 71-84 to 18 ms on the Radeon 780M, with no throughput lost on a quiet host; under
the host's CPU load the GPU idles more (docs/FAST-PATHS.md has the numbers). Counted:
+20 -1
View File
@@ -129,7 +129,26 @@ known. The rest of the differences are docs/API.md section 9's precision notes.
at once by a longer one and halved toward a shorter one; a batch of a queue with no run seen yet
holds the others back until it completes. So a compositor's command buffer waits behind about
one batch of an application's, as Metal runs it beside the application's work, and the next
batch goes in before the one ahead ends. `unshared_isolation = UnsharedIsolationPolicy::Off`
batch goes in before the one ahead ends. Two budgets (`unshared_hold.rs`): `BUDGET`, 2 ms, while
an unshared queue there committed a command buffer within the last 50 ms (`ACTIVE`: a compositor
drawing 20 frames a second or more, a 30-frame game's or a 24-frame video's, keeps it, where one
refresh at 50 Hz would not); `IDLE_BUDGET`, 16 ms (the owner's line for an intolerable wait),
while none has. Beside a quiet compositor, an application keeping less than 16 ms of expected
work queued is not held (`WorkCounts::heads_let_go_unshared_idle` counts the heads 2 ms would
have held): Geekbench 7's Super Resolution on the Radeon 780M (RADV) kept at most 6.48 ms
queued ahead of a batch with no hold (a batch's submission to its GPU start 1.41 ms at the
median, 4.68 ms at the 90th percentile, 3,920 command buffers; reims's perfscout4, gbo-780m),
and the hold's costing replayed over that trace (each batch at its queue's expected run as it
went, the oldest credited its run) put 8.34 ms in flight at the 90th percentile of its 6,855
submissions and 14.73 ms at most: the 16 ms budget holds none of them where 2 ms holds 3,168
(Face Tracking 7 of 1,892 against 607, Background Blur none of 1,998 against 644); a queue's
first batch, of unknown length, still holds the next until it completes. One keeping more
still has 16 ms queued as its next batch goes. The trade: the
compositor's first command buffer after a quiet stretch goes in behind the work already
submitted, at most about 16 ms of expected work and the last batch let go (beside an
application keeping three 30 ms command buffers in flight, the first's last 16 ms and the
second, where `Off` puts all three ahead: about 75 ms at the median below), and the 2 ms bound
applies from its commit on, to the next ones. `unshared_isolation = UnsharedIsolationPolicy::Off`
submits every ready batch at once: peak rate with no hold, the unshared queue's command buffer
behind every batch submitted before it. Not an accuracy choice: it trades the other queues'
submission ahead for the unshared queue's wait. The runtime's choice: no pipeline differs.