RUNTIME 2300: Unshared hold: a batch whose room comes during a pass waits for an unshared commit posted before it
A scheduler pass takes the inbox in once, at its start (scheduler/inbox.rs), then submits one batch after another, about 0.3 ms each on the Radeon 780M. An unshared queue's commit posted during the pass waits in the inbox until the pass and its handlers end, and "Heads put first" only orders heads already in the order. Meanwhile each further look of the same pass asks the other queues' held heads again, and one whose room came (the oldest batch's credit grew, or its queue's previous batch went) was submitted ahead of the compositor's commit. reims's traced ld-auto walks (um870 780M, guest compositor beside a load app) show the path: the compositor's command buffer committed at +1.97 ms from the take, the same pass then submitted the app's long command buffer's last batch (+2.16) and its short one (+2.49), and the compositor's went at +2.81; that frame finished behind the short one, a refresh late. Frames where a batch let go after one of the frame's unshared command buffers was committed went in ahead of it: 106 (pin 86), 127, 121, 129 (pins 88, 89) of about 611, carrying 7 of 9, 12 of 17, 23 of 27 and 15 of 19 of the frames answered more than a refresh late. The rule: SlotShare counts each VkQueue's unshared commits posted to the inbox (Scheduler::commit, before the post) and taken into the order (take_in). A held batch notes the posted count at the first look that finds its room (unshared_hold::behind_commits) and is held (HeldFor::UnsharedIsolation, new WorkCounts::heads_held_for_unshared_commits) until the taken count reaches its note. The passer never sleeps while the inbox holds a commit, so the next pass takes the commit in, sends the unshared head first where it is ready, and lets the held batch go in the same pass. Commits posted after the room came never hold it, so a compositor posting during every pass holds it one pass at most. Committing and waiting threads' passes leave such a batch to the scheduler's thread. No new switch; UnsharedIsolationPolicy::Off is untouched; the documented bounds (2 ms and 16 ms budgets, about one batch ahead) still hold. Not covered: the commit call's own work before its post (15 us at the median in the traces), and commits deferred to the render lowering thread (RenderLoweringPolicy::Worker; AtCall is the default). Tests: unshared_hold unit test of the note's bound; queue_share_device an_unshared_commit_posted_during_a_pass_goes_before_work_let_go_after_it (the scheduler paused after each vkQueueSubmit; the unshared command buffer committed during the pass that submits the app's first goes before the app's next; the unshared queue's next commit, posted after that room came, does not hold it). Docs: unshared_hold.rs, FAST-PATHS unshared-isolation row, API.md, WorkCounts; api_signatures.tsv (signatures.py --check passes). Verified (msi lavapipe): m3-max-29410 at the tip: clippy -D warnings (runtime, plain) 0; 74/74 under --cfg m2v_cpu_icd (unshared_hold, queue_share, queue_share_device, scheduler, scheduler_held_wakes, scheduler_wakes, inbox). Negative controls: the hold off (29412) fails with the slip reproduced (next 501.3 ms before drawn 752.6, 0 holds); a hold with no note (29413) fails starved (next 1007.1 behind later 756.4). The workload proof is a traced compositor-beside-load walk on the 780M after landing.
This commit is contained in:
1 parent
65a32d771a
commit
df4cee2e01
11 files changed
+299
-9
No files matched your search
+4
-1
@@ -282,7 +282,10 @@ 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. The 2 ms holds while an unshared queue there committed a command
|
||||
sends the unshared one first, and a batch whose room comes during a pass waits while the
|
||||
unshared queue's commit, posted before that, is not yet taken in by a pass
|
||||
(`WorkCounts::heads_held_for_unshared_commits`); commits posted after its room came never hold
|
||||
it. 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
|
||||
|
||||
Reference in new issue
Block a user