Repository navigation
drm/asahi: g16: keep compute UMA managers bound and ASC-cached - #3695
Conversation
A VM's shared compute UMA manager lived in a per-VM ASC-uncached
object next to its host-written counter. The firmware saves and
unbinds a manager whenever a command finishes with COMPLETED equal to
the counter. A client with one job at a time (8 processes in
compute.light procs) paid a save and a rebind on every job, with
every access to the manager uncached.
Map the managers as macOS 26B123 does. In the J773g Metal procs-d8
snapshot, each of the 8 compute managers
sits alone on its own page with leaf 0x443 (ASC write-back), each
counter is on a separate page, and an idle manager's counter equals
COMPLETED.
- Each hardware compute UMA slot gets two device-lifetime manager
records, ASC-cached on their own pages and never freed: 1 MiB for
all 32 slots, allocated on a slot's first use. The host rewrites
only a record that the firmware's slot table cannot name, so each
slot needs a second record.
- The counter stays on an uncached page of its own. While the
manager has commands in flight it runs one past the submissions,
so the firmware never saves the manager. When the manager's last
command retires, the counter drops back to the submission count.
An idle manager stays bound with its cursors in the hardware, and
its counter equals COMPLETED, as on macOS.
- The firmware's bind loads only the incoming record and never saves
the outgoing manager. In 26B123, the save runs only past the
COMPLETED == *counter gate. So the host tracks which manager each
slot holds:
- The same manager keeps its record, with no host write.
- Any other return waits for the manager's own commands to retire.
That covers another VM's manager or a private SCS unit taking
the slot, an idle power-down, a sleep and a recovery. The host
then rebuilds a record the slot table does not name, and reseeds
the drained freelist and pool rows with it.
- A private unit waits for shared commands in its slot.
- The slot ledger keeps only identities and counts. As before, a
closed VM's manager, pool and live-VM charge go when its last
flight retires.
- The host never reads the cached manager. Retirement uses two
receipts: the service stamp, which the firmware stores after its
last access to the command's work, microsequence and manager; and
the GPU end tick.
The firmware powers the GPU down after an idle delay, and that drops
the hardware state of a manager left bound. The host checks for this
only at a publication pass where it has nothing in flight and a
shared manager may be bound. It reads the firmware's powered flag,
which 26B123 and the T6030 firmware record, and treats every binding
as stale unless the flag shows the GPU powered. Firmware without the
flag keeps the GPU powered while it runs. Passes with work in flight
and render-only work read nothing.
Signed-off-by: DjDeveloperr <hey@djdev.me>
|
Merge readiness at
Areas: Updated by pr-readiness on pushes, edits, reviews and comments, and on a schedule. Rules: merge policy · labels. |
There was a problem hiding this comment.
Verdict: HOLD at ebc3b149 — G16 compute UMA residency/double-buffered ASC-cached record design and host tests are solid, but there is a f.group fence-hang bug on error in poll.rs, plus queued CI and missing M3 regression / exact-head hardware row.
Blockers:
drivers/gpu/drm/asahi/g16/poll.rs(retire_oldest): in the newif let Some(Err(error)) = releasedblock aftershared.counter.w64(...),f.jobis retained and completed beforeself.fail_stop(error, done)andcore::mem::forget(f), but folded compute horizon jobs inf.groupare skipped. Because compute horizon folding (engine.rs:2929-2952) folds same-queue compute jobs intof.groupandfwas already removed fromself.engine.flights, skippingfor j2 in f.group.iter() { self.retain(j2); complete(done, j2, Err(error)); }leaks folded jobs with permanently unsignalled DMA fences (matching the siblingfail_stoppaths immediately above and below inretire_oldest).- Hosted CI at
ebc3b149is stillQUEUED(apple-build,host-tests, and 16KUnitsuites). - Missing second-family / exact-head hardware row (
needs-hw-row,blast:m3,blast:m4): PR notes J516s (M3 Pro, which shares the G16 backend) is not yet run, and the J773g 4-boot ABBA / dEQP-VK run was built on42169a04(needs an exact-head SHA row or maintainerhwok+ M3 regression row).
Checked:
- Double-buffered per-slot device-lifetime
Class::FwCoherentmanager records (PersistentUmaRecordsinresources.rs,UMA_RECORDS = 2): never dropped while firmware's slot table may still reference them, partial-failure retry preserves already-mapped records, andbind_compute_uma()only writes to the record not currently named byuma_bound[slot]. - In-flight
+1hold accounting (prefix_computereservessubmitted.checked_add(1)before publication, publication storestail_sub.saturating_add(1), clean retirement drops*counterback tosubmittedonly whenoutstandingdrains to0). - Shared vs private (SCS) slot serialization (
compute_uma_private_ready(),uma_shared_flights/uma_private_flightsbitmask per flight,uma_bound/uma_livedisplacement,invalidate_compute_uma()across recovery, warm sleep restart, and idle power-down check). - Quarantine/abort invariance:
Slots::quarantine()already quarantinesuma_quarantinedper hardware UMA slot and retainsquarantined_shared_uma[slot], so aborted flights never re-enter clean accounting. - Closed-VM lifetime: per-slot residency ledger stores only
id/rec/genand flight counts (noArc<SharedComputeUma>), verified byclosed_vms_release_admission_after_retirement.
Evidence
- Verified
engine.rs:2929-2952pushes folded same-queue compute jobs ontof.group, and verified every otherfail_stoppath inpoll.rs:1555-1563,1590-1598,1609-1617, and1634-1636loopsfor j2 in f.group.iter() { self.retain(j2); complete(done, j2, Err(error)); }. - Non-blocking note for future GPU idle power-gating:
Session::may_be_powered_down()reads the handoffpoweredbyte without holdinglock_m4_handoff(). Once GPU idle power-gating is enabled, a TOCTOU window exists if the firmware powers the GPU down betweennote_gpu_idle_if_any()readingpowered != 0and the next doorbell waking it (leaving a bound shared manager trusting lost hardware allocator state). Worth hardening with a monotonic firmware power-cycle counter or handoff-lock coordination when GPU idle power-gating lands.
On J516s (T6030) the compute UMA idle check invalidated the held managers at nearly every publication from an empty engine. The G15S handoff byte at +0x638 does not read nonzero there while the GPU is powered, so each such job rebuilt its manager record and reseeded its 64 KiB freelist. compute.light procs d2 went from 43.6 to 56.6 us. The driver stats show the cost: about 5 us more prefix time per publication, and 14 us more for each publication after the engine drained. On J773g the byte reads 1 while the GPU is powered, so J773g was not affected. Trust the flag only after it has read nonzero at a publication pass with nothing in flight. The GPU is then idle and powered, and only a flag that tracks GPU power shows that. A flag that stays zero, or one set only while work runs, never earns trust and invalidates nothing, as on firmware without the flag. Bindings on such firmware rely on the GPU staying powered while the firmware runs, which holds on J516s and J773g today, and on the invalidation at system sleep and recovery. A change that makes such firmware power the GPU down must first make the flag earn trust. Report the residency in aurora-g16/stats as "compute_uma: rebuilds N invalidations M powered_flag 0|1". Signed-off-by: DjDeveloperr <hey@djdev.me>
The error path after the compute UMA counter write-back completed only the flight's own job with the error. Compute jobs folded into the flight's group were left with fences that never signal. Complete them with the error like the other fail-stop paths in retire_oldest. Signed-off-by: DjDeveloperr <hey@djdev.me>
There was a problem hiding this comment.
Verdict: HOLD at 11b31056 — prior poll.rs f.group error-path blocker is cleanly fixed and the new powered_flag_proven guard + stats look solid; awaiting hosted CI completion and exact-head M3/M4 hardware rows.
Blockers:
- Hosted CI at
11b31056is stillQUEUED(apple-build,host-tests, and 16KUnitsuites). - Hardware rows (
needs-hw-row,blast:m3,blast:m4): awaiting exact-head11b31056J773g/J516s rows (or maintainerhwokcarry-forward once J516s M3 Pro verification is recorded).
Checked:
11b31056(drivers/gpu/drm/asahi/g16/poll.rs): addsfor j2 in f.group.iter() { self.retain(j2); complete(done, j2, Err(error)); }beforeself.fail_stop(error, done)andcore::mem::forget(f)inretire_oldest(), matching the siblingfail_stoppaths and closing the folded-compute fence-hang bug.bb0df446(boot.rs,engine.rs,slots.rs,poll.rs,test-publication.py,test-resources.py):Session::powered_flag()returnsOption<bool>(Nonewhenadt.layout.poweredis absent;Some(nonzero)otherwise), andnote_gpu_idle_if_any()setspowered_flag_proven = trueonly after seeingSome(true)with an emptyflightsqueue and held manager — preventing spurious invalidations/rebuilds on G15S/T6030 where the handoff byte stays zero while powered, while still invalidating onSome(false)once proven.SlotStatsadds saturatinguma_rebuildsanduma_invalidationscounters exposed in debugfs alongsidepowered_flag, covered by updatedtest-publication.pyandtest-resources.pyhost tests.
Evidence
- Verified full interdiff
ebc3b149..11b31056across all 6 touched files (boot.rs,engine.rs,poll.rs,slots.rs,test-publication.py,test-resources.py). MERGEABLEagainstmain;pr-textandreadinesspassed; remaining 18 hosted CI checksQUEUED.
… power off Compute UMA managers stay bound across short idle gaps under the in-flight hold, so their allocator cursors live only in the hardware, and a GPU power-off drops them. The previous check trusted the firmware's powered byte once it had read nonzero at idle. That byte is not a validated witness of continuous power: it reads zero on G15S, so nothing was ever invalidated there, and a byte seen high once does not prove that the GPU stayed powered. Decide from the power policy that boot actually sends instead. The session records it with the final boot control. START with a zero argument asks the firmware to wake the GPU and hold it powered, and the firmware then never powers the GPU off on its own while idle (measured on main: 0 of 16 checks off at 250 ms on J773g and J516s). Under that hold a bound manager cannot be lost while idle, so nothing is invalidated and the managers keep their fast reuse. System sleep and recovery still invalidate, as before. When a policy lets the firmware power the GPU off on its own, there is no qualified power-loss witness yet (a firmware power-loss generation, or a power hold that spans this check through the firmware's consumption of the next kick). So every publication pass that finds nothing in flight after retiring what it can, with a shared manager held, invalidates the held managers. Their next commands rebuild into the slot record that the firmware's slot table does not name. A pass with work in flight invalidates nothing, because a flight in flight keeps the GPU busy. A later change can replace this with a qualified witness. The change that releases the power hold must set the flag where it sends that policy. The flag is set next to the START control, so such a change conflicts with this one visibly instead of silently. Drop the powered-byte heuristic and its stat. The stats line becomes "compute_uma: rebuilds N invalidations M idle_invalidations K". Signed-off-by: DjDeveloperr <hey@djdev.me>
There was a problem hiding this comment.
Verdict: HOLD at e85c6d2
Blockers: Hosted build, host and KUnit jobs are queued. Keep the combined idle-power-off landing with #3697 held for the wake-cost fix and the J516s paired regression.
Checked: The idle decision follows the boot policy. The author posted J773g and J516s passes with matching CRCs and zero GPU faults at this head. The J773g #3697 pairing passed 16/16 power-off cycles and its checked wake stress, with about 75 µs added per wake. That wake cost is specific to the combined policy.
|
PASS — J773g (M4 mini, T8132 G16G) target row at
The earlier rows below are at PASS — J773g (M4 mini, T8132 G16G) target row at PASS — J516s (M3 Pro, T6030 G15S) second-generation row at J773g
J516s (M3 lead)Three-way, then final head. Each boot set ran on the same J516s config with exact-SHA native builds; values are boot medians in µs.
The first version's procs d2 regression:
J516s correctness and health: 40/40 timing rows and 40/40 CRCs; 0 faults, recoveries, hang kills or quarantined owners; With #3697 (GPU idle power-off)When the boot policy lets the firmware power the GPU off by itself, this head rebuilds a held manager at every publication made with nothing in flight. There is not yet a qualified power-loss witness. J773g ABBA, #3697
That wake cost blocks the combined landing until it is bounded. Variants that skip the freelist reseed, or skip the invalidation, are queued on J773g. The J516s run of the same pairing is pending. Neither affects this PR on main, where GPU power is held. |
|
Review at Blocker: after a GPU recovery aborts a compute flight, a later compute job can stall publication and then fail-stop the whole GPU. On main, the same job fails alone with EIO.
Example: VM X's shared manager is in UMA slot 0, and its compute job faults on unit 5. The recovery aborts that flight and quarantines unit 5 and UMA slot 0. From then on, any SCS compute job on unit 0 waits until the deadline, and the GPU fail-stops. Fix: check the quarantine before waiting on the ledger. The smallest change is to move the if !render && self.slots.compute_uma_quarantined(job.resources.compute_uma_mask()) {
return Err(EIO);
}Alternatively, add the same
Checked, fine:
Other gates: |
A recovery quarantines an aborted flight instead of retiring it, so its commands stay counted in the compute UMA ledger of its slot for good: uma_shared_flights, uma_private_flights and the manager's outstanding count. prefix_compute waits on those counts before publish_prefix_body checks the slot quarantine. An SCS command in a slot where a shared flight was aborted, and a shared manager rebuilding in a slot where a private flight was aborted, both returned EAGAIN forever. With nothing else in flight the publication deadline then expired with ETIMEDOUT and the whole GPU fail-stopped, where the job alone used to fail with EIO. Check the quarantine with the other admission checks at the top of publish_prefix_body, before any wait. A job's UMA mask is fixed when it is prepared and nothing in between changes the quarantine, so a job in a healthy slot takes the same path as before. The host tests run those admission checks over the real slot ledger after a shared and after a private flight is aborted in a slot. Signed-off-by: DjDeveloperr <hey@djdev.me>
There was a problem hiding this comment.
Verdict: HOLD at 421240d7
Blockers:
- Hosted CI at
421240d7is still running (apple-build,host-tests, KUnit, etc.). - Exact-head hardware row at
421240d7is pending (prior J773g and J516s rows were captured ate85c6d2e).
Checked:
drivers/gpu/drm/asahi/g16/engine.rs,drivers/gpu/drm/asahi/g16/slots.rs: verified421240d7movesself.slots.compute_uma_quarantined(job.resources.compute_uma_mask())to the top ofpublish_prefix_body()beforewait_compute_stamps_for(),choose_compute_pipe(), andprefix_compute(), matchingf.compute_uma_mask(engine.rs:3320-3324) and returningErr(EIO)immediately rather than spinningEAGAINon aborted-flight ledger counts until publication timeout.tools/testing/selftests/drivers/gpu/asahi-m4/test-resources.py,test-publication.py: verified both new quarantine admission tests (aborted_shared_flight_fails_later_compute_in_its_slot,aborted_private_flight_fails_later_shared_jobs_in_its_slot) and static ordering assertions againstpublish_prefix_body().
Evidence
compute_uma_mask()(drivers/gpu/drm/asahi/g16/resources.rs:1967-1973) is fixed at preparation time (1 << uma.uma_slot_idxfor shared UMA orcompute_slot_mask()for private SCS) and equalsf.compute_uma_mask, so checking it up front preserves behavior on healthy slots while preventing a quarantined slot from stalling publication.- Code is ready once hosted CI passes and exact-head hardware confirmation at
421240d7is posted.
There was a problem hiding this comment.
Verdict: HOLD at 421240d
Blockers: Hosted CI and hardware evidence for the updated head remain. The paired idle-power-off landing still needs its wake-cost disposition and peer row.
Checked: The new admission check rejects quarantined compute slots before publication can wait on their ledger. The fixture exercises the early refusal in the resource paths. This addresses the earlier recovery-ordering finding in source.
|
J516s (MacBook Pro 16" M3 Pro, T6030, G15S B1) second-generation row at
|
|
Verdict at Blockers
Checked
Evidence
|
|
Since the 07:41 merge, main moved and this conflicts again in five files. One is a design conflict, not a merge-up. Main's |
Main's "stop G15S in prepare and preserve firmware SRAM" sends START with argument 1 on layouts that record the GPU's power, so the firmware may power the GPU off while idle. This branch sent START with argument 0 and kept a flag saying so. Keep main's START: the flag becomes Session::idle_power_off(), the same layout test that now picks START's argument. Held compute UMA managers are then rebuilt after every idle gap on those layouts, and stay bound across it where the firmware holds the GPU powered. The rest are adjacent edits: main's per-pair render statistics, sleep_restart(held), and the queue_passed() and render-only mocks it dropped. Keep both sides. Signed-off-by: DjDeveloperr <hey@djdev.me>
|
Merged main ( What main changed: Rule: main's START is kept. Is the idle invalidation enough?
Cost: held managers now rebuild after every idle gap on main too. The earlier rows with #3697 show what that costs without #3699 (J773g: queue d1 +6.5 %; J516s: queue d1 +54 %), so this should land together with #3699, which still merges cleanly onto this head. The body's "zero on main" notes no longer hold. Checks: full host tests 1028/1028 in the pinned container. Arm64 Not verified: no hardware run. Idle invalidation under main's policy without #3697 has never run on a Mac. Rows owed at
|
RyanTheTide
left a comment
There was a problem hiding this comment.
Reviewed bc7b139. Shared managers stay bound until replacement or invalidation, and submit checks the quarantined slot before waiting on its flight ledger. Clean retirement accounts for shared and private flights separately. The reported J516s and J773g rows establish the carried performance and correctness evidence at their recorded revisions.
There was a problem hiding this comment.
Verdict: MERGE at bc7b139
Checked: START and runtime idle invalidation now use the same powered-layout condition. The T6030 sleep policy remains the base policy, and unpowered layouts retain their existing behavior. Both submit and poll retire work before invalidating idle managers. The author reports 1,028/1,028 host checks on this head.
Follow-ups: Land with #3699. The paired work removes the per-wake freelist rebuild cost measured on the earlier stack.
|
J773g (Apple M4 Mac mini, Build & Arm Identification
Results (
|
…u64-cached-uma Sixteen compute pipes keep up to sixteen exited clients' VMs bound, eight more than main's pipes. Vulkan clients take one TTBAT slot each with this. A LiveToken of #3695's host test takes the new field. Signed-off-by: DjDeveloperr <hey@djdev.me>
|
J516s (MacBook Pro 16" M3 Pro, Build & Arm Identification
Results (
|
| Workload | base (us) |
compA (us) |
compA / base |
|---|---|---|---|
compute.light queue d=1 |
102.43 | 99.98 | 0.976 (-2.4%) |
compute.light queue d=4 |
25.73 | 24.67 | 0.959 (-4.1%) |
compute.light queue d=16 |
17.88 | 15.73 | 0.880 (-12.0%) |
compute.light queue d=32 |
20.44 | 16.15 | 0.790 (-21.0%) |
compute.light queue d=64 |
24.22 | 20.04 | 0.827 (-17.3%) |
compute.light queues d=2 / 4 / 8 |
55.56 / 35.78 / 26.30 | 50.50 / 33.39 / 24.33 | -9.1% / -6.7% / -7.5% |
compute.light procs d=2 / 4 / 8 / 16 |
54.94 / 33.00 / 27.91 / 27.57 | 52.59 / 32.59 / 25.78 / 25.91 | -4.3% / -1.2% / -7.6% / -6.0% |
sync.signal queues d=2 |
17.94 | 15.74 | 0.877 (-12.3%) |
idle.wake gap_ms=2 / 20 / 200 |
413.09 / 514.10 / 517.17 | 414.19 / 513.28 / 511.58 | +0.3% / -0.2% / -1.1% |
compute.heavy alu d=1 / 4 |
542.04 / 367.78 | 536.48 / 367.65 | -1.0% / 0.0% |
compute.heavy bw d=1 / 4 |
4405.55 / 4166.67 | 4385.96 / 4184.32 | -0.4% / +0.4% |
compute.uber uniform d=4 |
125.08 | 125.06 | 1.000 (0.0%) |
render.light queue d=1 / 16 / 64 |
110.99 / 39.26 / 34.15 | 123.33 / 39.44 / 34.44 | +11.1% / +0.4% / +0.9% |
render.light procs d=8 |
58.22 | 58.01 | 0.996 (-0.4%) |
render.postfx msaa=4 1080p d=1 / 2 |
2941.18 / 2427.18 | 2941.18 / 2427.18 | 1.000 / 1.000 |
render.bindless_ubo d=2 |
442.93 | 443.27 | 1.001 (+0.1%) |
render.deferred tile msaa=4 d=1 / 2 |
16666.67 / 16666.67 | 16666.67 / 16666.67 | 1.000 / 1.000 |
transfer.ops d=4 |
45.37 | 45.76 | 1.009 (+0.9%) |
Stress, Sleep, CTS & Health
gpubench-vk --verify: 0 CRC/status failures across all runs on both arms.gpubench-stress-vk --test idle.wake: idle PASS (2064 checks), all-CPU load PASS (1936 checks).- 40-process VM churn (
5 × compute.light procs d=8): PASS. s2idleacross livecompute.light procs d=4+ post-sleepcompute.light d=64andrender.postfx d=2:0 -> 2PASS.- Vulkan CTS (0 failures, 0 diffs vs
base):compute_pipeline:103/117passed,14not supported,0failedcompute_sample:1210/6756passed,5546not supported,0failedmulti_queue_3w:105/2439passed,2334not supported,0failed
aurora-g16/stats(end ofcompA):health: failed 0 errno 0 degraded 0,recovery_receipts: affected_full 0 aborted 0,jobs 4601105 recoveries 0 hang_kills 0,compute_uma: rebuilds 1121036 invalidations 435543 idle_invalidations 435543 reseeds 1822,compute_owners: retired 24 quarantined 0 reusable 16,vm_bindings: live 22 handles 0.- Kernel logs:
se61=0,gpu_lines=0,warn=0.
|
Local check of the merge with main, 2026-12-03.
Not run: the full host suite. Merging, then #3699. |
Conflict in g16/boot.rs: main (#3695) sends the last boot control from Session::idle_power_off(), the same rule the compute UMA idle check reads. Use that one rule for the control, the Globals word and the idle delays, and drop this branch's separate Admitted::allow_idle copy of it. test-publication.py checks the order of the merged code. Signed-off-by: DjDeveloperr <hey@djdev.me>
…ng its pool When a shared compute UMA manager's binding may be gone (it was displaced, or the GPU may have powered off while idle), its next command rebuilds its manager record. The rebuild also rewrote all 8192 freelist records (64 KiB of uncached writes) and the 16 pool-table rows. When the firmware may power the GPU off on its own, every publication with nothing in flight invalidates the held managers, so nearly every job after an idle gap paid for that. The freelist is a ring of 16384 records. The hardware takes pages at the head cursor and returns them at the tail cursor, and both wrap at the record count that bind loads with them. A rebuild restarts the cursors at their seed: head 0, tail 8192. Taking a page only reads its record; returning one writes the record at the tail. So after a restart, returns fill the records from 8192 upwards, and none reaches the first 8192 records before one has written the last record of the ring. Until then the first 8192 records still hold the seed, every page exactly once, and cursors at their seed describe the drained pool exactly, wherever the hardware cursors were. Pages the hardware still held when its cursors were lost do not matter: they are in the seed, and with no command in flight no page is in use. So the rebuild now reads two freelist records before it decides. The last record reads zero until a return reaches it: the freelist is zeroed when it is allocated, and a returned record holds a page address. The first record still holds the first seed unless taking a page wrote its record. If both hold, the rebuild writes only the 160-byte manager record and the 16 pool-row words. Otherwise it reseeds the freelist as before and clears the last record, so that a later rebuild can trust the seed again. Some events do not show in the freelist. A system sleep, a recovery, and a shared command that failed or was aborted advance a seed generation in the slot ledger, and the next rebuild of every manager then reseeds, whatever its freelist shows. Sleep and recovery call the new restart_compute_uma(), which also invalidates the bindings; the idle path still calls only invalidate_compute_uma(). On J773g, with aurora-silicon#3695 and aurora-silicon#3697 combined, skipping the reseed unconditionally (idle invalidations unchanged, about 179k per boot) measured: row as is no reseed no invalidation idle.wake 2/20/200 ms 175/272/539 145/193/458 142/192/458 compute queue d1 121.5 99.1 101.2 compute procs d2 67.9 59.0 58.3 That run passed the CRC smoke test 10/10 and the idle.wake stress with checked compute, with the GPU physically off in 16 of 16 checks and no faults. The reseed was the whole cost of the idle rebuild. This change skips it only while the ring has not reached its end since the last seed, which a run of short jobs between idle gaps never does. The stats line gains the reseed count: "compute_uma: rebuilds N invalidations M idle_invalidations K reseeds R". Signed-off-by: DjDeveloperr <hey@djdev.me>
What: Keep each VM's G16 compute UMA manager bound while it has compute in flight, and keep the manager records ASC-cached on their own pages. Light compute from separate processes no longer pays a firmware save and rebind after every job:
compute.lightprocs d8 is 11 % faster and queue d64 is 11 % faster on J773g.Tested: J773g (M4 mini) at
421240d7on main (2 boots): compute.light procs d2/d8 −8.7/−10.2 %, queue d64 −10.6 %, CRCs 10/10, 0 faults. Ate85c6d2e(4-boot ABBA): compute.light procs d2/d4/d8/d16 −5.9/−7.8/−11.0/−11.9 %, queues d8 −8.6 %, queue d64 −10.5 % against the same kernel without it (4-boot ABBA, every head boot faster on every compute row); render.light neutral; pinned CRCs 10/10 on every boot; 0 GPU faults, recoveries or quarantined owners. dEQP-VK compute groups (119,249 cases, 8 parallel processes) identical to base (first commit). J516s (M3 Pro) ate85c6d2e: procs d2 −3.0 %, procs d8 −5.9 %, queues d8 −9.8 %, queue d64 −14.7 % against main (4-boot ABBA), 40/40 CRCs, 0 GPU faults. Host tests 26/26 and checkpatch --strict clean at this head, including two new cases for the review fix: after a recovery aborts a shared or a private flight in a compute UMA slot, later compute jobs in that slot fail with EIO before any wait on the slot's ledger.Risk: two-way · M4 (T8132) and M3 (T6030/T8122), which share the g16 backend
Not yet: J773g and J516s rows at the current head, together with #3699, which removes the cost of rebuilding after idle gaps. Since main's
34a6d434aeb9the firmware may power the GPU off while idle on T8132 and T6030, so held managers rebuild after idle gaps on main too. The notes below that say the GPU is held powered on main are from before that. No row has a GPU recovery with innocent compute in flight, or a sleep cycle. T8122 (GPU held on) has no row.Details
The firmware saves and unbinds a compute UMA manager whenever a command finishes with
COMPLETEDequal to the manager's counter. The host set the counter to the submission count, so a process with one job outstanding at a time (gpubench compute.light --mode procs) drained its manager after every job. It paid a save and a rebind each time, and every firmware access to the manager was uncached.COMPLETED.COMPLETED, freelist and pool rows reseeded); the same manager coming back keeps its record with no host write. Private SCS descriptors that use the same slots take part in this tracking. A residency generation, bumped on recovery and system sleep, forces a rebuild.No parameters, no SoC gates. The
+1hold is the firmware's own "one command outstanding" and is reserved withchecked_add.Evidence
J773g (M4 mini, T8132, G16G, 26B123 firmware, SLC on both planes), kernel built from linux main
42169a04154695428ae092e981bf88c936c7fe2c(release 7.3.0-ARCH-m4kmain-42169a04),aurora.kofrom that tree with and without this change. The 17 main commits between42169a04and this branch's basee6c7b032change no file underdrivers/gpu/drm/asahior its tests, so the tested driver source is the same as this head's. gpubench-vkae90a40, Borealis Mesa5e89c89ce5, 300 ms warmup, 5 × 250 ms windows, two passes per boot; boot order main, change, change, main; median µs per submission (lower is better).Every boot of the change is faster than every boot of main on every compute row (worst change boot vs best main boot: −4.5 % to −9.4 %).
Correctness on every boot: pinned-CRC smoke, two passes (
compute.uber uniformd4b022fbaf,render.postfx msaa=4d1/d2668d6f0a,render.bindless_ubo 512d21af53d5c,render.deferred tile msaa=4d26dc74b48): 10/10 on all four boots. 0 GPU faults, recoveries, hang kills or quarantined owners. dEQP-VKcompute,spirv_assembly.instruction.compute,ssbo,memory_modelandglsl.atomic_operations(119,249 cases, 8 parallel processes, so 8 VMs cycling through the UMA slots) with this change: 36,794 Pass, 0 Fail, 82,455 NotSupported, the same as main; 0 recoveries.The rebuild after a GPU power-down is covered by the host tests only: on this kernel the GPU power state never reaches off between jobs (a physical PMGR read after each fence stayed on through 16 waits of ~250 ms), so the idle.wake rows don't exercise it.
Host, at this head: all 26
tools/testing/selftests/drivers/gpu/asahi-m4scripts pass (496 Rust cases, one test thread). New cases cover a manager that returns after another manager used its slot (freelist and pool rows reseeded), the same manager returning with no host write, shared → private SCS → shared on one slot, residency invalidation, mixed shared/private retirement out of order, 12 create/use/close cycles on one file against the 8-VM limit, and a shared or a private flight aborted in a slot, after which later compute jobs naming that slot fail with EIO before they wait on its ledger (both cases fail on the previous head).scripts/checkpatch.pl --strict: 0 errors, 0 warnings, 0 checks. The module builds with no new warnings.