Repository navigation
borealis: use 48 KiB tile buffers where the kernel admits them - #1194
Conversation
A render's tile buffer on chips with the native imageblock was capped at 32 KiB. With the five render targets of a 4x deferred G-buffer pass (24-byte samples) that leaves 16x16 tiles, so the pass bins four times the tiles of a single-sample one, and its vertex phase took 66 us instead of 35 us on J773g for the same 8192 triangles. Kernels that report DRM_ASAHI_FEATURE_TILE_BUFFER_48K admit 48 KiB tile buffers. When the bit is set, a 4x layout that then takes 32x16 tiles with every target resident uses that budget: the deferred pass above. Other layouts keep the 32 KiB budget. Taken for every layout, the larger budget mostly keeps more targets of a spilling layout resident, in shapes the native background and end-of-tile programs refuse: eight 2x RGBA32 targets keep six resident where they take four, and the render fails with VK_ERROR_FEATURE_NOT_PRESENT. Kernels without the bit keep today's layouts. The fragment SPECLM imageblock record refused any tile over 32 KiB, which also refused the background program of such a pass. Its encoding is the same for 48 KiB, so let it take up to the 48 KiB budget; the tilebuffer layout already keeps a render within what its kernel admits. A new test checks the 32x16, 24-byte, 4x record against our own trace of that pass on J773g and that larger tiles stay refused. Signed-off-by: DjDeveloperr <hey@djdev.me>
|
Verdict at I found no blocker. Without the new feature bit, every layout and every record is byte-identical to before. With the bit, the wider budget is taken for one shape only: 4x, 32x16 tiles, nothing spilled. The SPECLM record for that shape matches the macOS trace. Blockers none Checked
Merge gates
Evidence |
hk_tilebuffer_layout() builds a layout with the 48 KiB budget when the kernel reports DRM_ASAHI_FEATURE_TILE_BUFFER_48K and keeps it only when it is 4x, 32x16 and spills nothing. Pin the layouts it chooses between: the 4x G-buffer targets of a deferred pass take 16x16 tiles at 32 KiB and 32x16 at 48 KiB with nothing spilled, while eight 2x RGBA32 targets spill under either budget, with four of them resident at 32 KiB and six at 48 KiB. Signed-off-by: DjDeveloperr <hey@djdev.me>
RyanTheTide
left a comment
There was a problem hiding this comment.
Verdict: MERGE at 43bed29863dd
Blockers:
None in the code change. The paired kernel and stock-kernel peer results still need to be recorded before promotion.
Checked: Matched the feature bit, units and 48 KiB ceiling with linux#3339. The old-kernel path retains 32 KiB. The larger layout requires four samples, a 32x16 tile and no spill. The only change since the tested Mesa head adds a unit test for the 32/48 KiB layout and spill boundaries.
Evidence
The posted J773g paired-kernel CTS reports 19,678 passes and zero failures. The paired kernel's current head differs from the tested head. Carry its result only after checking equivalent runtime blobs, and record a no-bit peer run on the current stock kernel.
|
Merge status at |
|
J516s (MacBook Pro 16" M3 Pro, G15S) row at
|
What
On chips with the native imageblock, a render's tile buffer was capped at 32 KiB. The 4x G-buffer pass of
gpubench-vk render.deferred has five render targets, 24 bytes a sample, so it fit only 16x16 tiles. That is four
times the tiles a single-sample pass bins: on J773g its vertex phase took 66 µs, against 35 µs at 1x for the same
8192 triangles.
Kernels that report the new
DRM_ASAHI_FEATURE_TILE_BUFFER_48K(bit 46) admit tile buffers of up to 48 KiB. Whenthe bit is set, a 4x layout that then takes 32x16 tiles with every target resident uses the 48 KiB budget. Here that's
the deferred G-buffer pass.
encoding is the same for 48 KiB, so it now takes up to that size. The tilebuffer layout already keeps a render
within what its kernel admits.
AGX_NATIVE_TILE_BUFFER_BYTES,AGX_NATIVE_TILE_BUFFER_48K_BYTES). There's nochip check: the larger budget follows the kernel's feature bit.
Why only that shape: a first version took 48 KiB for every layout. Eight RGBA32 targets at 2x spill under either
budget, but at 48 KiB six of them stay resident instead of four. The native background and end-of-tile programs take
at most four raw 32-bit targets, so those renders failed with
VK_ERROR_FEATURE_NOT_PRESENT(15 CTS cases, below).Our trace of the same workload on macOS on J773g showed 32x16 tiles at 4x with 24-byte samples, a 48 KiB tile buffer,
and the same SPECLM record this change produces (
77 00 aa 06 43 00 00 00). The new test checks that record.The kernel side is the g16 change that admits 48 KiB and reports the bit: aurora-silicon/linux#3339.
Tested
J773g (M4 Mac mini, G16G B0), gpubench-vk 13 (ae90a40). Mesa overlay via
VK_DRIVER_FILES, Vulkan-only releasebuilds. Base
8ac326f31d4f(aurora-wip), candidate7a5a930e0727.Head
43bed29863ddadds a host unit test on top of the candidate and changes no driver code, so the rows below arefor the driver at head.
meson test --suite asahi212/212.Tilebuffer.NativeTileBuffer48KLayouts(new, at head) checks the two layouts the change chooses between. The 4xG-buffer targets take 16x16 tiles at 32 KiB and 32x16 at 48 KiB (exactly 49,152 bytes), both with nothing spilled.
Eight 2x RGBA32 targets spill under either budget, with four resident at 32 KiB and six at 48 KiB. Tilebuffer 21/21.
asahi-agx-ioto-state-core: the new SPECLM test passes. 32x16 / 24 B / 4x encodes the record above, and 64, 96and 56 KiB tiles are refused with the output untouched.
exactly two rows change, deferred tile msaa4 and dram msaa4, from 16x16 to 32x16 at 24 B/sample. Every other row
keeps its tiles.
On the paired kernel (
7.3.0-ARCH-m4kgtb48-2fc7c214, the g16 PR head, which reports bit 46), base and candidate:ms=4 tile=32x16 tib=24B.--jobs 1: 26,422 cases from renderpasses.*.{suballocation,dedicated_allocation}.{attachment,multisample},*attachment_allocation*, *local_read*, pipeline.monolithic.multisample, renderpasses.*.suballocation.formats
and *multisample_resolve*. Result: Pass 19,678, NotSupported 6,744, Fail 0. 0 kernel fault lines, GPU health clean.
Earlier A/B on a lab kernel with the same 48 KiB limit but no feature bit. It ran the first version of this change
(48 KiB for every layout), which gives both deferred passes the same 32x16 layout. Mirrored N T T N N T T N, 4 runs
per arm:
HK_FRAME_ANATOMY_TS=all), the vertex/tiling phase drops 66.2 → 47.5 µs (tile) and 68.2 → 42.2 µs(dram). Fragment time is unchanged, 293.4 → 293.9 µs.
renderpasses.*.multisample_resolve.r32g32b32a32_{sfloat,sint,uint}.max_attachments_8_samples_2. They failed aloneon it every time and passed on the base. This version keeps those layouts at 32 KiB, and the run above includes them.
Risk: two-way · Macs whose kernel reports
DRM_ASAHI_FEATURE_TILE_BUFFER_48K: M4 G16G with the paired g16 kernel. Without the bit nothing changes, including G17P (A18 Pro, whose g17 kernel backend keeps 32 KiB) and the M3 family until its kernel reports the bit.Not yet:
own row.