Skip to content

drm/asahi: g16: map the render FS notifier record ASC-cached - #3724

Merged
DjDeveloperr merged 4 commits into
mainfrom
perf/g16-m4-render-k1-fs-notifier
Dec 1, 2026
Merged

DjDeveloperr merged 4 commits into
mainfrom
perf/g16-m4-render-k1-fs-notifier

Conversation

@DjDeveloperr

@DjDeveloperr DjDeveloperr commented Dec 1, 2026 •

Copy link
Copy Markdown
Contributor

What: Give the G16 render FS notifier its own ASC-cached page while keeping the TA notifier uncached. Firmware writes TA and FS service stamps to the queues' uncached user-stamp cells, and the driver reads those cells for completion, progress, and recovery. Recovery still synchronizes the cached FS firmware stamp before using it as a fallback.

main already carries FS→FS barrier elision and fs_order accounting from #3499. #3483 carries TA→TA barrier elision and the 140 µs compute fan-out threshold. This branch merges cleanly with #3483 at ba4bc3220354.

Tested: J773g (M4 Mac mini, firmware 26B123) on the original notifier-only commit 2d9701fef93a against #3503 at 09d84a54. The isolated A/B/B/A runs measured time per submission on Borealis Mesa 285776c6af and gpubench-vk 868b0644.

Workload Change in time per submission
render.light tri d8/d16/d64 −2.7% to −4.3%
render.postfx msaa4 1080p d1/d2 −2.9% / −3.2%
render.bindless_ubo d2 −2.6%
render.shadow d32f depth-only d2 −3.5%

No measured workload slowed down. At da2e37b07cec, the Asahi M4 host suite passed 26/26, strict checkpatch passed, and the Asahi DRM driver cross-compiled for AArch64 with G16 enabled and produced the same compiler warnings as main.

Risk: two-way door · Macs using the G16 render backend, including M4 and supported M3 variants. If firmware fails to maintain the cached notifier record, render completion can stall.

Not yet: A hardware row at da2e37b07cec, a J516s (M3 Pro) row, and a second G16 chip row (T6040/T6041).

The firmware reads and updates the render notifier records (TA at +0,
FS at +0x200 of one page) around every finished TA and FS pass. G16
maps that page uncached, so each finished pass pays for uncached
firmware loads and stores on the path between passes. macOS 26B123
maps its notifier records ASC-cached and keeps the service stamps in
separate uncached cells, as G16 already does for compute.

Give the FS record its own page, with the same layout, and map that
page ASC-cached. The host writes it only before the firmware first sees
it and never reads it back. The TA record stays on the uncached page:
with it ASC-cached too, the firmware stores the FS service stamp of
five-pass depth-only renders later, and render.shadow d16 depth-only
d2 is 3.8 % slower.

Move the TA and FS service stamps from the notifier page to the TA and
FS queues' own uncached user-stamp cells, and read them there
everywhere the driver reads a render service stamp: the render receipt,
the oldest-stamp check, the progress (hang) check, the recovery
snapshot and the hang report. Drop the reads of the records' context
words from the render receipt, as compute does: the service stamps are
device-wide draw stamps, so a stamp equal to a flight's target names
that flight.

On the J773g (M4 Mac mini), against the parent (four boots per arm
pair, A/B/B/A, microseconds per submission): render.light tri
d8/d16/d64 -4.3/-2.7/-3.8 %, render.postfx 1080p MSAA4 d1/d2
-2.9/-3.2 %, render.bindless_ubo d2 -2.6 %, render.mdi d4 -1.6 %,
render.shadow d32f depth-only d2 -3.5 %, render.shadow d16 depth-only
d2 unchanged.

Signed-off-by: DjDeveloperr <hey@djdev.me>
Every render's TA work goes on the one firmware TA ring and its FS work
on the one FS ring, and each ring runs its works one at a time, in ring
order. Behind a render of the same VM, g16 still posts a barrier on the
previous TA's stamp ahead of each TA and, for a render that names an
earlier render, a barrier on that render's FS stamp ahead of its FS.
The rings' order already holds both: TA(N) starts only after TA(N-1)
has ended, and FS(N) only after every earlier FS has finalized. macOS
posts neither barrier: its TA ring holds no barriers at all, and its FS
ring holds only each pass's wait on its own TA. A barrier the firmware
reaches before its producer has finished parks the ring until a later
event, which adds to the turnaround of every pipelined render.

Make the barrier plan once every InitBM producer is known, and leave
out the TA->TA and FS->FS barriers when the previous render on the
rings belongs to the same VM and neither side carries InitBM. The TA
wait on an earlier FS stays: a vertex half may read what an earlier
fragment half wrote, or tile into attachments an earlier render still
owns, and the TA ring does not order a TA after an earlier FS. Renders
behind another VM's render, every InitBM case and the waits on compute
keep their barriers.

On J773g, a lab build that left out the same two barriers ran
bindless_ubo, postfx and render.light at depth 2 1-2 % faster over two
boots, with every CRC correct and no faults. The publication selftest
covers the plan with and without InitBM, and checks that it is made
after every InitBM producer.

Signed-off-by: DjDeveloperr <hey@djdev.me>
@DjDeveloperr
DjDeveloperr requested review from a team as code owners December 1, 2026 04:17
@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 Dec 1, 2026
@github-actions

github-actions Bot commented Dec 1, 2026 •

Copy link
Copy Markdown

Merge readiness at da2e37b0: not ready yet

Check Detail
CI at head running running: apple-build, host-tests, KUnit plan
Review no needs one approving review from Core or Omarchy Mac (not the author)
Requested changes ok none
Hardware row at head ok in the PR body at da2e37b0
Conflicts ok none
PR text ok Risk: two-way · Macs using the G16 render backend, including M4 and supported M3 variants. If firmware fails to maintain the cached notifier record, render completion can stall.

Areas: area:gpu

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

@RyanTheTide
RyanTheTide changed the base branch from perf/g16-fw-cache to main December 1, 2026 07:03
…ings"

This reverts commit 797fe30.

Signed-off-by: DjDeveloperr <hey@djdev.me>
Signed-off-by: DjDeveloperr <hey@djdev.me>
@DjDeveloperr DjDeveloperr changed the title drm/asahi: g16: cache the render FS notifier and leave same-VM render order to the rings drm/asahi: g16: map the render FS notifier record ASC-cached Dec 1, 2026

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

FINISH, then merge at da2e37b07cec. I found no code blocker. CI is pending. The J773g measurements are from 2d9701fef93a; hardware results at the reviewed head are still outstanding.

The diff against 429e7e15f122 is confined to the FS notifier split and its service stamps. It preserves #3499’s fs_order accounting and leaves #3483’s TA ring ordering alone. TA work still uses the uncached notifier. All host reads of render service stamps, including recovery and hang reporting, use the uncached queue cells. Both recovery fallback paths still call sync_for_cpu(0, 4) before reading the separate FS firmware stamp.

All 26 asahi-m4 host tests passed. One coverage gap remains in check-abi-26b123.rs (lines 129 and 414): both notifier bases are identical, so selecting the TA page for FS would pass. A separate host check with distinct notifier and stamp addresses verified the encoded pointers on G15S and G16G. Using distinct addresses in a checked-in assertion would preserve that coverage.

@DjDeveloperr

Copy link
Copy Markdown
Contributor Author

J773g (M4 mini, G16G B0) hardware row at da2e37b07cec975880630aae03b3d58ded319aa2: PASS.

One-shot boot of 7.3.0-ARCH-m4kpr3724-da2e37b07cec; the loaded aurora.ko build ID 6e483dd1d973319f2c6d1d2ea43c1b29cafb6e93 and module SHA-256 matched the kit. All 10 pinned GPUBench Vulkan CRCs matched across two passes of compute.uber, render.postfx (depths 1 and 2), render.bindless_ubo, and render.deferred. SLC enabled on both planes. GPU faults, recoveries, and hang kills: 0 each. Saved stock 7.3.0-ARCH-m4mainefed1ae3 verified with 0 failed units.

@github-actions github-actions Bot added ci-failing A check failed at the PR head (bot) and removed needs-hw-row No hardware row at the PR head (bot) labels Dec 1, 2026
@DjDeveloperr

Copy link
Copy Markdown
Contributor Author

J516s (M3 Pro, T6030, G15S B1) second-generation GPU smoke at da2e37b07cec975880630aae03b3d58ded319aa2 passed.

One-shot boot of 7.3.0-m3-maint-gda2e37b07cec with its J516s DTB and the stock command line. The loaded aurora.ko build ID 577313a5fedde7aa6819549e00f3d017e0f22b0c matched the staged module. The installed and staged SHA-256 both matched 9913774f9509d8c9075840aca34491755710c3a0bfa86e649b32a74e40dbb875.

Both GPUBench Vulkan passes matched all 10 pinned CRCs for compute.uber uniform d4, render.postfx MSAA4 d1/d2, render.bindless_ubo 512 d2, and render.deferred tile MSAA4 d2. SLC was enabled on all six MCC planes. GPU faults, recoveries, hang kills, and quarantined owners were all zero.

Stock 7.3.0 handback verified with MCC passing, Wi-Fi up, zero failed units, and an empty GRUB environment.

@github-actions github-actions Bot removed the ci-failing A check failed at the PR head (bot) label Dec 1, 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.

Approve at da2e37b under the merge bar. G16 perf change with two-generation exact-head rows (J773g M4 mini and J516s M3 Pro: 10/10 pinned CRCs, SLC intact, 0 GPU faults), an independent review, host selftests 26/26 and no failing checks.

@DjDeveloperr
DjDeveloperr merged commit 352cd95 into main Dec 1, 2026
6 of 13 checks passed
@DjDeveloperr
DjDeveloperr deleted the perf/g16-m4-render-k1-fs-notifier branch December 1, 2026 10:21
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