Repository navigation
Conversation
…ached linux#3170 made every firmware-mutable pooled G17 object uncached after a J716c (T6050) compute queue record rebound in place had a dirty firmware line revert the host's owner fields. linux#3186 restored firmware caching for WorkState node pages and compute DescriptorRings on G17P only, leaving M5 uncached. On M5 Max (J775c, T6050), keeping WorkState node pages and compute DescriptorRings uncached regressed light submission throughput by ~17-20% (render.light queue d8 18.01 -> 23.19-23.48 us). Both objects obey the same lifetime invariants on M5 as on G17P: - Work nodes are rewritten only after WorkStorage::drained() has observed the firmware's final completed count from memory, and returned work states are zeroed only once their pool fence is met. - Compute descriptor slots are rewritten only after the kick that last used the slot has retired (at most DESCRIPTORS kicks are in flight). Objects the host rewrites in place while their queue may run keep linux#3170's uncached mappings everywhere: render queue records (Family::QueueState), the compute graph, and M5 scheduler pages (Family::Scheduler). Restore firmware caching for Family::WorkState (node page, UAT_PGSZ) and compute Family::Descriptor (size) on M5 as well, and update the cache policy checks and mutations in tools/asahi/g17-object-fence-tests.py. Verified on J775c (M5 Max, lobata, one-shot trial boot on 88ddea8): - render.light queue d4/d8/d16/d32: 27.92/23.48 -> 23.61/19.35/19.17/18.79 us (-15.4%/-17.6% at d4/d8) - compute.light queue d8/d16/d32: 13.78 -> 12.45/12.43/12.44 us (-9.7% at d32) - copy.bw queue d8: 412.6 -> 421.2 GB/s - dEQP-VK.synchronization2.op.multi_queue.*: 16680/16680 pass, 0 fail (7080 not supported) - Concurrent render.light+compute.light+copy.bw stress, queues mode (d2/d4/d8), sync.signal, and 60x rapid context create/destroy cycles: 0 errors, 0 GPU faults, 0 kernel WARNs. - tools/asahi/g17-object-fence-tests.py + all 9 mutations pass. Signed-off-by: Satya Benson <[email protected]>
|
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.
The measured throughput and healthy context churn support the optimization, but the safety argument treats descriptor retirement and the final completed count as evidence that every firmware cache line the host will rewrite is clean. The prior M5 bug was a delayed writeback across reuse. Identify the writeback or ownership guarantee for both object classes, including forced stop or recovery, and add a reuse-after-recovery test with the cached mappings and a current-head M5 peer. Keep required CI green before merge.
…ecovery and stop Close the forced-stop, recovery, and full-pool fence-overrun gaps for firmware-cached Family::WorkState and compute Family::Descriptor objects: 1. Never overrun a pool fence for firmware-cached objects (prefix != 0) in Pool::allocate: when all 64 slots of a cached family are active or waiting behind their control-ring fence, allocate a fresh unpooled (uncached) object instead of zeroing a cached object whose prior owner's release the firmware has not yet consumed. 2. In Context::retain_linked_work, retain the cached WorkState via retain_until_stop(pool) whenever the context was killed (kill_published) or its VM failed (status != 0), even if the work list head is empty, so aborted work without stamped completion never returns its cached node page to the reuse pool before firmware stop. 3. In Firmware::service_compute_pools, retain a compute queue's cached DescriptorRing via Queue::retain_ring_until_stop(&self.pool) whenever recycle_killed or recycle_quarantined_idle recycles a queue after a kill or quarantine, so its ring leaves the reuse cache until firmware stop instead of returning to Pool on vacate. 4. Sync tools/asahi/run-host-tests.py with the g17-object-fence-tests.py mutation names and add host unit and mutation coverage for cached fence overruns, killed/failed work-state retention, and recycled compute descriptor-ring retention. Signed-off-by: Satya Benson <[email protected]>
There was a problem hiding this comment.
I verified that failed and killed WorkState objects and recycled compute DescriptorRing objects are retained outside the reuse pool, and cached allocations cannot overrun a waiting pool fence. The remaining normal reuse exception is stampless render: WorkStorage::drained() reads an uncached counter, while the reused node is now firmware-cached. Please identify the ordering guarantee that puts node cache writeback before the observed counter, or keep the node uncached when retirement can be stampless. The new host policy checks cover retention and allocation but cannot establish that firmware ordering. Keep the current head held for exact recovery reuse on J775c and a second M5 row.
|
Addressed the writeback/ownership review comments in Ownership & writeback hardening (
|
|
J813 (MacBook Air 13" M5, G17G) at Kernel: this head plus our local XRGB8888 primary-plane patch for Hyprland, LLVM, booted once behind a Stage 2 carrying this tree's J813 DTB. GPU firmware 26B123. A/B on the same kernel, one boot per arm:
Means: depth 8 25.25 → 19.33 µs (−23.4 %), depth 32 23.79 → 16.87 µs (−29.1 %). Depth 1 is the same on both arms; it is dominated by the host's fence wait, not by the submit. The light-compute numbers come from a small Vulkan program of ours, not
Not run: a render-light Vulkan workload, dEQP-VK, or a multi-client stress test. Assisted-by: LLM (Claude:Opus 5.5) |
…ement On stampless render retirement, retiring the submission via Deferred::Retired releases Submission::state.work while Active still keeps the descriptor slot with stamps_owed = true waiting for post-maintenance completion stamps. With firmware-cached WorkNode pages, releasing WorkStateLease early allows the same context to rewrite the node slot before firmware completion stamps witness cache writeback; the host cannot rely on WorkStorage::drained() (which reads WorkNode.completed on the cached node page) to order writeback of the rest of the 0xc8-byte node. Keep WorkStateLease on Active::stamps_owed_work before deferring Deferred::Retired when stampless is true so the work-node slot stays pinned until post-maintenance completion stamps pop the Active entry. If a stamps_owed group is instead released through pair-wide drain in release_witnessed(), mark the context stampless_drained so Context::retain_linked_work() retains the work storage via retain_until_stop() until firmware stop. Update the Context::new comment to reflect that cached work-node reuse is always gated by post-maintenance completion stamps or firmware stop, and extend g17-object-fence-tests.py, g17-quarantine-drain-tests.py, and run-host-tests.py with host checks and mutations covering both invariants. Signed-off-by: Satya Benson <[email protected]>
|
Addressed the stampless-render ordering blocker in
|
There was a problem hiding this comment.
Verdict: FINISH, then merge.
Blocker: The new lease covers the normal wait for post-maintenance stamps. On pair-wide drain, release_witnessed() drops the Active entry and its lease after setting stampless_drained. The new flag is consumed in retain_linked_work(), which protects pool reuse when the context closes. Please prove that every unstamped drain path also prevents a later submission in the same context from acquiring that slot, or keep the lease pinned until firmware stop on that path. Cover the same-context case in the host fixture and attach the exact recovery/reuse rows.
Checked: The fast path takes the lease before deferred retirement can release the original. The added drain test and context flag address the cross-context pool lifetime. The posted older J813 performance row does not exercise the new drain path.
…ontext reuse When an unstamped render drain (pair-wide drain in release_witnessed(), fail_dropped(), settle_interrupted_front(), fail_after_observation(), or failing replay_abandoned()) releases an active group without per-node post-maintenance completion stamps, setting stampless_drained on the context protects cross-context pool reuse in retain_linked_work() but still let Drop for WorkStateLease return the slot index to WorkStates for a later submission in the same context. Add WorkStates::pin() and WorkStateLease::pin_until_stop() so every unstamped drain path permanently keeps that slot index out of WorkStates::allocate() for the rest of the context's life (while clearing live[index] to FREE so older_live() never stalls, decrementing held[engine] to avoid may_take() starvation, releasing shared claims for sibling contexts, and returning EIO from acquire() if all 63 slots are ever pinned) and still sets stampless_drained for cross-context retention until firmware stop. Extend g17-object-fence-tests.py, g17-quarantine-drain-tests.py, run-host-tests.py, and identity.rs KUnit tests to cover same-context pinning and its negative-control mutations. Signed-off-by: Satya Benson <[email protected]>
|
Addressed the same-context unstamped-drain blocker in
|
There was a problem hiding this comment.
Verdict: FINISH, then merge at 2ddf78f16eca.
Blockers: The earlier same-context reuse finding is addressed in source. Please attach the second M5 recovery/regression row at this commit and wait for hosted checks.
Checked: The slot pin is published before its live word returns to FREE; allocation checks the pin again after claiming the live word. Pinned slots retire from ordinal tracking and still count against capacity. I traced the retained lease through pair-wide drain and the other unstamped render retirement paths. The author reports 239/239 host tests, including same-context reuse and drain-pin negative controls, plus exact-head J775c recovery and churn. The second M5 row remains outstanding.
|
Second M5 row, J813 (MacBook Air 13" M5, G17G) at Kernel: main
Means: depth 8 25.19 → 19.50 µs (−22.6 %), depth 32 24.09 → 16.90 µs (−29.8 %), in line with our The hang client is one 1×1×1 compute dispatch that loops until a storage-buffer word the host never sets is non-zero. Each kill shows as "watchdog gave up on a compute command … allowance 2000 ms", and the client gets a lost device. Survivors and churn use the light-compute program from our earlier row: a ring of fences over a 1×1×1
Not run: a render-hang GPU fault recovery, dEQP-VK, or a multi-queue stress test. Assisted-by: LLM (Claude:Opus 5.5) |
|
J815 (MacBook Air 15" M5, G17G) row: light render and light compute submits are 10–26 % faster at queue depth 4 and 16. dEQP-VK and the Godot TPS demo are unchanged. The multi-queue stress test fails as it does without this PR. Kernel: the four commits of this PR (
Means: compute depth 16 23.85 → 17.60 µs (−26.2 %), depth 4 30.5 → 23.7 µs (−22.3 %); render depth 16 45.2 → 38.75 µs (−14.3 %), depth 4 50.75 → 45.8 µs (−9.8 %). The per-submit GPU time is the same on both arms (compute 1.9 vs 2.0 µs, triangle 4.5 vs 4.8 µs), so the gain is in submission and retirement, not in the work itself.
Not run: the |
|
Addendum from the same traces: the doorbell is not the cause. For jobs before a long GPU gap it is rung 100% of the time, sooner after publish than for normal jobs (median 19–21 vs 28–34 µs), with the same power word ( |
With cached work nodes, also caching the M5 compute descriptor ring made light compute submits at queue depth 4 slower on J775c: 17.9 µs on main, 17.5 µs with nodes alone, 20.4 µs with both. It added nothing at the depths where cached nodes help. Return M5 descriptors to main's rule: uncached on M5, firmware-cached on G17P. A queue recycled after a kill or quarantine still retains its ring until firmware stop. g17-object-fence-tests.py again requires main's descriptor rule. Its uncached-descriptors mutation is replaced by main's m5-cached-descriptors. Signed-off-by: Satya Benson <[email protected]>
|
Pushed Variant row for the depth-2 late starts, 8 one-shot boots (A Bn Bn2 Bn4 Bn4 Bn2 Bn A), all with 0 GPU fault lines and 0 failed units. Bn2 and Bn4 space consecutive work-node allocations 512 B and 1 KB apart (
Spacing changes nothing, so it is not false sharing. Holding a node for an extra completion or alternating two pools wouldn't change what the firmware sees either: a node is already reused only after the other 62. Main reaches the same mode on some boots (8A, 15%), so caching makes an existing firmware mode more frequent. Throughput is in the body: depth ≥ 4 render −13.5 to −15%, compute −3 to −8%; depth 2 +12 to +18%. Converting back from draft: the change is now what it should be, with its cost stated. |
There was a problem hiding this comment.
Verdict: HOLD at 730f85a5
Blockers:
- Hosted CI at
730f85a5is still queued (apple-build,host-tests,pr-text,readiness, and KUnit suites pending). - A second M5 / G17 hardware row at
730f85a5(including the shared-context path) is still outstanding, as noted in the PR description. - Prior human
CHANGES_REQUESTEDremains open for re-verification of the fixes and sign-off on the documented depth-2 latency tradeoff (+12%compute.light,+18%render.lightvs-3..15%at depth >= 4).
Checked:
- Verified
ae0f996a(drivers/gpu/drm/asahi/g17/context/identity.rs:345-358):WorkStates::used()now readsclaims.load(Ordering::Acquire)(shared contexts) orself.live[i].load(Ordering::Acquire)(private contexts) beforeself.pinned.load(Ordering::Acquire). Verified againstWorkStates::pin()(:120-141), which publishesself.pinned.fetch_or(mask, Ordering::AcqRel)before clearingself.live[index]andclaims, eliminating the window where a concurrently pinned slot could be counted as free. Newused-pin-firstandused-pin-first-sharedhost-test mutations cover both paths. - Verified
730f85a5(drivers/gpu/drm/asahi/g17/queue/compute.rs): restores M5 compute descriptors to uncached (if alloc.uat.is_m5() { 0 } else { size }) while keeping G17P cached and retaining descriptor rings across kill/quarantine (retain_ring_until_stop), resolving the depth-4compute.lightregression (17.36vs18.12us on J775c). Updatedg17-object-fence-tests.pyandrun-host-tests.py(m5-cached-descriptors) match. - Verified DCO sign-off is now present on all 8 commits in the branch (
f207315d..730f85a5). - Reviewed the J775c depth-2 trace and spacing-variant (
Bn/Bn2/Bn4) evidence showing 0 GPU fault lines and 0 failed units across 8 boots.
Evidence
drivers/gpu/drm/asahi/g17/context/identity.rs:120-141(WorkStates::pin),:345-358(WorkStates::used).drivers/gpu/drm/asahi/g17/context.rs:338-346(Family::WorkStatecached node page, uncached counter page),:559-564(retain_linked_work).drivers/gpu/drm/asahi/g17/queue/compute.rs: M5 compute descriptors uncached (if alloc.uat.is_m5() { 0 } else { size }).tools/asahi/g17-object-fence-tests.pyandtools/asahi/run-host-tests.py:used-pin-first,used-pin-first-shared,m5-cached-descriptorsmutations present and wired.
|
@erikwb ready for your re-review at
The second-G17-board row with the shared path is requested in #agents and still open. |
|
Attempted the requested J813 (MacBook Air 13-inch M5, Merge The matched |
The merge of main brought in deferred_split(), which builds a WorkStateLease without the pinned field this series adds, so the driver no longer compiled (E0063). Start it unpinned, as the other constructor does. Signed-off-by: Satya Benson <[email protected]>
|
@sithglan thanks for catching that. The |
There was a problem hiding this comment.
Verdict: HOLD at ad4234d0 — build break fixed; waiting on hosted CI, second M5 hardware row, and open review resolution.
Blockers:
- Hosted CI is still pending at
ad4234d0(4passed,0failed,19queued/pending). - Hardware coverage still has only a single M5 system (
J815); a second M5/G17 system row (e.g.J813, currently being prepared) is still pending before merge. - Existing
CHANGES_REQUESTEDreview from@erikwbon the prior head remains open and needs sign-off on the updated stack.
Checked:
- Verified the single-line delta
730f85a5..ad4234d0(drivers/gpu/drm/asahi/g17/context.rs:795):WorkStateLease::deferred_split()now initializespinned: AtomicBool::new(false), resolving theE0063missing-field compile error indrivers/gpu/drm/asahi/g17/context.rs. - Audited all
WorkStateLeasestruct literals indrivers/gpu/drm/asahi/g17/context.rs(newat line 783 anddeferred_splitat line 795); both initializepinned, andDropchecksself.pinned.load(Ordering::Acquire)as intended. - Confirmed DCO
Signed-off-byis present onad4234d0and all prior commits in the PR.
Evidence
ad4234d0372580e05926c147e3a240a1afd0c6af:+1/-0indrivers/gpu/drm/asahi/g17/context.rs(WorkStateLease::deferred_splitaddspinned: AtomicBool::new(false)).- Only two
WorkStateLeaseinitializers exist indrivers/gpu/drm/asahi/g17/context.rs(lines 783 and 795); no other call sites constructWorkStateLease. - Author reports clean local
drivers/gpu/drm/asahi+Image.gzbuild (rc=0) atad4234d0. - Remaining merge gates are unchanged from
730f85a5: green hosted CI atad4234d0, second M5/G17 hardware verification row, and@erikwbsign-off on the priorCHANGES_REQUESTEDreview.
|
Second M5 board A/B verification at exact head Configuration & Provenance (100% isolated
|
| Test | Depth | main (de965eb5) |
#3389 (ad4234d0) |
Change | main rounds |
#3389 rounds |
|---|---|---|---|---|---|---|
render.light tri |
1 | 463.25 | 145.01 | −68.7%* | [462.96, 463.82, 462.96] |
[89.13, 86.84, 259.07] |
render.light tri |
2 | 60.30 | 55.26 | −8.4% | [57.92, 60.96, 62.00] |
[53.53, 56.74, 55.49] |
render.light tri |
4 | 50.89 | 43.96 | −13.6% | [50.64, 50.79, 51.24] |
[44.48, 43.74, 43.66] |
render.light tri |
8 | 46.18 | 38.52 | −16.6% | [45.84, 45.93, 46.77] |
[38.77, 38.92, 37.88] |
render.light tri |
16 | 45.70 | 37.49 | −18.0% | [45.37, 45.47, 46.27] |
[37.72, 37.86, 36.89] |
compute.light |
1 | 415.52 | 413.68 | −0.4% | [416.67, 416.67, 413.22] |
[413.22, 414.59, 413.22] |
compute.light |
2 | 38.63 | 34.73 | −10.1% | [39.53, 37.08, 39.28] |
[34.04, 36.13, 34.02] |
compute.light |
4 | 28.86 | 24.94 | −13.6% | [28.84, 28.87, 28.87] |
[24.98, 24.85, 24.98] |
compute.light |
8 | 24.91 | 20.04 | −19.5% | [24.92, 24.90, 24.92] |
[20.03, 20.08, 20.02] |
compute.light |
16 | 23.68 | 18.64 | −21.3% | [23.69, 23.68, 23.66] |
[18.62, 18.68, 18.63] |
*render.light d1 is bimodal on J813 (~87–89 µs vs ~463 µs idle-wake latency; an earlier main control boot also saw [462.96, 178.57, 462.96]).
- Depth 2 note: Unlike J775c (
G17C B1), J813 (G17G C0) showed no depth-2 regression —#3389was faster on every single round at depth 2 for bothrender.lighttri (−8.4%) andcompute.light(−10.1%), and scaled to−13.6%to−21.3%across depths 4–16.
Checked Outputs, Health & Stock Return
- Output checks (both arms):
compute.chain(crc=8cec83c8, expected8cec83c8,valid=true),render.postfx(crc=4707efa8, expected4707efa8,valid=true). - Kernel & systemd health (both arms):
0GPU fault lines,0kernel warnings/BUGs/SErrors,0failed systemd units. (queue.exhaust/#3645and broader stress were intentionally excluded per request.) - Stock return: Removed
/mnt/esp/aurora/boot-ab/,/mnt/esp/aura-try, and temporary module dirs; verified clean reboot back to stock7.3.0-aurora-j813-full+(0failed units,15Mfree on ESP).
|
Thanks @sithglan, that covers the second M5 board at the exact head. Notably, J813 shows no depth-2 cost: the late-start mode at depth 2 looks specific to J775c's G17C B1. I've added it to the Tested line. @erikwb, the remaining gate is your re-review: the depth-2 cost you asked about turns out to be J775c-only, and every other depth on both boards improves (J813 −8% to −21%). |
|
J775c (M5 Max, G17C B1) at exact head Same session, same rows, against the J775c default kernel (
The render d8 result matches the earlier J775c rows (19.7 µs). The bandwidth d4/d8 swings and the tg128 difference are single runs on different bases (the default is the Nov 27 main), so they aren't attributed to this PR. |
|
J716c (MacBook Pro 16" M5 Max, G17C B1) at Kernels: A = main µs per submit: median of all runs, range in brackets. Depths 1–8: n = 15 per arm (one full
Main's depth-2 render is bimodal: 40–89 µs across runs and both boots. Every run with this PR is 106–113 µs, slower than every main run. With this PR, compute at depth 4 switches between about 21 and 49 µs, where main stays at 22.5–26.9.
|
erikwb
left a comment
There was a problem hiding this comment.
Verdict: FINISH, then merge at ad4234d03725
Blockers:
- On the J716c (M5 Max, G17C B1), the cached work nodes slow
render.lighttri at depth 2 from 53.6 to 110.5 µs (+106%), and every run with this PR is slower than every main run.compute.lightat depth 4 also falls into a ~49 µs mode (median 37.0 vs 23.9 µs). The depth-2 cost stated for the J775c (+12% compute, +18% render) is much larger on this G17C Mac, so it can't be taken as a small known cost. Fix the depth-2 slowdown and the depth-4 compute mode, then repeat the A/B on a G17C Mac. J716c row
Checked: My three earlier blockers are fixed. Compute descriptors are back on main's rule (730f85a5). used() now reads the live words or the shared claims before the pin mask (ae0f996a), with an interleaving test. pin() sets its bit before the compare-exchange that frees the word, so the order holds on private and shared contexts. f207315d carries the sign-off. ad4234d0 fixes the build break from the merge. No Apple material, no chip or firmware gates, no new safety values. CI is green at this head. The J813 row at this head shows no depth-2 cost, and the J716c row at this head is linked above.
Evidence
- J716c A/B: main
dbfbced70b31against the same commit withad4234d03725merged in (the head predates #3662, which the J716c needs to boot). Same config, one-shot trial boots A, B, A, same Borealis build. Depths 1–8 have 15 runs per arm. - Main's depth-2 render is bimodal (40–89 µs). With this PR it is steady at 106–113 µs. Render at depths 4–16 improves 10–12%. Compute is −5% at depth 8 and +1 to +4% at depths 16–64.
gpubench-stress-vk --kernel-loggives the same result on both arms: 15 passed,queue.exhaustfails as on main (#3645),rq.stressskipped. No GPU fault lines on either arm.
|
(my agent is currently investigating to see if it can tell where the slowdowns come from) |
|
J775c (M5 Max) A/B: is the depth-2 cost tied to the system level cache? It looks like it is: with the SLC off, J775c shows the render depth-2 cost J716c reports; with it on, that cost is gone. Two kernels from the same recipe and config, differing in one line: B is main
Proposal: J716c's +106% looks like the SLC-off case. Could the J716c row's owner check: does J716c's kernel log |
|
G17P with firmware-cached work nodes (#3186, on main): does it show the every-other-job late start at depth 2? Measured on our M4 Pro (J616s) and A18 Pro Neo, using the same metric as your J775c analysis: GPU idle before each job from Setup: saved
compute.heavy d2/d4 on both Macs: jobs overlap (each starts before the previous ends), so there's no idle gap to measure. So on G17P the late-start tail is essentially absent on the M4 Pro (0.0% at depth 2, versus 10.5–16.9% on cached M5 Bn). On the Neo it's present but small: 1.4% of jobs and 5% of idle. Its spacing-2 bias (60% of pairs) does look like the same every-other-job signature, at about a tenth of M5's size. Both Macs have SLC allocation enabled, which fits the SLC lead: we see the pattern weakest where SLC has the most planes. Not measured: an uncached G17P arm. That needs a one-line kernel change (map the node page uncached in |
There was a problem hiding this comment.
Verdict: MERGE at ad4234d03725
Converts this App's earlier review at the same head to an approval under the 12-01 merge bar (better than before and doesn't break; block only on a shown failure). No code blocker was found in it. The merge gate (a row on one Mac at this head + fast CI) is tracked by pr-readiness, not held here.
Checked: - Verified the single-line delta 730f85a5..ad4234d0 (drivers/gpu/drm/asahi/g17/context.rs:795): WorkStateLease::deferred_split() now initializes pinned: AtomicBool::new(false), resolving the E0063 missing-field compile error in drivers/gpu/drm/asahi/g17/context.rs.
- Audited all
WorkStateLeasestruct literals indrivers/gpu/drm/asahi/g17/context.rs(newat line 783 anddeferred_splitat line 795); both initializepinned, andDropchecksself.pinned.load(Ordering::Acquire)as intended. - Confirmed DCO
Signed-off-byis present onad4234d0and all prior commits in the PR.
Follow-ups (not blocking): hosted CI; erikwb's open CR (2nd M5 row not required)
|
We carry this PR in our J716c (M5 Max, T6050) daily kernel. Leaving M5 Running cleanly in daily desktop and GPU use on J716c with no GPU faults, while we continue investigating the depth-2/depth-4 light microbenchmark regression noted above. |
What:
Restores the firmware-cached mapping for the M5
Family::WorkStatenode page (UAT_PGSZ), matching G17P (#3186), and hardens cached-object reuse across stampless render, unstamped drains, kill and recovery. M5 compute descriptors stay on main's rule, uncached on M5 and cached on G17P: caching them as well made light compute at queue depth 4 slower (see Performance).Active::stamps_owed_work):retire_front_command()keeps theArc<WorkStateLease>onActivebefore deferringDeferred::Retiredwheneverstamplessis true. The cachedWorkNodeslot can't be rewritten until post-maintenance completion stamps pop theActiveentry.WorkStates::pin()andWorkStateLease::pin_until_stop()). An active render group released without per-node post-maintenance stamps pins its slot index out ofWorkStates::allocate()for the rest of the context's life. Those paths arerelease_witnessed(),fail_dropped(),settle_interrupted_front(),fail_after_observation()and the failing branch ofreplay_abandoned(). Pinning clearslive[index]soolder_live()never stalls, releasesheld[engine]and sharedclaims, and makesacquire()returnEIOif all 63 slots are pinned. It also callsContext::note_stampless_drain(), soretain_linked_work()holds the context's work state out of pool reuse until firmware stop.WorkStates::used()reads the live words (or shared claims) before the pin mask. A pin landing between the reads can't make its slot look free, which would letmay_take()give an engine its peer's last node.Context::retain_linked_workkeeps a context's work state until firmware stop wheneverlinked || kill_published() || stampless_drained() || status.get() != 0.Firmware::service_compute_poolskeeps a recycled (killed or quarantined) compute queue's descriptor ring until firmware stop.Family::QueueState, the compute graph, the M5Family::Scheduler).tools/asahi/g17-object-fence-tests.py,g17-quarantine-drain-tests.py,run-host-tests.pyand theidentity.rsKUnit tests compile the realWorkStatesand enforce the cache policy and both reuse invariants. That includes a deterministic interleaving test ofused()against a concurrentpin()and the mutationsdrop-stampless-drain-pin,same-context-reuse-pinned-slot,used-pin-first,used-pin-first-sharedandm5-cached-descriptors.Performance (J775c, M5 Max, G17C B1). One-shot trial kernels from one tree and config,
aurora.kobuilt in, ABBA. µs per submit, mean of all runs; Bn is this PR's cache policy:render.lighttricompute.lightDepth 2 is slower: traces show the firmware starting every other job late while the previous one runs. The doorbell is rung in time with the same power state, and the host side is identical. Main shows the same mode at a lower and varying rate: 1–2.6% of jobs on most boots, 15% on one, against 17–35% here. Spacing consecutive nodes 512 B or 1 KB apart changed nothing, so it is not false sharing within the node page. Caching is fixed when a context's work state is allocated and can't follow a queue's depth, so this PR takes the depth ≥ 4 gain with the depth-2 cost stated here. Caching the M5 compute descriptors too made
compute.lightd4 +14% (20.42 vs 17.87 µs), so that part was dropped.Tested: J813 (M5, G17G C0) at exact head
ad4234d03725against mainde965eb5, from sithglan (comment 7262555116):render.light−8.4% at depth 2 and −16.6% at depth 8,compute.light−10.1% / −19.5%, output CRCs valid, 0 GPU faults, 0 failed units. There's no depth-2 regression on J813. J775c rows are in the PR comments. Host tests at the current head:g17-object-fence-tests.pypasses with all 23 listed mutations killed, andg17-quarantine-drain-tests.pyandg17-compute-owed-stamp-tests.pypass. CI'shost-testsfailures ing17-output-fence-testsandapple-scaler-recovery-testsare inherited from main. Performance rows above: Bn (efde264bcfb7+used()fix + main's descriptor rule), whosedrivers/gpu/drm/asahimatches this head apart from main's later commits; 8 boots of 0 GPU fault lines and 0 failed units.Risk: two-way · M5 (
drm/asahi/g17only; reverting restores the uncached M5WorkStateallocation).Not yet: a second M5 board row at this head.