Skip to content

drm/asahi: g16: keep compute UMA managers bound and ASC-cached - #3695

Merged
DjDeveloperr merged 7 commits into
mainfrom
feat/g16-uma-slot-records
Dec 3, 2026
Merged

DjDeveloperr merged 7 commits into
mainfrom
feat/g16-uma-slot-records

Conversation

@DjDeveloperr

@DjDeveloperr DjDeveloperr commented Nov 30, 2026 •

Copy link
Copy Markdown
Contributor

What: Keep each VM's G16 compute UMA manager bound while it has compute in flight, and keep the manager records ASC-cached on their own pages. Light compute from separate processes no longer pays a firmware save and rebind after every job: compute.light procs d8 is 11 % faster and queue d64 is 11 % faster on J773g.

Tested: J773g (M4 mini) at 421240d7 on main (2 boots): compute.light procs d2/d8 −8.7/−10.2 %, queue d64 −10.6 %, CRCs 10/10, 0 faults. At e85c6d2e (4-boot ABBA): compute.light procs d2/d4/d8/d16 −5.9/−7.8/−11.0/−11.9 %, queues d8 −8.6 %, queue d64 −10.5 % against the same kernel without it (4-boot ABBA, every head boot faster on every compute row); render.light neutral; pinned CRCs 10/10 on every boot; 0 GPU faults, recoveries or quarantined owners. dEQP-VK compute groups (119,249 cases, 8 parallel processes) identical to base (first commit). J516s (M3 Pro) at e85c6d2e: procs d2 −3.0 %, procs d8 −5.9 %, queues d8 −9.8 %, queue d64 −14.7 % against main (4-boot ABBA), 40/40 CRCs, 0 GPU faults. Host tests 26/26 and checkpatch --strict clean at this head, including two new cases for the review fix: after a recovery aborts a shared or a private flight in a compute UMA slot, later compute jobs in that slot fail with EIO before any wait on the slot's ledger.

Risk: two-way · M4 (T8132) and M3 (T6030/T8122), which share the g16 backend

Not yet: J773g and J516s rows at the current head, together with #3699, which removes the cost of rebuilding after idle gaps. Since main's 34a6d434aeb9 the firmware may power the GPU off while idle on T8132 and T6030, so held managers rebuild after idle gaps on main too. The notes below that say the GPU is held powered on main are from before that. No row has a GPU recovery with innocent compute in flight, or a sleep cycle. T8122 (GPU held on) has no row.

Details

The firmware saves and unbinds a compute UMA manager whenever a command finishes with COMPLETED equal to the manager's counter. The host set the counter to the submission count, so a process with one job outstanding at a time (gpubench compute.light --mode procs) drained its manager after every job. It paid a save and a rebind each time, and every firmware access to the manager was uncached.

  • Each hardware compute UMA slot gets two device-lifetime manager records, ASC-cached on their own pages and never freed (1 MiB for all 32 slots, allocated on first use), matching how macOS 26B123 maps its compute managers. The host rewrites only a record the firmware's slot table cannot name, which is why a slot needs two.
  • The counter has its own uncached page. While the manager has commands in flight it runs one past the submissions, so the firmware keeps the manager bound; when the manager's last command retires it drops back to the submission count, and an idle counter equals COMPLETED.
  • Residency is tracked per physical slot. A manager that returns after another manager used its slot is rebuilt (cursors, COMPLETED, freelist and pool rows reseeded); the same manager coming back keeps its record with no host write. Private SCS descriptors that use the same slots take part in this tracking. A residency generation, bumped on recovery and system sleep, forces a rebuild.
  • GPU power: while the boot policy holds the GPU powered (the final boot control's argument, zero on main), a held manager can't lose its binding while idle and is reused. When the policy lets the firmware power the GPU off on its own while idle, there is no qualified power-loss witness yet, so every publication made with nothing in flight and a shared manager held bumps the generation and rebuilds (about 14 µs). The powered byte is not used: on G15S it reads 0 while the GPU is on.
  • A closed VM releases its manager, pool and admission charge when its last flight retires, as before; the per-slot ledger holds only IDs and counts.
  • A flight a recovery aborts never retires, so its commands stay counted in its slot's ledger. A job naming a quarantined slot fails with EIO at the top of publication, before it waits on that ledger, as on main.
  • Retirement reads uncached stamps only, never the cached manager.

No parameters, no SoC gates. The +1 hold is the firmware's own "one command outstanding" and is reserved with checked_add.

Evidence

J773g (M4 mini, T8132, G16G, 26B123 firmware, SLC on both planes), kernel built from linux main 42169a04154695428ae092e981bf88c936c7fe2c (release 7.3.0-ARCH-m4kmain-42169a04), aurora.ko from that tree with and without this change. The 17 main commits between 42169a04 and this branch's base e6c7b032 change no file under drivers/gpu/drm/asahi or its tests, so the tested driver source is the same as this head's. gpubench-vk ae90a40, Borealis Mesa 5e89c89ce5, 300 ms warmup, 5 × 250 ms windows, two passes per boot; boot order main, change, change, main; median µs per submission (lower is better).

Row main this change Δ Metal (macOS 26B123)
compute.light procs d2 62.99 57.77 −8.3 % 64.67
compute.light procs d4 47.22 43.18 −8.6 % 39.60
compute.light procs d8 41.37 36.69 −11.3 % 34.05
compute.light procs d16 40.72 35.85 −12.0 % 32.38
compute.light queues d2 61.85 57.61 −6.9 % 77.76
compute.light queues d4 42.05 39.06 −7.1 % 37.68
compute.light queues d8 32.34 29.25 −9.5 % 31.79
compute.light queue d64 22.86 20.50 −10.3 % 21.46
render.light procs d8 73.66 72.45 −1.6 %
render.light queues d8 67.22 67.02 −0.3 %
idle.wake (gap 2 / 20 / 200 ms) 164 / 198 / 277 145 / 195 / 267 faster
sync.signal host 164.31 160.15 −2.5 % 156.00

Every boot of the change is faster than every boot of main on every compute row (worst change boot vs best main boot: −4.5 % to −9.4 %).

Correctness on every boot: pinned-CRC smoke, two passes (compute.uber uniform d4 b022fbaf, render.postfx msaa=4 d1/d2 668d6f0a, render.bindless_ubo 512 d2 1af53d5c, render.deferred tile msaa=4 d2 6dc74b48): 10/10 on all four boots. 0 GPU faults, recoveries, hang kills or quarantined owners. dEQP-VK compute, spirv_assembly.instruction.compute, ssbo, memory_model and glsl.atomic_operations (119,249 cases, 8 parallel processes, so 8 VMs cycling through the UMA slots) with this change: 36,794 Pass, 0 Fail, 82,455 NotSupported, the same as main; 0 recoveries.

The rebuild after a GPU power-down is covered by the host tests only: on this kernel the GPU power state never reaches off between jobs (a physical PMGR read after each fence stayed on through 16 waits of ~250 ms), so the idle.wake rows don't exercise it.

Host, at this head: all 26 tools/testing/selftests/drivers/gpu/asahi-m4 scripts pass (496 Rust cases, one test thread). New cases cover a manager that returns after another manager used its slot (freelist and pool rows reseeded), the same manager returning with no host write, shared → private SCS → shared on one slot, residency invalidation, mixed shared/private retirement out of order, 12 create/use/close cycles on one file against the 8-VM limit, and a shared or a private flight aborted in a slot, after which later compute jobs naming that slot fail with EIO before they wait on its ledger (both cases fail on the previous head). scripts/checkpatch.pl --strict: 0 errors, 0 warnings, 0 checks. The module builds with no new warnings.

A VM's shared compute UMA manager lived in a per-VM ASC-uncached
object next to its host-written counter. The firmware saves and
unbinds a manager whenever a command finishes with COMPLETED equal to
the counter. A client with one job at a time (8 processes in
compute.light procs) paid a save and a rebind on every job, with
every access to the manager uncached.

Map the managers as macOS 26B123 does. In the J773g Metal procs-d8
snapshot, each of the 8 compute managers
sits alone on its own page with leaf 0x443 (ASC write-back), each
counter is on a separate page, and an idle manager's counter equals
COMPLETED.

- Each hardware compute UMA slot gets two device-lifetime manager
  records, ASC-cached on their own pages and never freed: 1 MiB for
  all 32 slots, allocated on a slot's first use. The host rewrites
  only a record that the firmware's slot table cannot name, so each
  slot needs a second record.
- The counter stays on an uncached page of its own. While the
  manager has commands in flight it runs one past the submissions,
  so the firmware never saves the manager. When the manager's last
  command retires, the counter drops back to the submission count.
  An idle manager stays bound with its cursors in the hardware, and
  its counter equals COMPLETED, as on macOS.
- The firmware's bind loads only the incoming record and never saves
  the outgoing manager. In 26B123, the save runs only past the
  COMPLETED == *counter gate. So the host tracks which manager each
  slot holds:
  - The same manager keeps its record, with no host write.
  - Any other return waits for the manager's own commands to retire.
    That covers another VM's manager or a private SCS unit taking
    the slot, an idle power-down, a sleep and a recovery. The host
    then rebuilds a record the slot table does not name, and reseeds
    the drained freelist and pool rows with it.
  - A private unit waits for shared commands in its slot.
- The slot ledger keeps only identities and counts. As before, a
  closed VM's manager, pool and live-VM charge go when its last
  flight retires.
- The host never reads the cached manager. Retirement uses two
  receipts: the service stamp, which the firmware stores after its
  last access to the command's work, microsequence and manager; and
  the GPU end tick.

The firmware powers the GPU down after an idle delay, and that drops
the hardware state of a manager left bound. The host checks for this
only at a publication pass where it has nothing in flight and a
shared manager may be bound. It reads the firmware's powered flag,
which 26B123 and the T6030 firmware record, and treats every binding
as stale unless the flag shows the GPU powered. Firmware without the
flag keeps the GPU powered while it runs. Passes with work in flight
and render-only work read nothing.

Signed-off-by: DjDeveloperr <hey@djdev.me>
@DjDeveloperr
DjDeveloperr requested review from a team as code owners November 30, 2026 12:32
@github-actions github-actions Bot added 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-hw-row No hardware row at the PR head (bot) needs-review No approving review from Core or Omarchy Mac yet (bot) labels Nov 30, 2026
@github-actions

github-actions Bot commented Nov 30, 2026 •

Copy link
Copy Markdown

Merge readiness at bc7b1395: not ready yet

Check Detail
CI at head no failing: host-tests
Review ok approved by RyanTheTide
Requested changes ok none
Hardware row at head ok comment at bc7b1395
Conflicts ok none
PR text ok Risk: two-way · M4 (T8132) and M3 (T6030/T8122), which share the g16 backend

Areas: area:gpu

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

@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: HOLD at ebc3b149 — G16 compute UMA residency/double-buffered ASC-cached record design and host tests are solid, but there is a f.group fence-hang bug on error in poll.rs, plus queued CI and missing M3 regression / exact-head hardware row.

Blockers:

  • drivers/gpu/drm/asahi/g16/poll.rs (retire_oldest): in the new if let Some(Err(error)) = released block after shared.counter.w64(...), f.job is retained and completed before self.fail_stop(error, done) and core::mem::forget(f), but folded compute horizon jobs in f.group are skipped. Because compute horizon folding (engine.rs:2929-2952) folds same-queue compute jobs into f.group and f was already removed from self.engine.flights, skipping for j2 in f.group.iter() { self.retain(j2); complete(done, j2, Err(error)); } leaks folded jobs with permanently unsignalled DMA fences (matching the sibling fail_stop paths immediately above and below in retire_oldest).
  • Hosted CI at ebc3b149 is still QUEUED (apple-build, host-tests, and 16 KUnit suites).
  • Missing second-family / exact-head hardware row (needs-hw-row, blast:m3, blast:m4): PR notes J516s (M3 Pro, which shares the G16 backend) is not yet run, and the J773g 4-boot ABBA / dEQP-VK run was built on 42169a04 (needs an exact-head SHA row or maintainer hwok + M3 regression row).

Checked:

  • Double-buffered per-slot device-lifetime Class::FwCoherent manager records (PersistentUmaRecords in resources.rs, UMA_RECORDS = 2): never dropped while firmware's slot table may still reference them, partial-failure retry preserves already-mapped records, and bind_compute_uma() only writes to the record not currently named by uma_bound[slot].
  • In-flight +1 hold accounting (prefix_compute reserves submitted.checked_add(1) before publication, publication stores tail_sub.saturating_add(1), clean retirement drops *counter back to submitted only when outstanding drains to 0).
  • Shared vs private (SCS) slot serialization (compute_uma_private_ready(), uma_shared_flights / uma_private_flights bitmask per flight, uma_bound / uma_live displacement, invalidate_compute_uma() across recovery, warm sleep restart, and idle power-down check).
  • Quarantine/abort invariance: Slots::quarantine() already quarantines uma_quarantined per hardware UMA slot and retains quarantined_shared_uma[slot], so aborted flights never re-enter clean accounting.
  • Closed-VM lifetime: per-slot residency ledger stores only id/rec/gen and flight counts (no Arc<SharedComputeUma>), verified by closed_vms_release_admission_after_retirement.
Evidence
  • Verified engine.rs:2929-2952 pushes folded same-queue compute jobs onto f.group, and verified every other fail_stop path in poll.rs:1555-1563, 1590-1598, 1609-1617, and 1634-1636 loops for j2 in f.group.iter() { self.retain(j2); complete(done, j2, Err(error)); }.
  • Non-blocking note for future GPU idle power-gating: Session::may_be_powered_down() reads the handoff powered byte without holding lock_m4_handoff(). Once GPU idle power-gating is enabled, a TOCTOU window exists if the firmware powers the GPU down between note_gpu_idle_if_any() reading powered != 0 and the next doorbell waking it (leaving a bound shared manager trusting lost hardware allocator state). Worth hardening with a monotonic firmware power-cycle counter or handoff-lock coordination when GPU idle power-gating lands.

On J516s (T6030) the compute UMA idle check invalidated the held
managers at nearly every publication from an empty engine. The G15S
handoff byte at +0x638 does not read nonzero there while the GPU is
powered, so each such job rebuilt its manager record and reseeded its
64 KiB freelist. compute.light procs d2 went from 43.6 to 56.6 us. The
driver stats show the cost: about 5 us more prefix time per
publication, and 14 us more for each publication after the engine
drained. On J773g the byte reads 1 while the GPU is powered, so J773g
was not affected.

Trust the flag only after it has read nonzero at a publication pass
with nothing in flight. The GPU is then idle and powered, and only a
flag that tracks GPU power shows that. A flag that stays zero, or one
set only while work runs, never earns trust and invalidates nothing,
as on firmware without the flag. Bindings on such firmware rely on the
GPU staying powered while the firmware runs, which holds on J516s and
J773g today, and on the invalidation at system sleep and recovery. A
change that makes such firmware power the GPU down must first make the
flag earn trust.

Report the residency in aurora-g16/stats as
"compute_uma: rebuilds N invalidations M powered_flag 0|1".

Signed-off-by: DjDeveloperr <hey@djdev.me>
The error path after the compute UMA counter write-back completed only
the flight's own job with the error. Compute jobs folded into the
flight's group were left with fences that never signal. Complete them
with the error like the other fail-stop paths in retire_oldest.

Signed-off-by: DjDeveloperr <hey@djdev.me>

@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: HOLD at 11b31056 — prior poll.rs f.group error-path blocker is cleanly fixed and the new powered_flag_proven guard + stats look solid; awaiting hosted CI completion and exact-head M3/M4 hardware rows.

Blockers:

  • Hosted CI at 11b31056 is still QUEUED (apple-build, host-tests, and 16 KUnit suites).
  • Hardware rows (needs-hw-row, blast:m3, blast:m4): awaiting exact-head 11b31056 J773g/J516s rows (or maintainer hwok carry-forward once J516s M3 Pro verification is recorded).

Checked:

  • 11b31056 (drivers/gpu/drm/asahi/g16/poll.rs): adds for j2 in f.group.iter() { self.retain(j2); complete(done, j2, Err(error)); } before self.fail_stop(error, done) and core::mem::forget(f) in retire_oldest(), matching the sibling fail_stop paths and closing the folded-compute fence-hang bug.
  • bb0df446 (boot.rs, engine.rs, slots.rs, poll.rs, test-publication.py, test-resources.py):
    • Session::powered_flag() returns Option<bool> (None when adt.layout.powered is absent; Some(nonzero) otherwise), and note_gpu_idle_if_any() sets powered_flag_proven = true only after seeing Some(true) with an empty flights queue and held manager — preventing spurious invalidations/rebuilds on G15S/T6030 where the handoff byte stays zero while powered, while still invalidating on Some(false) once proven.
    • SlotStats adds saturating uma_rebuilds and uma_invalidations counters exposed in debugfs alongside powered_flag, covered by updated test-publication.py and test-resources.py host tests.
Evidence
  • Verified full interdiff ebc3b149..11b31056 across all 6 touched files (boot.rs, engine.rs, poll.rs, slots.rs, test-publication.py, test-resources.py).
  • MERGEABLE against main; pr-text and readiness passed; remaining 18 hosted CI checks QUEUED.

… power off

Compute UMA managers stay bound across short idle gaps under the
in-flight hold, so their allocator cursors live only in the hardware,
and a GPU power-off drops them. The previous check trusted the
firmware's powered byte once it had read nonzero at idle. That byte is
not a validated witness of continuous power: it reads zero on G15S, so
nothing was ever invalidated there, and a byte seen high once does not
prove that the GPU stayed powered.

Decide from the power policy that boot actually sends instead. The
session records it with the final boot control. START with a zero
argument asks the firmware to wake the GPU and hold it powered, and the
firmware then never powers the GPU off on its own while idle (measured
on main: 0 of 16 checks off at 250 ms on J773g and J516s). Under that
hold a bound manager cannot be lost while idle, so nothing is
invalidated and the managers keep their fast reuse. System sleep and
recovery still invalidate, as before.

When a policy lets the firmware power the GPU off on its own, there is
no qualified power-loss witness yet (a firmware power-loss generation,
or a power hold that spans this check through the firmware's
consumption of the next kick). So every publication pass that finds
nothing in flight after retiring what it can, with a shared manager
held, invalidates the held managers. Their next commands rebuild into
the slot record that the firmware's slot table does not name. A pass
with work in flight invalidates nothing, because a flight in flight
keeps the GPU busy. A later change can replace this with a qualified
witness.

The change that releases the power hold must set the flag where it
sends that policy. The flag is set next to the START control, so such
a change conflicts with this one visibly instead of silently.

Drop the powered-byte heuristic and its stat. The stats line becomes
"compute_uma: rebuilds N invalidations M idle_invalidations K".

Signed-off-by: DjDeveloperr <hey@djdev.me>
@github-actions github-actions Bot removed the needs-hw-row No hardware row at the PR head (bot) label Nov 30, 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: HOLD at e85c6d2

Blockers: Hosted build, host and KUnit jobs are queued. Keep the combined idle-power-off landing with #3697 held for the wake-cost fix and the J516s paired regression.

Checked: The idle decision follows the boot policy. The author posted J773g and J516s passes with matching CRCs and zero GPU faults at this head. The J773g #3697 pairing passed 16/16 power-off cycles and its checked wake stress, with about 75 µs added per wake. That wake cost is specific to the combined policy.

@DjDeveloperr

DjDeveloperr commented Nov 30, 2026 •

Copy link
Copy Markdown
Contributor Author

PASS — J773g (M4 mini, T8132 G16G) target row at 421240d70a4adc382be29c6ba8aceab1a8d90e57 (after the quarantined-slot fix). Every compute row is faster than main, and outputs match.

  • Kernel and module: main 42169a04, with aurora.ko built from this head's driver.
  • Run: boot order main, head; two passes per boot; same setup as below.
Row main 421240d7 Δ
compute.light procs d2 / d4 / d8 / d16 64.00 / 47.40 / 41.67 / 40.92 58.41 / 43.69 / 37.40 / 36.44 −8.7 / −7.8 / −10.2 / −10.9 %
compute.light queues d2 / d4 / d8 62.29 / 42.38 / 32.46 58.46 / 40.01 / 29.78 −6.1 / −5.6 / −8.3 %
compute.light queue d64 22.77 20.36 −10.6 %
idle.wake (gaps 2/20/200 ms combined) 198.37 193.99 −2.2 %
sync.signal host 163.69 158.99 −2.9 %
render.light procs d8 / queues d8 73.04 / 66.47 73.18 / 67.56 +0.2 / +1.6 % (neutral; the e85c6d2e ABBA below showed them overlapping)
  • CRC smoke: pinned CRCs 10/10 on both boots.
  • Faults: 0 GPU faults, recoveries, hang kills or quarantined owners.
  • UMA counters: compute_uma: rebuilds 76 invalidations 0 idle_invalidations 0.

The earlier rows below are at e85c6d2e and still describe the change. 421240d7 adds only the quarantined-slot check before the UMA wait, with host tests.


PASS — J773g (M4 mini, T8132 G16G) target row at e85c6d2ee6a01cea0693061fb59d43ec19a48403. Every compute row is faster than main on every boot, outputs match, and there are no GPU faults.

PASS — J516s (M3 Pro, T6030 G15S) second-generation row at e85c6d2ee6a01cea0693061fb59d43ec19a48403. Every compute row is faster than main; the procs d2 regression of the first version is gone.

J773g

  • Kernel: main 42169a04 (same drivers/gpu/drm/asahi as this branch's base e6c7b032), with aurora.ko built from this head's driver.
  • Setup: SLC on both planes, Borealis Mesa 5e89c89ce5, gpubench-vk ae90a40, 300 ms warmup, 5 × 250 ms, two passes per boot.
  • Boot order: main, head, head, main.
  • Values: median µs per submission.
Row main this head Δ every head boot faster than every main boot
compute.light procs d2 61.76 58.11 −5.9 % yes
compute.light procs d4 46.85 43.22 −7.8 % yes
compute.light procs d8 41.24 36.71 −11.0 % yes
compute.light procs d16 40.63 35.78 −11.9 % yes
compute.light queues d2 / d4 / d8 61.49 / 41.86 / 32.23 57.67 / 38.85 / 29.46 −6.2 / −7.2 / −8.6 % yes
compute.light queue d64 22.63 20.25 −10.5 % yes
idle.wake gap 2 / 20 / 200 ms 154 / 198 / 279 150 / 192 / 265 −3 to −5 % yes
sync.signal host 163.62 158.26 −3.3 % yes
render.light procs d8 / queues d8 73.42 / 67.22 72.87 / 66.08 −0.8 / −1.7 % overlaps (neutral)
  • Correctness: the pinned-CRC smoke matched 10/10 on all four boots (compute.uber uniform d4 b022fbaf, render.postfx msaa=4 d1/d2 668d6f0a, render.bindless_ubo 512 d2 1af53d5c, render.deferred tile msaa=4 d2 6dc74b48).
  • Health: 0 GPU faults, recoveries, hang kills or quarantined owners.
  • Counters: compute_uma: rebuilds 76 invalidations 0 idle_invalidations 0 (main holds GPU power, so the last commit never fires).

J516s (M3 lead)

Three-way, then final head. Each boot set ran on the same J516s config with exact-SHA native builds; values are boot medians in µs.

Row main e6c7b032 first version ebc3b149 11b31056 main (final-head run) this head e85c6d2e
procs d2 43.17 57.59 (+33 %) 42.44 43.88 42.58 (−3.0 %)
procs d8 25.91 27.80 24.70 25.96 24.42
queues d8 24.90 25.74 22.83 25.04 22.59
queue d64 16.62 16.28 15.27 16.63 14.18

The first version's procs d2 regression:

  • Cause: that version invalidated held managers whenever the GPU's powered byte read 0 at an idle pass. On G15S that byte reads 0 while the GPU is on (4,492 jobs checked), so it rebuilt a manager (about 14 µs) on almost every job.
  • Fix: the current head drops that byte entirely.
  • Result: both final-head boots are faster than both main boots on every row.

J516s correctness and health: 40/40 timing rows and 40/40 CRCs; 0 faults, recoveries, hang kills or quarantined owners; idle_invalidations 0.

With #3697 (GPU idle power-off)

When the boot policy lets the firmware power the GPU off by itself, this head rebuilds a held manager at every publication made with nothing in flight. There is not yet a qualified power-loss witness.

J773g ABBA, #3697 98d103b8 alone vs the combined tree (lab/g16-uma-3695-on-3697 e0efb60a):

  • Safety holds: the GPU powered off 16/16 at about 42 ms; the idle.wake stress (render plus a checked compute ring across 2/20/200 ms gaps) passed 788–872 checks with 0 errors; CRC 10/10; 0 faults; about 151k idle invalidations per boot.
  • Gains: procs d8 −12.3 %, queue d64 −8.6 %, sync queues −11.7 %.
  • Cost of the rebuild: procs d2 +7.2 %, queue d1 +6.5 %, idle.wake 2/20/200 ms +21/+39/+17 % (about +75 µs per wake).

That wake cost blocks the combined landing until it is bounded. Variants that skip the freelist reseed, or skip the invalidation, are queued on J773g. The J516s run of the same pairing is pending. Neither affects this PR on main, where GPU power is held.

@DjDeveloperr

Copy link
Copy Markdown
Contributor Author

Review at e85c6d2e: one error-path bug to fix before merge. The fast path itself looks right.

Blocker: after a GPU recovery aborts a compute flight, a later compute job can stall publication and then fail-stop the whole GPU. On main, the same job fails alone with EIO.

  • An aborted flight never goes through retire_compute_uma / retire_private_uma: drivers/gpu/drm/asahi/g16/poll.rs:1655 quarantines it instead. Its counts therefore stay in uma_shared_flights[slot], uma_private_flights[slot] and the manager's outstanding for good. The comment at slots.rs:2095 relies on "no shared or private command publishes in a quarantined slot again".
  • That guarantee comes from compute_uma_quarantined at engine.rs:3325. It runs after prefix_compute, and prefix_compute now waits on those stuck counts first:
    • engine.rs:3620: a private (SCS) command whose unit's UMA slot was quarantined by an aborted shared flight sees compute_uma_private_ready() == false forever. An existing SCS set is reused without checking the UMA quarantine (resources.rs:1533). pick_scs_compute_slots also prefers units 0 and 1, so every SCS VM on that slot hits this, including new submissions.
    • engine.rs:3593 → slots.rs:2034: a shared manager in a slot where a private flight was aborted, with a job prepared before the quarantine. The recovery bumped the generation, so the job skips the fast path and waits on uma_private_flights[slot] != 0 forever.
  • Both return EAGAIN with slot_wait. Once nothing else is in flight, the idle EAGAIN path reaches the publication deadline and returns ETIMEDOUT (engine.rs:1314). poll.rs:325 then fail-stops the device for every client (or the job waits forever when g16_deadline_ms is 0).

Example: VM X's shared manager is in UMA slot 0, and its compute job faults on unit 5. The recovery aborts that flight and quarantines unit 5 and UMA slot 0. From then on, any SCS compute job on unit 0 waits until the deadline, and the GPU fail-stops.

Fix: check the quarantine before waiting on the ledger. The smallest change is to move the engine.rs:3325 check to the top of publish_prefix_body for compute, right after the compute_exhausted() check at engine.rs:2689:

if !render && self.slots.compute_uma_quarantined(job.resources.compute_uma_mask()) {
    return Err(EIO);
}

Alternatively, add the same compute_uma_quarantined(1 << slot) check just before bind_compute_uma and before compute_uma_private_ready in prefix_compute. Either way you get main's behaviour back: the job fails with EIO before anything is visible. A host test in test-resources.py would cover it:

  1. Publish a shared command in slot s and quarantine it instead of retiring it.
  2. Check that a private command in slot s gets EIO, not EAGAIN.
  3. Check that a shared manager in slot s gets EIO after invalidate_compute_uma, not EAGAIN.

Checked, fine:

  • Each attempt starts from a fresh Flight and fresh claims (engine.rs:2627). A record rebuilt for an attempt that then waits is rebuilt again on the next attempt. Another VM can't run in the slot at the same time, because compute_uma_conflict is checked before publish_prefix.
  • Each slot has two records, and the host rewrites only the one the slot table doesn't name. Reusing the same manager writes nothing. A rebuild reseeds the freelist and pool rows only while the manager has nothing in flight.
  • In-flight hold: prefix_compute reserves the +1 with checked_add. The counter drops back to the submissions only when outstanding reaches 0. The write-error path now fails folded jobs too.
  • Closed VMs: the ledger keeps only IDs and counts. The records are device-lifetime, and the counter lease works as before.
  • Recovery (recovery.rs:600) and sleep (sleep_restart, sleep.rs:66) invalidate. The idle invalidation follows the boot power policy and does nothing on main, because idle_power_off is set false next to START. There is no module parameter and no SoC gate.
  • checkpatch.pl --strict is clean on all four commits.

Other gates: apple-build, host-tests and every KUnit job, including KUnit asahi, are still queued at this head. The merge also needs an approval from an account other than the pusher.

A recovery quarantines an aborted flight instead of retiring it, so its
commands stay counted in the compute UMA ledger of its slot for good:
uma_shared_flights, uma_private_flights and the manager's outstanding
count. prefix_compute waits on those counts before publish_prefix_body
checks the slot quarantine. An SCS command in a slot where a shared
flight was aborted, and a shared manager rebuilding in a slot where a
private flight was aborted, both returned EAGAIN forever. With nothing
else in flight the publication deadline then expired with ETIMEDOUT and
the whole GPU fail-stopped, where the job alone used to fail with EIO.

Check the quarantine with the other admission checks at the top of
publish_prefix_body, before any wait. A job's UMA mask is fixed when it
is prepared and nothing in between changes the quarantine, so a job in a
healthy slot takes the same path as before.

The host tests run those admission checks over the real slot ledger
after a shared and after a private flight is aborted in a slot.

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 Nov 30, 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: HOLD at 421240d7

Blockers:

  • Hosted CI at 421240d7 is still running (apple-build, host-tests, KUnit, etc.).
  • Exact-head hardware row at 421240d7 is pending (prior J773g and J516s rows were captured at e85c6d2e).

Checked:

  • drivers/gpu/drm/asahi/g16/engine.rs, drivers/gpu/drm/asahi/g16/slots.rs: verified 421240d7 moves self.slots.compute_uma_quarantined(job.resources.compute_uma_mask()) to the top of publish_prefix_body() before wait_compute_stamps_for(), choose_compute_pipe(), and prefix_compute(), matching f.compute_uma_mask (engine.rs:3320-3324) and returning Err(EIO) immediately rather than spinning EAGAIN on aborted-flight ledger counts until publication timeout.
  • tools/testing/selftests/drivers/gpu/asahi-m4/test-resources.py, test-publication.py: verified both new quarantine admission tests (aborted_shared_flight_fails_later_compute_in_its_slot, aborted_private_flight_fails_later_shared_jobs_in_its_slot) and static ordering assertions against publish_prefix_body().
Evidence
  • compute_uma_mask() (drivers/gpu/drm/asahi/g16/resources.rs:1967-1973) is fixed at preparation time (1 << uma.uma_slot_idx for shared UMA or compute_slot_mask() for private SCS) and equals f.compute_uma_mask, so checking it up front preserves behavior on healthy slots while preventing a quarantined slot from stalling publication.
  • Code is ready once hosted CI passes and exact-head hardware confirmation at 421240d7 is posted.

@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: HOLD at 421240d

Blockers: Hosted CI and hardware evidence for the updated head remain. The paired idle-power-off landing still needs its wake-cost disposition and peer row.

Checked: The new admission check rejects quarantined compute slots before publication can wait on their ledger. The fixture exercises the early refusal in the resource paths. This addresses the earlier recovery-ordering finding in source.

DjDeveloperr added a commit that referenced this pull request Nov 30, 2026
Brings in "drm/asahi: g16: fail compute in a quarantined UMA slot before waiting". No conflicts.

Signed-off-by: DjDeveloperr <hey@djdev.me>
@github-actions github-actions Bot removed the needs-hw-row No hardware row at the PR head (bot) label Nov 30, 2026
@github-actions github-actions Bot removed ci-failing A check failed at the PR head (bot) merge-conflict Conflicts with the base branch (bot) labels Dec 2, 2026
@DjDeveloperr

Copy link
Copy Markdown
Contributor Author

J516s (MacBook Pro 16" M3 Pro, T6030, G15S B1) second-generation row at 1ad9df182a4a (merged onto main 105e3fbc6adc): PASS.

  • Kernel / module: 7.3.0-m3-gpu-g105e3fbc6adc with aurora.ko rebuilt from 1ad9df182a4a merged onto 105e3fbc6adc (SHA-256 0c3a9bcae9e2...), boot_id=31511810-3d26-4ce2-b5f3-e97ba47304c4, compared against same-kernel main 105e3fbc6adc (boot_id=3b704c79-537a-40e0-b39c-a89c5ec05ac9). Stock boot.bin, multi-user.target.
  • UMA cache counters: compute_uma: rebuilds 42 invalidations 0 idle_invalidations 0 across 499,233 compute commands.
  • gpubench-vk compute rows & CRCs (us_per_submit median, main 105e3fbc6adc -> #3695 1ad9df182a4a):
    • compute.light queue d32: 18.51 -> 15.87 µs (-14.3%), d64: 19.60 -> 17.45 µs (-11.0%).
    • compute.light procs d2: 49.29 -> 46.51 µs (-5.6%), d4: 32.54 -> 31.07 µs (-4.5%), d8: 28.80 -> 26.33 µs (-8.6%), d16: 29.41 -> 26.44 µs (-10.1%).
    • compute.light queues d2: 56.09 -> 54.04 µs (-3.7%), d4: 36.01 -> 31.51 µs (-12.5%), d8: 28.43 -> 25.29 µs (-11.0%).
    • compute.uber queue d4: 1363.64 -> 1363.64 µs (CRC 9963f56c valid); compute.heavy d1 1685.39 -> 1666.67 µs, d4 1470.59 -> 1470.59 µs; transfer.ops d4 86.71 -> 86.26 µs (CRC 55a4e6b1 valid).
    • Render smoke CRCs valid: render.postfx (4707efa8), render.bindless_ubo (57e7bedd), render.deferred msaa4 (5e4130ce).
  • CTS (dEQP-VK.compute.* smoke):
    • dEQP-VK.compute.pipeline.basic.*: 79 Pass, 2 NotSupported, 0 Fail.
    • dEQP-VK.compute.pipeline.indirect_dispatch.*: 24 Pass, 12 NotSupported, 0 Fail.
  • Faults / stats: compute_owners: retired 24 quarantined 0 reusable 16, compute: count 499233, jobs 500302, recoveries 0, hang_kills 0, health: failed 0 errno 0 degraded 0, 0 GPU faults, 0 kernel errors.

@DjDeveloperr

Copy link
Copy Markdown
Contributor Author

Verdict at 1ad9df182a4a: no code blockers. Not mergeable yet: it needs a J773g row at this head.

Blockers

Checked

  • The fix from the earlier review is still in place. publish_prefix_body() fails a compute job in a quarantined UMA slot with EIO before anything waits on the slot ledger. The early-error path in retire_oldest() also fails the folded jobs in f.group.
  • Residency. Each slot has two device-lifetime records, and the host writes only the one the slot table doesn't name. The +1 in-flight hold is reserved with checked_add and dropped back to the submission count when the manager drains. Recovery and sleep invalidate. The idle invalidation follows the boot power policy and does nothing on main.
Evidence
  • J516s PASS at this head (comment).
  • Hosted CI at this head: apple-build and host-tests passed. KUnit asahi is still queued.
  • A per-file patch-ID comparison of the driver diff at 421240d7 (base e6c7b032) and at this head (base a2cc412a) matches for every file except object.rs, where only context differs.

@DjDeveloperr

Copy link
Copy Markdown
Contributor Author

Since the 07:41 merge, main moved and this conflicts again in five files. One is a design conflict, not a merge-up. Main's 34a6d434aeb9 ("stop G15S in prepare and preserve firmware SRAM") now sends START with policy.words[1] = 1 on powered ADT layouts, so the firmware manages idle and may power the GPU off. This PR sends START with a zero argument so the GPU is held powered, which the held compute UMA managers rely on (Firmware::note_gpu_idle_if_any). The merge has to choose: keep main's policy and rely on this PR's idle invalidation path (uma_idle_invalidations), or keep the hold and make main's idle policy conditional. #3697 hits the same devctl_submit() call. The other four are adjacent edits: g16/engine.rs stats fields, g16/sleep.rs sleep_restart(held) versus this PR's comment, and the test-publication.py and test-stamp-wrap.py selftests. The J773g row the 13:00 verdict asks for should be taken after that merge, at the new head.

Main's "stop G15S in prepare and preserve firmware SRAM" sends START
with argument 1 on layouts that record the GPU's power, so the firmware
may power the GPU off while idle. This branch sent START with argument 0
and kept a flag saying so. Keep main's START: the flag becomes
Session::idle_power_off(), the same layout test that now picks START's
argument. Held compute UMA managers are then rebuilt after every idle
gap on those layouts, and stay bound across it where the firmware holds
the GPU powered.

The rest are adjacent edits: main's per-pair render statistics,
sleep_restart(held), and the queue_passed() and render-only mocks it
dropped. Keep both sides.

Signed-off-by: DjDeveloperr <hey@djdev.me>
@DjDeveloperr

Copy link
Copy Markdown
Contributor Author

Merged main (5fe340acef00) as bc7b1395c585, no rebase.

What main changed: 34a6d434aeb9 sends START with argument 1 on layouts that record the GPU's power (T8132 and T6030 on 27.2), so the firmware may power the GPU off while idle. This branch sent 0.

Rule: main's START is kept. Session::idle_power_off() is now the same layout.powered test that picks START's argument (boot.rs:542, boot.rs:915), so the two can't drift apart. T6030 sleep keeps what it relies on. T8122 still holds the GPU on.

Is the idle invalidation enough?

  • Gaps a publication pass can see: yes, from the code. submit_locked() (poll.rs:277) and poll_step() (poll.rs:721) retire finished work before they publish, and note_gpu_idle_if_any() (engine.rs:1199) then rebuilds every held manager if nothing is in flight. System sleep and recovery still invalidate.
  • Not covered: a host stall between that check and the doorbell that outlasts the firmware's idle delay (2 ms for the cores, about 42 ms in total). Main has the same kind of gap after its counter store.

Cost: held managers now rebuild after every idle gap on main too. The earlier rows with #3697 show what that costs without #3699 (J773g: queue d1 +6.5 %; J516s: queue d1 +54 %), so this should land together with #3699, which still merges cleanly onto this head. The body's "zero on main" notes no longer hold.

Checks: full host tests 1028/1028 in the pinned container. Arm64 W=1 of drivers/gpu/drm/asahi/ builds with no new warnings. checkpatch --strict is clean. Apart from boot.rs, the driver diff against main has the same changed lines as at 1ad9df18.

Not verified: no hardware run. Idle invalidation under main's policy without #3697 has never run on a Mac.

Rows owed at bc7b1395c585:

@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

@RyanTheTide RyanTheTide 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 bc7b139. Shared managers stay bound until replacement or invalidation, and submit checks the quarantined slot before waiting on its flight ledger. Clean retirement accounts for shared and private flights separately. The reported J516s and J773g rows establish the carried performance and correctness evidence at their recorded revisions.

@github-actions github-actions Bot removed the needs-review No approving review from Core or Omarchy Mac yet (bot) label Dec 3, 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: MERGE at bc7b139

Checked: START and runtime idle invalidation now use the same powered-layout condition. The T6030 sleep policy remains the base policy, and unpowered layouts retain their existing behavior. Both submit and poll retire work before invalidating idle managers. The author reports 1,028/1,028 host checks on this head.

Follow-ups: Land with #3699. The paired work removes the per-wake freelist rebuild cost measured on the earlier stack.

@RyanTheTide RyanTheTide closed this Dec 3, 2026
@RyanTheTide RyanTheTide reopened this Dec 3, 2026
@github-actions github-actions Bot added the ci-failing A check failed at the PR head (bot) label Dec 3, 2026
@DjDeveloperr

Copy link
Copy Markdown
Contributor Author

J773g (Apple M4 Mac mini, Mac16,10, T8132, G16G B0, os-fw 27.2, desktop graphical.target) isolated hardware row at head bc7b1395c585 (tested in compA = #3695 @ bc7b1395c585 + #3699 @ e8a8a9bcb43f on main @ d1ae4f292b93, without #3340): PASS.

Build & Arm Identification

  • Kernel: 7.3.0-j773g-g16ready+ (identical Image 6dc091cb2e5f and t8132-j773g.dtb d1d7f79109cf, aurora.ko swap only)
  • base1 (main @ d1ae4f292b93): aurora-base.ko sha256 7f9f82c970be, boot 97f7e550-4f58-4115-abf4-f66c6c3a30d0
  • compA (#3695 @ bc7b1395c585 + #3699 @ e8a8a9bcb43f): aurora-compA.ko sha256 494045488e3e, boot 5ea52891-ad28-4f3a-8b0a-16433a287f1a
  • ICD: system /usr/share/vulkan/icd.d/asahi_icd.aarch64.json, gpubench-vk --verify --warmup-ms 600 --runs 6 --run-ms 250 (2 passes), gpubench-stress-vk, deqp-vk, rtcwake -m freeze ×2.

Results (base1 -> compA)

  • All commands: 0 failures (compA.fail empty, compA.err clean — including both passes of compute.light [procs] d=16, isolating the VM_CREATE ENOSPC seen in the 3-PR composite exclusively to #3340).
  • Debugfs (aurora-g16/stats):
    • health: failed 0 errno 0 degraded 0, gpu_lines=0, warn=0
    • compute_owners: fresh 0 preparing 0 published 0 retired 24 quarantined 0 reusable 16 (matches base1 8 undisplaced retired leases)
    • vm_bindings: live 32 handles 11 (post-bench) / live 30 handles 11 (post-sleep), matching base1 (live 30 handles 9–11)
    • compute_uma: rebuilds 610876 invalidations 339296 idle_invalidations 339296 reseeds 11612 (98.1% rebuilds without reseed)
  • Compute latency medians (us_per_submit, lower is better):
    • compute.light [queue] d=1 / 4 / 16 / 32 / 64: 113.61 -> 103.35 (-9.0%) / 44.04 -> 40.35 (-8.4%) / 25.75 -> 23.20 (-9.9%) / 23.86 -> 21.50 (-9.9%) / 24.18 -> 21.73 (-10.1%)
    • compute.light [queues] d=2 / 4 / 8: 64.67 -> 59.89 (-7.4%) / 43.45 -> 40.00 (-7.9%) / 33.21 -> 30.32 (-8.7%)
    • compute.light [procs] d=2 / 4 / 8 / 16: 64.64 -> 60.52 (-6.4%) / 46.98 -> 43.92 (-6.5%) / 39.27 -> 34.80 (-11.4%) / 37.81 -> 32.92 (-12.9%)
    • sync.signal [queues] d=2: 26.06 -> 23.27 (-10.7%)
    • idle.wake gap_ms=2 / 20 / 200: 394.14 -> 388.08 (-1.5%) / 403.20 -> 391.06 (-3.0%) / 486.55 -> 464.31 (-4.6%)
    • compute.heavy / compute.uber / render.* / transfer.ops: flat to -3.0% (render.light d=64: 47.08 -> 45.69 (-3.0%), render.postfx d=2: 1048.22 -> 1048.22 (0.0%)).
  • CTS (deqp-vk): compute_pipeline 103/117 (0 fail), compute_sample 1210/6756 (0 fail), multi_queue_3w 105/2439 (0 fail) — identical pass/NS counts to base1.
  • Stress (gpubench-stress-vk idle.wake 20 s): idle 2328/2328 PASS (vs 1880 base), loaded 1940/1940 PASS (vs 1976 base), 0 errors.
  • s2idle (rtcwake -m freeze ×2): 2/2 PASS, post-sleep compute.light d=64 and render.postfx d=2 PASS, 0 kernel faults/warnings.

@github-actions github-actions Bot removed the needs-hw-row No hardware row at the PR head (bot) label Dec 3, 2026
DjDeveloperr added a commit that referenced this pull request Dec 3, 2026
…4-cached-uma

#3695 keeps the shared compute UMA managers in per-slot records and #3699
rebuilds drained ones. They replace this branch's ComputeUmaPool. The
widths, masks, client VA layout, the ASC-cached compute fw_stamp and its
recovery witness stay.

Signed-off-by: DjDeveloperr <hey@djdev.me>
DjDeveloperr added a commit that referenced this pull request Dec 3, 2026
…u64-cached-uma

Sixteen compute pipes keep up to sixteen exited clients' VMs bound, eight
more than main's pipes. Vulkan clients take one TTBAT slot each with this.
A LiveToken of #3695's host test takes the new field.

Signed-off-by: DjDeveloperr <hey@djdev.me>
@DjDeveloperr

Copy link
Copy Markdown
Contributor Author

J516s (MacBook Pro 16" M3 Pro, Mac15,7, T6030, G15S B1, macOS 27.2 / 26B123 stub, headless with display manager stopped) isolated hardware row at head bc7b1395c585 (tested in compA = #3695 @ bc7b1395c585 + #3699 @ e8a8a9bcb43f on main @ cff875630c61, without #3340): PASS.

Build & Arm Identification

  • Kernel: 7.3.0-m3-s2r-gcff875630c61 (identical Image and t6030-j516s.dtb, aurora.ko swap only)
  • base (main @ cff875630c61): aurora.ko sha256 e9fa74e14022, boot 0d966b1e-03ce-4617-9ad3-6579fa451c89
  • compA (#3695 @ bc7b1395c585 + #3699 @ e8a8a9bcb43f): aurora.ko sha256 581c913c72f5, boot 4a24a4d0-713c-49ed-bf60-1618aa3b32f4
  • gpubench-vk 1f05885 (--verify, 2 passes × 6 runs × 250 ms)

Results (base vs compA, median us_per_submit)

Workload base (us) compA (us) compA / base
compute.light queue d=1 102.43 99.98 0.976 (-2.4%)
compute.light queue d=4 25.73 24.67 0.959 (-4.1%)
compute.light queue d=16 17.88 15.73 0.880 (-12.0%)
compute.light queue d=32 20.44 16.15 0.790 (-21.0%)
compute.light queue d=64 24.22 20.04 0.827 (-17.3%)
compute.light queues d=2 / 4 / 8 55.56 / 35.78 / 26.30 50.50 / 33.39 / 24.33 -9.1% / -6.7% / -7.5%
compute.light procs d=2 / 4 / 8 / 16 54.94 / 33.00 / 27.91 / 27.57 52.59 / 32.59 / 25.78 / 25.91 -4.3% / -1.2% / -7.6% / -6.0%
sync.signal queues d=2 17.94 15.74 0.877 (-12.3%)
idle.wake gap_ms=2 / 20 / 200 413.09 / 514.10 / 517.17 414.19 / 513.28 / 511.58 +0.3% / -0.2% / -1.1%
compute.heavy alu d=1 / 4 542.04 / 367.78 536.48 / 367.65 -1.0% / 0.0%
compute.heavy bw d=1 / 4 4405.55 / 4166.67 4385.96 / 4184.32 -0.4% / +0.4%
compute.uber uniform d=4 125.08 125.06 1.000 (0.0%)
render.light queue d=1 / 16 / 64 110.99 / 39.26 / 34.15 123.33 / 39.44 / 34.44 +11.1% / +0.4% / +0.9%
render.light procs d=8 58.22 58.01 0.996 (-0.4%)
render.postfx msaa=4 1080p d=1 / 2 2941.18 / 2427.18 2941.18 / 2427.18 1.000 / 1.000
render.bindless_ubo d=2 442.93 443.27 1.001 (+0.1%)
render.deferred tile msaa=4 d=1 / 2 16666.67 / 16666.67 16666.67 / 16666.67 1.000 / 1.000
transfer.ops d=4 45.37 45.76 1.009 (+0.9%)

Stress, Sleep, CTS & Health

  • gpubench-vk --verify: 0 CRC/status failures across all runs on both arms.
  • gpubench-stress-vk --test idle.wake: idle PASS (2064 checks), all-CPU load PASS (1936 checks).
  • 40-process VM churn (5 × compute.light procs d=8): PASS.
  • s2idle across live compute.light procs d=4 + post-sleep compute.light d=64 and render.postfx d=2: 0 -> 2 PASS.
  • Vulkan CTS (0 failures, 0 diffs vs base):
    • compute_pipeline: 103/117 passed, 14 not supported, 0 failed
    • compute_sample: 1210/6756 passed, 5546 not supported, 0 failed
    • multi_queue_3w: 105/2439 passed, 2334 not supported, 0 failed
  • aurora-g16/stats (end of compA): health: failed 0 errno 0 degraded 0, recovery_receipts: affected_full 0 aborted 0, jobs 4601105 recoveries 0 hang_kills 0, compute_uma: rebuilds 1121036 invalidations 435543 idle_invalidations 435543 reseeds 1822, compute_owners: retired 24 quarantined 0 reusable 16, vm_bindings: live 22 handles 0.
  • Kernel logs: se61=0, gpu_lines=0, warn=0.

@DjDeveloperr

Copy link
Copy Markdown
Contributor Author

Local check of the merge with main, 2026-12-03.

Not run: the full host suite. Merging, then #3699.

@DjDeveloperr
DjDeveloperr merged commit f5bf8bf into main Dec 3, 2026
18 of 19 checks passed
@DjDeveloperr
DjDeveloperr deleted the feat/g16-uma-slot-records branch December 3, 2026 08:14
DjDeveloperr added a commit that referenced this pull request Dec 3, 2026
Conflict in g16/boot.rs: main (#3695) sends the last boot control from
Session::idle_power_off(), the same rule the compute UMA idle check
reads. Use that one rule for the control, the Globals word and the idle
delays, and drop this branch's separate Admitted::allow_idle copy of it.
test-publication.py checks the order of the merged code.

Signed-off-by: DjDeveloperr <hey@djdev.me>
DjDeveloperr added a commit to jgoyvaerts/linux that referenced this pull request Dec 3, 2026
…ng its pool

When a shared compute UMA manager's binding may be gone (it was
displaced, or the GPU may have powered off while idle), its next
command rebuilds its manager record. The rebuild also rewrote all 8192
freelist records (64 KiB of uncached writes) and the 16 pool-table
rows. When the firmware may power the GPU off on its own, every
publication with nothing in flight invalidates the held managers, so
nearly every job after an idle gap paid for that.

The freelist is a ring of 16384 records. The hardware takes pages at
the head cursor and returns them at the tail cursor, and both wrap at
the record count that bind loads with them. A rebuild restarts the
cursors at their seed: head 0, tail 8192. Taking a page only reads its
record; returning one writes the record at the tail. So after a
restart, returns fill the records from 8192 upwards, and none reaches
the first 8192 records before one has written the last record of the
ring. Until then the first 8192 records still hold the seed, every page
exactly once, and cursors at their seed describe the drained pool
exactly, wherever the hardware cursors were. Pages the hardware still
held when its cursors were lost do not matter: they are in the seed,
and with no command in flight no page is in use.

So the rebuild now reads two freelist records before it decides. The
last record reads zero until a return reaches it: the freelist is
zeroed when it is allocated, and a returned record holds a page
address. The first record still holds the first seed unless taking a
page wrote its record. If both hold, the rebuild writes only the
160-byte manager record and the 16 pool-row words. Otherwise it
reseeds the freelist as before and clears the last record, so that a
later rebuild can trust the seed again.

Some events do not show in the freelist. A system sleep, a recovery,
and a shared command that failed or was aborted advance a seed
generation in the slot ledger, and the next rebuild of every manager
then reseeds, whatever its freelist shows. Sleep and recovery call the
new restart_compute_uma(), which also invalidates the bindings; the
idle path still calls only invalidate_compute_uma().

On J773g, with aurora-silicon#3695 and aurora-silicon#3697 combined, skipping the reseed
unconditionally (idle invalidations unchanged, about 179k per boot)
measured:

  row                      as is         no reseed    no invalidation
  idle.wake 2/20/200 ms    175/272/539   145/193/458  142/192/458
  compute queue d1         121.5         99.1         101.2
  compute procs d2         67.9          59.0         58.3

That run passed the CRC smoke test 10/10 and the idle.wake stress with
checked compute, with the GPU physically off in 16 of 16 checks and no
faults. The reseed was the whole cost of the idle rebuild. This change
skips it only while the ring has not reached its end since the last
seed, which a run of short jobs between idle gaps never does.

The stats line gains the reseed count: "compute_uma: rebuilds N
invalidations M idle_invalidations K reseeds R".

Signed-off-by: DjDeveloperr <hey@djdev.me>
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) ci-failing A check failed at the PR head (bot) door:two-way Revertible or not, from Merge risk (bot)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants