Repository navigation
drm/asahi: g16: standby PB pool, WC scrub/write trims, inline submit, multi-flight render pipelining, and Wave 3 submit/retire wins - #2741
Conversation
Rename the retained-session predicate to apple_pmp_t8132_retained_board() and detect the retained T8132 PMP power-vote bridge from the device tree's own `pmp` node (`apple,t8132-pmp-v2`, available, `apple,tunable-soc-device` present) rather than gating on a board list, root SoC compatible, or OS firmware version string. Keep apple_pmp_j713_board() as an inline alias for existing callers. Signed-off-by: Diljit Singh <[email protected]>
… and run to top p-state Admit the J773g 25G83 firmware images, including the boot-filled B000 ranges zeroed before digest verification, and cover them in fwid.rs unit tests. Derive the firmware DVFS table row count (10-row 6-pair vs 11-row 5-pair+top) directly from the preserved ADT performance-state table rather than gating on a board compatible, and let the utilization governor, cooling ceiling, and reported p-state bound run up to the board table's top state (S10 on 11-row tables). Signed-off-by: Diljit Singh <[email protected]>
… PB heap, and close VM caches Carry the G16 parameter-buffer and compute-pipelining updates needed under the 26B123 runtime: - unconditionally reuse a pass slot's retired PB epoch for the same VM and binding (no runtime toggle or mutable debugfs); - keep compute commands in flight on dedicated per-unit UMA slots; - share one 64 MiB PB heap per VM across render allocators, sizing the PB manager descriptor fields to the actual backed heap_blocks rather than hardcoding 256 MiB, and recycle never-exposed spare epochs; - let closed VMs release arenas while slot leases retain only their own backing, and drain spare epochs in both Registry::prune() and Gpu::vm_closed() to break the Cache -> Arc<VmState> cycle; - avoid redundant submit-path publication while a render is active. Signed-off-by: Diljit Singh <[email protected]>
… idle power-off
Support the 26B123 G16 GPU firmware (also shipped in 26B131) while
leaving 25G83 byte-for-byte unchanged. Firmware selection keys strictly
on the boot loader's handoff fields and loaded TEXT digest, failing
closed on unknown builds.
Firmware layout, ABI, and ADT derivation:
- Add V25G83/V26B123 layout tables for InitData, device-control opcodes,
queue info, and TA/FS/compute work records, with compile-time
layout_fits() bounds and collision checks.
- Set POWER_PERFORMANCE +0xa4 = 1 (required power-up state selector)
with no undocumented static InitData policy words.
- Derive 26B123 power sampling (+4/+8, +0x2b48/+0x2bbc/+0x2c10) and the
average-power IIR filter (+0x29e4..+0x29f8) from /arm-io/sgx
gpu-pwr-sample-period-aic-clks, CNTFRQ_EL0, and /arm-io/pmgr/clpc
cpu-avg-limiter-input-tc; derive the low-peak (PPM) limiter filter and
PI gains (+0xa80..+0xae0) from cpu-lowpeak-limiter-{input-tc,ki,kp}
and gpu-power-sample-period (65536.0 PI integrator clamp at +0xaa8).
Fail closed with EINVAL when any required ADT property is missing or 0.
- Read coredump-copy-buffer from /arm-io/gfx-asc/iop-gfx-nub in the
preserved ADT to size InitData MAIN +0xfa8 and the 26B123 host
crash-log buffer (failing closed when absent or invalid).
Start, idle power-off, and runtime:
- Admit 26B123 firmware-owned page tables and perform the PPL magic
handshake, clearing handoff +8 before RUN and returning ETIMEDOUT if
the firmware answer does not arrive.
- Start 26B123 without a PMP AGX vote (enabling GFXCAXI2AF and leaving
loaded DATA to the firmware), hand over the host crash-log buffer
before AP power-on, and run the standard boot NOP + IMPORT_GLOBALS +
START sequence while accepting a pending InitData scheduler request.
- Publish the RETENTION table at RUNTIME +0x2c8 (leaving MAIN +0xfa0
zero) so 26B123 can power the GPU down when idle, and guard all SGX
MMIO reads/writes (engine busy/fault state, pstate(), and runtime
set_generation()) inside Session::while_powered() under the PPL lock.
- Attempt all three Globals ceiling selectors without short-circuiting
in floor_power() at fail-stop, drain all receive rings per pass, read
the 26B123 queue-info busy flag at +0x54, read compute work ticks from
compute::Layout::work_ticks with a tear-free hi/lo/hi loop, and check
the session once per poll pass plus before publish_checked().
Signed-off-by: Diljit Singh <[email protected]>
… tests Add check-abi-26b123.rs and test-abi-26b123.py to verify 26B123 layout selection, compile-time policy collision guards, and exact byte-for-byte InitData/work/queue encoding parity against independent per-field offset tables. Extend test-perf.py for ADT power-sampling, low-peak limiter, and coredump-copy-buffer parsing; extend test-vm.py for 26B123 firmware page tables, +8 clear before RUN, and ETIMEDOUT on missing magic answer; and update the remaining host suites for the 26B123 ABI and compute work tick layout. Signed-off-by: Diljit Singh <[email protected]>
|
Big wins on the J773g, and the 0 recoveries over 228k jobs is reassuring. A targeted adversarial read of fd755f1 (not every line of the 2k):
Things I'd like to see before this leaves draft:
Assisted-by: LLM (Claude:Opus 5.5) |
fd755f1 to
4bae960
Compare
|
Thanks for the targeted adversarial read! Updated Review Points Addressed
Wave 3
|
|
Re-checked at 4bae960. Commits 1-4 are unchanged from fd755f1. 5 and 6 differ only in the commit-message note and the job.rs comment. Earlier points:
New commits:
Every row so far is from the J773g on 26B123. A functional run (vk-mustpass-short) on a J713 at this head would cover the Air's side of the same G16 code. Assisted-by: LLM (Claude:Opus 5.5) |
…ives a deep wake The 26B123 POWER_PERFORMANCE layout inserts four u32s at +0x9c. G16 writes only +0xa4, the powered-up state selector. That is enough for a cold boot, but not for the firmware's warm restart after a deep sleep: on the J713 (M4 Air) the first deep wake ends with "GPU firmware back in 691 us" and, 0.3 ms later, "RTKit: co-processor has crashed" in the firmware's power-up path, before any client has submitted work. The GPU is gone until reboot. macOS 27.2 sets all four words to 1, and so did this driver before the 26B123 layout was reworked. Write +0x9c, +0xa0 and +0xa8 again, next to +0xa4. The words belong to the 26B123 layout, so they are selected by the firmware ABI, as before; 25G83 is unchanged. On the J713 (macOS 27.2 firmware, default kernel command line) with the external monitor and the USB4 peer attached: 3 of 3 deep sleeps wake with the GPU alive, with vkmark running across the first sleep, then dEQP-VK smoke and glmark2 after the wakes. Without the change the same kernel crashed on the first wake. The host tests and the 26B123 offset oracle are updated for the three words. Signed-off-by: Ryan Murray <[email protected]>
4bae960 to
65a87c4
Compare
|
Updated
Host verification: Remaining open items tracked for next runs:
Assisted-by: LLM (Gemini:4 Neon) |
|
Re-checked at 65a87c4. Commits 1-8 are unchanged from 4bae960.
No new issues. Assisted-by: LLM (Claude:Opus 5.5) |
|
A non-author adversarial pass over the whole stack at its tip, 1b85b1e. It looks at lifetime, concurrency, firmware-shared memory and accounting. It does not repeat the earlier rounds on this PR. Findings are listed under the PR whose commit introduced them, and line numbers are at 1b85b1e. Two reviewers traced the first item independently and reached the same result. 1.
Consequence: a BO that userspace closes while still mapped (userspace frees BOs by GEM close and relies on it to unmap) stays pinned until the queue is destroyed. A long-lived G16 context that keeps allocating and freeing BOs (compositor, browser) grows without bound. G15, G17 and M3 have no 2. The same retained job inflates
This means "steady single-pass clients stay on the two base slots" (the code comment at 3. An aborted render on a fresh PB epoch frees that epoch when the flight drops (43952f8). This contradicts 4. A slot that is in flight across a recovery loses the forced full scrub (dc5c24e + 5607d21). 5. CLPC work hint is not cleared on drain (d915ca0; the 1cad4da hold in #2787 builds on it).
On a fanless M4 Air this would be idle power. A J713 idle-draw row after a short burst, compared with one after a fresh boot, would show it. Low, same-VM stall only: Method and evidence
Assisted-by: LLM (Claude:Opus 5.5) |
…ar idle phase-0 notices Defer recovery storm admission, pool invalidation, stage snapshot capture, and fault_scan() until firmware actually halts in phase 1 inside MarkAndAcknowledge, instead of running them before the phase loop while firmware may still be executing on phase 0. Also dismiss trailing type-4/0x16 recovery notifications when phase stays at 0 with no flights in flight for 50 ms (PHANTOM_PHASE0_WAIT_NS), so a late notification drained after Resume does not spin for the full 1000 ms recovery budget and fail-stop the GPU. Signed-off-by: Diljit Singh <[email protected]>
65a87c4 to
ba6a7be
Compare
|
@RyanTheTide Rebased Point-by-point fixes (
|
Live macOS 27.2 (26B123) InitData captures on J773g write 1 at MAIN (HW data) +0x277e, an unaligned u32 that 26B123 adds and that we left at zero. With it at zero, long single-dispatch compute shaders (compute.long, more than ~500 ms per workgroup) were falsely reported as stalled and the firmware started GPU recovery (event=[4, 0, 0, 0xf], stats[0]=0x16), as measured on J773g. Write 1 there, as macOS does. Add Layout::main_policy with compile-time disjointness validation in layout_fits(), set MAIN +0x277e = 1 on V26B123, and update the asahi-m4 host ABI and golden tests accordingly. Signed-off-by: Diljit Singh <[email protected]>
Previously Cache::prepare() popped a spare PbEpoch (cap 4) or allocated and UAT-mapped a fresh 80 KiB PbEpoch for every queued render job, only for almost every render to reuse the slot's existing epoch and discard the unused epoch on drop once submission depth exceeded 4. Keep a shared per-VM standby pool in Cache::standby guarded by SpinLockIrq with the invariant epochs.len() >= reserved for all accepted unpublished render commands. Cache::prepare() tops up only the deficit in SUBMIT ioctl context before any fence exists, waiting interruptibly on a CondVar for standby headroom during bursts instead of failing with E2BIG (matching Budget::reserve's 10-second administrative bound) and retrying if a concurrent InitBM pops an epoch before commit. Steady-state queued renders at any depth allocate zero PbEpochs and perform zero UAT mappings or window syncs. Fresh InitBM publications draw from standby under the device lock without allocating, unpublished rollbacks return the unexposed epoch, and Cache::close() drops surplus epochs immediately while retaining only reserved epochs until accepted jobs drain. Signed-off-by: Diljit Singh <[email protected]>
…C reads Previously every compute dispatch zeroed 288.8 KiB of write-combined memory (256 KiB context_store, 16 KiB aux, 16 KiB preempt, unused seq, and 16 B its) and read back the 160-byte UMA descriptor byte by byte with read_volatile(). Every render pass zeroed ~530 KiB to >1 MiB of WC memory (including dead-code ta_scratch/fs_scratch, work/seq images immediately overwritten by prefix_render(), aux, scene_user, full 48 KiB preemption buffers, and tpc_dirty) synchronously under Shared::state. Track per-slot full-scrub necessity in Slots: - First use, cross-VM switch, cancelled preparation, affected error receipts, and firmware recovery (invalidate_scrub) perform the full scrub so no client or faulted state can ever leak. - Clean same-VM compute reuse zeroes only the 16-byte internal timestamp pair (its). - Clean same-VM render reuse zeroes only its (32 B), active heap header (4 KiB), tilemap_dirty, and active preemption record headers (2 KiB), preserving the tpc_dirty high-water mark until the next full scrub. - Upgrade FwObject::read() to 64-bit volatile word loads for aligned spans, reducing compute descriptor WC bus reads by 8x. Signed-off-by: Diljit Singh <[email protected]>
…it ring can_queue_behind() previously refused to pipeline behind any in-flight compute command carrying timestamp_outputs, forcing depth-4+ timed compute workloads down to depth-1 serialization. Each compute flight already owns its own private ComputeSlot (its/work), and retire_oldest() publishes timestamps in FIFO publication order before signalling the flight's fence, so timed same-VM compute commands can pipeline freely. Expand hw::sizes::COMPUTE_UNITS and params::compute_units() from 8/6 to 16 (placing extension units at 0x7080000000..0x70b8000000, clear of the 0x7040000000..0x7080000000 dynamic PB page-list aperture and below PB_HEAP at 0x70c0000000, using hardware UMA slots 1..=16). With displacement lifetime tracking, 16 units sustain up to 15 in-flight compute commands per bursting VM instead of 5. Signed-off-by: Diljit Singh <[email protected]>
…en poll cadence Eliminate four layers of host-side latency on the G16 submit/completion round trip while preserving sleep-transition safety: 1. Direct inline submit from SUBMIT ioctl: when the previous job on the logical queue has already started, all input fences are signalled, and Shared::state is uncontended (try_lock), Scheduler::push() publishes immediately on the submitting CPU before pushing to drm_sched (whose subsequent run() observes started == true as a no-op while preserving credits, fence ownership, and QUEUE_DESTROY drain semantics). Contended or dependency-blocked jobs fall back to drm_sched in strict queue order. 2. Submitter-pinned dedicated completion worker: replace WORK_CPU_UNBOUND on system_highpri_wq for EP 0x20 / hrtimer wakeups with a per-CPU high-priority reclaim OwnedQueue (aurora_g16_events) enqueued on the last submitting CPU, keeping WC receipt reads and fence wakeups hot on the submitting core; join cleanly in sleep::join_workers(). 3. Tighten post-event retirement tail: extend post-EP-0x20 trailing 5 us polls from 4 (20 us) to 10 (50 us) to absorb firmware's WC receipt tail without falling into a 100 us resnap hrtimer sleep, and rearm at repoll_us (15 us) if an evented flight is still settling. 4. Split fast completion drain from 1 ms housekeeping and stop hrtimer / delayed-work thrash: throttle power-governor updates, host-window health checks, full Session::check(), and administrative hang checks to 1 ms cadence while keeping transport checks, ring drains, and recovery/fault checks immediate; avoid cancelling/reprogramming the hrtimer or re-arming the 1-jiffy backup when a sufficient timer is already armed. Guard run_poll(), submit_locked(), and try_submit_inline() with lock-held sleeping.load(Ordering::Acquire) checks so suspend never races inline or polled publication. Signed-off-by: Diljit Singh <[email protected]>
…d decouple PB/UMA slots Compact the per-pass render VA layout from 256 MiB to 64 MiB stride within 0x7020000000..0x7040000000 (verified by compile-time overlap assertions), expanding RENDER_SLOTS from 2 to 8, and move scene_list (0x4000 bytes) from the shared per-allocator Allocator into per-pass PassSlot (client VA client::SCENE_LIST + i * PASS_STRIDE, 0x7020180000). Giving each PassSlot its own scene_list matches G15's per-pass storage and prevents TA(N)/FS(N-1) overlap corruption when render pipelining is enabled. This commit is bisect-safe on its own with render overlap still off: Order::ready() and Firmware::can_queue_behind() still serialize renders at depth 1 until the following commit, so the compacted 64 MiB pass stride and per-PassSlot scene_list run cleanly under single-flight render execution. Keep base RenderArena at 2 pass slots for single-pass or light VMs and lazily allocate extension pass slots 2..8 in RenderExtArena on render bursts (mirroring compute_ext). Box RenderOwners in Slots alongside ComputeOwners and switch its displacement ledger to pipelined mode (Lifetime::<8>::new(true)), keeping up to 7 concurrent passes in flight. Decouple the two device-wide PB/UMA allocator slots (parameter_id 0/1, hardware UMA slot 33) from PassSlot index 0..8: same-VM renders stay on their active reusable allocator slot with cumulative uma_submitted tracking (PoolSet::prepare_in_flight / retired_at), while cross-VM switches and post-recovery/error renders drain and switch to the displaced alternate slot. Aborted receipts permanently quarantine the affected allocator slot and retain its VM and arena leases. Check Pools::exhausted(), per-VM Pools::exhausted_for(), and Slots::render_exhausted_within() in publish_checked() so blocked render VMs cancel immediately with ECANCELED instead of spinning on EAGAIN and stalling unrelated compute. Signed-off-by: Diljit Singh <[email protected]>
…nt barriers, and deeper queues Lift depth-1 render serialization so same-VM renders pipeline across PassSlot 0..RENDER_SLOTS while sharing the active exposed PB/UMA allocator slot, and remove remaining host-side queue-depth and wakeup-placement caps: - Allow same-engine render orders in Order::ready() to follow the queue's published render frontier while keeping cross-engine dependencies gated on full completion. - Extend Firmware::can_queue_behind() to admit healthy same-VM renders behind in-flight non-InitBM renders of the same VM (up to params::render_flights() = RENDER_SLOTS - 1), while still draining across VM switches, cross-engine transitions, InitBM priming renders, and error/recovery paths. - Emit explicit TA/FS hardware barriers in prefix_render() for queued renders: fragment-only or barrier-free renders overlap TA(N) with FS(N-1) (advertising DRM_ASAHI_FEATURE_FRAGMENT_BARRIERS); full render barriers hold TA(N) on FS(N-1) in hardware. - Remove the render_busy skip in Shared::submit_locked() so queued renders publish immediately on submit, and extend queue_passed() and retired_snapshot() for in-order passed receipts across Channel::Ta, Channel::Fs, shared notifier stamps, and cumulative PoolSet::retired_at() UMA completion. - Bound clean same-VM tilemap scrubbing in Slots::claim_pass_in() to tilemap_dirty.min(current_tilemap_bytes) while retaining the high-water mark for larger subsequent passes and cross-VM/recovery full scrubs. - Raise FLIGHTS (16 -> 32), SCHEDULER_CREDITS (16 -> 32), AHEAD_RECORDS (64 -> 128), and params::compute_flights() (16 -> 32), give each logical queue's drm_sched a creator-cluster-restricted ordered reclaimable workqueue, and implement gpu::Gpu::syncobj_wait_hint() with a lock-free active-burst uclamp hint (matching G17). Signed-off-by: Diljit Singh <[email protected]>
…l fences early Firmware::retire() previously ran up to EVENT_RETIRE_POLLS (10) x 5 us udelay() loops while holding Shared::state whenever flights remained non-empty after an EP 0x20 interrupt. At queue depth d > 1, retiring the oldest flight left subsequent flights in self.engine.flights, causing every EP 0x20 interrupt to spin for 50 us under Shared::state (bouncing concurrent try_submit_inline() submissions onto drm_sched) and to arm a 15 us short_repoll hrtimer even though retirement had succeeded. Periodic 1 ms housekeeping also ran before retiring and signalling completed fences. Split polling into a non-sleeping Firmware::poll_step() and Firmware::retire_once() that report whether any flight retired: - Stop the EP 0x20 trailing retry loop immediately as soon as any flight retires (or flights drain, a receipt fault occurs, or the engine freezes/fails), and set short_repoll only when an event with active flights still retired nothing after the trailing retries. - Release Shared::state and complete any ready jobs before each 5 us udelay() retry so concurrent inline submissions can acquire the lock without contention. - Retire and publish ready work before periodic 1 ms housekeeping, deferring housekeeping until after job::complete_all() wakes userspace whenever jobs retired on that pass. Signed-off-by: Diljit Singh <[email protected]>
Advertise DRM_ASAHI_FEATURE_COMPUTE_NO_QUERY_ACCESS in G16 GET_PARAMS and accept DRM_ASAHI_COMPUTE_NO_QUERY_ACCESS in compute stream/command validation. G16 publishes command timestamp outputs from the CPU during retire_oldest(). Record on each Flight whether it carries timestamp outputs and, in Firmware::can_queue_behind(), hold a same-queue compute command with a compute barrier behind an in-flight timed predecessor unless DRM_ASAHI_COMPUTE_NO_QUERY_ACCESS is set (clearing ComputeCommand::query_access). Ordinary compute dispatches that pass NO_QUERY_ACCESS continue to pipeline freely behind timed compute work, while query copy/reset compute shaders wait for host timestamp publication. Extend test-command-stream.py and test-publication.py with host coverage for the compute flag and query-access pipelining rules. Signed-off-by: Diljit Singh <[email protected]>
…cation batches When publish_checked() publishes multiple commands in a single pass (multi-command SUBMITs or queued back-to-back submissions), each command still posts its own SubmitRecord and advances qstate::WRITE individually per the M4 firmware contract, but previously called session.ring(channel) on every iteration. Defer doorbell ringing into a per-batch channel bitmask and ring each touched channel once via Firmware::flush_doorbells() after the batch loop finishes (preserving FS-before-TA ordering for render batches and fail-stopping on any post-visibility doorbell error). Count commands that share a coalesced doorbell pass in Engine::stats.grouped. Add host tests in test-publication.py covering coalesced compute/render doorbells, deferred-follower flushing, and doorbell error fail-stop. Signed-off-by: Diljit Singh <[email protected]>
…scene Every G16 compute dispatch previously copied the full 8 KiB ComputeWork object (0x2000 bytes) into write-combined firmware memory, even though encode_compute_for() and the firmware only touch 0x000..0x150 (header plus up to 25 register records) and 0x720..0xf08 (metadata, ABI fields, embedded sequence, notifier, UMA descriptor, tail) — leaving 5,832 bytes (71%) perpetually zero. Similarly, every render pass zeroed and copied the full 16 KiB scene object (0x4000 bytes) to WC memory even though only 0x000..0x780 (rounded up to 0x800, 2 KiB) is touched by host or firmware. - Track on ComputeOwners whether each unit's latest claim required a full scrub (first use, cross-VM switch, cancelled prep, error, or firmware recovery). On clean same-VM reuse, prefix_compute() writes only the two active spans (0..0x150 and 0x720..0xf08: 2,360 bytes instead of 8,192 bytes); full-scrub claims still write all 0x2000 bytes after preserving any existing UMA descriptor. - Zero the full 16 KiB PassSlot::scene in PassSlot::scrub(full = true), size Scratch::scene to scene::ACTIVE_SIZE (0x800), and allow fill_scene() to zero and populate that active 2 KiB prefix, cutting 14,336 bytes (87.5%) of CPU memset and WC writes per render pass. - Extend test-resources.py to verify compute_needs_full_work() state transitions and PassSlot::scene full-scrub coverage. Signed-off-by: Diljit Singh <[email protected]>
… and idle CLPC drain Address review findings on PR #2741: - Replace Scheduler::last_job (Option<Arc<Job>>) with a lightweight last_scheduled: Option<Arc<AtomicBool>> signalled after SchedJob::run(), cancel() or drop() finishes handing off the job. Queue-local inline submission ordering is preserved without pinning the previous Arc<Job> (and its VmJobGuard / Prepared arenas) across idle periods or subsequent submissions. - Retain the aborted flight's fresh PbEpoch in Pools::quarantine_flight() alongside the prior slot owner, and mem::forget() the removed Flight on fail-stop early returns in retire_oldest() so exposed epochs are never unmapped while firmware may still reference them. - Track a monotonic scrub_gen across Slots::invalidate_scrub() and stamp it on Claims during Slots::publish() so flights that were already in flight across a firmware recovery do not clear scrub_full on retirement. - Report idle work state to CLPC (power.report_work(false)) in poll_step() when flights drain with an empty pending queue. - Drop Cache::ready before the up-to-10 s standby wait in Cache::prepare() so Cache::close() and same-VM compute submits do not block behind a render standby wait. Signed-off-by: Diljit Singh <[email protected]>
ba6a7be to
9f14889
Compare
8f43a11 to
20cf248
Compare
Bring in CONFIG_DRM_ASAHI_G14_V27_2, which the hardware-defaults host test requires the shared asahi.config to enable. Signed-off-by: Diljit Singh <[email protected]>
Bring in integration/aurora through the updated base. The only conflict is the g16/params.rs module comment: it now lists VDM_USC_INVALIDATE from the shared file.rs together with the fragment-only render barriers and COMPUTE_NO_QUERY_ACCESS this series advertises. 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) submit and render pipelining, stacked on #2676: a standby PB epoch pool, fewer same-VM WC scrubs and writes, inline ready submit, 8 render pass slots with per-slot scene lists, multi-flight same-VM render pipelining with fragment barriers, early fence signalling,
COMPUTE_NO_QUERY_ACCESS, coalesced doorbells, and fixes for job retention, PB quarantine, scrub generation and the idle CLPC drain.Tested: M4 Mac mini (J773g, G16G B0, 26B123) on earlier heads of this branch, not the current one: vk-mustpass-short 87/87, cross-VM stress, Minecraft 1080p, the 24-row gpubench-vk sweep, 314,336 GPU jobs with 0 recoveries; memory-leak gate flat on the stack tip of the time. 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); J713 idle/video power and a 10-minute sustained thermal run; CI, which runs once the base lands and this PR targets
main.Details (original description)
Summary
Ten-commit G16 (M4 / T8132, 26B123 firmware) GPU performance series stacked on
djdev/g16-272(#2676), with zero new knobs or debugfs/module parameters:Waves 1–2 (commits 1–6)
PbEpochpool: decouple standby PB epochs from per-jobPreparedso consecutive renders reuse epochs without re-allocating.scene_list+ decoupled PB/UMA allocator slots: compact per-pass VA stride to 64 MiB (8 slots) and isolatescene_listperPassSlot(bisect-safe on its own with overlap still off).DRM_ASAHI_FEATURE_FRAGMENT_BARRIERS+ deeper queues: enable TA(N)/FS(N-1) overlap via explicit hardware barriers, raiseFLIGHTS/SCHEDULER_CREDITSto 32 andAHEAD_RECORDSto 128, restrict each logical queue'sdrm_schedworkqueue to the creator cluster (matchingg17/job.rs), and add lock-freesyncobj_wait_hint().Wave 3 (commits 7–10, hardware-verified on the J773g)
Shared::stateacross retire tail delay + early fence signalling: stop EP0x20trailing retries immediately once any flight retires (armingshort_repollonly when active flights still retired nothing), releaseShared::stateand wake ready jobs before each 5 µs retry, and defer 1 ms housekeeping until afterjob::complete_all().DRM_ASAHI_FEATURE_COMPUTE_NO_QUERY_ACCESS: advertise and honorCOMPUTE_NO_QUERY_ACCESSso ordinary compute dispatches pipeline behind timed compute work while query copy/reset shaders wait for host timestamp publication.Firmware::flush_doorbells()(preserving FS-before-TA ordering and fail-stopping on post-visibility doorbell error).ComputeWorkand renderscene: write only the activeComputeWorkspans (0..0x150and0x720..0xf08: 2,360 B vs 8,192 B, -71%) on clean same-VM reuse and populate only the active 2 KiBsceneprefix (vs 16 KiB, -87.5%) per render pass.Hardware Verification (Mac mini M4 J773g, macOS 27.2 / 26B123, 4K60 HDMI)
Tested on
7.3.0-ARCH-m4drv8withaurora.kocarrying all 10 commits (Wave 1–3) + Mesamesa-m4-mega-59b5202e(Borealis + G16G single-sample colour compression). Across the full boot (314,336 GPU jobs;247,674across the 24-rowgpubench-vksweep withtpc_clear_bytes=0,grouped=14,376,overlaps=202,661,reused=113,529 / fresh=3): 0 recoveries, 0 hang kills, 0 dmesg GPU errors,health: failed 0 degraded 0.vk-mustpass-short): 87/87 Pass (0 Fail, 0 Crash, 0 Timeout, 0 GPU errors).compute.light+ concurrent 2-procrender.light+compute.heavy(compute_cross_vm=6,264,render_cross_vm=77) PASS, 0 recoveries, 0 errors.rd=12, offscreen KWin Wayland, native GL):rc=0, 163.80 FPS (still154.77 /spin131.38 /fly194.91 FPS,mean 6.105 ms, 8,191 frames, 0 GPU errors).24-Row
gpubench-vkvs Native macOS 27.2 (us/sub, lower is better;*= Linux beats/ties native macOS 27.2 — 7/24 rows)render.light (tri)render.light (tri)render.light (tri)render.light (tri)render.light (tri)render.heavy (fill, 1080p)render.heavy (fill, 1080p)render.heavy (fill, 1080p)render.heavy (fill, 1080p)render.heavy (fill, 1080p)render.heavy (geom, 1080p)render.heavy (geom, 1080p)compute.lightcompute.lightcompute.lightcompute.lightcompute.heavy (alu)compute.heavy (alu)compute.heavy (bw)compute.heavy (bw)copy.bw (fill)copy.bw (fill)copy.bw (buf2buf)copy.bw (buf2buf)Host Verification
python3 tools/testing/selftests/drivers/gpu/asahi-m4/run-host-tests.py: 24/24 PASS at Commit 5 alone (bisect verification) and atHEAD(all 10 commits).scripts/checkpatch.pl --strict --git origin/djdev/g16-272..HEAD: 0 errors, 0 warnings, 0 checks across all 10 commits.Keeping as draft pending the fanless M4 MacBook Air (J713) idle/video power + 10-minute sustained thermal row.