Repository navigation
borealis: native preambles on M3 when the firmware takes the spill-carrying launch - #1335
Conversation
…HAL200 firmware G15 (M3) kept native constant programs and preambles off because the G15 command-stream generation (RTKit 2419) has no thread-invariant spill field in its direct compute launch. That is a property of the legacy firmware. On macOS 27 firmware the kernel reports DRM_ASAHI_GPU_HAL_200 for G15G, the same condition agx_stream_sampler_state() keys on, and the HAL200 launch layout is accepted for every launch, including ones that carry spill. Key the decision on the firmware instead of the chip: - agx_dev_g15_hal200() / agx_dev_native_preamble() in agx_device.h decide per device; the Vulkan driver's preamble, constant-program and uniform-export sites use them. - agx_chip_supports_cprog() says the hardware can carry a constant program (the qualified chips plus G15*); the Ioto packers and validators use it, the device decides. - The compute launch takes a g15_hal200_launch flag, set per dispatch from the device, which selects the HAL200 layout on G15. Without it G15 keeps the legacy layout and refuses spill, byte for byte as before. Legacy G15 firmware (J516s M3 Pro reports HAL_LEGACY) is unchanged. The Gallium driver keeps its current path; it gets the same change with its own rows. Measured on J615 (MacBook Air M3, G15G, macOS 27.2 firmware) with an earlier arm of this change: 12,369 CTS cases Pass -> Pass, 0 GPU faults; constant programs engage (a uniform-heavy compute shader's main program drops from 130 to 11 instructions). Signed-off-by: Ryan Murray <81541646+RyanTheTide@users.noreply.github.com>
…LAUNCH Both M3 firmwares report DRM_ASAHI_GPU_HAL_LEGACY, so the HAL generation cannot tell the 27.2 firmware from the legacy one, and reporting HAL200 would also turn on the separately-qualified sampler stream path. The kernel instead reports a dedicated bit where the firmware takes the spill-carrying compute launch (the g16 runtime's T8122 row). Key agx_dev_g15_spill_launch() (renamed from agx_dev_g15_hal200()) on that bit, mirror the define, add a drm-shim switch (ASAHI_SHIM_G15G_TI_SPILL_LAUNCH) and a predicate test covering the bit present and absent, legacy G15S and the qualified chips. Signed-off-by: Ryan Murray <81541646+RyanTheTide@users.noreply.github.com>
|
Note for the merger: the first commit (90b8557) says the kernel reports |
There was a problem hiding this comment.
Verdict: MERGE at 0ca230974b78
Blockers: None (coordinate with aurora-silicon/linux#3603 — Borealis safely ignores bit 47 until the kernel reports it — and squash-merge using the PR description so commit 90b8557a's superseded HAL_200 premise does not land in history).
Checked:
- uAPI & device capability (
include/drm-uapi/asahi_drm.h,agx_chip.h,agx_device.h,asahi_noop.c): MirrorsDRM_ASAHI_FEATURE_COMPUTE_TI_SPILL_LAUNCH(bit 47, matchinglinux#3603with no bit collisions), cleanly separates hardware capability (agx_chip_supports_cprog()) from device/firmware enablement (agx_dev_g15_spill_launch()/agx_dev_native_preamble()), and addsASAHI_SHIM_G15G_TI_SPILL_LAUNCH. - Direct launch packing & Borealis Vulkan wiring (
agx3_compute_program_core.{c,h},hk_agx3_ioto_program_core.{c,h},hk_cmd_dispatch.c,hk_cmd_draw.c,hk_shader.{c,h}):agx3_g17p_native_compute_launch_pack()switches G15 onto the HAL200 direct compute launch (includingword1TI spill reservation and 1D subkernel masking) only whenprogram->g15_hal200_launchis set; without the feature bit, legacy G15 packing and spill refusal are byte-identical to before.- All Borealis Vulkan preamble, constant-program, uniform-export, precompiled, fused, and direct compute dispatch sites consistently query
agx_dev_native_preamble(&dev->dev)/agx_dev_g15_spill_launch(&dev->dev). - Unit tests (
test_g15_hal200_launch,asahi-agx-dev-native-preamble, updatedtest-hk-m5-vs-cprog.candtest-hk-agx3-ioto-program-core.c) cover both bit-set and bit-absent paths.
- Exact-head two-generation hardware evidence (
0ca23097):- J615 (M3 G15G) with
linux#3603: CProg 11/11 onubo.random.16bit.all_out_of_order_offsets.1*, 16,254/16,254 CTS Pass -> Pass, 0 regressions, 0 GPU faults; without bit on stock Edge kernel: CProg 0, 16,254 Pass -> Pass. - Neo (G17P): 16,475/16,475 CTS Pass -> Pass, 0 regressions.
- J615 (M3 G15G) with
- Checked for Apple material, tool attribution, private serials, and gating: clean.
Evidence
- Head:
0ca230974b78(base: aurora-wip,mergeable: MERGEABLE,+344/-77across 22 files). - Non-blocking note: in
hk_g17p_append_indirect_launch()(src/asahi/vulkan/hk_cmd_dispatch.c:1633-1638),helper_program.launch.g15_hal200_launchis leftfalse, so the 1x1x1 grid-helper direct launch still packs the legacy G15 format (safe today since the grid helper hasword1 == 0, but worth threadingagx_dev_g15_spill_launch(&dev->dev)in a follow-up for consistency with all other G15 direct launches).
DjDeveloperr
left a comment
There was a problem hiding this comment.
Hold at 0ca230974b78.
- Bit 47 advertises a direct CDM launch layout.
agx_dev_native_preamble()also releases the G15 vertex CProg path inhk_allow_vs_cprog(), fragment preambles inhk_compile_nir_impl()andhk_prepare_local_read_nir(), and render epilog uniform exports inhk_cmd_draw.c. The kernel says nothing about those render paths. Keep the new capability scoped to compute, or qualify and gate the render paths independently. hk_g17p_append_indirect_launch()passeshelper_program.launchdirectly to the indirect dispatch packer. That packer emits a direct helper launch and bypasses the new wrappers that setg15_hal200_launch. Zero spill does not establish layout equivalence because the legacy and HAL200 layouts also place address and control fields differently. Pass the capability through to the direct helper and verify the emitted packet with bit 47 present and absent. Include one J615 indirect workload that exercises that helper.
The mirrored UAPI bit has no collision on this base. Both shader cache identities already include the feature mask.
…direct helper Review of the first version: DRM_ASAHI_FEATURE_COMPUTE_TI_SPILL_LAUNCH says the firmware takes a direct compute launch layout. It says nothing about render work, but agx_dev_native_preamble() also released the vertex constant program, fragment preambles and render epilog uniform exports on G15. And the indirect dispatch's geometry helper, a direct launch, went to the packer without the per-dispatch layout flag. - Rename the device predicate to agx_dev_native_compute_preamble() and use it only where the compile or launch is compute. The vertex, fragment and epilog-export sites go back to agx_chip_native_preamble(), so G15 forms a preamble only for a compute kernel. - hk_agx3_g17p_native_indirect_compute_dispatch_append() takes the flag and gives it to the main program and to the helper. - test_g15_hal200_launch also packs an indirect dispatch: a helper that reserves spill is refused without the flag and packs the HAL200 words with it; a helper without spill keeps the legacy layout. Signed-off-by: Ryan Murray <81541646+RyanTheTide@users.noreply.github.com>
There was a problem hiding this comment.
Verdict: FINISH at 7186c68.
The delta restores the chip-table gate for vertex constant programs, fragment preambles and epilog exports. The indirect dispatch now sends the device capability to the geometry helper, and the packing test checks the helper record in both launch formats.
Please provide an exact-head J615 indirect-dispatch result that exercises this geometry helper with bit 47 enabled, plus a stock-kernel control, and report the targeted host packing test result. The published 0ca2309 rows predate the helper layout fix. Please also update the PR description before it becomes the squash message. It still names the old helper and says the new capability applies to uniform export sites. Describe the compute-only scope and the indirect geometry helper there.
|
Review fixes (7186c68), answering Dj's two findings at 0ca2309:
Host tests: 328 Ok / 26 Fail, the base set; compute-program-core 586 checks. J615 row at the paired heads (one-shot linux#3603 kernel, dead-man armed, back on saved Edge after; base 06e34ec vs 7186c68):
Absent-bit (stock Edge) and Neo G17P rows are as in the description; the render paths they cover are unchanged by this commit. Traces: traces/gpu/20261129-gpu-ungate-g15hal/j615 (this run), .../j615-0ca23097 (previous head). |
|
Requested items, all at exact head 7186c68:
|
|
J713 (M4 Air, G16G) no-change row at 7186c68, saved fleet85 kernel, isolated ICDs, base 06e34ec: 6,497 Pass -> Pass, 3,316 NS -> NS, 3 DeviceLost -> DeviceLost (pre-existing on this old kernel, same cases on both arms), 0 regressions. Restored: Enforcing, 0 failed units. The old kernel cuts the list short, as it did for the base. That makes three generations for the shared code: G15G (feature on and off), G16G, G17P (Neo). Traces: traces/gpu/20261129-gpu-ungate-g15fw/j713-g16g. |
There was a problem hiding this comment.
Verdict: MERGE at 7186c689.
Blockers: The prior review findings are resolved. Keep hosted CI and land Mesa ahead of Linux #3603, which exposes the feature bit.
Checked: The compute-only predicate leaves the render call sites on the existing chip capability. Indirect dispatch passes the launch flag to both the main program and geometry helper. The squash description now matches both paths. The stock-kernel control exercises the legacy path before the kernel advertises the feature.
Evidence
- J615 on the paired kernel: 24 indirect workload passes on both sides, zero failures, and constant programs on 60/60 compute shaders with the change.
- J615 on stock Edge: 24 indirect workload passes, zero failures and constant programs on 0/60 shaders. The wider CTS list retained 16,254 passes.
- Reported host packing: 586 checks passed, including both helper layouts. J713 G16G retained 6,497 passes and the three pre-existing device losses.
- #1335 (comment)
- #1335 (comment)
M3 (G15) kept native constant programs and preambles off because the legacy G15 firmware (RTKit 2419) has no thread-invariant spill field in its direct compute launch. The 27.2 firmware does: J615 takes the HAL200-form launch for every dispatch. That's a firmware fact, not a chip one, so this keys it on the firmware, for compute only. It needs aurora-silicon/linux#3603, which reports
DRM_ASAHI_FEATURE_COMPUTE_TI_SPILL_LAUNCH(bit 47) from the g16 runtime's T8122 row. HAL reporting and the sampler-stream path stay as they are.What changes
agx_dev_g15_spill_launch()(agx_device.h) is true for G15 when the kernel reports the bit.agx_dev_native_compute_preamble()is the chip table's qualified chips plus that.no_preamblefor compute kernels,hk_agx3_compute_cprog_supported(), andhk_g17p_compute_shader_supported().hk_allow_vs_cprog()), fragment and local-read preambles, and epilog uniform exports stay onagx_chip_native_preamble().agx_chip_supports_cprog(): the hardware can carry a constant program (qualified chips plus G15*). The Ioto packers and validators use it, and the device decides whether to form one.g15_hal200_launchflag from the device. The direct dispatch wrappers and the indirect dispatch's geometry helper (hk_agx3_g17p_native_indirect_compute_dispatch_append()) both pass it.ASAHI_SHIM_G15G_TI_SPILL_LAUNCH).test_g15_hal200_launch: direct and indirect (helper) launches. Spill is refused without the flag; with it, the HAL200 words; without spill, the legacy layout.asahi-agx-dev-native-preamble: the bit present and absent, legacy G15S, G16G/G17P/G14G.Rows at 7186c68 (base aurora-wip 06e34ec)
Host tests: 328 Ok / 26 Fail, the same 26 as base.
asahi-agx3-compute-program-corepasses 586 checks, including the indirect helper packing;asahi-agx-dev-native-preamblepasses 9.J615 (M3 G15G), one-shot of the linux#3603 kernel (
7.3.0-aurora-ungg15tis+, dead-man armed, back on saved Edge after):ubo.random.16bit.all_out_of_order_offsets.1*compute.pipeline.indirect_dispatch.*(geometry helper path)Control, J615 on the stock Edge kernel (no bit): identical to base. CProg 0/60 on indirect_dispatch (24 P / 0 F), CTS 16,254 Pass -> Pass.
gpubench-vk, interleaved A/B on the paired kernel: neutral, within about ±1% except render.bindless_ubo d2 +2.9% time. compile.pso is +8.7% (2.7 -> 2.9 ms), the constant-program compile. This puts M3 compute on the G16G/G17P path; it is not a measured speedup on these benches.
Neo, G17P (second generation, shared packer/launch code), at 0ca2309: 16,475 Pass -> Pass, 0 regressions. 7186c68 only narrows G15 behaviour and adds the indirect flag, which is false off G15.
J713 (G16G): row to follow when the Mac is free.
Machines restored to their saved defaults (Enforcing, 0 failed units). Traces: traces/gpu/20261129-gpu-ungate-g15hal/j615, traces/gpu/20261129-gpu-ungate-g15fw/j615-g15g-stock-7186c689, traces/gpu/20261129-gpu-ungate-g15fw/neo-g17p.