Repository navigation
drm/asahi: g17: scale the tiler heap's normal maximum with memory - #2186
jgoyvaerts wants to merge 1 commit into
Conversation
The tiler heap of a 25G83 render grows on the host only: the driver does not let the firmware grow it mid-render, as macOS doesn't for a pass that can partial-render. The host grows it before a render to three times the last high-water, capped at the heap's normal maximum, which also goes to the firmware in BM+0x80. A scene larger than that cap partial-renders on every frame. That cap is 0x45e (1,118 blocks, 140 MiB) on every NEO-layout heap. It is macOS's value on an 8 GiB Mac: macOS 25G83 scales the limits with memory (halGetDefaultParameterBufferSizeMax). The maximum is a twentieth of the memory, at least 192 MiB, in whole groups of 129 blocks, and a queue's pre-render growth and BM+0x80 are capped at a third of it. That gives 3,354 and 1,118 blocks with 8 GiB, the A18 Pro's TVB_BLOCK_SLOTS and NORMAL_MAX_BLOCKS, and 19,737 and 6,579 with 48 GiB, the BM+0x7c and BM+0x80 macOS writes on a 48 GiB M4 Pro (J616s). Derive the normal maximum from memory the same way, up to the block table's TVB_MAX_BLOCKS. The memory is si_meminfo()'s, as for the M5 heap (shared helper). It is below the installed amount macOS reads, so the 8 GiB value stays the floor and the A18 Pro keeps 1,118. A 24 GiB Mac gets 3,311, 32 GiB or more 3,353, the value aurora-silicon#2021 sets for the M4 Max by hand. The A18 Pro's mesh floor keeps 1,118. On the J616s (M4 Pro, 48 GiB, 25G83), an off-screen GLES test draws N screen-spanning triangles into a stored 3456x2234 RGBA8 + D24S8 target and waits for each frame. Before, a triangle cost 3.0 us up to N = 14,500 and 9.7 us from N = 15,000, on every frame. With this change, 3.0 us holds up to N = 40,000: N = 20,000 takes 55 ms a frame instead of 193 ms, N = 30,000 83 ms instead of 281 ms. Above 3,353 blocks it partial-renders as before. macOS on the same Mac keeps its 2.9 us up to its 6,579-block cap. Signed-off-by: Jonathan Goyvaerts <jonathan.goyvaerts@gmail.com> Assisted-by: LLM
|
The production boot stub pins at macOS 27.2 (26B123), so please retarget this to 27.2. The heap sizing is measured and tested on the 26.6.2 (25G83) GPU firmware; please run the same tiler test on the J616s under the 27.2 stub and show the BM+0x80 value it takes there. |
|
Blockers: 2.
The rest of the change is sound:
HW row: the 27.2 tiler row already requested on the J616s. On the same head, run J700 (A18 Pro, 8 GiB) and check that Assisted-by: LLM (Claude:Opus 5.5) |
|
Superseded by #2724, rewritten as requested: the normal maximum is now a 64th of si_meminfo() memory clamped to NORMAL_MAX_BLOCKS..=TVB_MAX_BLOCKS, justified from our BM+0x80 reads and the sweep; commit carries only the Signed-off-by. |
On 25G83 only the host grows the tiler heap: the driver keeps the firmware from growing it mid-render. Before a render, the host grows it to 3x the last high-water, capped at the heap's normal maximum. That cap also goes to the firmware in
BM+0x80. A scene bigger than the cap partial-renders on every frame.The cap is
0x45e(1,118 blocks, 140 MiB) on every NEO-layout heap. That is macOS's value for an 8 GiB Mac. macOS 25G83 scales the limit with memory (halGetDefaultParameterBufferSizeMax):BM+0x80.TVB_BLOCK_SLOTSandNORMAL_MAX_BLOCKSBM+0x7c/BM+0x80written by macOS 26.6.2 on a 48 GiB J616s (live read)The closed form matches an emulation of the kext's integer arithmetic on 200,000 memory sizes.
This change derives the normal maximum from memory the same way, up to the block table's
TVB_MAX_BLOCKS:si_meminfo(), as for the M5 heap; the helper is now shared.si_meminfo()reports less than the installed amount macOS reads, so the 8 GiB value is the floor. The A18 Pro keeps 1,118.tvb_normal_blocksfield.Tested on the J616s (M4 Pro, 48 GiB, 25G83)
The test is off-screen GLES: N screen-spanning triangles into a stored 3456x2234 RGBA8 + D24S8 target, waiting for each frame (
glFinish). 0 GPU recoveries."After" is our m4.166 test kernel. It also carries #1902 and #1986, which only change pairs that never go idle and so don't affect this test. KUnit asahi suites 698 of 699, one skipped (needs
CONFIG_UCLAMP_TASK).tools/asahi/run-host-tests.py --only g1790/90.#1902 / #1986 on the M4 Pro
The same test with two frames in flight, so the pair never idles, measures #1902 + #1986:
g17_busy_tvb_grow=0)#1986 asks for a heavier scene to measure this on 25G83; this is one.
Not done
🤖 Generated with Claude Code