Skip to content

drm/asahi: g17: grow busy tiler heaps on the 25G83 firmware too - #1986

Closed
AxxzyWasTaken wants to merge 2 commits into
aurora-silicon:gpuperf/g17-busy-tvb-growfrom
AxxzyWasTaken:busy-tvb-25g83
Closed

AxxzyWasTaken wants to merge 2 commits into
aurora-silicon:gpuperf/g17-busy-tvb-growfrom
AxxzyWasTaken:busy-tvb-25g83

Conversation

@AxxzyWasTaken

@AxxzyWasTaken AxxzyWasTaken commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor

Stacked on #1902 (base: gpuperf/g17-busy-tvb-grow), so the diff shows only this commit.

#1902 grows a busy render pair's tiler heap ahead of the render on the A18 Pro firmware (26A428) and leaves 25G83, the firmware of the M4 Pro and the M4 Max, on idle growth only because it wasn't measured there. This turns it on for 25G83. 25F84, which takes the rest of its Variant from 25G83, keeps it off: nothing has run it there.

Tested on the J616c (M4 Max, 32 cores, 25G83):

Not shown: a speed-up. An off-screen A/B on the J616c, three runs each with aurora.g17_busy_tvb_grow off and on (run-time switch), stayed within its own run-to-run spread:

Benchmark (fps) off on
7,000 small draws, 1728x1116 862 / 990 / 1004 1354 / 1001 / 998
7,000 small draws, 3456x2234 829 / 964 / 1209 954 / 1277 / 1250
depth-only pass switch, 3456x2234 2660 / 2690 / 1884 2683 / 1943 / 1925
full-screen quads, 3456x2234 3536 / 3545 / 3446 3563 / 2307 / 2263

So this is the M4 Pro/Max side of #1902 for whoever can measure a heavier scene. aurora.g17_busy_tvb_grow=0 still turns it off at run time.

Assisted-by: LLM (Anthropic:Claude Opus 5.5)

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's grow requests. A pair that is never idle, because renders
are queued back to back, keeps the heap its first render left. On the
A18 Pro the next tiling pass then waits for the previous scene's pages
to be freed instead of asking for growth, 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 A18 Pro 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, 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.

The A18 Pro firmware build (26A428) takes it. The 25G83/25F84 builds,
where it is not measured, and the M5 heaps, which are never shrunk, keep
growing on idle submissions only. aurora.g17_busy_tvb_grow (0644,
default 1) turns it off at run time for an A/B.

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 runs about 18 % faster:
the heap grows within the first frames instead of waiting for a drain.
The light and medium presets are unchanged.

Signed-off-by: Diljit Singh <hey@djdev.me>
@jgoyvaerts

Copy link
Copy Markdown
Contributor

Measured on the 25G83 M4 Pro (J616s, 48 GiB), the heavier scene this asks for.

Test: off-screen GLES, N screen-spanning triangles into a stored 3456x2234 RGBA8 + D24S8 target. Two frames in flight (fences, no glFinish), so the pair never idles. Kernel m4.166 = this PR + #1902 + #2186:

N without (m4.164) off (m4.166, g17_busy_tvb_grow=0) on (m4.166)
3,000 31 ms not run 8 ms
10,000 109 ms 108 ms 27.5 ms

Without it, the busy pair keeps its first-frame heap for every frame (10.5-11 us per triangle). With it on, the heap grows within two frames, and later frames run at 2.75 us per triangle, the same as an idle pair. 0 GPU recoveries. It is now our daily kernel.

Past 1,118 blocks the cap is the next limit; #2186 scales it with memory.

@DjDeveloperr

Copy link
Copy Markdown
Contributor

Heads-up: per the review on #1902, its rework (6d406e1, force-pushed to gpuperf/g17-busy-tvb-grow) drops Variant::busy_heap_growth and applies busy growth to every NEO-geometry heap, so 25G83 (and 26B123) get it without this flag change. This PR's base branch moved under it. Your J616c run is cited in #1902's description as the 25G83 evidence; thanks for it.

Assisted-by: LLM (Claude:Opus 5.5)

Commit 7771d2f ("drm/asahi: g17: grow a busy render pair's tiler
heap ahead of the render") grows a busy render pair's tiler heap ahead
of the render on the A18 Pro firmware (26A428) only. 25G83, the
firmware the M4 Pro and the M4 Max (T6040, T6041) run, kept growing on
idle submissions only, because it was not measured.

Turn it on for 25G83. 25F84, which takes the rest of its variant from
25G83, keeps it off: nothing has run it there.

The J616c (M4 Max, 32 cores, 25G83) has run with it for about 13
hours, including a Minecraft session and the GL and Vulkan off-screen
tests, with no GPU faults, recoveries or timeouts.
aurora.g17_busy_tvb_grow=0 still turns it off at run time.

Not shown: a speed-up. An off-screen A/B on the J616c (7,000 small
draws per frame, full-screen passes, a depth-only pass switch; three
runs each with the run-time switch off and on) stayed within its own
run-to-run spread.

Signed-off-by: AxxzyWasTaken <axxzytte@gmail.com>
@RyanTheTide

Copy link
Copy Markdown
Contributor

Superseded. The #1902 rework (6d406e1) drops Variant::busy_heap_growth and applies busy growth to every NEO-geometry heap, so 25G83 and 26B123 get it without this flag change, and this branch now conflicts with its moved base. Nothing here is still needed on top of #1902; suggest closing this one and carrying the J616s 25G83 numbers from the 11-18 run over to #1902 as its 25G83 row.

Assisted-by: LLM (Claude:Opus 5.5)

@AxxzyWasTaken

Copy link
Copy Markdown
Contributor Author

Closing as superseded by #1902 (6d406e1 drops Variant::busy_heap_growth and enables busy heap growth for all BlockGeometry::NEO heaps, including 25G83/26B123). Both the J616c and J616s 25G83 rows are already recorded on #1902.

Assisted-by: LLM (Google:Gemini 4 Neon)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants