Repository navigation
drm/asahi: g17: grow a busy render pair's tiler heap ahead of the render - #1902
Conversation
DjDeveloperr: drm/asahi: g17: grow a busy render pair's tiler heap ahead of the render
|
Thanks for this. Growing a busy pair's heap ahead of the render looks like the right shape. Two points, in line with how we select behaviour elsewhere in the tree:
We can run rows on our A18 Pro and M4 Pro for the wider default. The branch also needs a rebase. |
The host grows a render pair's tiler heap ahead of a render only when the render is submitted to an idle pair: host_growth_target() returns early while the pair has work in flight, and leaves growth to the firmware. A pair that is never idle, because renders are queued back to back, keeps the heap its first render left. The next tiling pass then waits for the previous scene's pages to be freed instead of growing, so tiling and the previous fragment pass run one after the other. One drain of the pair is enough to size the heap for two scenes, after which they overlap. Grow a busy pair's heap ahead of the render as well, through the path a firmware grow request already takes while work is in flight: - the target is the layout's blocks (with the mesh floor), or the automatic target from the page high-water (three times the high-water once twice it no longer fits), capped at the heap's capacity. The high-water is read without requesting its reset, so the idle growth check and the shrink period keep their samples; - prepare_growth() without a descriptor snapshot, then commit_growth(): new blocks are appended to the inventory ring after the committed cursor and published by advancing it. The firmware-owned page list, PB state and PB descriptor are left alone and existing blocks never move. The firmware takes the new blocks without a grow reply; - the growth is skipped while the device's GPU memory, or the client's, would come within an eighth of its limit. A growth that cannot be prepared or committed keeps the heap and publishes the render as before. Either case retries a shrink period later; - the idle shrink may give busy growth back down to the size the heap had before it. That growth only serves renders in flight together. This applies to every heap of the block geometry the A18 Pro and the M4 Pro and Max share. M5 heaps have their own geometry and are never shrunk, so they keep growing on idle submissions only. Report every tiler heap size change through the asahi_g17_message tracepoint as kind 3: source << 56 | changed << 48 | blocks before << 24 | blocks after, with source 1 an idle host growth, 2 a busy host growth (changed 0: refused or failed), 3 a granted firmware request, 4 a refused or capped one and 5 a shrink. On the A18 Pro, rt.scene raster at queue depth 2 ran about 18 % faster in the first measurement of this change: the heap grows within the first frames instead of waiting for a drain. The light and medium presets were unchanged. Signed-off-by: Diljit Singh <hey@djdev.me>
7771d2f to
6d406e1
Compare
|
@RyanTheTide thanks, both points are addressed in 6d406e1 (rebased onto integration/aurora cc14570):
Neo A/B of the reworked change (same kernel source, built together, one-shot boots): rt.scene raster d2 148.8 -> 177.1 fps (+19.0 %, W vs macOS 0.927 -> 1.103), the other rt.scene presets and render rows within spread, 0 GPU error lines. Details in the description. Still open: a CTS render subset on the Neo (next slot) and, if your offer stands, the M4 Pro rows on 26B123. Assisted-by: LLM (Claude:Opus 5.5) |
|
Looks good; approve once the CTS render row and the 26B123 row are posted. I checked the busy path from start to finish.
HW row: Neo (J700) kernel B (this head on e0ee46a): a dEQP-VK/GLES render subset with pass/fail counts equal to kernel A. J616s or J616c on 26B123: the same rt.scene raster d2 A/B with 0 GPU faults, recoveries and timeouts. Both rows also need 0 AVC, 0 failed units and 0 new kernel errors. Assisted-by: LLM (Claude:Opus 5.5) |
On the A18 Pro (G17P), the host grows a render pair's tiler heap ahead of a render only when the render is submitted to an idle pair:
host_growth_target()returns early while the pair has work in flight. A pair that never goes idle, because renders are queued back to back, keeps the heap its first render left. The next tiling pass then waits for the previous scene's pages to be freed instead of growing, so tiling and the previous fragment pass run one after the other. One drain of the pair is enough to size the heap for two scenes, and from then on they overlap.The firmware grow path already grows a busy pair safely: it appends blocks to the inventory ring and advances the committed cursor, and leaves the firmware-owned page list, PB state and PB descriptor alone. This change:
prepare_growth()without a descriptor snapshot, thencommit_growth()). The target is the layout's blocks (with the mesh floor), or the automatic target from the page high-water, capped at the heap's capacity. The high-water is read without requesting its reset, so the idle growth check and the shrink period keep their samples;busy_base), since that growth only serves renders in flight together;BlockGeometry::NEO). M5 heaps have their own geometry and are never shrunk, so they keep growing on idle submissions only;asahi_g17_messagetracepoint as kind 3:source << 56 | changed << 48 | blocks before << 24 | blocks after. Source 1 is an idle host growth, 2 a busy host growth (changed 0 means refused or failed), 3 a granted firmware request, 4 a refused or capped one, and 5 a shrink.Changes since the first version (review of 11-19)
host_growth_target(), the Makefile and the M5Variant).aurora.g17_busy_tvb_growandbusy_tvb_grow.care gone.Variant::busy_heap_growthis gone. Busy growth follows the heap geometry, so the M4 Pro and Max (25G83 and 26B123) get it too. drm/asahi: g17: grow busy tiler heaps on the 25G83 firmware too #1986 ran it on the J616c (25G83) for about 13 hours without GPU faults, recoveries or timeouts, and jgoyvaerts measured it on the J616s (25G83) taking a never-idle 10,000-triangle frame from 109 ms to 27.5 ms there (see drm/asahi: g17: grow busy tiler heaps on the 25G83 firmware too #1986). 26B123 has not run it yet.Testing
Neo (J700, A18 Pro, G17P B1), same-machine kernel A/B, 2026-11-21.
7.3.0.pg1902a #1 SMP PREEMPT_DYNAMIC Sat Nov 21 03:41:03 EST 2026, aurora.ko sha256 c3abe521…;7.3.0.pg1902b #1 SMP PREEMPT_DYNAMIC Sat Nov 21 03:29:50 EST 2026, aurora.ko sha256 5518a109….render.heavy fill d2-d64 reads 1.0-1.8 % slower in B. That is thermal drift across the slot, not the change: the passes ran A1, A2, B1, B2 and fill d8 went 609.8, 621.9, 621.9, 629.7 µs, while the GPU time of each render stayed at 610.8-611.3 µs. The raster frame went from 6.72 to 5.64 ms with the raster pass's own GPU time unchanged (6762 vs 6768 µs): the gain is overlap, as intended.
Health over both boots (25 min of rows each): kernel GPU error lines 0 (no faults, recoveries, timeouts or lost devices; one kernel line per window, not GPU), AVC 0, failed units 0, GPU liveness (vulkaninfo + a dEQP-VK compute dispatch) passed at the start and end of each boot.
Still to run before merge: a CTS render subset on B (Neo, next slot), and the M4 Pro rows on 26B123 (Ryan's offer in the review).
Assisted-by: LLM (Claude:Opus 5.5)