Skip to content

drm/asahi: g16: lease a TA/FS render queue pair to each rendering VM - #3355

Merged
DjDeveloperr merged 8 commits into
mainfrom
perf/g16-render-pairs-on-3201
Dec 2, 2026
Merged

DjDeveloperr merged 8 commits into
mainfrom
perf/g16-render-pairs-on-3201

Conversation

@DjDeveloperr

@DjDeveloperr DjDeveloperr commented Nov 27, 2026 •

Copy link
Copy Markdown
Contributor

Stacked on #3370 (which is on #3353). The four implementation commits are followed by the merge of #3370 and two cleanup commits.

What: on the g16 backend, each VM that renders leases its own firmware TA/FS queue pair, the way compute already leases per-VM workqueues (62e450e). Renders of different VMs overlap again without sharing one queue.

  • Why:
  • macOS:
    • A hypervisor capture of Metal render.light procs with 2 and 4 processes, on macOS 26B123 on the J773g, shows every process with its own TA queue and FS queue, each with its own job-list entry.
    • All processes ring the same doorbell, and the firmware chooses among the queues.
    • This change gives each VM its own pair the same way, behind the same doorbells.

Design:

  1. Events through RenderRefs. A render's completion events travel in RenderRefs. Pair p uses TA 0x70 + 2p and FS 0x71 + 2p. Pair 0 keeps 0x70/0x71, so the render goldens don't change.
  2. Per-pair queue state, with one pair.
    • Graphs, stamps, targets, heads, registration, retirement, progress and recovery blame become per pair.
    • This commit sets RENDER_PAIRS = 1 and changes no behaviour.
  3. Displacement in publication order.
    • A PB slot or pass slot goes to another owner only after a render published after the owner's last render has retired.
    • This used to be "the last retirement observed", which only held while renders retired in order on one queue.
  4. Eight pairs, leased per VM.
    • Lease: a VM keeps its pair while any of its renders are in flight. Otherwise it takes its last pair if free, else the lowest free one.
    • Same-pair rule: two VMs' renders are never in flight on one pair at the same time. Admission and publication both check this; it's the linux#3201 rule.
    • Handoff: when every pair holds another VM's renders, the pair with the fewest passes in flight drains for the waiting VM while the others keep running.
    • Stage order: a render's first pass waits for the TA and FS of the newest render in flight on another pair. Renders reach the TA and FS engines in publication order across pairs, and one VM's TA still overlaps another VM's FS. The FINALIZE stamp orders each engine across pairs. Cross-VM data dependencies wait on host fences through producer retirement.
    • Unchanged: a render beside another VM's compute still drains, both ways, and so does any InitBM flight.
    • Firmware registration: pairs register with the firmware on their first record.
    • Stats: a render_pairs: line counts publications per pair and cross-pair overlaps.
  • With drm/asahi: g16: wait for the service stamp in cross-engine barriers #3370:
    • A compute's barrier on a render waits on the FS service stamp of the waited render's pair.
    • Retirement reads each pair's TA and FS service stamps through that pair's accessors.
    • Waits between processes never resolve in firmware: a fence from another VM, or one without a g16 origin, is waited on the host, and g16 job fences signal only at retirement on the service stamps.

Tested: J773g (M4 Mac mini, macOS 26B123 firmware), on a69f447171c8. Since that boot, a67f388a9ae4 clarifies stage order and cross-VM drains, removes an unused receipt helper, checks its two live components directly in the host fixture, and compiles a single-pipe convenience method only in tests. The executed driver paths are identical.

  • Cost against Metal: µs per submit, lower is better. Each kernel was measured on its own boot, median of 2 passes, with 0 GPU faults on every boot. Metal 4 values are native macOS 26B123.

    Row Base: drm/asahi: g16: keep renders of a multisampling VM apart from other VMs #3180 + drm/asahi: g16: drop the M4 TA wave window #3185 drm/asahi: g16: drain the engine before a render of another VM #3353 (+ drm/asahi: g16: wait for the service stamp in cross-engine barriers #3370) This PR Metal 4 Base / Metal drm/asahi: g16: drain the engine before a render of another VM #3353 / Metal This PR / Metal
    render.light procs d2 99.1 127.1 108.5 169.38 1.71× 1.33× 1.56×
    render.light procs d4 81.2 128.3 93.2 104.47 1.29× 0.81× 1.12×
    render.light procs d8 72.6 127.6 89.7 97.81 1.35× 0.77× 1.09×
    render.light procs d16 68.5 128.6 89.0 94.84 1.38× 0.74× 1.07×
    render.postfx 1080p msaa4 procs d1 766.3 757.6 766.6 no row
    render.postfx 1080p msaa4 procs d2 717.7 707.6 723.8 no row
    render.postfx 1080p msaa4 procs d4 1,967.2 1,941.8 735.7 no row
    render.light queue d4 (one process) 78.0 77.7 79.3 72.67 0.93× 0.94× 0.92×
    render.light queue d16 (one process) 58.3 57.2 58.4 48.29 0.83× 0.84× 0.83×
    • render.light procs is back above Metal at every depth.
    • postfx procs d4 is 2.6× faster than the base, because multisampled VMs no longer drain each other.
    • Single-process rows don't change.
    • All 8 pairs carried renders (publications 101,583 / 86,971 / 28,735 / 27,879 / 11,265 / 15,989 / 9,040 / 8,089), with 181,301 cross-pair overlaps and no cross-VM drain.
    • The base is faster than this PR from d4 on, but it is the shared-pair overlap that faults (linux#3201).
  • Correctness under CPU load, with 2 busy loops beside every list, one boot:

    List Workers Result
    dEQP-VK.synchronization*multi_queue* 3 8,538 pass, 0 fail
    dEQP-VK.synchronization*.cross_instance.* (two VMs, so cross-pair waits; 11,384 dma_buf cases) 2 20,008 pass, 0 fail
    api.copy_and_blit blit_image RGBA8/BGRA8 8 3,324 pass, 0 fail
    dEQP-VK.synchronization*.implicit.* 3 1,024 pass, 0 fail
    drm/asahi: g16: keep renders of a multisampling VM apart from other VMs #3180's MSAA hot list, 30 s 4 5,280 results, 0 non-pass

    0 GPU faults on the boot.

  • J516s (M3 Pro, G15S) on a69f447171c8, two passes with Mesa 69179743d9ae. Compared with drm/asahi: g16: wait for the service stamp in cross-engine barriers #3370, render.light procs d4 went from 119.9 to 66.7 µs and d16 from 126.5 to 61.5 µs. The 1440p MSAA1 postfx procs d4 row went from 2,547.8 to 1,290.3 µs. All eight render pairs carried work. The multi-queue, cross-instance and implicit synchronization lists recorded 29,484, 20,008 and 1,024 passes respectively, with zero failures.

  • Host: at a67f388a9ae4, all 26 asahi-m4 host selftest files passed. Strict checkpatch reported zero errors, warnings and checks on the complete diff against drm/asahi: g16: wait for the service stamp in cross-engine barriers #3370.

Risk: two-way · M4 and M3 Macs on the g16 backend.

  • Scope: render admission and publication on the g16 backend: M4, and the M3 parts on the 26B123 protocol.
  • Main unknowns:
    • Pairs 2–7 on the firmware. On the J773g they ran the rows above.
    • Cross-pair stage-order waits, which compute already does across pipes.

Not yet:

  • Long multi-process stress on the final J516s head.
  • A suspend/resume row on this head and a row on a second M4 chip.
  • The rest of the gap to the shared-pair overlap: 1.07–1.12× Metal against 1.29–1.38×.

The TA and FS work images, the scene's own-TA wait and the FS finalize
name the render queue's completion events. They were the literals 0x70
and 0x71 of the one TA/FS queue pair. Take them from RenderRefs::event
instead, filled from work::render_pair::events(pair), which gives pair p
the events 0x70 + 2p and 0x71 + 2p. The block 0x70..0x80 is bits 16..32
of type-1 event word 4, so it can name up to eight pairs.

Every render still uses pair 0, so the encoded images are byte-identical
and the render goldens are unchanged.

Signed-off-by: DjDeveloperr <hey@djdev.me>
Give the render side the structure the compute pipes got in 62e450e,
so later renders can use more than one firmware TA/FS queue pair.
RENDER_PAIRS stays 1 here, and every render still uses pair 0.

- Graphs::render holds RENDER_PAIRS render graphs. Each pair has its
  own TA and FS qinfo, qstate, work ring, job list, stamps, notifier
  page and threshold. sched_ctx is shared, and the context still
  registers once, through pair 0's TA queue.
- Pair p completes with events 0x70 + 2p and 0x71 + 2p.
  Events::drain decodes them from word 4. The stage cells (event times
  and the recovery snapshot) keep pair 0 at 0/1 and put pairs 1.. after
  the compute pipes. RetiredStamps keeps a TA and an FS history per
  pair.
- Each pair numbers its stamps and thresholds with its own dense draw
  ordinal. The UMA counters and the work UUID keep the global one.
- The engine keeps TA/FS targets, heads and registered flags per pair.
  A flight records its pair, and an fs2c barrier waits on the waited
  render's pair.
- Retirement takes the oldest render flight of each pair. A later
  flight on the same pair makes the queue and stamp proof a "passed"
  one. Any other render flight or later record makes the proof on the
  shared TA/FS submit channels a "passed" one.
- Progress is sampled per pair and renews the one render deadline.
- Recovery maps a snapshot event to its pair and blames only that
  pair's flights, since dense per-pair stamps collide across pairs.

With one pair every value and image is as before; the host suite
covers the per-pair paths with two pairs in its mocks.

Signed-off-by: DjDeveloperr <hey@djdev.me>
A PB/UMA allocator slot or render pass slot passes to another owner
only once it is displaced. After its last render retires, a slot stays
the TA and FS engines' current one until they run a render of another
slot. Both ledgers inferred that from the order in which retirements
were observed: the PB pool from the last cleanly retired slot, and the
pass ledger from a later publication retired on the same queue. That
holds while every render runs on one TA/FS queue pair, because the pair
retires in publication order.

Renders on different queue pairs are observed retiring out of
publication order, so the observed order says nothing about which
render the engines ran last. Decide by the publication sequence
instead:

- Pools::publish_flight returns the render's sequence, and
  retire_flight takes it back. A clean retirement displaces every other
  slot whose newest render was published before it.
- The render pass ledger has ordered pipes: a later publication that
  retired displaces an owner whatever pair it ran on. Each pair still
  retires its own owners in order, and pass slots are published on
  their flight's pair. The compute ledger keeps per-pipe displacement.

This relies on renders running on the TA and FS engines in publication
order. With the one pair in use, both rules decide exactly as before.

Signed-off-by: DjDeveloperr <hey@djdev.me>
Every VM's renders shared one firmware TA/FS queue pair. While two VMs'
passes are published on one pair, the GPU faults in the one whose pass
runs (linux#3201), so a render of another VM drained the engine first
(8722b2e). That serialized multi-process rendering: gpubench
render.light with 2 to 16 processes took about 127 µs per frame against
Metal's 104 µs. macOS 26B123 gives every Metal process its own TA and FS
queue, each with its own job-list entry, all rung through one doorbell.

Lease one of RENDER_PAIRS = 8 pairs to each rendering VM instead. The
completion-event block 0x70..0x80 names eight pairs, so a compositor and
seven clients render without a handoff. Each pair costs fourteen 16 KiB
pages at probe. A pair registers with the firmware on its first record,
and a VM takes the lowest free pair, so unused pairs stay unregistered.

- Leasing. A VM keeps the pair of its renders in flight, so its render
  waits never leave one in-order pair. Otherwise it takes its last pair
  if free, else the lowest free pair. Two VMs' renders are never in
  flight on one pair (cross_vm_render_conflict).
- Handoff. When every pair holds another VM's renders, the pair with
  the fewest passes in flight drains for the waiting render, as
  compute_handoff_pipe drains a compute pipe, and the other pairs keep
  running. This replaces the full engine drain.
- Render vs another VM's compute still drains, in both directions, and
  so does any InitBM flight.
- Stage order. A prefix's first pass waits for the TA and FS of the
  newest render in flight when that render is on another pair. Renders
  so reach the TA and FS engines in publication order, as on one pair,
  which the PB and pass slot displacement proofs rely on. That render's
  completion implies every earlier one's, so these waits take the place
  of the pair's own prev_barrier and fs_dep, and a pass still takes at
  most MAX_RENDER_RING_ENTRIES entries per ring. One VM's TA still
  overlaps another VM's FS. Since a pair can wait on another, the pairs
  keep one render deadline.
- Shared submit channels. Like the compute pipes on Channel::Compute,
  TA/FS channel receipts are latched before another pair's records can
  lap a long flight, and no record is posted that would lap an unlatched
  one.
- aurora-g16/stats gains "render_pairs: publications <per pair>
  cross_pair <n>": the renders published on each pair, and those
  published while another VM's renders were in flight on another pair.

A prototype with two pairs and per-VM pairs ran on the J773g with no GPU
fault or recovery. render.light procs d2/d4/d8/d16 went from 126.9,
126.6, 127.4 and 128.8 µs to 105.6, 100.9, 102.4 and 102.7 µs; single-VM
rows were unchanged. The stage-order barriers and the eight pairs are
new here.

Signed-off-by: DjDeveloperr <hey@djdev.me>
…r-pairs-on-3201

Stack this series on #3370 (linux#3349: cross-engine barriers wait on the
producer's service stamp, one accessor per service-stamp cell).

With per-VM render pairs every pair has its own render graph, so a
compute's barrier on a render waits on the FS service stamp of the
waited render's pair, and retirement reads each pair's TA and FS
service stamps through that pair's accessors.

Signed-off-by: DjDeveloperr <hey@djdev.me>
The comment over the render barriers said G16 FINALIZE flushes producer
caches before fw_stamp advances. linux#3349 showed that it does not make
a producer's writes visible to another firmware queue, and the merged
service-stamp change makes every cross-engine wait use the service stamp.
The render->render waits that stay on fw_stamp only order the TA and FS
engines across pairs, which is what the displacement proofs need.

Comment only.

Signed-off-by: DjDeveloperr <hey@djdev.me>
Document the visibility boundary of the stage-order waits and remove
the unused aggregate receipt check. The active retirement path checks
the rings and channels separately.

Signed-off-by: DjDeveloperr <hey@djdev.me>
@DjDeveloperr
DjDeveloperr changed the base branch from fix/g16-3201-cross-vm-render-drain to fix/g16-3349-compute-service-stamp November 27, 2026 19:55
@DjDeveloperr
DjDeveloperr marked this pull request as ready for review November 27, 2026 19:55
@DjDeveloperr
DjDeveloperr requested review from a team as code owners November 27, 2026 19:55
@DjDeveloperr

Copy link
Copy Markdown
Contributor Author

J516s (M3 Pro, G15S) at a69f447171c8ebd5fb00ee3ffd97f252265edb60. The PR advanced two commits to a67f388a9ae43066288a9e3022565f9c6739033a during stress testing. All hardware measurements below are from the earlier SHA.

Per-VM render pairs recovered most of the cross-process render cost on this Mac. The exact-head kernel booted with zero failed units. The two timing passes used the same native gpubench-vk binary and isolated Mesa 69179743d9ae as the earlier rows.

Median µs per submit across two passes, lower is faster.

Workload Before #3353 #3353 #3370 This head
render.light procs d4 63.5 119.0 119.9 66.7
render.light procs d16 45.2 136.5 126.5 61.5
postfx procs d4, 1440p MSAA1 1,286 2,564.1 2,547.8 1,290.3
render.light queue d4 51.8 51.4 51.5 51.3

On this head, 1080p MSAA4 postfx procs d1/2/4 measured 998.8 / 732.6 / 799.2 µs. The remaining render.light procs depths d2/8 measured 79.5 / 61.8 µs, queue d16 measured 38.3 µs, and compute.light procs d4/16 measured 30.6 / 27.8 µs. All eight render pairs carried work. Effective clocks reached S8 (1,380 MHz) in 1,766 of 1,913 busy samples. Earlier #3353 row · Earlier #3370 row

With one CTS worker and two busy CPU loops, all 238,015 case executions completed. Each of the three multi-queue runs had 29,484 pass and 7,089 unsupported. Each of the two cross-instance runs had 20,008 pass and 42,604 unsupported. All 1,024 implicit cases passed on each of three runs. Zero failures or missing results.

The concurrent render.light procs d16 and 1080p MSAA4 postfx procs d4 stress ran 603 seconds. Each completed 138 runs, all 276 returned valid results, and their under-load medians were 367.8 and 4,705.9 µs per submit. The candidate boot recorded zero GPU faults, SErrors, recoveries, or hang kills across timing, CTS, and stress.

@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) ci-failing A check failed at the PR head (bot) door:two-way Revertible or not, from Merge risk (bot) needs-review No approving review from Core or Omarchy Mac yet (bot) labels Nov 27, 2026
@github-actions

github-actions Bot commented Nov 27, 2026 •

Copy link
Copy Markdown

Merge readiness at f8951063: not ready yet

Check Detail
CI at head ok 2 checks passed
Review no needs one approving review from Core or Omarchy Mac (not the author)
Requested changes ok none
Hardware row at head ok comment at f8951063
Conflicts ok none
PR text ok Risk: two-way · M4 and M3 Macs on the g16 backend. - Scope: render admission and publication on the g16 backend: M4, and the M3 parts on the 26B123 protocol. - Main unknowns: - Pairs 2–7 on the firmware. On the J773g they ran the rows above. - Cross-pair stage-order waits, which compute already does across pipes.

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.

Superseded 12-01: not a hold under the merge bar (no shown failure). Full diff review deferred; follow-ups: land #3370/#3353/#3185, retarget, main CI

Verdict: HOLD at a67f388a

Blockers:

  1. Targets open non-main base branch fix/g16-3349-compute-service-stamp (#3370, stacked on #3353 and #3185); full main CI has not run.

Checked:

  • Verified #3370, #3353, and #3185 are still OPEN.
  • Deferred full diff review until parent PRs land and this PR is retargeted onto main with green CI.
Evidence
  • Base ref: fix/g16-3349-compute-service-stamp (#3370 state: OPEN).

@github-actions github-actions Bot removed the ci-failing A check failed at the PR head (bot) label Nov 30, 2026
…r-pairs-on-3201

Bring in #3370's branch, which now carries #3353's branch and main up to
1b2c361.

Main changed the one render graph that this series splits into pairs.
Each pair now takes main's layout: its FS fw_stamp comes from the
firmware-cached ring allocator, it has its own ASC-cached FS notifier
page, and the shared scheduling context, now allocated in
Graphs::finish(), is handed to every pair there. Pair 0 keeps the
allocation order, and later pairs share its legacy_empty and
registration barrier as before.

Retirement keeps main's model per pair: the uncached TA and FS service
stamps gate it, the recovery-suspect path falls back to the stage
fw_stamps, and the notifier records are never read. The pair's own
targets and the latched per-flight TA/FS channel receipts of this
series take the place of main's single-pair queue_passed() and
queue_receipt(). Progress, the recovery snapshot and the report read
each pair's FS user_stamp[1], as main does for its one pair.

Render barriers: behind a render on another pair, the stage-order waits
on that pair's fw_stamps are always posted. Behind a render on this
pair, which is always of the same VM, the TA->TA and FS->FS barriers are
left to the ring's order as in #3483 and #3499, and counted. The
counters still commit only on TA producer publication, now on the pair's
queues. needs_engine_drain() keeps main's compute UMA slot conflict.

Selftests: the mocks index render pairs and read the service stamps.
This series' pair tests now set the service stamps instead of the
notifier, and main's tests carry the pair fields.

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

Copy link
Copy Markdown
Contributor Author

Forward-merged the base: new head f8951063015d (merge of #3370's branch at d52995c924a7, which carries #3353's branch and main 1b2c3613cdbc). The base PR still goes first: #3353, then #3370, then retarget this one to main.

Conflicts (8 files; main had reworked the one render graph that this PR splits into pairs):

  • Graph: each pair takes main's layout. The FS fw_stamp comes from the firmware-cached ring allocator, each pair has its own ASC-cached FS notifier page, and the shared sched_ctx (now allocated in Graphs::finish()) goes to every pair there. Pair 0 keeps the allocation order, and later pairs still share its legacy_empty and registration barrier.
  • Retirement: main's model, per pair. The uncached TA/FS service stamps gate retirement, the recovery-suspect path falls back to the stage fw_stamps, and the notifier records are never read. This PR's per-pair targets and latched TA/FS channel receipts replace main's single-pair queue_passed()/queue_receipt(). Progress, the recovery snapshot and the report read each pair's FS user_stamp[1].
  • Barriers: behind a render on another pair, the stage-order waits on that pair's fw_stamps are always posted. Behind a render on the same pair (always the same VM), the TA→TA and FS→FS barriers are left to the ring order as in drm/asahi: g16: drop redundant same-VM TA barriers and lower compute fan-out threshold to 140 us #3483/drm/asahi: g16: leave same-VM FS render order to the FS ring #3499, and counted. The counters still commit on TA producer publication, on the pair's queues. needs_engine_drain() keeps main's compute UMA slot conflict.
  • Tests: the mocks index render pairs and read the service stamps. This PR's pair tests now set service stamps instead of notifier words. One pair test now also completes the later flight's PB work, because main's pb_flight_retired() checks each flight's target. Main's tests carry the pair fields.

Checks (pc, x86_64 → arm64, LLVM, rustc 1.100.1):

  • linux-build/build kernel --profile asahi <tree> -- modules_prepare drivers/gpu/drm/asahi/ (defconfig + asahi.config): pass, 0 errors, no new warnings.
  • tools/asahi/run-host-tests.py --only asahi-m4: 26/26 pass.
  • tools/asahi/run-host-tests.py --only g16: g16-vm-share-tests 2/2 pass.
  • KUnit: not run locally (the asahi suite needs arm64 QEMU).

Rows: the J516s and J773g rows predate this merge, and it touches the firmware-facing pair layout (FS notifier, FS stamp, stage-order waits), so J773g and J516s rows at f8951063 are requested.

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

Copy link
Copy Markdown
Contributor Author

J773g (M4 Mac mini, T8132, G16G B0) hardware row PASS at exact head f8951063015d (#3353 2d0871048181 -> #3370 d52995c924a7 -> #3355 f8951063015d).

  • Kernel: 7.3.0-j773g-pr3355-f8951063 (boot_id 22ebd39e-b742-4ab9-947c-1a2baadcf494, exact PR DTB, stock cmdline)
  • Per-VM render-pair spread (/sys/kernel/debug/aurora-g16/stats): render_pairs: publications 69960 33250 27177 24208 20228 16791 5922 5289 cross_pair 134674 (all 8 render pairs active; ta_prev: barriers 127033 ring_ordered 109659, fs_ring: dep 127033 order 89663)
  • gpubench-vk (7a0dfcf8, --verify, all CRCs valid) vs stock 6c83a2a6:
    • render.light procs d2/d4/d8/d16: 101.79 / 86.06 / 82.43 / 81.33 us (CRCs 701903f1 / 9695123a / 7e29f787 / 54a81b87 valid; stock 95.49 / 79.52 / 67.24 / 66.03 us)
    • render.postfx procs d4 (1440p MSAA1): 1552.80 us (crc=9d69f178 valid, 644 fps, 30% faster than stock 2232.14 us)
    • render.postfx procs d4 (1080p MSAA4): 1012.15 us (crc=14afd2e3 valid, 988 fps)
    • render.postfx queue d1 (1440p MSAA1): 2032.52 us (crc=4707efa8 valid, stock 811.69 us)
  • CTS stress:
    • 3-worker parallel dEQP-VK.synchronization*multi_queue* (2,439 cases x 3): 105 Passed / 0 Failed / 2334 NotSupported / 0 Warnings on all 3 workers
    • 2-worker parallel binding_model.shader_access.* + mutable_descriptor.* (3,656 cases x 2): 3053 Passed / 0 Failed / 603 NotSupported / 0 Warnings on both workers (0 wrong images)
    • 3-worker parallel #3349 tess->blit repro under 4-core CPU load: 7 Passed / 0 Failed x 9 runs (0 memory mismatches)
  • s2idle (rtcwake -d /dev/rtc1 -m freeze -s 5) with 4 active render procs across 2+ pairs: resumed cleanly (RC=0), render.postfx procs d4 completed 6308 submits (crc=9d69f178 valid=true, RC=0), render_pairs advanced across 6 pairs (cross_pair 112135 -> 134674)
  • GPU health & kernel state: health: failed 0 errno 0 degraded 0, classes: render_failed 0 compute_failed 0, recoveries 0 hang_kills 0 clustered 0, recovery_receipts: affected_full 0 aborted 0, 0 failed units, 0 GPU faults/Oops/WARN.

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

Copy link
Copy Markdown
Contributor Author

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

  • Kernel / module: 7.3.0-m3-gpu-g105e3fbc6adc with aurora.ko rebuilt from f8951063015d merged onto 105e3fbc6adc (SHA-256 187568f89f53...), boot_id=c9649783-d761-40a8-89fa-5b5a6813ee21, compared against #3370 d52995c924a7 (boot_id=815c22cb-7d3d-47fd-9895-fde390dd11fa). Stock boot.bin, multi-user.target.
  • Leased TA/FS render queue pairs exercised: render_pairs: publications 25784 20902 12081 11292 5520 6985 5328 5187 cross_pair 74224.
  • gpubench-vk (us_per_submit median, #3370 d52995c924a7 -> #3355 f8951063015d):
    • render.light procs d2: 122.25 -> 80.32 µs (-34.3%), d4: 149.37 -> 66.76 µs (-55.3%), d8: 132.36 -> 62.70 µs (-52.6%), d16: 158.73 -> 63.80 µs (-59.8%).
    • render.postfx procs d4: 6896.55 -> 5128.21 µs (-25.6%).
    • Single-process CRCs valid: render.postfx queue d1 5357.14 µs / d2 5000.00 µs (4707efa8), render.bindless_ubo d2 1515.15 µs (57e7bedd), render.deferred msaa4 16666.67 µs (5e4130ce).
  • CTS (multi_queue 3-worker + 1-worker, cross_instance, sync subset):
    • multi_queue 3-worker (900): 205 Pass, 695 NotSupported, 0 Fail (67 + 67 + 71).
    • multi_queue 1-worker (900): 205 Pass, 695 NotSupported, 0 Fail.
    • cross_instance (300): 92 Pass, 208 NotSupported, 0 Fail.
    • sync subset (671): 552 Pass, 119 NotSupported, 0 Fail.
  • Faults / stats: jobs 92518, recoveries 0, hang_kills 0, health: failed 0 errno 0 degraded 0, 0 GPU faults, 0 kernel errors.

@DjDeveloperr

DjDeveloperr commented Dec 2, 2026 •

Copy link
Copy Markdown
Contributor Author

Verdict at f8951063015d: the code is ready. Hold for one J773g A/B before merging.

Blocker

Checked

  • The lease. render_pair_for() gives a VM the pair of its in-flight renders, else its last pair if free, else the lowest free one. publish_prefix_body() checks the pair against every flight again before anything is visible, so two VMs' renders are never in flight on one pair (the linux#3201 rule). The handoff drains the least-loaded pair and clears its mark on every exit path.
  • Order across pairs. A prefix's first pass waits on the TA and FS fw_stamp of the newest render in flight on another pair. With ring order inside a pair, the TA and FS engines run renders in publication order. That is what the sequence-based displacement in Pools::retire_flight() and the ordered render Lifetime rely on. A render wait that names another pair returns EAGAIN instead of posting a barrier on the wrong pair.
  • Events and stamps. Pair p uses events 0x70+2p and 0x71+2p (asserted to fit word 4), dense per-pair stamps and per-pair thresholds. Compute's wait on a render uses the waited render's pair, stamp and event. The UMA counters and work UUID still use the global draw ordinal.
  • Retirement and recovery. Pairs retire independently. The shared TA/FS submit channels latch a flight's receipt before another pair's records can lap it. Recovery matches an event to its pair, snapshots every pair, and keeps retired-stamp history per pair. Registration is per pair and happens on the first record.
  • Merge with current main. The stack merges cleanly onto main 8a42aee5, with the same patch ID as the stack's own diff (4e37e018), so the rows carry over.
Evidence
  • Rows: J773g PASS at this head, with all 8 pairs active and s2idle with 4 render clients (comment). J516s PASS at this head (comment).
  • Hosted CI: this PR's base is still drm/asahi: g16: wait for the service stamp in cross-engine barriers #3370's branch, so only pr-text and readiness run. The full set runs once it's retargeted to main after drm/asahi: g16: wait for the service stamp in cross-engine barriers #3370 lands.
  • Local checks on this head merged into main 8a42aee5 (tree 404e003e), on an x86_64 build host, LLVM, rustc 1.100.1, defconfig + asahi.config:
    • W=1 build of modules_prepare and drivers/gpu/drm/asahi/: 0 errors, and the same 39 W=1 warnings as main, all already there.
    • tools/asahi/run-host-tests.py in the host-tests image: asahi-m4 26/26 files (502 Rust cases, 0 failed) and g16 2/2.
    • The arm64 asahi KUnit kernel compiles; it wasn't run, since our build hosts have no arm64 VM. That .kunitconfig doesn't enable CONFIG_DRM_ASAHI_G16, so KUnit asahi doesn't cover g16 code; the host suites do.

Hold lifted (14:11 UTC). The same-session J773g A/B (receipt) found no regression at f8951063015d: render.postfx 1440p queue d1 was −1.58 % against main 9177b2d, all CRCs were valid, and there were 0 GPU faults, recoveries or WARNs. The A/B didn't reproduce the slowdown, so a split boot of #3370 wasn't needed. Merge order: #3370 first, then #3355 retargeted to main. Each still needs a non-author approval of its exact head.

@DjDeveloperr

Copy link
Copy Markdown
Contributor Author

Same-session J773g A/B validation PASS comparing main (7.3.0-nightly-9177b2d474f8, stack base g16 driver) against pr3355-f8951063 (7.3.0-j773g-pr3355-f8951063, exact head f8951063015d, carrying #3353 + #3370 d52995c924a7 + #3355 unchanged). No regression on render.postfx (-1.58% on queue d1); split boot of #3370 not needed.

Environment & Boots (both SLC on 2 planes, default cmdline, gpubench-vk 7a0dfcf8 --verify, runs=5, 2 passes each)

  • Board: Apple Mac mini M4 (Mac16,10, J773g, T8132, G16G B0, Borealis Mesa 26.3.0-devel git-d4ad4a4dce)
  • Base boot: 7.3.0-nightly-9177b2d474f8 (boot_id=aae09ad7-e957-4a4d-89ec-13e57ff60e3a, Image SHA-256 382fd54c6f8a..., SLC enabled on 2 planes)
  • Candidate boot (#3355 stack tip): 7.3.0-j773g-pr3355-f8951063 (boot_id=9066f025-f100-4353-aa55-43e95ceedb3e, exact head f8951063015dc470052cd7a2c57b64a8511d0c8a, Image SHA-256 8607b2b48241..., SLC enabled on 2 planes)

Same-Session Medians (us_per_submit, lower is better)

Case Base 9177b2d4 pass 1 / pass 2 (us) #3355 f8951063 pass 1 / pass 2 (us) Delta (median) CRCs
render.postfx 1440p MSAA1 queue d1 2016.13 / 2032.52 1968.50 / 2016.13 -1.58% all valid (4707efa8)
render.postfx 1440p MSAA1 queue d2 1582.28 / 1592.36 1582.28 / 1582.28 -0.32% all valid (4707efa8)
render.postfx 1080p MSAA4 queue d1 1453.49 / 1445.09 1428.57 / 1428.57 -1.43% all valid (668d6f0a)
render.postfx 1080p MSAA4 queue d2 1012.15 / 1012.15 1016.26 / 1024.59 +0.82% all valid (668d6f0a)
render.postfx 1440p MSAA1 procs d1 2032.52 / 2032.52 2032.52 / 2016.13 -0.40% all valid (4707efa8)
render.light queue d1 134.55 / 133.12 131.03 / 131.23 -2.02% all valid

Health

  • Base (9177b2d474f8): health: failed 0 errno 0 degraded 0, recoveries 0, hang_kills 0, quarantined 0, 0 WARN/BUG/Oops.
  • Candidate (pr3355-f8951063): 52,308 jobs / 209,428 job_cmds, render_pairs: publications 60290 103 74 ... cross_pair 224, health: failed 0 errno 0 degraded 0, recoveries 0, hang_kills 0, quarantined 0, 0 WARN/BUG/Oops.

satchlj
satchlj previously approved these changes Dec 2, 2026

@satchlj satchlj left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Reviewed f8951063015d across the full g16 driver diff (encode/render.rs, engine.rs, event.rs, fw/work.rs, graph.rs, hw.rs, poll.rs, pools.rs, pools/lifetime.rs, recovery.rs, recovery/logic.rs, slots.rs) and asahi-m4 selftests.

The per-VM TA/FS render queue pair leasing invariants look solid: cross_vm_render_conflict isolates cross-VM renders on the same pair and cross-VM compute/render while allowing distinct VMs on separate pairs, render_pair_for/render_handoff_pair keep one VM's live renders on one pair with drain-on-saturation, prefix_render emits cross-pair stage-order barriers so PB/slot displacement stays in publication order (Lifetime::ordered(), Pools::slot_seq/undisplaced), latch_render_channel_receipts() latches shared channel proofs before lapping, and RetiredStamps + recovery_snapshot() cover all RENDER_PAIRS stages.

M4 J773g same-session A/B at exact head f8951063 passes with valid CRCs and 0 faults/recoveries (render.postfx 1440p MSAA1 queue d1 -1.58%, render.light queue d1 -2.02%, cross_pair 224) alongside the J516s second-gen row. pr-text and readiness are green. LGTM (ready to retarget once #3370 merges).

@github-actions github-actions Bot added ready-to-merge Meets the merge policy: merge it (bot) and removed needs-review No approving review from Core or Omarchy Mac yet (bot) labels Dec 2, 2026
@DjDeveloperr

Copy link
Copy Markdown
Contributor Author

Local build receipt for the merge tree. Hosted CI only ran pr-text and readiness on this stack, so I built it here.

Merge tree: main 37916aa84355 (includes #3813, #3920, 6334738 and #3775) plus #3355 head f8951063015d, which contains #3370 head d52995c924a7. It merges cleanly. Local test-merge commit 90925c6454a7, tree fd5b74049aaf. Main has since moved to a8a6c903779b (#3939). That only changes three apple-dcp host-test fixtures, so the driver tree is the same, and it still merges cleanly (tree 881231212143).

Setup: pc (x86_64, cross to arm64), clang 23.1.3, rustc 1.100.1, bindgen 0.73.2, defconfig + asahi.config, 16K pages, CONFIG_DRM_ASAHI=m, CONFIG_DRM_ASAHI_G16=y.

Check main 37916aa8 merge 90925c64
make O=… LLVM=1 W=1 olddefconfig modules_prepare drivers/gpu/drm/asahi/ (asahi outputs deleted first, so every asahi object is rebuilt) 0 errors, 39 warnings 0 errors, the same 39 warnings (same messages, same files)
tools/testing/kunit/kunit.py build --arch=arm64 --make_options LLVM=1 --kunitconfig=drivers/gpu/drm/asahi/.kunitconfig (compile only, no QEMU) — builds, 0 errors
tools/asahi/run-host-tests.py --only g16 (host-tests container) — 2/2 passed
tools/asahi/run-host-tests.py --only asahi-m4 — 1/1 passed

The stack adds no new warnings. The hardware evidence still stands: the J773g same-session A/B at f8951063 (#3355 (comment)) and the J516s rows. Logs are on pc in .build-host/mt3370-1202/logs/.

Base automatically changed from fix/g16-3349-compute-service-stamp to main December 2, 2026 14:37
@DjDeveloperr
DjDeveloperr dismissed satchlj’s stale review December 2, 2026 14:37

The base branch was changed.

@github-actions github-actions Bot added needs-review No approving review from Core or Omarchy Mac yet (bot) and removed ready-to-merge Meets the merge policy: merge it (bot) labels Dec 2, 2026

@satchlj satchlj left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Re-approving f8951063015d after retargeting to main (head unchanged since prior approval on the #3370 stack, with #3370 now merged as c948713c).

Verified the local merge-tree build receipt (main 37916aa84355 and a8a6c903779b merge cleanly with f8951063015d, W=1 0 errors, KUnit compiles, g16 2/2 and asahi-m4 1/1 pass), pr-text and readiness are green, and the exact-head M4 J773g A/B + J516s rows remain valid. LGTM.

@DjDeveloperr
DjDeveloperr merged commit 8616760 into main Dec 2, 2026
6 of 7 checks passed
@DjDeveloperr
DjDeveloperr deleted the perf/g16-render-pairs-on-3201 branch December 2, 2026 14:43
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