Repository navigation
drm/asahi: g16: map the render FS notifier record ASC-cached - #3724
Conversation
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>
|
Merge readiness at
Areas: Updated by pr-readiness on pushes, edits, reviews and comments, and on a schedule. Rules: merge policy · labels. |
…ings" This reverts commit 797fe30. Signed-off-by: DjDeveloperr <hey@djdev.me>
Signed-off-by: DjDeveloperr <hey@djdev.me>
DjDeveloperr
left a comment
There was a problem hiding this comment.
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.
|
J773g (M4 mini, G16G B0) hardware row at One-shot boot of |
|
J516s (M3 Pro, T6030, G15S B1) second-generation GPU smoke at One-shot boot of Both GPUBench Vulkan passes matched all 10 pinned CRCs for Stock |
RyanTheTide
left a comment
There was a problem hiding this comment.
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.
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.
mainalready carries FS→FS barrier elision andfs_orderaccounting from #3499. #3483 carries TA→TA barrier elision and the 140 µs compute fan-out threshold. This branch merges cleanly with #3483 atba4bc3220354.Tested: J773g (M4 Mac mini, firmware 26B123) on the original notifier-only commit
2d9701fef93aagainst #3503 at09d84a54. The isolated A/B/B/A runs measured time per submission on Borealis Mesa285776c6afand gpubench-vk868b0644.render.lighttri d8/d16/d64render.postfxmsaa4 1080p d1/d2render.bindless_ubod2render.shadowd32f depth-only d2No 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 asmain.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).