Repository navigation
drm/asahi: g17: fan M5 Pro compute out to sibling channels for sustained heavy kicks - #3035
Conversation
8d7ae2e to
4c461ae
Compare
|
R2 (
|
4c461ae to
ba6fe60
Compare
…D sources directly Cross-queue compute handoffs previously hit three layers of host lock contention and fallback overhead: 1. asahi_g17_collect_fences() expanded every unsignaled node in a timeline dma_fence_chain without same-context coalescing (forcing reallocations and per-leaf global device-mutex scans inside Backend::input_sources()). 2. Backend::input_sources(), compute_readiness(), and sources_published() always took the global device mutex and linearly scanned compute queues to check whether a same-VM producer was published. 3. Backend::compute_direct() unconditionally rejected packets with converted input sources, forcing every cross-QID compute submission through compute_inline() under the global device mutex (and holding m5_outer across mailbox doorbell I/O in ComputeHost::notify()). Coalesce healthy unsignaled leaves sharing a non-zero fence context in collect_leaf() (keeping only the latest seqno via dma_fence_is_later() while preserving every failed leaf with status < 0), keeping the initial Rust collection capacity at 4, and hoist the fallback device mutex out of the leaf loop in Backend::input_sources(). Publish immutable cross-QID kick metadata (PublishedSource: epoch, publication order, KickDependency, and producer source_readers counter) onto fence::Submission once compute::Queue::publish() commits and rings its doorbell, invalidating it on retirement, error, replay, and cancel. Track the live epoch in published_epoch (AtomicU64, 0 = unpublished) so has_published_epoch() and empty clear_published() skip Submission::state, and store immutable vm_status outside Mutex<State> so same_vm() is lock-free. Remove ReaderHint's blind spot so lock-free Hold::new() loans are always observed by shareable(), can_rearm(), and reset_for_owner(). Use the PublishedSource snapshot for lock-free checks in input_sources(), compute_readiness(), and sources_published(), allow M5 compute_direct() to resolve same-VM compute sources directly (skipping duplicate explicit barriers, self-reader Holds, and firmware_consumer marks when a source was already published on the consumer's own physical QID in the same epoch while still validating source_status() and recovery/epoch), mark firmware_consumer atomically on cross-QID producers, and drop m5_outer before port.notify() in ComputeHost::notify(). Add host C+Rust tests and mutation controls in g17-m5-cross-qid-direct-tests. Signed-off-by: Diljit Singh <[email protected]>
…ned heavy kicks On M5 Pro one physical firmware compute QID per logical compute queue serializes its kicks: each QID owns a single preemption, operand, usage, status and stamp state, so a kick holds for its parent on that QID. Kicks that each leave the GPU partly idle then run one at a time. macOS runs one M5 Pro command queue on up to three firmware compute queues of the same context, created on demand and sharing one completion ordinal, as its own kicks show when run under aura. Describe that as a property of the board: Board::compute_channels() is the number of firmware compute queues of one context over which a single command queue's independent kicks may run, 3 for the J714 and 1 for the J716C, J775D and J813, whose macOS drivers have not been seen to spread a command queue. multi_channel() and pairs::select_board() read that count alone rather than the board's encoding forms, and a const assertion keeps every board between 1 and COMPUTE_CHANNELS_MAX, the size of the per-owner channel arrays and of the compute waits a render kick carries. Let an owner on such a board hold up to that many physical compute channels sharing one execution context, QoS slot, scheduler page and work-state table, and fan out onto them only the work that gains from overlap: - A command runs on, or brings up, a sibling channel only when it is independent (no in-queue barrier), has no cross-queue input sources, the owner's primary channel runs sustained heavy work and at least two kicks of the owner are already in flight. The work is sustained heavy when the primary's last two retired kicks each ran at least 100 us between the start and end timestamps of their exact firmware execution records (pairs::heavy_run(), pairs::sustained()). One QID streams short kicks back to back faster (about 11 us per kick) than three QIDs do (about 16.4 us: each sibling kick pays about 5 us of firmware arbitration), so short kicks stay on the primary ring; from 100 us that cost is within 5% of the kick. Recordless retirements and releases of held descriptors never count, and the run restarts for every owner. - A kick queued behind one in flight on the same ring starts the moment its predecessor ends, while the host needs 60 to 100 us to turn that completion into the next submission. Two overlapped kicks that each fill the shader cores share them and end together; both rings then wait for the host, and every pair of kicks pays that turnaround (a processor-sharing model predicts 300 to 319 us per kick against 270 us serial; 286 to 302 us were measured for an owner keeping two such kicks in flight). A kick that leaves the GPU partly idle gains about 10% from the same overlap, but the kernel cannot tell the two apart from a kick's metadata (same workgroup size, no threadgroup memory, similar register footprint; the grid lives in the CDM stream). So a kick leaves the primary ring only with SIBLING_MIN_IN_FLIGHT (two) kicks already in flight (pairs::overlaps(), on the direct path, in channel selection and in sibling admission): the primary then keeps one queued behind the overlap, a sibling only adds overlap and never exposes the turnaround, and an owner keeping at most two kicks in flight runs exactly as on one ring. Mesa applies the same rule to the sibling queues it opens itself. - A command with input sources always takes the primary channel, on the direct path (whose lock-free cross-QID source resolution, binding loans and hold hand-off are unchanged) and on the device-mutex path, and never binds a sibling, so a semaphore hop between queues stays on one ring per queue. - Backend::fans_out() checks the command before it asks for the primary's state, and compute_direct() reads that state from the primary ComputeCell's lock-free mirror (sustained), so short kicks and sourced commands neither lock a cell nor detour to the device-mutex path to add a sibling. - Each sibling channel owns a dedicated ComputePool mapped into the context VM; concurrent kicks take distinct 1-based ordinals and (predecessor_id << 32) | current_id object ids from one per-context atomic sequence (Context::next_compute_identity()), used as both submit_sequence and completion_ordinal. - ComputeCell mirrors (configuring, active_len, last_published, sustained) whenever a QueueGuard drops; compute_direct() routes to an idle primary without locking a sibling cell and scans the hints lock-free otherwise. - Siblings bind lazily when every bound channel is busy, from the source Registry::sibling_source() names, in the order a primary binding takes its channel: an idle reusable queue whose populated pool serves the owner's VM and fits, bound at once; a vacant reusable queue no other owner is re-arming, re-armed with fresh backing off the device mutex and bound as the sibling through the primary's own rearm_vacant(), rearm_compute() and bind_rearmed(); a fresh QID; and last an idle reusable queue whose pool still serves another VM, given back (give_back_foreign(), which rebind_compute() now shares) while no other pool release is in flight, so the next pool pass vacates it for a later attempt. Only reusable queues qualify: a queue with an owner or work, an open owner's idle channel, a queue another owner is re-arming and one whose scheduler or pool release is in flight are never taken, and an owner waiting for its first channel goes first. Once earlier clients had taken compute QIDs up to the fresh-QID ceiling, every idle queue was vacant or held a gone VM's pool, so admitting only same-VM pools and fresh QIDs never brought a sibling up again until the GPU slept. A miss backs off for SIBLING_HEADROOM_BACKOFF_NS. - Each QID keeps the completion-class implicit parent while its own earlier kick is active; dependent compute and render consumers wait on every channel of the owner. Siblings release and roll back before the primary, idle siblings drain before primary pool growth, and a ContextKill cookie and its acknowledgment cover every channel. GET_PARAMS reports the new DRM_ASAHI_FEATURE_COMPUTE_MULTI_CHANNEL wherever a logical compute queue holds more than one channel (pairs::compute_channels_per_owner() > 1), so userspace that would open sibling queues of its own for the same overlap leaves it to the kernel instead of fanning out twice. Only the M5 Pro reports it: the other M5 boards describe one channel, and G17P never selects an M5 board. The feature takes bit 42, the next free bit: bit 40 is DRM_ASAHI_FEATURE_VDM_USC_INVALIDATE and bit 41 is DRM_ASAHI_FEATURE_COMPUTE_ONLY. Mesa's Vulkan driver reads the bit and then leaves the sibling queues to the kernel (aurora-silicon/mesa#793). Host tests: tools/asahi/g17-m5-sibling-gate-tests.py compiles the gate, the in-flight threshold, the direct-path channel selection, the ComputeCell mirror and the registry's channel selection and sibling admission, with 17 mutation controls; g17-m5-sibling-rearm-tests.py runs the production reuse predicates, sibling sources, give-back, pool pass and re-arm for clients that come and go with no fresh QID left (14 controls, the old admission rule among them); g17-compute-multi-channel-feature-tests.py reads every production board's channel count and checks where the feature is reported, that the decision ignores the encoding forms and that its bit is unique (9 controls); g17-compute-owed-stamp-tests.py runs the real retirement pass against the heavy-kick run (2 more controls); g17-m5-sibling-compute-tests.py covers identities, dedicated pools, routing, release, rollback, growth and exit ordering (8 controls). Link: aurora-silicon/mesa#793 Signed-off-by: Diljit Singh <[email protected]>
ba6fe60 to
7bb65ce
Compare
|
Merge readiness at
Areas: Updated by pr-readiness on pushes, edits, reviews and comments, and on a schedule. Rules: merge policy · labels. |
|
Rebased onto Conflicts were all in
The stack is unchanged: on #3025 ( Host tests: |
…i-g17-m5-direct-cross-qid-sources Bring in the base PR's merge of main up to 6ec49ac, including its m5_history_view() update for the relocated M5 submission-history fields. Conflict in tools/asahi/run-host-tests.py: both sides register a new g17 test; both are kept. Signed-off-by: Diljit Singh <[email protected]>
…i-g17-m5-direct-cross-qid-sources Bring in the removal of the unused unlocked M5 history update from the base branch. No conflicts. Signed-off-by: Diljit Singh <[email protected]>
…sahi-g17-m5-sibling-compute Bring in the removal of the unused unlocked M5 history update from the base branch. No conflicts. Signed-off-by: Diljit Singh <[email protected]>
satchlj
left a comment
There was a problem hiding this comment.
Verdict: FINISH, then merge at 9b419de5e66e
Blockers:
rollback_unpublished_compute()anddrain_compute_siblings()can drop aliases/queues underself.shared.state.lock()and permanently leakComputeReservationslots on OOM:- In
drivers/gpu/drm/asahi/g17/runtime/backend.rs:38-67,retiredandbindingsare zero-capacityKVec::new()and grow vialet _ = bindings.push(replaced, GFP_KERNEL);andlet _ = retired.push((entry.reservation, queue), GFP_KERNEL);whileself.shared.state.lock()is held (on a failure path that runs afterENOMEMpublication failures). On allocation failure,let _ =dropsreplaced(Binding) orqueueinside the device mutex (violating off-lock alias teardown) and skipsfinish_uninstalled_compute(), leavingentry.queue == Nonewith an uncancelledComputeReservationso the QID/slot leaks and futurereserve_compute_channel()calls for that owner permanently fail withEINVAL. - In
drivers/gpu/drm/asahi/g17/runtime.rs:1150-1190(Registry::drain_compute_siblings()),retired.push((entry.reservation, queue), GFP_KERNEL)?;runs underself.shared.state.lock()afterentry.queue.take()has already emptied the slot. An allocation failure returnsErr(ENOMEM)while droppingqueue(and any earlier pushed sibling queues) under the device mutex and leaking the uncancelled reservation(s). - Fix: since an owner holds at most
COMPUTE_CHANNELS_MAX(3) channels, store collected items in fixed stack arrays ([Option<...>; COMPUTE_CHANNELS_MAX]) or pre-allocate/reserve capacity before takingself.shared.state.lock()and before callingentry.queue.take().
- In
Checked: Full incremental kernel diff audit of aurora-silicon/linux#3035 (e35ddb55bc59..9b419de5e66e, 15 kernel files across drivers/gpu/drm/asahi/ and include/uapi/drm/asahi_drm.h), plus finish_uninstalled_compute(), reserve_compute_channel(), and paginated CI (19/19 passed).
Evidence
drivers/gpu/drm/asahi/g17/runtime.rs:1648-1664:finish_uninstalled_compute()documents the two-phase rollback contract — the empty registry entry reserves the QID/free-list identity until off-lockdrop(queue)completes, and thencancel_compute(reservation)frees the slot. Skippingfinish_uninstalled_compute()afterentry.queue.take()leaves the empty entry stuck inself.queues.compute[slot].drivers/gpu/drm/asahi/g17/runtime.rs:1060-1065(reserve_compute_channel()): returnsErr(EINVAL)whenever an entry hasqueue.is_none() && entry.reservation.owner == owner, turning a droppedretired.push()into permanent lockout for that owner.- Remaining audited areas look solid: UAPI
DRM_ASAHI_FEATURE_COMPUTE_MULTI_CHANNELuses pre-reserved bit 42,Context::next_compute_identity()atomically allocates monotonic non-zero ordinals/object IDs across sibling QIDs,QueueGuard::drop()syncs cell stats before releasing_guard,compute_direct()avoids nested cell locks and falls back on cross-channel barriers, andcompute_exit.rspropagates and acknowledges the shared context-kill cookie across all sibling channels.
…under the lock rollback_unpublished_compute() and drain_compute_siblings() take compute queues out of the registry under the device mutex. The empty entry keeps the QID until finish_uninstalled_compute() drops the queue off-lock and cancels its reservation. Both collected the queues, and the rollback its displaced bindings, into empty KVecs while holding the mutex. A failed push dropped the queue or binding under the mutex and skipped the cancellation. The empty entry then stayed for good, and reserve_compute_channel() refused its owner with EINVAL from then on. The drain also lost the queues it had already taken when a later sibling was still busy (EAGAIN), and the rollback lost them when a later channel's rollback failed. An owner holds at most COMPUTE_CHANNELS_MAX channels, so collect into fixed per-channel arrays that the caller owns: nothing is allocated under the mutex, a channel is refused before it changes if it would have no place, and after a failure the caller still has everything taken before it. The caller drops the displaced bindings and finishes every taken queue after releasing the mutex, and goes on past a failed cancellation. The rollback loop moves into the registry beside the drain, so no early return can skip that. Also remove Registry::compute_mut(), which has no caller left in this series and was the driver's only g17 dead-code warning. The new g17-compute-retired-tests host test runs the production rollback, drain, finish and reservation code for an owner with all three channels, including a failing rollback, a busy sibling and a failing cancellation. Signed-off-by: Diljit Singh <[email protected]>
|
Review fix at
Tests: new host test Hardware row at
Details are in the PR body's Evidence block. |
satchlj
left a comment
There was a problem hiding this comment.
Verdict: MERGE at df36284f753b
Blockers: none
Checked: review fix commit df36284f753b resolving the prior CHANGES_REQUESTED on 9b419de5e66e; Registry::rollback_unpublished_compute() and drain_compute_siblings() now collect displaced bindings and retired queues into caller-owned [Option<_>; COMPUTE_CHANNELS_MAX] arrays with zero allocations or drops under the device mutex, and finish_retired_compute() cancels every taken reservation off-lock even after a partial rollback, busy sibling (EAGAIN), or failed cancellation; dead Registry::compute_mut() removed; new tools/asahi/g17-compute-retired-tests.py host suite plus existing g17 suites wired into run-host-tests.py; exact-head Apple M5 Pro (T6050 / J714s / G17S B1) hardware row (gpubench-vk, Vulkan synchronization2.op.multi_queue, RTC deep-sleep wake, zero GPU/DART faults); commit hygiene (DCO Signed-off-by, zero AI attribution, zero Apple material); all 18 build/host/KUnit/pr-text CI checks green (0 active, 0 failed).
Evidence
- Fix audit (
df36284f753bcf69c83ca964d0ba84ae45438c79on top of9b419de5e66e):drivers/gpu/drm/asahi/g17/runtime.rs&drivers/gpu/drm/asahi/g17/runtime/backend.rs: replaces under-lockKVeccollection in bothrollback_unpublished_compute()anddrain_compute_siblings()with caller-owned fixed[Option<_>; COMPUTE_CHANNELS_MAX]arrays. If a channel has no free slot it fails withEIObefore mutating state; otherwise all displaced bindings and taken queues are dropped and cancelled off-lock infinish_retired_compute(), continuing past individual cancellation failures so no empty entry can strand an owner withEINVAL.- Unused
Registry::compute_mut()removed (clears the remainingg17dead-code warning). tools/asahi/g17-compute-retired-tests.py+tools/asahi/run-host-tests.py: exercises production rollback, drain, finish, and re-reservation paths across all 3 channels (including partial rollback failure, busy siblingEAGAIN, cancellation failure, and capacity overflow) with 7 negative mutation checks.
- Exact-head hardware & CI verification (
df36284f753b):- Apple M5 Pro (
T6050 / J714s / G17S B1) native build (make -j18, 0 Rust warnings in touched files),gpubench-vk(compute.heavyd1 372.4 us / d4 262.8 us, 8,171 GFLOP/s;render.heavyd1 260.4 / d4 125.3 us), Vulkansynchronization2.op.multi_queue(2,147 pass, 823 not supported, 0 fail), RTC deep-sleep wake (suspend_stats0 -> 1),crashed=0, 0 GPU/DART faults. - Paginated CI check-runs at
df36284f753b: 18/18 real CI checkscompleted / success(apple-build,host-tests,pr-text / pr-text, and all 15KUnitsuites includingKUnit asahi,KUnit clpc,KUnit trusted-keys);0active,0failed (readiness / readinesshad an earlier concurrency-cancelled run at13:55:19Zthat re-triggers on this review).
- Apple M5 Pro (
|
Tested (
|
The merge-base changed after approval.
satchlj
left a comment
There was a problem hiding this comment.
Verdict: MERGE at df36284f753b
Blockers: none
Checked:
- Clean-room diff with no Apple copyrighted material, decompiled listings, or copied firmware/tuning data.
- No hardcoded model, board, or firmware gates and no new module or command-line parameters; channel capacity is read from
Board::compute_channels()and exposed viaDRM_ASAHI_FEATURE_COMPUTE_MULTI_CHANNEL(bit 42). - No hardcoded hardware safety limits; safety and hardware values come from machine descriptors and runtime state.
- Clean human
Signed-off-by:DCO on every commit and zero AI attribution across commits and PR text. - Prior blocker at
9b419de5e66eresolved indf36284f753b, exact-head hardware rows pass on both J714s (M5 Pro) and J700 (Neo), and all paginated CI checks are green.
Evidence
- Prior blocker resolution (
df36284f753bon top of9b419de5e66e):drivers/gpu/drm/asahi/g17/runtime.rsanddrivers/gpu/drm/asahi/g17/runtime/backend.rs:Registry::drain_compute_siblings()andRegistry::rollback_unpublished_compute()now collect taken queues and displaced bindings into caller-owned[Option<T>; COMPUTE_CHANNELS_MAX]arrays (PerChannel<Uninstalled>andPerChannel<compute::Binding>), verifying free slots before mutating any channel so nothing allocates or drops underself.shared.state.lock().Backend::finish_retired_compute()drops taken queues and cancels every reservation off-lock without short-circuiting on individual failures, closing theEINVALowner-lockout leak across busy siblings (EAGAIN), partial rollback failures, and failed cancellations.- Removed unused
Registry::compute_mut()and addedtools/asahi/g17-compute-retired-tests.py(7 scenarios, 7 negative mutations) wired intotools/asahi/run-host-tests.py.
- Incremental diff audit (
e35ddb55bc59..df36284f753b): VerifiedContext::next_compute_identity()atomic shared ordinals/object IDs,QueueGuard::drop()cell stat sync,compute_direct()single-cell lock discipline and cross-channel barrier fallback,compute_exit.rsmulti-channel kill-cookie propagation,compute_replay.rsper-QID replay prefix handling, andinclude/uapi/drm/asahi_drm.hbit 42. - Hardware rows & CI:
- Exact-head Apple M5 Pro (
T6050 / J714s / G17S B1) pass row atdf36284f753b: native build clean,gpubench-vkok (compute.heavyd4 8,171 GFLOP/s), Vulkansynchronization2.op.multi_queue2,147 pass / 0 fail, RTC deep-sleep wake clean, 0 GPU/DART faults. - Exact-head MacBook Neo (
J700 / G17P B1) combined Wave C pass row (7bb607c48427):215/215g17host tests,2,880/2,880timeline semaphore CTS pass,373focused compute/sync CTS pass / 0 fail,5/5compute CRCs, 0 GPU faults / 0 AVCs. - Paginated CI check-runs at
df36284f753b: 19/19 green (0active,0failed), clean merge preview ontomain.
- Exact-head Apple M5 Pro (
The merge-base changed after approval.
Merge origin/main (f3bfe50) to keep the union of host test entries in tools/asahi/run-host-tests.py after #3024, #3036, and #3023 landed. Signed-off-by: Diljit Singh <[email protected]>
…sahi-g17-m5-sibling-compute Bring in origin/main (f3bfe50) via the updated base branch so tools/asahi/run-host-tests.py keeps the union of host test entries. Signed-off-by: Diljit Singh <[email protected]>
|
Merged updated |
What: Stacked on the #2947 → #2955 → #2969 → #3025 series. On M5 Pro, one physical firmware compute QID per logical compute queue serializes kicks even when heavy dispatches leave part of the GPU idle. A logical compute queue can now hold up to three sibling channels sharing one context and ordinal sequence, and independent kicks fan out to them only during a sustained heavy run (two retired kicks ≥ 100 us, at least two in flight). The channel count is a board property (
Board::compute_channels(): 3 on J714, 1 elsewhere), andDRM_ASAHI_FEATURE_COMPUTE_MULTI_CHANNEL(bit 42) tells userspace (consumer: aurora-silicon/mesa#793).Tested: J714s M5 Pro (G17S B1) at
df36284f753b(this head, built natively, default command line with MTE and SEP writes on): boots; gpubench-vk compute and render rows allok(compute.heavyd4 8,171 GFLOP/s); Vulkansynchronization2.op.multi_queue(every 8th case) 2,147 pass, 0 fail, the same as the default kernel; one RTC deep-sleep wake, GPU live after it; 0 GPU faults, 0 new kernel errors. Host tests--only g17181/181. The fan-out speedups below were measured on the R1 commit (integration test kernel build 9, Mesa with aurora-silicon/mesa#793): sustained bandwidth-bound heavy compute (d=4..64) +9.9 % to +20.1 %, ALU-bound heavy compute (d=2) +5.9 %, 4/4 fresh sequential processes at 320–330 us with no QID lockout.Risk: two-way · M5 Pro (J714) gets the new fan-out; J716C, J775D and J813 report one channel, so the fan-out stays off there. Adds a UAPI feature bit (42).
Not yet: Neo (G17P) at this head (its last row predates the
mainmerge), M5 Max (J716C), M5 Ultra (J775D) and M5 (J813) not run.After review (11-25): new commit
df36284f753b. The unpublished-compute rollback and the sibling drain take an owner's channels out of the registry under the device mutex. They now collect them into fixed per-channel arrays (an owner holds at most three) instead of growing aKVecthere. So nothing is allocated or dropped under the mutex, and every taken channel's reservation is cancelled, also when a later channel fails or is still busy. Before, a failed push left the owner locked out ofreserve_compute_channel()withEINVAL. The commit also removes the unusedRegistry::compute_mut().Details
Stacking: carries the same six commits as #3025 (#2947 -> #2955 -> #2969 -> #3025), patch-identical by
git range-diff, and is rebased ontomain(2ba145b5e335). The new feature bit is still bit 42, the next free bit: bit 40 isDRM_ASAHI_FEATURE_VDM_USC_INVALIDATEand bit 41 is nowDRM_ASAHI_FEATURE_COMPUTE_ONLY(merged). The only new commit on top of the stack isdrm/asahi: g17: fan M5 Pro compute out to sibling channels for sustained heavy kicks. Independent of the event-placement / render-return PR; targetsintegration/aurorasoHost testsCI runs on the full stack.After the
mainmerge (11-25,maina73023bc5f1f): no conflicts; the 100-column wraps are in their own commits.Review fix (
df36284f753b):Registry::drain_compute_siblings()and the newRegistry::rollback_unpublished_compute()(the rollback loop, moved beside the drain) write into caller-ownedPerChannel<T>arrays ([Option<T>; COMPUTE_CHANNELS_MAX]). Each refuses withEIObefore it changes a channel that would have no place, which cannot happen within the per-owner bound. After a failure the caller still holds everything taken before it. The caller drops displaced bindings and callsBackend::finish_retired_compute()only after releasing the device mutex. That runsfinish_uninstalled_compute()for every taken queue and goes on past a failed cancellation.grow_compute()uses the same path for drained siblings.New commit:
7bb65ce97e1d.This commit:
Board::compute_channels()(ing17/fw/m5/initdata.rs) is the number of firmware compute queues of one context that a single command queue's independent kicks may run on. It is3for the J714 (M5 Pro): macOS runs one M5 Pro command queue on up to three firmware compute queues of the same context, created on demand and sharing one completion ordinal, as seen from its own kicks traced under our hypervisor. It is1for the J716C, J775D and J813.multi_channel()andpairs::select_board()read only that count, and a const assertion keeps every board between1andCOMPUTE_CHANNELS_MAX.COMPUTE_CHANNELS_MAX) sharing one execution context, QoS slot, scheduler page, and work-state table, with dedicated per-channelComputePoolmappings and a unified per-context atomic ordinal sequence (Context::next_compute_identity()).SIBLING_MIN_IN_FLIGHT = 2kicks are already in flight so short kicks and two-deep serial loops keep single-ring zero-arbitration latency.ComputeCellstate lock-free so short kicks and sourced commands never lock a cell or detour to the device mutex to add a sibling.Registry::sibling_source(),rearm_vacant()/rearm_compute()/bind_rearmed(), andgive_back_foreign()(prioritizing owners waiting for their primary channel) so fresh sequential processes never lock out sibling admission once the fresh-QID ceiling has been reached.DRM_ASAHI_FEATURE_COMPUTE_MULTI_CHANNEL(bit 42) throughGET_PARAMSwheneverpairs::compute_channels_per_owner() > 1(today only the M5 Pro). Userspace consumer: borealis: gate sibling compute queues and kernel cumulative signals by kernel features mesa#793. When the bit is set, Borealis stops opening its own sibling compute queues, so the same commands are not fanned out twice.Constants
COMPUTE_CHANNELS_MAX = 3: the most firmware compute queues any board spreads one command queue over (Board::compute_channels(), three on the M5 Pro, from macOS's own M5 Pro kicks traced under our hypervisor). It sizes the per-owner channel arrays and the compute waits of a render kick.SIBLING_EXECUTION_NS = 100_000: measured on M5 Pro, one QID streams queued kicks back to back at about 11 us each, while three QIDs take about 16.4 us per kick (about 5 us of firmware arbitration per sibling kick). 100 us is where that 5 us drops to 5% of the kick.SIBLING_MIN_IN_FLIGHT = 2: measured on M5 Pro. With a threshold of one, an owner keeping two GPU-filling kicks in flight took 286 to 302 us per kick against 270 us on one ring, because both rings then wait for the host's 60 to 100 us completion-to-resubmit turnaround. A processor-sharing model predicts 300 to 319 us. With two kicks already in flight, the primary always has one queued behind the overlap. This is the d=1 vs d>=2 crossover.Evidence
df36284f753b(11-25), Apple M5 ProT6050 / J714s / G17S B1: kernel7.3.0-m5-p3035o, built natively on the M5 (clang 22.1.8, LLD 23.1.1, rustc 1.98.1) with the default kernel's own config. The warm tree was resynced file by file to this commit and checked byte-identical first.make -j18 Image modules dtbsexit 0, 0 errors, no Rust warnings in the touched files. Default command line (MTE on, SEP writes on), Mesa: the default Borealis26.3.0-devel (aac82bea8e), headless only.tailscaled.service, which also fails on the default boot. LSMscapability,landlock, 0 AVC denials.dmesg: 0 new errors and 0 GPU or DART faults, timeouts or recoveries across all runs below. Kernel lines at priority err or worse: 10, none from the GPU (HID "no listeners", DCP clock index, as on the default boot).ok):compute.lightd1 108.6, d2 60.2, d4 24.8;compute.heavyd1 372.4 (5,766 GFLOP/s), d4 262.8 (8,171 GFLOP/s);render.lightd1 129.0, d2 68.1, d4 27.6;render.heavyd1 260.4, d4 125.3;sync.signald1 96.4 µs;concurrent.crd4 overlap 0.99.--deqp-surface-type=fbo), 0 fail, crash or timeout:synchronization.smoke.*12/12,synchronization2.smoke.*10/10,compute.pipeline.basic.*80 pass + 1 not supported,draw.renderpass.linear_interpolation.*12 pass + 9 not supported,synchronization2.op.multi_queue.*every 8th case (2,970): 2,147 pass + 823 not supported, the same as the default kernel (7.3.0-m5-cdirect15) in the same slot.crashed=0, 0 quarantined compute queues, 0 awaiting witness, 0 leaked render graphs, 0 refusals.mem_sleepdeep, +28 s, Wi-Fi parked across it): entered and returned in 34.3 s,suspend_statssuccess 0 → 1, fail 0. After the wake the GPU is live (vulkaninfoand a dispatch).compute.lightd1 108.3, d4 22.5;render.lightd1 129.0, d4 28.0;sync.signald1 91.1 µs, allok, 0 new GPU errors.df36284f753b(python3 -I tools/asahi/run-host-tests.py --only g17):181/181. The newg17-compute-retired-testsruns the productiondrain_compute_siblings(),rollback_unpublished_compute()(registry and backend),finish_uninstalled_compute(),finish_retired_compute(),reserve_compute_channel()andcancel_compute()for an owner with all three channels. It covers rollback of all three, displaced bindings, a failing rollback after a cancelled sibling, the drain, a busy sibling (EAGAIN) after an idle one, a failing cancellation, and more channels than places. Every queue and binding is dropped off the mutex, and the owner can reserve again after each case. Its 7 mutations each restore one way the old code leaked or dropped under the lock, and all fail.g17-m5-sibling-compute-testsandg17-compute-growth-deadline-testsfollow the moved code.scripts/checkpatch.pl --strictondf36284f753b:0errors,0checks,1warning: the generic "added file, does MAINTAINERS need updating?" for the new test (no MAINTAINERS entry coverstools/asahi/g17-*).ba6fe60583a6, ontointegration/auroraa3d477d03f8e): the only conflict was theasahi_drm.hcontext next to the merged bit 41 (COMPUTE_ONLY); bit 42 is kept. Same code as R2 otherwise (the commit message's bit-41 note now namesCOMPUTE_ONLY). Host tests--only g17:170/170.checkpatch.pl --strict:0errors,0checks,10warnings (unchanged from R2: 9 line-length in existing code, 1 MAINTAINERS).4c461ae19fe1): replaces thecompletion_inputs && !g17d_forms && !j813_formsboard-form test withBoard::compute_channels(), documents the constants above, and rewords the bit-42 note. The result is the same on every board (J714 true; J716C, J775D, J813 false, as before), so the hardware rows below still apply. They were measured on the R1 commit as carried by integration test kernel build 9: the same changes, with rebased context. Host tests after R2:170/170(g17-compute-multi-channel-feature-testsnow reads every production board'scompute_channelsand has9/9mutations:forms-gate,max-channelsandmulti-channel-maxare new).checkpatch.pl --stricton the commit:0errors,0checks,10warnings, none on lines R2 touches (9 line-length warnings in existing Rust code, 1 MAINTAINERS).scripts/checkpatch.pl --strict:0errors (0 errors, 0 warnings, 0 checksoninclude/uapi/drm/asahi_drm.h).python3 -I tools/asahi/run-host-tests.py --only g17):167/167passed (includingg17-m5-sibling-compute-tests8/8 mutations,g17-m5-sibling-gate-tests17/17 mutations,g17-m5-sibling-rearm-tests14/14 mutations,g17-compute-multi-channel-feature-tests6/6 mutations, andg17-compute-owed-stamp-tests+2 mutations).Apple M5 Pro / J714s / G17S B1, Linux 7.3.0 with the M5 direct-submission stack and Mesa with compute sibling deferral onDRM_ASAHI_FEATURE_COMPUTE_MULTI_CHANNEL):0GPU faults,0kernel warnings;4,058/4,068multi-queue and timeline Vulkan CTS passed (0failures).d=4..64): +9.9% to +20.1% faster.320-330 uswith zero QID exhaustion lockout.d=2): +5.9% faster.Regression tuple (R1 row)
git-8956dffd84(with aurora-silicon/mesa#793)0(microbenchmark health checkgpu_faults_delta=0, stress gate, CTS runs)0(as recorded in the run summaries; the raw dmesg of these runs was not kept)4,058/4,068multi-queue + timeline semaphore passed,0failedCONFIG_SECURITY_SELINUXunsetsystemctl --failedoutput was kept for these runs