Repository navigation
drm/asahi: g16: Wave 7 — barrier elision, timestamp-free render microsequences, and 48 render pass slots - #2852
Conversation
|
Review at 71daf4f. Review at 71daf4f (stacked on #2826 at f631683).
|
71daf4f to
abb9cd7
Compare
f631683 to
993edd6
Compare
|
Re-checked at abb9cd7 against the 71daf4f review. Fixed:
New in this revision:
Still open: rows. Nothing is posted at abb9cd7, and all three commits changed. Needed at this head:
The J713 smoke row and the other-generation rows owed on #2826 still apply here. Assisted-by: LLM (Claude:Opus 5.5) |
993edd6 to
ec6afbe
Compare
abb9cd7 to
1b85b1e
Compare
|
@RyanTheTide Thanks for the R2 review (
R3 host & build verification:
Ready for Assisted-by: LLM (Gemini:4 Neon) |
|
Re-checked at 1b85b1e against abb9cd7. Fixed:
New, minor:
Still open: rows. Nothing live is posted at 1b85b1e, and the only rows are from 71daf4f. Needed at this head:
Assisted-by: LLM (Claude:Opus 5.5) |
|
Exact-head
Assisted-by: LLM (Gemini:4 Neon) |
|
Thanks for the J773g rows at 1b85b1e. They close the recovery item: render and compute hangs with a concurrent healthy client of the other kind all return 0, Still open:
Assisted-by: LLM (Claude:Opus 5.5) |
|
Part of a non-author adversarial pass over the stack at 1b85b1e (lifetime, concurrency, firmware-shared memory, accounting). The J773g rows closed the recovery item for a concurrent healthy client whose commands finish within about a millisecond of resume. The first item below is a remaining case the rows do not reach, and a host repro built from the tree's own harness shows it. 1. An innocent suspect flight that finishes more than 20 ms after recovery started can be retired
The 20 ms runs from when the flight was marked, not from when its gate first passed, and one sample is enough. The gate words and the receipts are written at different times: the stage stamp at FINALIZE, the notifier stamp and So when an innocent flight's own work ends more than 20 ms after the mark, the first poll in the tail window gives
The result is EIO with a sticky VM error for the innocent client, its pass/compute slots and PB slot quarantined until reboot, and one step of the quarantine budget spent. Your Dir A/B rows show Host evidence: the case is added to the tree's own Fix direction:
A hardware check: Dir A/B with the healthy client's job sized to run more than 20 ms past resume, for example a long compute dispatch or a heavy fragment pass. 2. fdinfo render time for timestamp-less renders multiplies with pipeline depth (b335109). Correction to our earlier comment here: the two-clock point mentioned an overlap union in Method and evidence
Assisted-by: LLM (Claude:Opus 5.5) |
|
J713 (M4 Air, T8132 G16G, 27.2 GPU firmware) rows at R3 Setup: the same Mac, the same rows and the same system Mesa (26.3.0-devel d4ad4a4d) on both arms, with the default fleet cmdline and one-shot boots. Baseline = our fleet82 kernel, which carries the older #2676 head. Test arm = fleet82 + this stack (#2676 -> #2741 -> #2787 -> #2826 -> #2852 at 1b85b1e). It merged with one conflict: mmu.rs VmReadGuard, resolved to your reservation guard plus our M3
The innocent-client-after-recovery fix works on J713: the baseline loses every later client, R3 keeps them. Still open:
M3 (J615, T8122 G15G) shared-file check: the M3 runtime runs your mmu.rs/file.rs changes. Same rows on both arms on one Stage 2. The result is neutral: glmark2 47/1713 -> 46/1692, vkmark 1890 -> 1872, gpubench median 0.994x, deqp-vk 112 P / 0 F and GLES3 795/795 on both, and no new faults. The M3 hang row (one faulting client takes the GPU away for every client) is the same on both arms. That is an existing gap on our side: M3 has no resume-after-fault yet. It is not caused by this stack. Method and raw data
Assisted-by: LLM (Claude:Opus 5.5) |
ec6afbe to
cff1485
Compare
1b85b1e to
44dd255
Compare
|
@RyanTheTide Rebased Point-by-point fixes
Verification
Assisted-by: LLM (Gemini:4 Neon) |
…ooth receipt-tail backoff Reduce G16 completion-poll overhead while preserving per-CPU completion locality and the full post-event receipt-tail window: 1. Skip redundant `publish_checked()` walks in `Firmware::poll_step()` when flights are active and nothing changed (no retirement, no ring headroom wait, no recovery unfreeze, no off-lock scrub wakeup, no external `publish_wake`, and no 1 ms housekeeping tick). Add `Shared::publish_wake` / `Shared::wake_publish()` so external state transitions (VM close, unstarted queue cancellation) re-evaluate `engine.pending` immediately without waiting for the 1 ms tick; `Prepared::drop` only releases standby PB reservations for `Cache::prepare` waiters, whose woken `SUBMIT` enters `submit_locked()` directly. 2. Keep `aurora_g16_events` per-CPU (`new_percpu_reclaim`) and `EVENT_RETIRE_POLLS = 11`, smoothing the trailing receipt-poll backoff from `1/2/5 us` (~48 us) to `1/2/3/4/5 us` (45 us total) so post-EP 0x20 retirement finishes inline without falling back to the repoll timer. 3. Batch `Events::drain()` and `Events::drain_statistics()` ring advances: read only the active words of common type-1 stage events (3 WC reads vs 18) and non-recovery statistics records (1 WC read vs 18), and write `STATE_READ` once per drained burst (flushing partial progress on mid-burst errors). 4. Cache `recovery_pending()` once per `submit_locked()` / `poll_step()` pass and short-circuit `retire_once()` when `flights` is empty. Signed-off-by: Diljit Singh <[email protected]>
… workqueue Move off-lock write-combining zeroing of displaced render pass slots out of `Shared::try_submit_inline()`, `Shared::submit()`, and `run_poll()` onto a dedicated unbound reclaim workqueue (`aurora_g16_scrub`): - Add a zero-allocation slot-indexed `ScrubQueue` protected by `Shared::scrub_queue` (`SpinLock`) and a `SCRUB_WORK` work item on `Shared::scrub_wq` so SUBMIT ioctls and completion polls never stall on WC fills. Drop the `scrub_queue` spinlock before `item.run_one()` and `poll_now()` so WC zeroing never runs under the spinlock. - Issue `wmb()` (`dsb st` on aarch64) after `PassSlot::scrub_clean()` completes and before clearing `tilemap_dirty` or publishing `clean_mask`, ordering scrubbed WC bytes globally before firmware or another CPU can claim and reuse the slot. - Preserve strict slot-reuse exclusion (`scrubbing` bitmask) and wake waiting render submitters via `poll_now()` immediately when a waited slot finishes scrubbing. - Guard async `clean_mask` publication with a monotonic `generation` counter incremented by `invalidate_scrub()` so a scrub staged before firmware recovery can never leave a stale clean bit afterward. - Drain `scrub_queue` and `scrub_wq` cleanly in `sleep.rs::join_workers()` after `sleeping` is set and `events` is drained so S2R and teardown never overlap workqueue draining with concurrent enqueues. Signed-off-by: Diljit Singh <[email protected]>
…and compute units to 18
Eliminate the 15-flight displacement cap at queue depth 16 and 32 for
both render and compute on G16 without imposing a 107.8 MiB per-VM
memory jump on compositors or shallow desktop VMs:
- Pack lazy extension render pass slots (`2..32`) at an 8 MiB VA stride
(`EXT_PASS_STRIDE = 0x00800000`, tilemap at `+0x600000`) starting at
`0x7024000000`, while keeping base slots `0..2` at their full 32 MiB
intervals (`16 MiB` TPC / `8 MiB` tilemap). All 32 pass slots occupy
`0x7020000000..0x7033000000` (208 MiB spare below `0x7040000000`),
raising `render_flights()` from 15 to 31.
- Tie both `RENDER_SLOTS = 32` and `COMPUTE_UNITS = 18` explicitly to
firmware's own ring, UMA, channel, and recovery capacities (enforced
with compile-time assertions against `QUEUE_CAP`):
- Work rings (`QUEUE_CAP = 256` entries, 255 usable): at most 4
entries/pass on TA (`prev_barrier`, `ta_fs_barrier`,
`compute_barrier`, `ta_work`) and FS (`fs_dep`,
`fs_compute_barrier`, `own_barrier`, `fs_work`), so 31 concurrent
renders use <= 124/255 entries (49%); at most 2 entries/compute
(`fs2c` barrier + `work`), so 17 concurrent computes use <= 34/255
entries (13%).
- Channel rings (`RING_SLOTS = 256`, `AHEAD_RECORDS = 128`): bounded
by `FLIGHTS = 32` `SubmitRecord`s (25% of `AHEAD_RECORDS`).
- Hardware UMA slots: compute units own `COMPUTE_UMA_SLOT + 0..18`
(`1..19`, within `RENDER_UMA_SLOT = 33`), while all renders share
`RENDER_UMA_SLOT = 33` through the active PB/UMA descriptor.
- Recovery affected-work snapshot: `snapshot_entries = 448` in
`initdata.rs`, far above `31 + 17 = 48` max in-flight commands.
- Grow extension pass slots in three demand-grown `RenderExtArena` tiers
(`EXT_RENDER_TIERS = [(2, 8), (8, 18), (18, 32)]`) sized against live
render pass count (`active_render_passes + render_count + 1`). Each
base slot backs 24.59 MiB (25,184 KiB: 16 MiB TPC + 8 MiB tilemap +
608 KiB metadata/scratch/barriers) and each extension slot backs
3.59 MiB (3,680 KiB: 2 MiB TPC + 1 MiB tilemap + 608 KiB):
- Base only (`0..2`, steady 60/120 Hz single-pass): 49.19 MiB pass
backing (0 MiB ext).
- Tier 0 (`2..8`, +6 slots, compositors / 2-pass / shallow depth):
+21.56 MiB ext (80% less than eager 30-slot allocation).
- Tier 1 (`8..18`, +10 slots, moderate multi-pass bursts):
+35.94 MiB (+57.50 MiB cum ext).
- Tier 2 (`18..32`, +14 slots, deep multi-pass bursts):
+50.31 MiB (+107.81 MiB cum ext).
- Fix `PASS_MASK` in `g16/slots.rs` to `u32::MAX >> (32 - RENDER_SLOTS)`
so `RENDER_SLOTS = 32` does not overflow `1u32 << 32`, and raise
`MAX_CLIENT` from 320 to 512 for headroom.
- Expand `COMPUTE_UNITS` from 16 to 18 (17 concurrent compute flights,
covering `d=16` without displacement stalls), fitting directly inside
the existing 64 MiB VA layout (`compute_base(18) == PB_HEAP`), and
simplify `params::compute_units()` with a compile-time
`COMPUTE_UNITS >= 2` assertion in `g16/hw.rs`.
Signed-off-by: Diljit Singh <[email protected]>
…ing, and synchronize resnap Eliminate repeated SUBMIT-path CPU work across stream parsing, CDM stream gating, and completion timer management: - Replace the three-pass SUBMIT stream walk (check_stream -> prepare -> validate) with single-pass parse_stream() -> ParsedStream::prepare() -> Prepared::validate(). Structural validation and attachment parsing run once before device-state checks, preserving exact EINVAL/EOPNOTSUPP precedence over crashed/vm.status EIO. Attachment KVecs move directly into the first consuming command with zero copy, timestamp destinations resolve in place via timestamp::Destinations::empty() (G16-only), and validate() operates on the already-decoded commands. Remove the now-dead check_stream, cover, and Resolved helpers from g16/command.rs. - Expose VmReadGuard::covers_range() to G16 in mmu.rs and add command::cover_locked() so gate::cdm() holds a single vm.read_lock() across stream window reads, USC program checks, and indirect parameter checks, dropping the lock and invalidating cached window/program proofs before might_sleep() every CDM_RESCHED_RECORDS records. - Double-check resnap_deadline_ns and sleeping under resnap_handle.lock() in rearm(), and unconditionally acquire resnap_handle.lock() in cancel_resnap() before clearing resnap_deadline_ns and dropping the handle. This avoids redundant cancel+start cycles under racing callers while strictly ordering sleep_down() (sleeping = true then cancel_resnap()) against concurrent rearm() so no hrtimer handle can leak into suspend. Signed-off-by: Diljit Singh <[email protected]>
…InitBM handoffs Use BarrierType::Stamp (type 0) instead of BarrierType::Hold (type 1) for same-VM non-InitBM cross-engine barriers (fs2c in prefix_compute() and c2ta/c2fs in prefix_render()), eliminating software-job hold bubbles on compute <-> render handoffs (such as postfx and deferred shading). Why G16 differs from G15 (`g15/hw.rs:566-567`, "Never both type 0"): On G15, `CROSS_ENGINE_HOLD` keeps at least one cross-engine direction at type 1 (`Hold`). On G16 (M4 firmware 25G83/26B123), every GPU stage (CDM, TA, FS) executes its `FINALIZE` micro-sequence — flushing stage caches to the shared coherent fabric — before firmware advances `fw_stamp`, so waiting on `fw_stamp` via `BarrierType::Stamp` (type 0) in both directions (`fs2c` and `c2ta`/`c2fs`) avoids hold bubbles within one VM (same ASID and UAT page tables). Zero-fault M4 J773g runs (13,873 `fs2c` and 20,506 `c2ta` type-0 handoffs on mixed postfx / deferred shading) confirm no GPU wedge or hang, while CTS synchronization / pipeline-barrier coverage validates producer-to-consumer memory visibility. Safety gates preserved: - Whenever either the waited producer, any live in-flight command (`self.engine.flights.iter().any(|fl| fl.initbm)`), or the consumer carries `InitBM`, keep `BarrierType::Hold` via `cross_engine_barrier_type(producer_initbm, consumer_initbm)` across `fs2c`, `c2ta`, `c2fs`, and pipelined render->render barriers (with `WaitTarget` propagating producer `InitBM` state from `wait_stamp_for_with()` and `cross_engine_wait()`). - Cross-VM transitions, recovery paths, and `query_access` CPU-timestamp waits drain `flights` completely before publishing. Audited `waits_for_timestamps` in `can_queue_behind()`: because G16 copies timestamp results into user query-pool BOs on CPU upon flight retirement (`publish_timestamps`), keeping the retirement wait when `query_access` is true (userspace did not pass `DRM_ASAHI_COMPUTE_NO_QUERY_ACCESS`) remains required for query-pool correctness and is documented inline. Signed-off-by: Diljit Singh <[email protected]>
…er validation Vm::read_lock() previously called lock_vm(&self.gpuvm, None, false), which allocates a KBox<drm_gpuvm_exec>, runs drm_exec_init() (allocating a page-sized object array), and locks every external BO reservation on the VM (O(external BOs)) on every G16/G15 SUBMIT. Because every mapping mutation in mmu.rs holds the VM's shared reservation, read-only page-table coverage walks and user-memory copies need only self.gpuvm.lock_inner(), matching covers_ranges_batch(): 1. Back VmReadGuard<'a> with GpuVmInnerGuard<'a, VmInner> via self.gpuvm.lock_inner(), eliminating the per-SUBMIT KBox, drm_exec object-array allocation, and O(external BOs) lock walk. 2. In G16 Prepared::validate(), validate render VM spans and VDM root barriers under one Vm::read_lock() hold via SpanBatch::flush_locked() and gate::vdm_batch_locked(). 3. Minimize PoC cache maintenance (dc civac + dsb sy) in G16 stream gates: read only 4 bytes (1 cache line) for single-pass VDM roots and clamp CDM root-stream window reads to the validated root end. Signed-off-by: Diljit Singh <[email protected]>
Previously prefix_render() unconditionally emitted a same-ring FS(N-1)->FS(N) barrier (fs_dep) on every pipelined early render pass, even when vdm_barrier was NONE or the render dependency had already retired or been satisfied by TA. Resolve the exact in-flight render wait stamp (fs_wait_render) in prefix_render() and plan_render_barriers(): - Keep the TA(N-1)->TA(N) prev_barrier (matching G15) whenever a prior render is in flight and plan.ta_fs_wait does not already serialize TA behind prev_fs (which dominates prev_ta via own_barrier): consecutive pipelined renders share one parameter-buffer / UMA epoch (RENDER_UMA_SLOT), so TA(N) must still wait on TA(N-1) before writing into the shared PB. - Emit cross-ring FS->TA (ta_fs_barrier) only when plan.ta_fs_wait names an in-flight FS stamp (legacy dependent renders, conservative early_tiling=false, or staged TA waits). - Emit FS->FS (fs_dep) only when plan.fs_render_wait names an in-flight FS dependency not already dominated by plan.ta_fs_wait. - Pre-check wait_stamp_for_with() for o2.wait_through[RENDER] in the multi-pass render batch fold loop so prefix_render() never defers after claiming a pass slot. Independent multi-pass renders drop fs_dep (from 3 hardware barrier records / 5 ring entries per pass to 2 barrier records / 4 ring entries) while preserving TA->TA serialization on the shared PB epoch, exact FS->FS coherence on dependent passes, and cross-VM / InitBM boundaries. Expand test-publication.py to cover independent multi-pass renders, dependent FRAGMENT_BARRIERS/STAGE_PREFIXES renders (including TA-dominated waits and older-FS waits), legacy renders, early_tiling=false, and cross-VM/InitBM boundaries. Signed-off-by: Diljit Singh <[email protected]>
Avoid per-SUBMIT heap allocations without placing a large command buffer on the kernel stack across queue.lock().submit() or holding the queue mutex across userspace copies: - Store a reusable KVec<u8> staging buffer on TableQueue (retained up to 4096 bytes between submissions, releasing oversized buffers on completion or error). - Take the cached KVec<u8> out of TableQueue under a brief queue.lock(), drop the queue mutex before copy_from_user() and SyncItem::parse_array() (preventing queue.lock() -> mmap_lock lock-order inversion), then re-acquire queue.lock() only for inner.submit() and returning the cleared buffer (or return on early error). - Read drm_asahi_sync entries in 8-entry (128-byte) stack chunks rather than issuing a separate copy_from_user per sync. - Preserve the pre-syncobj failure boundary on guarded (G16/G17) paths by snapshotting the command buffer before resolving output syncobjs, and keep parsing syncs first on unguarded paths. Signed-off-by: Diljit Singh <[email protected]>
…epoll Deep multi-pass render benchmarks (such as 11-pass render.postfx at depth 3, 7-pass compress.bw array at depth 5, and 4-pass render.shadow at depth 8) saturated the 32-slot pass cap (31 active + 1 displacement) and stalled between passes waiting for the 100 us resnap timer to free retired pass slots. - Raise hw::sizes::RENDER_SLOTS from 32 to 48 (47 in-flight passes + 1 displacement slot) and widen pass_busy/pass_mask/clean_mask/scrubbing in g16/slots.rs from u32 to u64. Both TA and FS work rings hold QUEUE_CAP = 256 entries (255 usable); at worst-case 4 ring entries per pipelined pass (MAX_RENDER_RING_ENTRIES = 4), 47 in-flight passes consume at most 188 entries (67 spare), bounded by compile-time assertion in hw.rs and clamped in params::render_flights() to (QUEUE_CAP - 1) / MAX_RENDER_RING_ENTRIES (63), well within AHEAD_RECORDS = 128, RING_SLOTS = 256, FLIGHTS = 32, and firmware recovery snapshot_entries = 448. - Split EXT_RENDER_TIERS in g16/resources.rs into four demand-grown tiers so 20-31 pass workloads do not pay for 48 slots upfront (per base slot = 25,184 KiB / 24.59 MiB; per ext slot = 3,680 KiB / 3.59 MiB): - Base (0..2, 2 slots): 50,368 KiB (49.19 MiB), ext 0 KiB - Tier 0 (2..8, +6 ext): +22,080 KiB (+21.56 MiB), ext 21.56 MiB - Tier 1 (8..18, +10 ext): +36,800 KiB (+35.94 MiB), ext 57.50 MiB - Tier 2 (18..32, +14 ext): +51,520 KiB (+50.31 MiB), ext 107.81 MiB - Tier 3 (32..48, +16 ext): +58,880 KiB (+57.50 MiB), ext 165.31 MiB - Add Engine::slot_wait and Firmware::blocked_on_slot_headroom() so poll_step() arms short_repoll (repoll_us) when pending work is specifically blocked on same-VM flight, pass/compute slot, or work-ring headroom, without arming short_repoll for cross-VM drains, InitBM/PB-unprimed waits, external sync fences, or CPU timestamp waits. Update host selftests in test-resources.py, test-publication.py, and test-poll-retire.py to verify 48 pass slots, all four demand-grown tier boundaries and exact byte footprints, blocked_on_slot_headroom() filtering, and slot_wait-gated short_repoll behavior. Signed-off-by: Diljit Singh <[email protected]>
When multiple render commands are batched into a single G16 flight, engine publication previously called commit_render() once, leaving (f.renders - 1) standby PB reservations held until Prepared::drop on the deferred cleanup worker. Pass f.renders to commit_render() so all published render commands release their standby reservations immediately upon firmware visibility. Signed-off-by: Diljit Singh <[email protected]>
…chdogs Wrap per-queue fdinfo engine accounting in crate::usage::Lane while keeping real per-stage firmware TA/FS/CDM timestamps, preventing pipelined double-counting and vertex==fragment skew. Add an rmb() between stage/queue gate checks and receipt reads in retired_snapshot_at(), and require two consecutive unsettled polls spanning ABORT_GRACE_NS from the first gate-passed poll before aborting a recovery_suspect flight so innocent flights finishing > 20 ms after recovery cannot falsely abort. Raise the firmware DM2 (compute) progress-watchdog thresholds (~4 ms per tick) in GLOBALS_FIXED: secondary DM2 soft-preempt watchdog 0x9c8 (26B123 0x9cc) from 40 (~0.16 s) to 750 (~3.0 s) and primary DM2 recovery watchdog 0x9cc (26B123 0x9d0) from 50 (~0.20 s) to 800 (~3.2 s) so legitimate long/contended compute dispatches (such as 1.5 s solo workloads) complete without premature firmware recovery while real hangs still recover strictly below the 5 s host fail-stop deadline. Signed-off-by: Diljit Singh <[email protected]>
Match the VmReadGuard<'a> lifetime introduced when switching VM_BIND gate reads to the VM reservation lock so asahi-g15/run.py builds and passes all host tests. Signed-off-by: Diljit Singh <[email protected]>
…stamps With sibling kernel queues sharing one DRM file (such as Borealis's per-VkQueue sibling queues across multiple flights or dual CDM pipes), usage::Lane only deduplicated intervals per queue, allowing concurrent sibling queues on the same DRM file to exceed 100% of wall time in drm-engine-*. Add Client::add_union() backed by a per-engine atomic watermark on usage::Client (sharing union_mark() with Lane::add() and preserving existing Client::add() and Lane::add() semantics for other backends). Have G16 QueueState hold Arc<usage::Client> directly and charge retired stages via Client::add_union() so overlapping intervals on the same DRM file union cleanly to <= 100% of wall time while keeping distinct files isolated. Also accept end >= start (with start != 0) on 24 MHz (41.67 ns) compute ITS and render TA/FS stage timestamps so sub-tick draws or dispatches retire cleanly instead of remaining pending while still rejecting zero or reversed intervals. Signed-off-by: Diljit Singh <[email protected]>
44dd255 to
d1f88bb
Compare
Bring in main through the updated base. Conflicts: - g16/gate.rs, test-stream-gate.py: the base's vdm_batch() admits the VDM root with or without the USC cache invalidate. Keep this series' vdm_batch_locked() with that check, and test both words through vdm_check(). - g15/gate.rs: main's USC cache invalidate admission together with this series' VmReadGuard<'_> lifetimes. Signed-off-by: Diljit Singh <[email protected]>
Slots::publish() takes its claims as &mut Claims. Five render-slot cases still passed &Claims, so check-resources.rs no longer compiled and the asahi-m4 suite failed at test-resources.py. Signed-off-by: Diljit Singh <[email protected]>
Bring in main through the updated base. Conflicts: - usage.rs: Client keeps this series' per-file union marks next to the base's engine ledger, both sized by main's NUM_ENGINES. add_union() still charges through add(), so main's ENGINE_NS busy share counts it too. - test-resources.py: keep this series' 48-slot case (slot 47, 64-bit mask), which already publishes its claims mutably. Signed-off-by: Diljit Singh <[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:
Checked: this PR's own commits against its base; no Apple material in code or commit messages; no chip or board gates; no new parameters ( |
What: G16 (M4) Wave 7, stacked on #2826: elides redundant independent FS and TA-FS render barriers, raises render pass slots to 48 with a tighter slot-wait repoll, moves usage accounting to
usage::Lanewith hardened suspect aborts and calibrated watchdogs, and deduplicates fdinfo per DRM file.Tested: M4 Mac mini (J773g, G16G B0, 26B123) on an earlier revision of this branch, not the current head: Vulkan CTS 1,104 pass, 0 fail, 0 GPU errors. Host tests 25/25.
Risk: two-way · M4 (J773g, J713)
Not yet: a row at the current head (the branch was rebuilt after the rows above); CI, which runs once the base lands and this PR targets
main.Details (original description)
Summary
Three-commit G16 (M4 / T8132,
26B123firmware) Wave 7 series (Revision 3, head1b85b1e25122e) stacked directly on#2826(djdev/g16-perf-wave6R4 atec6afbe19af9b):28ccd5e53a99ddrm/asahi: g16: elide redundant independent FS and TA-FS render barriersfs_wait_render) inprefix_render()/plan_render_barriers(), preservesTA(N-1)→TA(N)prev_barrieron the shared PB /RENDER_UMA_SLOTepoch wheneverplan.ta_fs_waitdoes not already serialize TA behindprev_fs, emitsta_fs_barrier/fs_deponly when needed and not already dominated, and pre-checkswait_stamp_for_with()in the multi-pass render batch fold loop. Independent multi-pass renders dropfs_dep(from 3 barrier records / 5 ring entries per pass to 2 barrier records / 4 ring entries).b335109318775drm/asahi: g16: omit render TA microsequence timestamps and retirement reads when unusedSEQ_SIZE_NOTS,FINALIZE_NOTS,END_NOTS) keepingWaitForIdle (1)and rebasedFINALIZE/has_attachmentsoffsets, tracks full-timestamp emission inFlight::stage_ts_mask, and writes only the active TA microsequence length to WC memory.user_pair == 0,0x380-byte FS microsequence) as a zero-hot-path-cost execution proof so innocent concurrent compact renders still retireRetirement::Fullduring another client's hang recovery (recovery_suspect), while truly firmware-aborted passes (zeros) retireRetirement::Abortedafter the 20 ms grace window.!recovery_suspectretirement (0WC scene reads on the steady-state hot path) and falls back topublished_ticks..counter_ticks()converted viaCNTFRQ_EL0(counter_hz(), documented as an upper bound) so DRMfdinfoengine-time counters remain active.1b85b1e25122edrm/asahi: g16: raise render pass slots to 48 and tighten slot-wait repollhw::sizes::RENDER_SLOTSfrom 32 to 48 (47 in-flight passes + 1 displacement slot) and widens pass bitmasks (pass_busy,pass_mask,clean_mask,scrubbing) ing16/slots.rsfromu32tou64, withparams::render_flights()clamped to(QUEUE_CAP - 1) / MAX_RENDER_RING_ENTRIES(63).EXT_RENDER_TIERSing16/resources.rsinto four demand-grown tiers (Base 0..2,Tier 0 2..8,Tier 1 8..18,Tier 2 18..32,Tier 3 32..48) so 20–31 pass workloads do not pay for 48 slots upfront.Engine::slot_waitandFirmware::blocked_on_slot_headroom()sopoll_step()armsshort_repoll(repoll_us) specifically when pending work blocks on same-VM flight, pass/compute slot, or work-ring headroom.Verification
Revision 3 (
1b85b1e25122e) host gates & buildscripts/checkpatch.pl --strict --no-signoff(ec6afbe19af9b..1b85b1e25122e):0 errors, 0 warnings, 0 checks(0/0/0).run-host-tests.py:25 / 25PASS (includingcheck-abi-26b123.rs,test-stamp-wrap.py,test-publication.py,test-poll-retire.py,test-resources.py).drivers/gpu/drm/asahi/(aurora.o): compile-verified with0new warnings.1b85b1e25122eonJ773g(v21) is queued next (and ready forDJ-GPU-STACKJ713).Prior Revision 2 (
71daf4f3f7ea0) live hardware baseline (Apple M4 (G16G B0),J773g/T8132, Linux 7.3.0,/opt/mesa-v10-tc)Vulkan CTS (
1,104Pass /233NotSupported /0Fail /0Crash /0Timeout /0GPU errors)vk-mustpass-short*timestamp*(strided of 1,094)dEQP-VK.query_pool.statistics_query.*(strided of 18,775)dEQP-VK.synchronization.op.single_queue.*(strided of 7,324)dEQP-VK.renderpasses.renderpass2.*(strided of 32,680)gpubench-vk(v18Wave 7 R2 vsv17Wave 6 R2f63168347300con identical/opt/mesa-v10-tc;0CRC/status fails across 44 rows)render.light(kind=tri):d=1273.82 -> 262.61 us(+4.27%),d=2209.73 -> 196.08 us(+6.96%),d=4173.13 -> 157.83 us(+9.70%),d=8138.27 -> 127.10 us(+8.79%),d=16132.56 -> 121.48 us(+9.12%).render.postfx(6 rows):+7.91%geomean (1080p msaa=4 d=21388.89 -> 1269.04 us+9.44%,1440p msaa=1/4 d=21428.57 -> 1322.75 us+8.00%).compress.bw(kind=array,res=1440p)(2 rows):+8.11%geomean (d=1+6.67%,d=4886.52 -> 809.06 us+9.57%).+1.68%geomean vsv17(0.8773×M4 Metal).overlap.passes(4 rows):1.1853×M4 Metal (+0.54%vsv17;render_render d=21.38 -> 1.44+4.24%).render.deferred(8 rows):+1.20%geomean vsv17(0.7149×M4 Metal).render_owners: fresh 3 retired 45 quarantined 0 reusable 47(48 slots),slot_sync 0,ct_sync 0,pass_sync 0,pb: bad 0,type0: fs2c 759 c2ta 7454.Real Deep Sleep S2R
apple-sleep: back from sleep, boot object resumes 0 -> 1,pcie-appleport 0 & 2 link restored,GPU firmware back in 5083 us,ZERO_S2R_ERRORS, post-wakevk-mustpass-short87 / 87PASS.