Repository navigation
Conversation
RyanTheTide
left a comment
There was a problem hiding this comment.
@aeries0x Two things before we take this. Pools now keeps an Arc of the last bound epoch per slot even with the parameter at 0, which keeps that VM's state and admission permit alive until another render uses the slot; please drop those references when the VM goes away or when the submit fails before publication. And if the stress results hold, we would rather have the reuse on by default than behind a parameter; is there a case you know of where it must stay off? We will run the default and =1 cases on an M4 Pro.
|
Results with the parameter at its default (0), on our J616s (M4 Pro, G16S), merged on integration e661192 as a one-shot test kernel:
We haven't run the |
63a115b to
cdb7d9c
Compare
|
Thanks for testing on the J616s. Pushed a new revision for both points. References: the change adds no reference to Default: now on, with Also new: any firmware recovery, also one that resumes, makes the next render on each slot start fresh, and a host test in The numbers in the description are from this change on top of 673f618 (the tested build differs from the pushed commit only in comments and the commit message). I have not tested suspend with reuse on; if your M4 Pro run includes s2idle again, that would be the first one with the default. |
|
A correction to the desktop line in the description: "also with blur at 2 passes" measured nothing extra. Omarchy ships blur off and blurs only behind see-through surfaces, and the test window was opaque. Measured again with Omarchy's Glassy look (every window 75 % + blur 2 passes), same kernel (673f618 + this change), a 900x600 client pinned in front, 15 s per row,
Hyprland does ~19-27 renders per frame there. With the default look (no blur) it is 120 fps with both settings. |
|
Tested on a J604 (MacBook Pro 14", M4, Mac16,1; os-fw 26.6.2, system-fw 27.0; aura 1.0.0b13). The kernel was alarm-aurora's pkgrel 38 recipe on
No GPU fault or recovery line in the log. This is not a same-boot A/B: Disclosure: an LLM (Claude) ran these tests on my Mac and drafted this. I did the listening and looking, reviewed it, and am responsible for it. Assisted-by: LLM |
|
Re-ran our J616s row on head cdb7d9c, now with the parameter at its new default (1): cherry-picked onto integration/aurora fc05050, one-shot test kernel, SELinux enforcing. The J616s (T6040) binds the G17 backend (
0 GPU faults, firmware crashes or recoveries, 0 DART faults, 0 AVC. One s2idle cycle completed, and render.light afterwards was 117.5 us at depth 1. The production queue.exhaust failure was one run on a kernel without this change, not something this branch fixes. |
|
J604 (M4, G16G) results for cdb7d9c, GPU firmware 25G83. I cherry-picked it unchanged onto integration/aurora
compute.light does not use a PB, so its difference is boot-to-boot spread. queue.exhaust ends in the driver's ENOMEM No GPU faults, firmware crashes, recoveries or DART faults with either setting. I also ran 6 s2idle cycles with |
|
Tested on J773g (Mac mini M4, 24 GB): a large win, and no regressions in what I ran. Kernel gpubench c36cbbe (Vulkan, KWin running, headless), median µs per submit, best of the passes:
Correctness:
Open, not attributed: gpubench 🤖 Generated with Claude Code |
|
Correction to my J773g report above: the My benchmark ran in a systemd unit with Run without the cap, or under 20 GB, the case passes, with stock and with this PR. Nothing is open against #1543 from my side. 🤖 Generated with Claude Code |
|
Tested on the J773g Mac mini (M4, G16G B0) as the base of #2419, which stacks on this commit: with it, almost every render reuses its slot's retired epoch (30,582 reused / 114 fresh over a gpubench round), and Vulkan CTS 1/16 (84,219 Pass, 0 Fail) and the public GLES/EGL plan (0 Fail) are clean on the stack. #2419 also keeps never-exposed epochs for the next render, which takes render submit CPU from ~190-435 µs to 35-46 µs. 🤖 Generated with Claude Code |
|
Not on integration/aurora yet, and the commit (cdb7d9c) applies cleanly to the tip 110861f. Since the last review it has rows on the J604 (aeries0x, =0 vs default), the J773g (DjDeveloperr, Vulkan CTS 1/16 and GLES clean on the #2419 stack) and a no-regression row on the J616s, which does not run the G16 path. The two review questions (references held after a VM goes away, reuse on by default) are answered in the current revision. What's left is the final review; #2419 builds on this commit, so it does not replace it. Build check of 110861f plus this change (arm64, LLVM=1, Image, dtbs and every directory it touches, Fedora config plus asahi.config): builds, no warnings in the files it touches. |
Every G16 render gets a fresh parameter buffer epoch at SUBMIT and an InitBM ahead of its TA work, so the firmware rebuilds the allocator state for each render. Reusing the epoch instead cuts a small triangle render at queue depth 1 on a base M4 MacBook Pro (J604) from 1121 to 492 us. With this change, the next render of the same VM on a pass slot gets the slot's owner epoch, without a reseed or InitBM, if that epoch's render retired normally and was exposed. InitBM binds the device-wide slot to one epoch and VM, so this happens only while no other epoch was handed to the slot since; after another VM's render on the slot, after a failed or aborted render, after any firmware recovery, or after a deep-sleep firmware restart, the next render starts fresh. SUBMIT still allocates a fresh epoch for every render, so one is always at hand. Renders are bound, published and retired one at a time, so the slot's owner is the epoch it is bound to whenever reuse is allowed. The reused epoch is the slot's existing owner lease, so this holds no epoch, VM or admission permit beyond what the lease already holds: a slot binding is tracked by a counter, not by a reference. A host test covers when an epoch may be reused and that nothing else holds it. The stats line counts reused and fresh bindings. Signed-off-by: Friedrich <261542475+aeries0x@users.noreply.github.com>
cdb7d9c to
e5f348e
Compare
|
Updated and rebased onto current
Booted this exact head on the J604 (base M4 MacBook Pro 14"),
One s2idle cycle (lid closed about 90 s, woken by the lid): it resumed and the kernel log stayed clean. render.light after the resume was 484 to 491 us at depth 1 and 324 to 338 at depth 8 (GPU time per render unchanged at 22 us; the difference is on the submit side, still well below ~1120 us without reuse, though no base-only s2idle comparison was run on Checks on this head: |
DjDeveloperr
left a comment
There was a problem hiding this comment.
Formal §1–§6 pre-PR checklist review at e5f348ef1f43ebd307f81c8e3f21615c90264d35 against integration/aurora (70a00e583b03):
- §1 No model gating: PASS. Applies uniformly to all G16 devices with zero board/SoC/firmware gates. Validated on J604 (two separate machines) and J773g, with a no-regression run on J616s (G17).
- §2 Production-ready, no hacks: PASS. The earlier
g16_pb_reusemodule parameter has been dropped so reuse is always on with the default kernel command line. State machine and lifetime invariants verified ing16/{engine,poll,pools,recovery,sleep}.rs:- Adds no extra
Arc<PbEpoch>references beyond the existingownersslot lease (binds: [u64; 2]+keep: [bool; 2]). Pools::reusable()requireskeep[k],Arc::ptr_eq(&owner._vm, vm), andowner.exposed(Acquire).Pools::bind(k, false)incrementsbinds[k]and clearskeep[k]immediately, so a deferred (EAGAIN) or failed fresh binding conservatively forces a fresh InitBM next time; a deferred reused binding leaves the retired epoch untouched and safely reusable.Pools::retire_epoch()checksbinds[k] == bindingundersizes::FLIGHTS == 1and clearskeep[k]whenresult.is_err(); aborted receipts callPools::forget(k).- Both
Firmware::recover()(recovery.rs) andFirmware::sleep_restart()(sleep.rs) callPools::invalidate(), bumpingbindsand clearingkeepso post-recovery and post-deep-sleep renders start fresh with InitBM.
- Adds no extra
- §3 Safety: PASS. No safety bounds weakened; ownership/invalidation invariants are covered by the new host test in
test-resources.py. - §4 Clean-room & attribution: PASS. Commit
e5f348ef1f43carries human author/committer (Friedrich <261542475+aeries0x@users.noreply.github.com>) and a single humanSigned-off-by:with zero AI trailers (the priorAssisted-bycommit trailer was removed); PR body ends withAssisted-by:. - §5 Evidence: PASS. Strong same-machine A/B wins on J604 (
render.lighttri d1 1121→492 us, d8 984→312 us, glmark2 485→983, Hyprland Glassy 30–40→51–61 fps; re-verified on rebased head at 432/237 us withgpubench-stress --all12 pass / 0 fail / 5 skip and clean s2idle resume), independent J773g A/B (1351→740us d1,992→331us d8) with Vulkan CTS 1/16 (84,183 Pass / 0 Fail) and GLES/EGL (0 Fail), J616s no-regression (0 GPU/DART faults, 0 AVC), and green live CIhost-testsone5f348ef1f43. (Minor non-blocking note: the PR body still mentions05032b14abf9in two places instead of the pushed heade5f348ef1f43.) - §6 Naming: PASS.
No blockers found; ready for MERGETRAIN-LINUX4.
Assisted-by: LLM (Gemini 4 Neon)
|
Merge readiness at
Areas: Updated by pr-readiness on every push, edit and review, and every 30 minutes. Rules: merge policy · labels. |
Summary
Every G16 render gets a fresh parameter buffer (PB) epoch at SUBMIT and an InitBM ahead of its TA work, so the firmware
rebuilds the allocator state for every render. Reusing the epoch instead cuts a small triangle render at queue depth 1
on a base M4 MacBook Pro (J604) from 1121 to 492 us (table below).
With this change, the next render of the same VM on a pass slot gets the slot's owner epoch (the lease
Poolsalreadykeeps until a replacement retires) without a reseed or InitBM, if that epoch's render retired normally and was exposed.
InitBM binds the device-wide pass slot to one epoch and VM, so the epoch is reused only while no other epoch was handed
to the slot since. Reusing it after another VM's render on the slot leads to a firmware recovery and a wedged GPU under
gpubench-stress
queue.exhaust(tested). After a failed or aborted render, after any firmware recovery (also one thatresumes and did not affect the render), and after a deep-sleep firmware restart (
sleep_restart()), the next render oneach slot starts fresh too. SUBMIT still allocates a fresh epoch for every render, so one is always at hand. Renders
are bound, published and retired one at a time, so whenever reuse is allowed the slot's owner is the epoch the slot is
bound to.
Apart from the in-flight render's handle (dropped when it retires or fails), nothing here holds a reference of its
own: a slot's binding is tracked by a counter, and the reused epoch is the owner lease itself, so no epoch, VM or
admission permit lives longer than it does without the change. A host test in
test-resources.pycovers when an epochmay be reused and that nothing but the owner lease holds it.
Reuse is always on (no module parameter). The
asahi-m4host harnessArcmock gainsptr_eq.Testing
Rebased onto
integration/aurora5441428d9033(tools/asahi/run-host-tests.pyin CI's Ubuntu 24.04 container:422/463 on this head and on the base,
asahi-m4pass, 0 regressions;drivers/gpu/drm/asahi/aurora.obuilds cleanwith
LLVM=1, 0 warnings in touched files). This revision drops theg16_pb_reusemodule parameter, removes thecommit
Assisted-bytrailer, and addsself.pools.invalidate()ing16/sleep.rs::sleep_restart().Exact head (
05032b14abf9) booted on the J604 (Mac16,1, GPU firmware 25G83,performanceprofile, desktop running):gpubench
render.lighttri 432 / 237 us/submit (depth 1 / 8),compute.lightdepth 1 291 us/submit,gpubench-stress --all12 pass / 0 fail / 5 skip,glmark2-es2-drmoff-screen 685; one s2idle cycle (~90 s, lid wake) resumed cleanlywith no GPU faults or recoveries (
render.light484-491 / 324-338 us after resume, GPU time unchanged at 22 us).The full A/B comparison below was measured on the previous revision (
cdb7d9c802fcon673f618425andc0a2a7522b4e,plus J616s and J773g rows in the comments) with
g16_pb_reuse=0vs=1(same reuse logic):J604 (Mac16,1), GPU firmware 25G83, the installed Aurora userland (Mesa
vulkan-aurora26.3.0 devel), unattended trialboots of
integration/aurora673f618 + the previous revision (g16_pb_reuse=0vs=1):gpubench core-a (Vulkan), no desktop session, power-profiles-daemon's
performanceprofile (Omarchy's choice onAC), median us per submit, two boots per setting (the second one is the error-path boot below):
g16_pb_reuse=0=1(default)render.light clear at depth 1 varies between boots by up to ~70 us with either setting; compute.light does not use a
PB.
--kernel-log): the same with 0 and 1: 11 pass, 5 skip (one queue, no sparseresidency, no ray query), and
queue.exhaustends in the graceful ENOMEM on submit (gpubench counts it as failedfor that kernel-log line). No firmware recovery or GPU fault.
life.churnand core-a withevery 97th completed render reported as failed to the reuse bookkeeping only (the job itself completes) and every
89th render deferred with EAGAIN after its slot was bound): 1699 injected failures and 86 deferred fresh bindings
were each followed by a fresh epoch with InitBM on that slot, never by a reuse; 1786 deferred reuses were retried.
No firmware recovery or GPU fault, stress results as without injection, the same with 0. A render held past the
5 s deadline is aborted the same way with 0 and 1 (firmware recovery, the render class stays unavailable until
reboot).
render class is marked failed);
recover()now also resets reuse on both slots there, but the render class staysunavailable afterwards, so no later render shows the effect. I found no recovery after which renders continue: a
compute dispatch past its deadline (with another client rendering) fail-stops the device without a firmware
recovery, the same on the previous revision. The reset itself (
Pools::invalidate) is covered by the host test.vm_bindingsin the debugfs stats around 20 short-livedlife.churnclients, measured the same way onthis commit with 0, with 1 and on the base: with the desktop session running it goes from 5 to 6 live (the slot's
owner lease) and stays there; without it, 1 is left afterwards. The same on all three.
wp_presentationframe pacing holds 120 fps in a window andfullscreen with both settings, also with blur at 2 passes. glmark2-es2-wayland scores 485 with 0 and 983 with 1,
with no faults.
tools/asahi/run-host-tests.pyin an Ubuntu 24.04 container with CI's toolchains: 422/463 on this head (05032b14abf9)and on the base (
5441428d9033),asahi-m4pass, no test failing only with this change.Tested: J604 (M4 MacBook Pro 14") at
e5f348ef1f43(same tree as05032b14abf9): gpubench render.light 432/237 us, gpubench-stress 12 pass / 0 fail, s2idle resume clean.Risk: two-way · G16 (M4 / T8132) Macs — plain revert restores per-render PB InitBM.