Repository navigation
drm/asahi: g16: share one compute UMA descriptor and pool per VM - #3287
Conversation
Every non-SCS compute unit previously owned a separate UMA manager descriptor, submission counter, 32 MiB backing pool, and hardware UMA slot (1..24). Because each unit holds at most one command in flight at a time, every completing command observed *counter == COMPLETED, forcing firmware to acquire its global UMA locks and tear down and rebind the hardware UMA slot on every dispatch. It also allocated up to 768 MiB of UMA pools per compute VM and serialized two-pipe heavy compute dispatches into phase lock. Match macOS 26B123 by sharing one compute UMA manager descriptor, monotonic submission counter, 32 MiB backing pool, and hardware UMA slot (rotating across the 32 compute UMA slots 1..=32) across all non-SCS compute units of a VM: - While any command of the VM remains queued or active on any compute pipe, *counter > COMPLETED keeps firmware on its fast-path UMA bind and unbind checks without locks or hardware slot teardown. - Cross-VM reuse of the same hardware compute UMA slot (when >32 compute VMs are open concurrently) is serialized by `compute_uma_conflict`, and `Slots` retains each slot's VM-free `FwLease` in `retained_uma[0..32]` and tracks quarantined hardware UMA slots across hangs. - Retirement keeps strict service-stamp and per-unit timestamp checks, verifies shared `COMPLETED >= retired + count` for out-of-order multi-pipe completions, and enforces exact `COMPLETED == counter` conservation when a VM drains idle. - SCS/ray-query compute units retain their existing per-unit UMA pools. Signed-off-by: DjDeveloperr <[email protected]>
|
Merge readiness at
Areas: Updated by pr-readiness on pushes, edits, reviews and comments, and on a schedule. Rules: merge policy · labels. |
|
Verdict at Blockers: none. My blocker at
Checked
Before merge
Notes, not blocking
Evidence |
Track live open VM occupancy per hardware compute UMA slot so new non-SCS compute VMs always allocate from free, unquarantined slots before falling back to least-loaded sharing when more than COMPUTE_UMA_SLOTS live compute VMs are open concurrently. Decouple ComputeSlot from SharedComputeUma references (keeping private_uma only for SCS units) and retain quarantined shared UMA backing in Slots until reboot. When a VM's shared UMA slot is quarantined, Cache::prepare() rebuilds SharedComputeUma on a fresh unquarantined slot in the next disjoint client VA window so both innocent sharing VMs and continuing work recover without EIO. Add host tests covering live-VM slot occupancy, 33+ concurrent VM sharing, quarantine pinning and migration, real can_queue_behind_with_ta cross-VM UMA conflict gating, and real Prepared::compute_uma_retired idle conservation. Wrap two over-100-column test lines. Signed-off-by: DjDeveloperr <[email protected]>
|
J516s (MacBook Pro 16" M3 Pro, G15S) row at
|
Keep the cross-VM compute UMA slot check alongside main's multisample render admission check, and exercise both in the publication fixture. Signed-off-by: DjDeveloperr <[email protected]>
|
J773g (M4 mini, G16G) passed at After s2idle, the host observed wake at 14 s (1 successful suspend, 0 failures). All seven post-wake GPU tests passed, including matching CRCs for postfx, array compression and MDI. The kernel log showed zero GPU faults. The driver reported zero recoveries, hang kills and quarantined owners.
|
|
J516s (MacBook Pro 16" M3 Pro, G15S) row at
|
There was a problem hiding this comment.
Verdict: MERGE at c4ecf0a0
Blockers: none.
Checked:
drivers/gpu/drm/asahi/g16/resources.rs,slots.rs,engine.rs,poll.rs,encode/compute.rs,hw.rs,mod.rs,queue.rs: verified oneSharedComputeUma(descriptor, counter, 32 MiB pool, hardware slot1..=32) per non-SCS compute VM while SCS compute units retainPrivateComputeUma.- Verified
compute_uma_conflict()serializes only cross-VM flights sharing a hardware compute UMA slot while allowing same-VM multi-pipe overlap; verifiedpick_compute_uma_slot()prefers unoccupied healthy slots with RAIIComputeUmaOccupancyreleased on close/drop/migration. - Verified idle-boundary
validate_shared_compute_descriptor()anchorsWORK == descriptor_fw,compute_uma_retired()requirescompleted == counterwhen draining idle (last_vm_flight), andSlots::quarantine()setsuma_quarantinedand retainsquarantined_shared_uma[slot]so aborted pools stay mapped while VMs migrate cleanly. - Verified 20/20 CI green and exact-head (
c4ecf0a078a8) hardware rows on both J773g (M4 mini: 20/20 shared binary semaphore CTS, 35 live VMs, s2idle + 7 post-wake GPU tests) and J516s (M3 Pro, G15S: 3.55M jobs, 0 faults).
Evidence
- Diff reviewed at
c4ecf0a0across all coreg16/files and host tests (check-abi-26b123.rs,test-publication.py,test-resources.py,test-stamp-wrap.py). - CI: 20/20 PASS.
|
Merge-train status at |
|
Merging under the 6-point rule (Ryan 09:29, permanent), at |
|
Correction to the merge note above: the merge didn't happen. After the PRs merged just ahead of it (#3285 and others), this branch no longer merges cleanly with main. @DjDeveloperr, please forward-merge main (no force push). It goes back into the queue at the new head, and the App re-approval plus the rows still apply if the merge is conflict-only. |
Forward-merge main after #3285. Only the asahi-m4 selftests conflicted: test-resources.py takes main's Registry::release(file, process) and LiveToken process field in the new test_live_token() helper; test-stamp-wrap.py keeps the PR's pub manager/fw::graph alias and adds main's user_stamp cell, and the shared compute UMA test now marks pipe 1 done through user_stamp like the other compute cases on main. Signed-off-by: Ryan Murray <[email protected]>
|
Forward-merged main into this branch (merge commit 7f4b5a1, no force push). Only the two asahi-m4 selftests conflicted with #3285: test-resources.py now passes main's |
There was a problem hiding this comment.
Verdict: FINISH, then merge at 7f4b5a10 — the #3285 selftest merge resolution is clean, but the branch is still CONFLICTING (DIRTY) against current main.
Blockers:
- Forward-merge current
origin/main(8ebb0f75ae2dor later, no force push) to resolve the remaining conflicts:7f4b5a10ad57mergedd2532e9034, which is 104 commits behindmainand predates#3185(fix/g16-m4-no-ta-wave), leaving conflicts acrossdrivers/gpu/drm/asahi/g16/engine.rs,g16/hw.rs,g16/poll.rs, andtools/testing/selftests/drivers/gpu/asahi-m4/test-publication.py. WhileCONFLICTING, the PR cannot merge andpull_requestCI cannot run.
Checked:
7f4b5a10ad57merge againstd2532e9034: verified the#3285conflict resolutions intools/testing/selftests/drivers/gpu/asahi-m4/test-resources.py(test_live_token()process: 0field andRegistry::release(file, process)) andtest-stamp-wrap.py(pub mod manager,fw::graphalias,user_stampcell set on pipe 1 inshared_compute_uma_retires_out_of_order_and_checks_idle_conservation()) are clean and preserve all previously approved driver behavior fromc4ecf0a0.- Live mergeability against
main(8ebb0f75ae2d):CONFLICTING/DIRTY(19CI checks queued/blocked).
Evidence
- Head:
7f4b5a10ad57(CONFLICTING/DIRTYagainstmain8ebb0f75ae2d). - Overlapping commits between
d2532e9034and8ebb0f75ae2d:#3185(4dcecee646,4f136979ba,4b884ef8b6,c7cf6c261b) touchingg16/engine.rs(+32/-231),g16/hw.rs(+0/-13),g16/poll.rs(+7/-24), andtest-publication.py(+87/-276).
Forward-merge main. Main (#3185) dropped the M4 TA wave window, which removed Flight::heavy_render, Engine::ta_wave_wait and turned can_queue_behind_with_ta() into can_queue_behind(). engine.rs keeps this branch's compute_uma_mask and takes main's removal of heavy_render. The test-publication.py stand-ins take main's Flight and QueueBehindFlight shapes plus compute_uma_mask/quarantined_uma_mask; the TA wave tests main deleted stay deleted, and the shared compute UMA tests call can_queue_behind() without the TA cursor. Signed-off-by: Ryan Murray <[email protected]>
|
Forward-merged current main (2fd49a6) into this branch; new head 6b13f41 (no force push). |
There was a problem hiding this comment.
Verdict: MERGE at 6b13f41 after exact-head CI.
Checked: The branch merges with current main. The resolution retains compute UMA ownership and quarantine checks while following main’s removal of the TA wave window. The publication fixture exercises the same-VM and cross-VM UMA decisions with the new queueing signature. Keep hosted Apple build and KUnit on the merged head and record hardware evidence equivalence against that tree.
|
code-owner ping @DjDeveloperr: closeout merge at |
|
Merging under the 6-point rule (Ryan 09:29, permanent), at |
What: share one compute UMA manager descriptor, monotonic submission counter, 32 MiB backing pool, and hardware UMA slot (allocated across compute UMA slots
1..=32) across all non-SCS compute units of a VM on G16, matching macOS 26B123.Previously, every non-SCS compute unit owned a separate UMA descriptor, submission counter, 32 MiB pool, and fixed hardware UMA slot (
1..=24). Because each unit holds at most one command in flight, every completing dispatch saw*counter == COMPLETED, forcing firmware to take its global UMA locks and tear down and rebind the hardware UMA slot on every dispatch. It also allocated up to 768 MiB of UMA pools per compute VM and locked two-pipe heavy compute dispatches into phase lock.With one shared compute UMA descriptor per VM:
*counter > COMPLETEDkeeps firmware on its fast-path UMA bind and unbind checks without global lock teardown/rebind.compute_uma_slot_userssized fromhw::sizes::COMPUTE_UMA_SLOTS): new compute VMs always allocate from unoccupied, unquarantined slots first and only fall back to least-loaded healthy slot sharing when more thanCOMPUTE_UMA_SLOTS - quarantinedlive compute VMs are open concurrently.ComputeSlotis decoupled fromSharedComputeUma(retainingprivate_umaonly for SCS units), andSlotspins quarantined shared UMA pools until reboot. If a VM's hardware compute UMA slot is quarantined,Cache::prepare()rebuildsSharedComputeUmaon a fresh unquarantined slot in the next disjoint client VA window so both innocent sharing VMs and continuing work recover without stickyEIO.compute_uma_conflictwhile disjoint VMs continue to overlap across compute pipes.COMPLETEDprogress and enforces exactCOMPLETED == counterconservation when the VM drains idle; SCS/ray-query compute units keep private per-unit UMA pools.Tested:
tools/testing/selftests/drivers/gpu/asahi-m4/run-host-tests.py) at078f963c: 26/26 passed, including:COMPUTE_UMA_SLOTS(test-resources.py),test-resources.py),can_queue_behind_with_ta()andneeds_engine_drain()cross-VM UMA conflict and quarantine gating (test-publication.py; mutation-verified),Prepared::compute_uma_retired()out-of-order retirement and idleCOMPLETED == counterconservation (test-stamp-wrap.py; mutation-verified).scripts/checkpatch.pl --stricton078f963c: 0 errors, 0 warnings, 0 checks (two >100-column test lines wrapped; earlier commit70c8451dhad one 76-character commit-message line).main b14959b819cfa/suma 70c8451d42be4/suma/main), 264/264 ok, 0 kernel findings, 0 GPU faults/recoveries/hangs (~1.37M jobs per suma boot):compute.light d=4compute.light d=8compute.light d=16compute.light d=32compute.light d=64compute.light procs d=16compute.heavy alu d=1compute.heavy alu d=2compute.heavy alu d=4compute.heavy alu queues d=2compute.heavy alu procs d=2compute.heavy bw d=1compute.heavy bw d=2compute.heavy bw d=4sync.signal binary d=2sync.signal timeline d=2sync.signal host d=1concurrent.cr light interleave d=4concurrent.cr heavy queues d=4render.light tri d=16compute.uber ilp d=4compute.uber uniform d=4compute.heavy bw d=2/4:bw.compcopies one 64 MiBs[]to one 64 MiBd[](134.22 MB read+write per dispatch) on M4 LPDDR5X (120 GB/s peak, 1,118.5 us DRAM floor).main's 880.30 us atd=2corresponds to 152.5 GB/s — above the 120 GB/s DRAM peak — which is only possible becausemain's per-command UMA teardown global locks forced both CDM pipes into tight 0-degree phase lock (~74% start overlap,gpu_us = 735.65 us,gpu_gap_us = -545.80 us) over the exact sames[]buffer so both waves shared the 8 MiB SLC and halved DRAM reads. Breaking that 2-wave lockstep atd=4droppedmainto 1,139.02 us (117.8 GB/s), and the same global lock regressedcompute.heavy alu d=2by +19.1% (639.39vs537.06 us) andconcurrent.cr heavy queues(1.15xvs1.03x). With shared UMA,bwruns steady-state pipeline overlap at 1,257.87 us at bothd=2andd=4(106.7 GB/s, 89% of DRAM peak, zero idle gap), still 12.45% ahead of Metal 4 (1,436.78 us, 93.4 GB/s).078f963c:dEQP-VK.synchronization.signal_order.shared_binary_semaphore.write_ssbo_vertex_read_copy_buffer_to_image.buffer_262144_opaque_fd): stockmain(7.3.0-ARCH-m4mainefed1ae3) 20/20 Pass (0 Fail);078f963c20/20 Pass (0 Fail).078f963c:compute.light d=4/8/16/32/64=42.55 / 30.93 / 24.60 / 23.66 / 23.62 us,procs d=16=43.71 us,compute.heavy alu d=2 / queues d=2 / procs d=2=537.63 / 537.63 / 606.80 us,concurrent.cr interleave=63.71 us,queues=1.02x.vk-uma-quarantine, 35 simultaneous openVkDevices > 32 hardware compute UMA slots + fresh 36th VM): clean run35/35 pre + 35/35 post + fresh VMpassed with exact readback and 0 faults/recoveries; post-wake unmapped BDA write run35/35 pre + 34/34 post + fresh VMpassed with 0 kernel findings (AGX soft-fault absorbed the unmapped BDA write without triggering a firmware abort-and-quarantine handshake; an infinite-loop compute shader hits the 5 s hostg16_compute_deadline_msdeadline before firmware's CDM watchdog, so the quarantine-migration path itself is verified by the host selftest).--jobs 1, excluding drm/asahi g16: dEQP-VK.synchronization*multi_queue* faults the GPU and fail-stops it on J773g (main 61c7b88a) #3201multi_queue/cross_instance, 15,000 cases recorded within the short slot window):7,393 Pass / 7,607 NotSupported / 0 Fail, 0 GPU faults/recoveries/hangs.s2idlesuspend/resume: woke cleanly after 13 s (S2IDLE_POST success=1 fail=0,DELTA_ERR=0), post-wake render+compute+CRC suite 7/7 passed (182,449jobs /319,576commands, 0 kernel findings).70c8451d(1.46Mjobs /1.73Mcommands, 0 kernel findings, 0 GPU faults/recoveries/hangs):concurrent.cr x10(20/20 ok),compute.light/procs/heavy/queues x5(25/25 ok), VK-GL-CTS 34,810 cases (17,982 Pass / 16,827 NotSupported / 1 Failon the shared-semaphore case confirmed 20/20 Pass on both main and078f963cabove),s2idle14 s (DELTA_ERR=0, post-wake 7/7).origin/main(git merge-tree --write-tree).Risk: two-way · Macs on the g16 backend (M4 G16G; M3 G15S and G15G). A plain revert undoes it.
*counter == COMPLETED) to idle-only teardown (*counter > COMPLETEDwhile any pipe is active). Mitigated by preserving strict service-stamp retirement, verifying monotonicCOMPLETEDprogress on out-of-order multi-pipe retirement, enforcingCOMPLETED == counteron VM idle, tracking live-VM slot occupancy, serializing cross-VM hardware slot reuse withcompute_uma_conflict, and migrating VMs to fresh unquarantined slots on quarantine.compute.heavy bw d=2moves frommain's 880.30 us (152.5 GB/s, above M4's 120 GB/s DRAM peak due to phase-locked SLC sharing from per-command UMA teardown locks) to 1,257.87 us (106.7 GB/s, 89% of peak, steady-state overlap at bothd=2andd=4, still 12.45% ahead of Metal 4's 1,436.78 us);compute.heavy alu procs d=2shifts by +1.36% (603.93 -> 612.13 us,606.80 uson078f963c), andcompute.ubershifts by +1.1% to +2.1%.Not yet:
compute.light d=16to 23.54 us (ahead of Metal 4's 23.89 us) andcompute.light d=64to 22.78 us.COMPUTE_UNITSbeyond 24 (now feasible since units no longer allocate per-unit 32 MiB UMA pools or hardware UMA slots) to eliminate the 16-process saturation seen oncompute.light procs d=16.