Skip to content

drm/asahi: g16: start-full render UMA pool with 5 s idle shrink - #3990

Merged
DjDeveloperr merged 5 commits into
aurora-silicon:mainfrom
IronsideXXVI:j604/g16-uma-pool-idle-shrink
Dec 4, 2026
Merged

DjDeveloperr merged 5 commits into
aurora-silicon:mainfrom
IronsideXXVI:j604/g16-uma-pool-idle-shrink

Conversation

@IronsideXXVI

@IronsideXXVI IronsideXXVI commented Dec 2, 2026 •

Copy link
Copy Markdown
Contributor

What: A G16/G15 render VM that has not rendered for 5 s gives back 24 MiB of each base render UMA pool whose descriptor firmware can't reach (32 MiB down to 8 MiB). It gets them back before its next render is accepted, so no render ever runs with less than main's 32 MiB. A VM whose second pool never rendered (the usual case on a desktop) saves 24 MiB; one whose pools have both been displaced by other VMs saves 48 MiB.

Tested: offline at dfcbdce1e48e merged with main 1ab453e8b404 (tree 1e89ff66a486): drivers/gpu/drm/asahi/ W=1 builds with no new warning, asahi-m4 and g16 host tests pass, checkpatch --strict is clean. The same on top of #3695, #3699 and #3340.

  • J516s (T6030): PASS at 5c74c6aa14cc in candidate a1f8c4e0 on main 148f5ca2. Shrink/regrow, GPU recovery while shrunk, and two deep sleeps per arm passed. With four idle VMs, system-wide available memory was 138.2 MiB higher. Adjusting for the start-of-row difference gives 72.4 MiB, consistent with three additional 24 MiB pools detached. The conventional median for the first verified frame after 8 s idle rose from 19.99 to 22.65 ms (+2.66 ms). Maximum pool restore was 6.92 ms. Paired receipt.
  • J773g (T8132): PASS for shrink/regrow, idle work, first-frame timing and s2idle at dfcbdce1e48e. The driver patch carries unchanged through the forward merge to 5c74c6aa14cc. Earlier row and scope.

Risk: two-way · M4 (T8132) and M3 (T6030, T8122), which share the g16 backend. No uAPI or parameter change. SCS pools and recovery arenas are untouched. A plain revert restores fixed 32 MiB pools.

Not yet: memory savings on an idle desktop and with 8+ idle clients, an exact-head J604 run, and a T8122 boot.

Details
  • Each base allocator's pool is a permanent 8 MiB (2048 pages) plus six 4 MiB pieces that can be detached. It starts full.
  • Firmware takes an allocator's ASC-cached descriptor with the first publication and keeps it until another lease retires on the same hardware slot. The host reads or rewrites it only while firmware can't reach it: never published, or neither retained nor held for a publication on its slot (Pools::uma_slot_fw_safe(), with the device state lock held across the check and the rewrite).
  • A pool therefore can't grow while it renders. Cache::prepare() restores the full pool under Cache::ready, before it accepts a render, and fails the SUBMIT with the allocation's error if it can't. SCS renders use their own pools and skip it.
  • Both directions put the pool back to its state at creation: free list, pool table and the whole descriptor, with COMPLETED level with submitted.
  • The shrink work is a one-shot 5 s after GPU work and while a VM counts its 5 s down. There is no periodic timer.
  • A failed pipelined publication no longer drops the slot's hold of the same VM's render still in flight, which the check above relies on.
Evidence

At dfcbdce1e48e (the author's two commits plus two fixes on top), no GPU used:

  • Merged with main 1ab453e8b404 (tree 1e89ff66a486, driver tree 548995b0e37f; main 5f32aa72fa7e changes nothing under the driver or its tests): make W=1 modules_prepare drivers/gpu/drm/asahi/ on arm64 (gcc 16.2.0, rustc 1.100.1, CONFIG_DRM_ASAHI=m, CONFIG_DRM_ASAHI_G16=y) links aurora.o, 0 errors, 40 warnings as on main.
  • Merged with drm/asahi: g16: keep compute UMA managers bound and ASC-cached #3695 bc7b1395, drm/asahi: g16: rebuild a drained compute UMA manager without reseeding its pool #3699 e8a8a9bc and drm/asahi: g16: widen compute concurrency to 64/16 and cache shared UMA and fw_stamp #3340 eb8c98e6 (tree b666cedc2aa4): the same build, 0 errors, 39 warnings as without this PR. The only textual conflict is in test-resources.py, where both sides add tests at the same place.
  • run-host-tests.py --only asahi-m4 (27 scripts) and --only g16 pass on both trees, in the host-tests.yml toolchain (ubuntu 24.04, rustc 1.96.0). test-resources.py: 92/92 on the main merge, 105/105 on the other.
  • checkpatch.pl --strict --ignore FILE_PATH_CHANGES on both fix commits: 0 errors, 0 warnings, 0 checks.
  • The new cases fail with each of ten single-line mutations of the fix. At c6903ad356d6 the same scenarios leave a pool at 2048 pages after 10000 heavy renders, and at 2048 pages for a heavy VM that wakes while another VM has a render in flight on its slot.

Back each base G16G render allocator private UMA pool with a permanent
8 MiB (2048-page) base plus six detachable 4 MiB (1024-page) pieces
(32 MiB / 8192 pages full at creation) so the first render of any newly
opened heavy client starts with the full 32 MiB pool and avoids 0x70
recovery.

After 5000 ms of VM render quiescence, a system_unbound delayed work item
checks per-allocator firmware-cache safety (never-published allocator,
displaced hardware UMA slot, or GFX idle power-off) plus circular ring
settlement and detaches the six 4 MiB pieces, updating descriptor head,
tail, seeded count, and ROW_WORDS (+0x48) and returning 24 MiB per shrunk
base allocator (up to 48 MiB per idle rendering VM).

Shrunk pools stay at 8 MiB for light desktop compositing and re-grow
proactively via circular-ring append in Cache::prepare() when heavy
signals fire (batch or in-flight demand >= 4, extension render tier,
PB heap growth, or per-render ring churn > backed / 2).

Add unit tests for the shrink/re-grow ring invariants and production
Allocator/Pools lifecycle in the asahi-m4 host selftest suite.

Signed-off-by: Dylan Ironside <dylan@dylanironside.io>
@IronsideXXVI
IronsideXXVI requested review from a team and DjDeveloperr as code owners December 2, 2026 20:36
@github-actions github-actions Bot added area:gpu Area from CODEOWNERS (bot) blast:m4 Macs affected, from Merge risk (bot) door:two-way Revertible or not, from Merge risk (bot) needs-review No approving review from Core or Omarchy Mac yet (bot) labels Dec 2, 2026
@github-actions

github-actions Bot commented Dec 2, 2026 •

Copy link
Copy Markdown

Merge readiness at 5c74c6aa: not ready yet

Check Detail
CI at head running running: apple-build, host-tests, KUnit asahi
Review no needs one approving review from Core or Omarchy Mac (not the author)
Requested changes ok none
Hardware row at head ok in the PR body at 5c74c6aa
Conflicts ok none
PR text ok Risk: two-way · M4 (T8132) and M3 (T6030, T8122), which share the g16 backend. No uAPI or parameter change. SCS pools and recovery arenas are untouched. A plain revert restores fixed 32 MiB pools.

Areas: area:gpu

Updated by pr-readiness on pushes, edits, reviews and comments, and on a schedule. Rules: merge policy · labels.

@DjDeveloperr DjDeveloperr left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review at 052bc063cd9b. The close and suspend handling, the preparing_renders window and the lock order (ready, then the device state) look right, and the ring math holds. The firmware-cache part does not, so this can't merge as it is.

Must change

  1. Re-grow rewrites a live descriptor with no firmware-cache check. uma_shrink_idle() only runs after uma_slot_shrink_safe(). uma_regrow_one() writes the same +0x24, +0x2c and +0x48 words plus the list rows on any quiescent submit. By then the slot is published, and usually neither displaced nor powered off. On main this descriptor is ASC-cached (FwCoherent), its rule is no host store after publication, and main deliberately doesn't read COMPLETED from it (flight_retired()). A stale or written-back line loses the append, or takes back the cursors. Re-grow needs the same rule as shrink, or a second descriptor the firmware can't name (what #3695 does for compute).
  2. "GFX power-off makes the ASC reload the descriptor" has no evidence here, and the check doesn't hold. The slot table and the cached lines are on the ASC side, not in the GFX domain. The state lock is also dropped before the rewrite, so another VM's submit can wake GFX in the middle of it. Getting the shrink side wrong means free-list entries that point at unmapped pages. Please either drop this branch or show the reload on the 26B123 FwCoherent mapping, with the check held across the rewrite. The J604 runs used fbc7693b7, which isn't public, and your Not yet says the FwCoherent mapping hasn't run.
  3. On main it mostly just polls. GFX stays on at idle on main (#3697 measured it on in 32/32 control windows), and with a few VMs a slot is never displaced. A published pool then never shrinks, and shrink_idle_uma() returns RetryAfter(1000) forever: a 1 Hz wakeup that takes the device lock and reads the PMGR on an idle desktop. Re-arm from an event (displacement, power-off), not a timer.
  4. It adds a smaller pool than main has. Main already seeds the base pool with 32 MiB (uma_manager::SEEDS = 8192), so starting full isn't new. What's new is that after 5 s idle a client has 8 MiB, about 736 pages above your own 1312-page reserve. The first heavy render after that gets no growth: churn is only learned while shrunk, and only from renders that already ran. A client that keeps renders in flight is never quiescent at submit, so demand >= 4 from in-flight work only records want. Please keep the high-water mark from before the shrink, and grow before the first render of a VM that has needed more.

Scope: this backend also runs T6030 (G15S) and T8122 (G15G). Placement::Base is shared, so they get the shrink too. Risk and Tested only name M4.

Wording: on main 0x70 is the first render pair's TA event, not a recovery. Please say what actually failed. Named fields instead of UMA_SHRINK[7] would help too.

Checked on main 2c667a4b + this head: drivers/gpu/drm/asahi/ W=1 builds, asahi-m4 host tests 27/27, g16 host tests 2/2, checkpatch --strict clean. No textual conflict with #3340; #3695 and #3699 conflict with it in test-resources.py, and #3697 decides whether the power-off branch can run at all. #2700 is USB only. Hosted host-tests, apple-build and KUnit show as skipped at this head, so nothing ran in CI.

Rows at the next head: J773g (T8132) and J516s (T6030) on 26B123. Each needs: 8 or more render clients open and closed, 6 s idle and then one heavy render, pipelined load after idle, s2idle and deep sleep while shrunk, a recovery while shrunk, the uma_shrink: line before and after, idle wakeups vs base, 0 GPU faults, 0 recoveries. One T8122 boot from a peer.

@github-actions github-actions Bot added the changes-requested A reviewer requested changes (bot) label Dec 2, 2026

@aurora-silicon-review aurora-silicon-review Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verdict: REQUEST CHANGES at 052bc06

Failure: In pools.rs, a shrunk UMA pool can be published again by a small render. A later quiescent submit with growth demand enters uma_regrow_one() and rewrites that same published descriptor and its freelist. The growth path only checks host-side quiescence and does not apply the firmware-cache ownership check that shrink uses. This violates the existing no-host-store-after-publication rule for the ASC-cached descriptor. Guard both operations with the same valid firmware-ownership boundary.

Failure: In resources.rs, a published pool that still owns its slot with GFX on makes shrink_uma() report retry. shrink_idle_uma() then returns RetryAfter(shrink_ms.min(1000).max(100)). A quiescent published pool kept in its slot therefore keeps waking and checking the device every second, even with no further render or ownership transition. Re-arm on a change that can make it safe to shrink.

Checked: Reviewed the new shrink and grow paths against the existing published-descriptor lifetime. The maintainer’s exact review records the matching cases and the base behavior.

Address review feedback on G16 render UMA idle shrink and re-grow:

- Enforce the same FwCoherent firmware-cache safety rule on both shrink
  and re-grow: hold shared.state across Pools::uma_slot_fw_safe() and
  all descriptor/list/ring reads and writes so a live ASC-cached
  descriptor is never modified or read while retained in firmware.
- Drop the unproven GFX-power-off safety branch; rely strictly on
  verified slot displacement (retained_uma[k] replaced by another lease)
  or never-published allocators while holding shared.state.
- Replace 1 Hz RetryAfter(1000) idle polling with event-driven
  re-arming: return WaitEvent for undisplaced idle VMs (0 Hz idle
  wakeups) and re-arm uma_shrink when Pools::retire_flight() displaces a
  previous RenderUmaLease.
- Track and preserve each allocator pre-shrink high-water mark (both
  heavy demand while full and pre-shrink ring churn) so a heavy VM
  immediately pre-grows back to 32 MiB before its first render after
  idle while its slot is still displaced.
- Replace UMA_SHRINK[0..10] indices with named UmaShrinkStats fields,
  update scope comments for shared Placement::Base on T6030/T8122, fix
  0x70 TA event wording, and expand host unit tests to cover all four
  behaviors.

Signed-off-by: Dylan Ironside <dylan@dylanironside.io>
@github-actions github-actions Bot added needs-hw-row No hardware row at the PR head (bot) blast:m3 Macs affected, from Merge risk (bot) and removed needs-hw-row No hardware row at the PR head (bot) labels Dec 3, 2026
@IronsideXXVI

Copy link
Copy Markdown
Contributor Author

@DjDeveloperr Thanks for the detailed review. Pushed forward commit c6903ad356d6 addressing every item:

  1. Firmware-cache check on re-grow (FwCoherent): uma_regrow_step() and uma_regrow_one() now enforce the exact same Shared::with_uma_fw_safe() -> Pools::uma_slot_fw_safe() gate as uma_shrink_idle(), holding Shared::state continuously across the uma_slot_fw_safe() check and all descriptor/list/state reads and writes. Live descriptors still retained in retained_uma[k] are never written or read for COMPLETED (quiescence outside the gate checks uncached submitted against host retired_submitted). GFP_KERNEL UmaPiece allocations and detached piece drops still run outside Shared::state and uma.inner.
  2. Dropped GFX-power-off branch: Removed the boot::glue::power_domain_state() check and gfx_powered_off parameter completely. fw_cache_safe(slot_free, slot_displaced) now relies solely on !published or verified slot displacement (slot_free && displaced) while holding Shared::state across the rewrite.
  3. Eliminated 1 Hz idle polling: Removed RetryAfter(1000) / active-VM retry timers. Cache::shrink_idle_uma() now returns RetryAfter(rem) only for the single one-shot countdown remaining in the initial 5 s idle window, and returns UmaShrinkOutcome::WaitEvent (0 Hz idle wakeups, no timer re-arm) when a published slot is still retained in firmware. Pools::retire_flight() tracks lease displacement (uma_displaced / take_uma_displaced()), and run_poll() re-arms uma_shrink from that displacement event.
  4. Pre-shrink high-water mark: Added high_water / high_water_fast on UmaPoolState, latched both from heavy demand while full (RenderInner::note_uma_demand() in Cache::prepare()) and from pre-shrink ring churn (churn_needs_full(churn)) before resetting w24 during shrink. A heavy VM that shrinks at idle keeps high_water = FULL_PAGES and immediately pre-grows back to 32 MiB before its very first render after idle while its shrunk slot is still displaced; light desktop compositors stay at 8 MiB.
  5. Scope & wording: Updated comments and PR Risk/Not yet sections to cover T6030 (G15S) and T8122 (G15G) alongside M4 (T8132), replaced UMA_SHRINK[0..10] with named UmaShrinkStats fields, and corrected the 0x70 wording (TA event starvation on smaller initial pools rather than calling 0x70 a recovery).

Verified offline at c6903ad356d6:

  • scripts/checkpatch.pl --strict --ignore FILE_PATH_CHANGES --git 052bc063cd9b..c6903ad356d6: 0 errors, 0 warnings, 0 checks (1444 lines).
  • ARM64 LLVM=1 W=1 (clang 18.1.8, rustc 1.85.0) drivers/gpu/drm/asahi/asahi_core.o: 68082232 bytes, 0 errors, 0 new warnings in g16/.
  • tools/testing/selftests/drivers/gpu/asahi-m4/run-host-tests.py: 27/27 passed (test-resources.py 92/92 including live retained-descriptor blocking on both shrink and re-grow, Pools::retire_flight() displacement event + safety gate, and pre-shrink high-water pre-grow on first render; test-uma-shrink.py 7/7).
  • tools/asahi/g16-vm-share-tests.py: PASS (ok, PASS control).

Live 26B123 hardware rows at c6903ad356d6 (including idle wakeups vs base, 8+ client displacement, 6 s idle -> heavy render, pipelined load, sleep/recovery while shrunk) will follow as a separate hardware verification comment.

@aurora-silicon-review aurora-silicon-review Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verdict: MERGE at c6903ad

Checked: Both growth and shrink now keep the GPU state lock across the slot ownership check and the firmware-cached descriptor and ring accesses. A published allocator needs an idle, displaced slot. The preparation and in-flight checks keep host and firmware ownership separate during regrowth. The five-second idle window arms once, and a pool still retained in its slot waits for a displacement event. The exact resource suite passed 92 cases, and the direct UMA suite passed all seven, including high-water regrowth and slot-displacement safety.

A shrunk pool could only grow again while its VM looked heavy and
firmware did not hold its descriptor. Firmware takes the descriptor with
the first publication and keeps it until another lease retires on the
same slot. With 16 warm slots that may be never, so a VM that was light
when it came back from idle rendered with 8 MiB for good. Neither a
quarantine nor another VM's render in flight on the slot let a heavy one
grow either. The estimate of who is heavy did not work: the ring cursor
wraps at 16384 pages, so 600 renders of 4000 pages each read as 13 pages
per render.

Restore the full 32 MiB in Cache::prepare() before it accepts a render
and fail the SUBMIT if that fails, as it already does for the arena
itself. Only an idle VM holds a shrunk pool now, so the high-water,
demand and churn heuristics go. Both directions now put the pool back to
its state at creation, the whole descriptor but for COMPLETED, instead
of patching the fields that name the pages and keeping the rest of what
firmware saved there.

Firmware can't reach a descriptor that is neither retained nor held for
a publication on its slot, whatever else runs there, so that alone is
the check for both directions. A published descriptor on a slot without
a retained lease no longer passes it. The check reads the published flag
under the device lock.

Every displacement also armed the shrink work after 1 ms, which walked
all VMs and took their locks for each render that changed a slot's
lease. A displacement ends in a completion, which arms the 5 s work
anyway, so drop the extra event. A VM whose first render never ran no
longer re-arms the work every 5 s.

Signed-off-by: DjDeveloperr <hey@djdev.me>
A publication that fails before it is visible, for example with EAGAIN
while a recovery is pending, dropped the slot's candidate VM, arena and
UMA lease even when an earlier render of the same VM was still in flight
there. That render then retired without them, so the slot kept naming
the owner before it while firmware held the new descriptor, and the idle
shrink would have taken a live descriptor for a displaced one.

Keep them until the last render in flight on the slot has retired.

Signed-off-by: DjDeveloperr <hey@djdev.me>
@github-actions github-actions Bot added the needs-hw-row No hardware row at the PR head (bot) label Dec 3, 2026

@DjDeveloperr DjDeveloperr left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verdict: FINISH, then merge at dfcbdce1e48e: only the hardware rows are missing. I pushed two fix commits on top of yours (maintainer edits are on) instead of sending it back; your commits are unchanged.

What was still wrong at c6903ad356d6, all fixed now:

  1. A pool that came back light stayed at 8 MiB. The growth check only passes until the first publication. After that firmware keeps the descriptor until another lease retires on the same slot, and with 16 warm slots that may be never. A host test at that head still reads 2048 pages after 10000 heavy renders. A heavy VM that woke while another VM had a render in flight on its slot, or whose slot was quarantined, wasn't grown either. 44db68e57f7a restores the full 32 MiB in Cache::prepare() before any render is accepted, and fails the SUBMIT if it can't.
  2. The heavy-use estimate read nearly zero. The ring cursor wraps at 16384 pages, so 600 renders of 4000 pages each came out as 13 pages per render. With 1. it isn't needed, so the high-water, demand and churn code is gone. The cost is that a light VM is no longer kept at 8 MiB while it renders; only idle VMs save.
  3. Each displacement armed the shrink work after 1 ms (poll.rs), which walks every VM and takes its lock. A displacement ends in a completion, which arms the 5 s work anyway, so the extra event is gone.
  4. A second render that failed before it was visible dropped the slot's hold of the first one in flight (cancel_alloc(), also on main). The slot then kept naming the owner before it, and the new check called a live descriptor safe to rewrite. dfcbdce1e48e keeps the hold until the last render on the slot retires.

Smaller: the restore and the shrink now write the whole descriptor as at its creation (a saved +0x28 used to stay behind), the check reads published under the device lock, and a VM whose first render never ran no longer re-arms the work every 5 s.

My earlier points: 1 (firmware-cache rule on re-grow), 2 (power-off branch) and 3 (1 Hz polling) are settled; 4 (smaller pool than main) by the first fix; scope and wording are fine. I'm dismissing that change request.

Checked: lock order (ready, device state, pieces; no allocation or unmap under the last two), close, deep sleep (the work is joined before the stop), recovery and quarantine while shrunk. Merged with main: drivers/gpu/drm/asahi/ W=1 with the same 40 warnings as main, asahi-m4 27/27 and g16 host tests, checkpatch clean. Merged with #3695, #3699 and #3340: the same checks pass; the only conflict is added tests in test-resources.py. Ten one-line mutations of the fix each fail a test. No Apple material, no gates, no parameters. I updated the PR body.

Rows at dfcbdce1e48e: J773g (T8132) and J516s (T6030) on top of #3695, #3699 and #3340: shrink and restore with and without other clients, 24 clients opened and closed, pipelined load after idle, s2idle and deep sleep (J516s: s2idle) while shrunk, a recovery while shrunk, idle wakeups, render rows against base. max_ns in uma_shrink: is the time a wake-up pays per pool; it needs to stay within 8 ms (half a 60 Hz frame) for each. We run both. Your J604 row at this head is welcome, and so is a T8122 boot.

@DjDeveloperr
DjDeveloperr dismissed their stale review December 3, 2026 02:42

Settled at dfcbdce: points 1 to 3 by c6903ad, point 4 by 44db68e. Only hardware rows are left; see the review at that head.

@github-actions github-actions Bot removed the changes-requested A reviewer requested changes (bot) label Dec 3, 2026
@IronsideXXVI

Copy link
Copy Markdown
Contributor Author

@DjDeveloperr Thanks for the review and for pushing 44db68e57f7a and dfcbdce1e48e directly on top — restoring the full 32 MiB in Cache::prepare() before accepting a render and keeping the slot hold across failed pipelined cancel_alloc() makes the ownership invariant much cleaner. I will follow up with a J604 hardware verification row at dfcbdce1e48e (covering shrink/restore, uma_shrink: max_ns, multi-client displacement, pipelined load after idle, idle wakeups, and sleep/recovery while shrunk).

@github-actions github-actions Bot removed the needs-hw-row No hardware row at the PR head (bot) label Dec 3, 2026
@DjDeveloperr

Copy link
Copy Markdown
Contributor

J773g (Apple M4 Mac mini, Mac16,10, T8132, G16G B0, os-fw 27.2, desktop graphical.target) hardware row at head dfcbdce1e48e: PASS for uma_shrink shrink/regrow, idle work, latency, and s2idle (with desktop-compositor timing, pre-#3629/#4007 deep-sleep refusal, and recovery-trigger caveats below).

Build & Arms (7.3.0-j773g-g16ready+, aurora.ko swap only)

  • base1 (comp3 without #3990): aurora-comp3.ko a91962b95270, boot e967caa1-db98-4b46-8e6f-53cc60e41a44
  • head1 (comp3 + #3990 @ dfcbdce1e48e): aurora-comp3-3990.ko 08dce02d2441, boot 41e0c6b4-617f-4eef-96b9-21c012355d5f

row-3990.sh Results (DEEP=0 on head1)

  • uma_shrink final counters (aurora-g16/stats):
    ms 5000 built 328 shrunk 26 detached 156 regrown 24 readded 144 fails 0 unsettled 0 unsafe_skip 297 max_ns 4669772 (4.67 ms <= 8 ms) last_free 8192
  • Health & logs: health: failed 0 errno 0 degraded 0, gpu_lines=0, warn=0 across all phases.
  • Idle work (60 s): head1 5068 <= base1 5239.
  • Shrink / regrow phases: LIGHT alone, LIGHT disp, DEEPQ disp, HEAVY alone, HEAVY disp, idle, and freeze all shrank and regrew with 0 fails (MemAvailable recovered +129 to +241 MiB while shrunk).
    • Desktop compositor note: DEEPQ alone missed its 7 s idle shrink window once (shrunk 11 < 12, regrown 7 < 8) because the live desktop compositor (kwin_wayland) submitted a frame during the idle wait; DEEPQ disp immediately after shrank (11 -> 13) and regrew (7 -> 9) cleanly.
  • Render latency (row-3990.sh):
    • short render.light d=1: base1 median 139.57 us (p95 142.86, max 145.35, n=168) vs head1 median 139.86 us (p95 143.47, max 144.30, n=120).
    • client: render.light d=1 324.64 -> 320.69 us, render.light d=64 60.57 -> 60.96 us, render.postfx d=2 1550.65 -> 1551.31 us.
  • Full row.sh comparison (comp3 vs comp3+3990): CTS (compute_pipeline 103/117, compute_sample 1210/6756, multi_queue_3w 105/2439, 0 fail), stress (stress-idle 2048/2048, stress-load 1996/1996), and s2idle (2/2 PASS) all clean. (The compute.light [procs] d=16 pass-2 VM_CREATE ENOSPC on comp3+3990 is from #3340 in the base comp3, confirmed absent on compA without #3340.)
  • Sleep & recovery caveats:
    • rtcwake -m freeze (s2idle): 2/2 PASS on both base1 and head1.
    • rtcwake -m mem (deep): refused on J773g (-16 / EBUSY) on this pre-#3629/#4007 base (apple-sleep: no PCIe tunables for ANS, apple-dcp 48ae00000.dcp: no firmware stop for a deep sleep: refusing it).
    • Recovery-while-shrunk was not exercised because recovertest fault 1 completed without faulting (recoveries 0) on current G16G.

@github-actions github-actions Bot added the merge-conflict Conflicts with the base branch (bot) label Dec 3, 2026
Signed-off-by: DjDeveloperr <hey@djdev.me>
@DjDeveloperr

Copy link
Copy Markdown
Contributor

Forward-merged main c5bdd6820568 as 5c74c6aa14cc. The only conflict was the final append in asahi-m4/test-resources.py. Both main's compute UMA residency tests and this PR's render UMA tests are kept. The CPU-only Asahi M4 suite passed 27/27, including resources and UMA shrink. The existing J773g result covers shrink/regrow and s2idle on the earlier base. The requested J516s row and recovery while shrunk still need results. Please use 5c74c6aa14cc for the planned J604 run.

@github-actions github-actions Bot added needs-hw-row No hardware row at the PR head (bot) and removed merge-conflict Conflicts with the base branch (bot) labels Dec 3, 2026
@IronsideXXVI

Copy link
Copy Markdown
Contributor Author

Thanks for forward-merging main as 5c74c6aa14cc, @DjDeveloperr — we will use 5c74c6aa14cc for the J604 run.

@github-actions github-actions Bot removed the needs-hw-row No hardware row at the PR head (bot) label Dec 3, 2026

@DjDeveloperr DjDeveloperr left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 5c74c6aa14cc. The render-prep guard and the firmware-held descriptor check cover the transition into publication. The base pool is restored before render acceptance, and detached pages are dropped after the device lock is released. The exact-head UMA helper tests passed 4/4. I pushed this merge, so the required approval needs another maintainer.

I would land #4035 first once its J773g and J516s A/B is in. It caps reuse of standby parameter-buffer epochs to avoid depth-64 submit churn. This PR changes a separate allocation and can follow on its own evidence. The current-head J604 and J516s runs should show reclaimed bytes across idle clients, the first-frame cost after idle, and recovery while shrunk. uma_shrink: max_ns measures both shrink and regrow, so record first-frame timing separately.

@IronsideXXVI

Copy link
Copy Markdown
Contributor Author

Thanks for the review at 5c74c6aa14cc, @DjDeveloperr — landing #4035 first makes sense. Once our current J604 parity sprint finishes, we will run and post the exact-head 5c74c6aa14cc J604 hardware row including reclaimed bytes across idle clients, separate first-frame timing after idle (distinct from uma_shrink: max_ns), and recovery while shrunk.

@DjDeveloperr

DjDeveloperr commented Dec 4, 2026 •

Copy link
Copy Markdown
Contributor

J516s (M3 Pro, T6030) at 5c74c6aa14cc merged onto 148f5ca2 as a1f8c4e0: PASS on 7.3.0-j516s-m148f with Aura Stage 2 9fecef9d1bda. Both arms passed shrink/regrow workload checks, recovery while pools were shrunk, and two deep-sleep entry/wake cycles while shrunk. The candidate recorded zero shrink failures and zero unsettled pools. Stock boot was verified after each arm.

With four idle VMs, available memory was 13,415 → 13,553 MiB (+138 MiB). First verified frame after 8 s idle was 20.94 → 23.41 ms median (+2.47 ms), max 23.69 → 26.50 ms (12 samples per arm, head first). Maximum measured pool restore was 6.92 ms.

The earlier v2 run exercised s2idle because its Stage 2 lacked the T6030 GP PCIe tunables. This v3 run verified real deep entry and wake on both arms. An independent maintainer approval is still needed at this head.

@DjDeveloperr DjDeveloperr left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No blocking findings at 5c74c6aa14cc89b724497a5754a902a59adc245d. I reviewed all ten files. Render preparation restores the full 32 MiB before accepting a base-pool render. I traced the firmware-lease check through publication, cancellation and retirement, and checked allocation failure and suspend-worker teardown.

The J516s idle-memory tradeoff is acceptable. The +138 MiB is system-wide MemAvailable. The boots started 65.8 MiB apart, leaving +72.4 MiB after adjusting for that difference. The counters independently show three additional 24 MiB pools detached at each idle sample. The receipt's +2.47 ms uses the upper middle of 12 first frames per arm. Averaging the two middle values gives 19.99 → 22.65 ms (+2.66 ms) after eight seconds idle. The 6.92 ms maximum occurred during a regrow and met the row's 8 ms bound. The checked clients survived recovery and both deep sleeps. I see no reason to change the idle delay or restore path. Paired hardware row

The J773g driver patch ID matches (97d38c0b5ff6). All ten files merge cleanly onto main 56a577e83350 with identical added and removed lines. I ran the UMA helper and resource suites on both trees: 4/4 and 105/105 at the PR head, 4/4 and 110/110 on the integration. GitHub readiness passed. The hosted host-test, Apple build/KUnit and PR-text workflows show action_required on the fork PR event.

@DjDeveloperr
DjDeveloperr merged commit 9ece2d8 into aurora-silicon:main Dec 4, 2026
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:gpu Area from CODEOWNERS (bot) blast:m3 Macs affected, from Merge risk (bot) blast:m4 Macs affected, from Merge risk (bot) door:two-way Revertible or not, from Merge risk (bot) needs-review No approving review from Core or Omarchy Mac yet (bot)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants