Skip to content

drm/asahi: g16: leave same-VM FS render order to the FS ring - #3499

Merged
RyanTheTide merged 3 commits into
mainfrom
perf/g16-fs-ring-order
Dec 1, 2026
Merged

RyanTheTide merged 3 commits into
mainfrom
perf/g16-fs-ring-order

Conversation

@DjDeveloperr

Copy link
Copy Markdown
Contributor

What

One self-contained g16 performance commit based cleanly on main (00fbe806db2322d96561542e7cf92af0874ff0ed):

  • 0c3efcd29427 (drm/asahi: g16: leave same-VM FS render order to the FS ring): Elide redundant self-event (0x71 -> 0x71) fs_dep barriers on r.ring[1] when !cross_vm_prev && !producer_initbm && !init_buffer, matching Metal's [own_TA_barrier, FS_work] FS ring and avoiding unnecessary firmware DAG spinlock / backward ring walks on pipelined same-VM renders. Stages fs_dep and fs_order counters on Prefix and commits them only after publish_producer succeeds on the TA ring (orthogonal to #3483 TA-ring ordering). Also dynamically parses the passed test count in test-publication.py ("tests": 90).

Tested

  • Host static / unit checks at 0c3efcd29427121d4a7555927d9afe566296e439:
    • scripts/checkpatch.pl --strict: 0 errors, 0 warnings, 0 checks.
    • tools/testing/selftests/drivers/gpu/asahi-m4/run-host-tests.py: 26/26 pass (test-publication.py: 90 passed, 0 failed).
    • drivers/gpu/drm/asahi/ (aurora.o): compiles cleanly with 0 errors and no new warnings.
  • J773g (Mac mini M4, T8132 / G16G B0) exact-head 4-boot ABBA (main 00fbe806db23 vs 0c3efcd29427, 4 fresh boots x 2 passes, 104 timed rows, 80/80 exact pinned CRCs, 8/8 compression structural checks, SLC ON 2 planes, 0 GPU faults/recoveries/hang kills/quarantine, gpubench-vk ae90a40, Mesa 90211df6816):
    • render.postfx msaa=4 1080p d2: -0.73% / -3.01% (732.1/736.4 -> 726.8/714.3 us, CRC 668d6f0a).
    • render.bindless_ubo 512 d1: -0.26% / -1.90% (265.8/267.7 -> 265.1/262.6 us, CRC 1af53d5c).
    • compress.bw array 1440p d4: -0.63% / -0.18% (453.3/448.8 -> 450.5/448.0 us).
    • fs_ring counters: dep delta +0 on all 4 candidate passes; order delta +158,812 / +160,103 (B1) and +160,856 / +160,108 (B2).
    • Zero repeatable >1% regressions across all 13 workloads.
    • (In-boot ablation on top of cached-notifier + TA-ring-order stack further confirmed FSORD alone delivers -2.57% postfx d2, -2.47% postfx d1, -2.02% compress array d4, -0.69% bubo d2, -0.67% shadow d2 once TA barriers & uncached notifiers are removed.)
Full J773g exact-head ABBA table (104 timed rows, 80/80 exact CRCs)
Workload A1 (us) B1 (us) B2 (us) A2 (us) Pair 1 / Pair 2 CRC
render.postfx msaa=4 d1 794.91 794.91 783.70 800.02 +0.00% / -2.04% 668d6f0a
render.postfx msaa=4 d2 732.08 726.77 714.29 736.42 -0.73% / -3.01% 668d6f0a
render.bindless_ubo 512 d1 265.82 265.12 262.61 267.70 -0.26% / -1.90% 1af53d5c
render.bindless_ubo 512 d2 166.23 165.79 166.28 165.89 -0.26% / +0.23% 1af53d5c
render.mdi 1024 d1 219.21 220.17 218.06 217.78 +0.44% / +0.13% f69c5f55
render.mdi 1024 d4 126.84 127.52 125.26 123.98 +0.54% / +1.03% f69c5f55
render.shadow depth_only d2 450.46 444.05 444.47 435.37 -1.42% / +2.09% c0fb9993
render.shadow alpha_test d2 1008.08 1008.13 1010.14 1008.13 +0.01% / +0.20% 7be9463a
compress.bw array 1440p d4 453.31 450.47 448.03 448.83 -0.63% / -0.18% structural OK
render.deferred tile msaa=4 d1 600.25 595.97 599.52 598.80 -0.71% / +0.12% 6dc74b48
render.deferred tile msaa=4 d2 352.11 352.36 354.11 351.87 +0.07% / +0.64% 6dc74b48
render.light tri d16 58.71 58.82 58.78 58.30 +0.19% / +0.82% —
render.light tri d64 60.02 59.78 59.89 59.34 -0.39% / +0.92% —

Risk

Two-way door (low risk): single self-contained change in drivers/gpu/drm/asahi/g16/ with zero UAPI or on-disk impact, cleanly revertible. Cross-VM renders and any live/pending InitBM producer or consumer retain the explicit FS->FS fs_dep barrier; own-TA, TA->FS, and compute barriers are unchanged. Touches shared g16 paths bound on T8132 (G16) and T6030/T8122 (G15).

Not yet

  • 2nd-gen G15 (T6030 / T8122) hardware verification row prior to merge.

g16 posts a self-event (0x71 -> 0x71) fs_dep barrier on the FS work
ring ahead of every pipelined same-VM render pass that has an in-flight
render dependency not already dominated by TA. Every render's FS work
goes on the single firmware FS queue, whose works the firmware runs in
ring order: macOS 26B123 posts no FS->FS barriers on its FS ring at all
(only each pass's own TA barrier ahead of its FS work).

On 26B123, each redundant fs_dep barrier takes the firmware's global
DAG spinlock, inserts a self-event 0x71 dependency, and forces the
kick path to walk backwards through the FS ring and poll SGX MMIO on
every FS kick.

Post fs_dep only when the FS ring's order does not cover it: behind
another VM's render (cross_vm_prev), or whenever a live producer or
this consumer carries InitBM (producer_initbm || init_buffer). Stage
the fs_dep and fs_order counters on Prefix and commit them to stats
only after TA producer publication succeeds.

The publication selftest covers the decision and its placement.

Signed-off-by: DjDeveloperr <[email protected]>
@DjDeveloperr
DjDeveloperr requested review from a team as code owners November 28, 2026 07:36

@DjDeveloperr DjDeveloperr left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

HOLD at 0c3efcd29427121d4a7555927d9afe566296e439 for one G15 hardware result. The backend binds T8132, T6030 and T8122 (drivers/gpu/drm/asahi/g16/mod.rs:109–118). The barrier decision at drivers/gpu/drm/asahi/g16/engine.rs:4173–4189 applies to all three. A pipelined same-VM render on T6030 or T8122 with an increasing fs_ring order counter, correct dependent output and clean GPU health would cover the other generation.

I found no host ordering or lifetime regression. Logical queues feed one FS ring, including folded renders. Every FS work item follows its own TA barrier (drivers/gpu/drm/asahi/g16/engine.rs:4240–4245). Source inspection establishes enqueue order. Completion and write visibility before the next dependent FS pass rely on firmware. The recorded four-boot J773g ABBA replay passes, with 80/80 pinned CRCs and zero recoveries.

Independent checks passed on the reviewed source tree: 26/26 host selftests, 90 publication tests, native Rust compile and link of aurora.o, strict checkpatch, canonical PR text check, and merge-tree against 00fbe806db23.

@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-review No approving review from Core or Omarchy Mac yet (bot) labels Nov 28, 2026
@github-actions

github-actions Bot commented Nov 28, 2026 •

Copy link
Copy Markdown

Merge readiness at 79955df1: not ready yet

Check Detail
CI at head no failing: KUnit asahi, KUnit spi-hid-apple, KUnit avd, KUnit ave, KUnit isp, KUnit jpeg
Review ok approved by RyanTheTide
Requested changes ok none
Hardware row at head ok comment at 79955df1
Conflicts ok not computed yet
PR text ok Risk: two-way · (low risk): single self-contained change in drivers/gpu/drm/asahi/g16/ with zero UAPI or on-disk impact, cleanly revertible. Cross-VM renders and any live/pending InitBM producer or consumer retain the explicit FS->FS fs_dep barrier; own-TA, TA->FS, and compute barriers are unchanged. Touches shared g16 paths bound on T8132 (G16) and T6030/T8122 (G15).

Areas: area:gpu

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

@DjDeveloperr

DjDeveloperr commented Nov 28, 2026 •

Copy link
Copy Markdown
Contributor Author

J516s (MacBook Pro 16" M3 Pro, T6030, G15S) row at 0c3efcd29427: PASS. One-shot boot of the exact head, default cmdline, 27.2 firmware, the head's own J516s DTB.

  • SLC on: PLANE_CACHE_STATUS is 0x2100 on all six MCC planes (16 data and 16 tag ways). The GPU ran at S8 (1380 MHz) in 4,901 of 5,041 busy samples, die peak 62.0 C.
  • GPU health: 0 GPU faults, 0 recoveries or hang kills, no completion-stamp lines, 0 failed units, about 3.16 million jobs. The only new kernel error is this Mac's usual per-boot hid-generic "no listeners" line.
  • The new path ran: fs_ring order went 0 → 138,516; explicit FS deps went 223 → 320.
  • gpubench-vk CRCs (cba9025, aurora-wip Mesa 69179743d9ae, 2 passes of 45 rows): 90/90 rows ok. All 44 pinned-CRC results match the CPU reference: render.postfx msaa=4 1080p 668d6f0a, render.bindless_ubo 512 1af53d5c, render.mdi 1024 f69c5f55, render.deferred tile msaa=4 6dc74b48, render.shadow depth_only c0fb9993 and alpha_test 7be9463a, compute.uber uniform b022fbaf and divergent 9963f56c, compute.conv2d gaussian 2d55a14d, compute.edge sobel 27c79e6d, compute.cull_mdi 57276de2. These are the same CRCs as earlier J516s boots and the ones in the J773g table. The compress.bw array structural check is valid 4/4 (that row has no pinned CRC).
  • CTS (one process, multi_queue excluded): 1,188 cases sampled from the synchronization and synchronization2 subsets (basic, smoke, timeline_semaphore, op.single_queue, signal_order, implicit) and compute. 914 Pass, 274 NotSupported, 0 Fail.
  • Timing: there was no main boot in this window, so this row doesn't claim a speedup or a regression. Against the 11-27 J516s boot with the same Mesa kit (older main), render.postfx msaa=4 d2 is 902.5 → 902.5 µs, and render.bindless_ubo 512 d1 455.4 → 467.8 µs and d2 339.7 → 358.1 µs. On this boot the two d2 passes read 349.2 and 367.1 µs, so that gap is within this boot's own spread.
  • Restored to stock and checked afterwards.

J516s second-generation row, 30 Nov: PASS. 34/34 rows passed, 26/26 pinned CRCs matched, and both compression structural checks passed. Pins included compute.uber uniform b022fbaf, postfx MSAA4 668d6f0a, and bindless UBO 1af53d5c. Zero GPU faults, recoveries, hang kills, compute/render quarantines, or failed units.

M3 Pro J516s (T6030, G15S), 30 Nov 2026. Both arms used their own one-shot kernel and matching aurora.ko built from the same source commit, SLC on (all six planes), Borealis 69179743d9ae, and GPUBench cba9025d3fd9. Baseline kernel/driver source was main e6c7b032633cd0018a90bfc8fe6fb9f3bc3890f9. Tested at 7ee656a3d092bcb6cedcc831d3e21deb5daa5238. The current head 79955df1d9a91412ab856a62655a205c05fbe04d differs only by a merge from main that touches none of this PR's files.

Staged aurora.ko SHA-256: main 456f346552b20a12d28ab2b53bdf59027ba03769c3224cd010fd7747dbb21f6f, PR 6033b7cc76be429cbcf512a6db233afe341e3c7c596cc92484467f9b0eae0ea5.

Two-pass wall-time smoke measurements vs baseline: compute.uber uniform d4 +0.8%, postfx MSAA4 d1/d2 −0.4%/+0.6%, and bindless UBO d1/d2 +1.1%/+3.1%. The two matched postfx/bindless d2 probes recorded FS ring order +16,092 and +17,019, with explicit FS deps +0 both times.

Evidence on the controller is in work/m3pro-bringup-20261124/rows-render3-e6c7b032/evidence-20261130T112653Z-qxQe5jS7/RESULTS.md, with raw rows and stages.tsv in the same directory.

@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 0c3efcd2

Blockers: none (wait for the queued KUnit CI jobs to finish green and re-run cancelled readiness before landing).

Checked:

  • drivers/gpu/drm/asahi/g16/engine.rs & poll.rs: fs_ring_orders_prev(cross_vm_prev, producer_initbm, init_buffer) cleanly elides redundant self-event (0x71 -> 0x71) fs_dep barriers on r.ring[1] while retaining them for cross-VM predecessors and any InitBM producer/consumer. Barrier counters (pf.fs_dep, pf.fs_order) are staged on Prefix and committed to self.engine.stats only after TA producer publication.
  • tools/testing/selftests/drivers/gpu/asahi-m4/test-publication.py: verifies ordering relative to cross_engine_barrier_type(), staging on Prefix, and all truth-table combinations (26/26 host tests, 90/90 publication tests pass).
  • Hardware row: J773g (T8132/G16G) exact-head 4-boot ABBA (104 timed rows, 80/80 exact CRCs, fs_ring.dep +0, order +158k..+160k).
  • Checked for Apple material, tool attribution, private serials, and gating: clean; MERGEABLE on main.
Evidence
  • Head: 0c3efcd29427 (base: main, mergeable: MERGEABLE, +70/-12 across 3 files).

@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 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 7ee656a3

Blockers:

  • Hosted CI at 7ee656a3 is still pending (18 queued jobs: apple-build, host-tests, and KUnit suites).
  • Exact-head 7ee656a3 hardware receipt or hwok carry-forward is still needed (needs-hw-row flagged by pr-readiness after the main merge).

Checked:

  • Forward-merge cleanliness (+70/-12 across drivers/gpu/drm/asahi/g16/engine.rs, poll.rs, and tools/testing/selftests/drivers/gpu/asahi-m4/test-publication.py): 7ee656a3 cleanly merges main (e6c7b03263) onto previously approved 0c3efcd2 with the feature diff preserved intact.
  • Ordering & rollback invariants: fs_ring_orders_prev(cross_vm_prev, producer_initbm, init_buffer) elides redundant same-VM non-InitBM 0x71 -> 0x71 FS barriers on r.ring[1] while retaining cross-VM and InitBM barriers, and stages fs_dep/fs_order stats on Prefix committed only after TA producer publication.
  • Prior hardware evidence (0c3efcd2): both J773g (M4, G16G) and J516s (M3 Pro, T6030 G15S — 3.16M jobs, 0 GPU faults, 0 failed units) passed.
Evidence
  • Delta from 0c3efcd2: Pure Merge main (e6c7b03263); no logic changes in g16/engine.rs, g16/poll.rs, or test-publication.py.
  • Ready condition: Upgradeable to APPROVE as soon as the 18 queued CI checks complete green and the 7ee656a3 hardware-row / carry-forward check clears.

@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 79955df1

Blockers:

  • Hosted CI workflows (apple-build, host-tests, and KUnit suites) are still queued/running at 79955df1.
  • Exact-head 79955df1 hardware row or hwok carry-forward (pr-readiness requires the current head SHA after the main merge).

Checked:

  • Forward merge 79955df1 (7ee656a3..79955df1): only unrelated drivers/accel/ane/* and include/uapi/drm/ane_accel.h files entered from main; zero changes to drivers/gpu/drm/asahi/ or test-publication.py relative to the previously audited and dual-generation hardware-verified 0c3efcd2 tree (J773g M4 G16G and J516s M3 Pro G15S).
Evidence
  • Code remains clean across all 3 touched files (+70/-12). Ready to approve once hosted CI finishes green and the 79955df1 head SHA is recorded with hardware acceptance.

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

Copy link
Copy Markdown
Contributor Author

PASS — J773g (M4 mini, T8132 G16G) target row at 79955df1d9a91412ab856a62655a205c05fbe04d. Outputs match on every boot, the FS-ring order counter rises with no extra dependency waits, and there are no GPU faults. Rows are neutral to slightly faster than main.

Setup

  • Kernel: linux main dbfbced70b31 (release 7.3.0-ARCH-m4kmain-dbfbced7), with aurora.ko built from this head's drivers/gpu/drm/asahi. That tree is byte-identical to the pre-merge PR tree, and the main..head diff equals the PR patch.
  • Userspace: Borealis Mesa 285776c6af, gpubench-vk 868b0644 (VK rows check their output CRC in every run), 300 ms warmup, 5 × 250 ms windows, two passes per boot.
  • Boot order: main, this PR, this PR, main.
  • Values: µs per submission.
Row main this PR Δ every PR boot vs every main boot
render.postfx msaa4 1080p d1 / d2 773.62 / 698.17 751.71 / 682.16 −2.8 / −2.3 % overlap
render.bindless_ubo 512 ubo_vec4 d1 / d2 232.32 / 168.92 227.43 / 166.73 −2.1 / −1.3 % faster / overlap
render.light tri d16 / d64 59.52 / 53.16 58.71 / 52.33 −1.4 / −1.6 % overlap
render.shadow d16 depth-only 2048 d2 451.69 448.44 −0.7 % faster
render.deferred tile msaa4 1080p d2 289.60 289.27 −0.1 % faster
compute.uber uniform d4 171.35 171.35 0 equal
  • FS-ring counter: fs_ring: dep 0 order 312,574 and 315,267 on the two PR boots. Same-VM FS renders were ordered by the ring, with no added dependency waits.
  • Correctness: pinned-CRC smoke 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 or hang kills on any boot. Each boot returned to the saved stock kernel.
  • Single-boot screen: an earlier screen on this kit showed render.light +5 to +7 %. The matched run above does not reproduce it.

@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.

Merge-train approval (last-push review of the merge-up delta, under the merge bar). 79955df1 merges current main on top of the reviewed code. Rows: J773g-exact-head(79955df)+J516s(0c3efcd). Merging once hosted CI is green.

@github-actions github-actions Bot added ci-failing A check failed at the PR head (bot) and removed needs-review No approving review from Core or Omarchy Mac yet (bot) labels Dec 1, 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 79955df1d9a9

Converts this App's earlier review at the same head to an approval under the 12-01 merge bar (better than before and doesn't break; block only on a shown failure). No code blocker was found in it. The merge gate (a row on one Mac at this head + fast CI) is tracked by pr-readiness, not held here.

Checked: - Forward merge 79955df1 (7ee656a3..79955df1): only unrelated drivers/accel/ane/* and include/uapi/drm/ane_accel.h files entered from main; zero changes to drivers/gpu/drm/asahi/ or test-publication.py relative to the previously audited and dual-generation hardware-verified 0c3efcd2 tree (J773g M4 G16G and J516s M3 Pro G15S).

Follow-ups (not blocking): queued CI; hwok carry-forward to head

@RyanTheTide

Copy link
Copy Markdown
Contributor

Merging at 79955df1d9a9 (B2 merge train, 12-01 merge bar). Approval at this head: RyanTheTide,aurora-silicon-review[bot]. Row: J773g exact head 79955df PASS (Dj). CI: linux train L1 = main 595e754 + #3503 #3499 #3240 #3208 #3696 #731 #2634 #2110 #3325 #3441 #3650 (candidate ef98b31c): Apple driver compile (defconfig + asahi.config, LLVM=1, Rust) pass, Apple DTBs W=1 pass, planned KUnit clpc/dcp-fabric/dcp-topology/dcp-display/pmgr-pwrstate/mt7932/asahi all pass; host-tests green (or path-skipped) at this head. The rest of the hosted run is queued behind the ~19 h backlog. Revert: git revert -m 1 <merge commit>.

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