Repository navigation
accel/ane: run the T8132 (M4) Neural Engine on macOS 27.2 firmware - #2630
Conversation
On macOS 27.2 (26B123) iBoot preloads a T8132 ANE image with a different TEXT/DATA split than 26.6.2: TEXT 0xbc000 and DATA 0x2b0000, DATA at DVA 0x100_000b_c000 (as on T6050 and T8142 at 27.2). The T8132 platform pins the 25G83 sizes, so preflight refuses the hand-off with -EINVAL and the engine stays off on every M4 Mac that runs 27.2 firmware. - Let the H16 path pick the loader's build through next_build, as the H17 staged path already does: preflight and probe use the build whose preload sizes and IOVAs match the hand-off. - Let a preload rule carry the TEXT and DATA sizes it was made for (0 keeps the 26.5-27.0 sizes), and check the snapshots against them. - Add the T8132 27.2 build and its J713 profile. Its DATA has the 26A428 patchbay records and rewritten range 0x10 bytes earlier; GKTS and ECAP change on every boot, as on 25G83. The boot values are the T8132 25G83 ones. KUnit covers both T8132 builds (each admits only its own layout) and a rule that refuses snapshots of another size. Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
program_add128_slots_test checks that a program without a scratch segment gets no scratch binding, but it passes NULL for the binding and then reads its own uninitialized one. With the stack pattern-filled the check fails (scratch.index 0xfefefefe). Pass the zeroed binding to ane_h16_process_bindings() so the check tests what it says. Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
DjDeveloperr
left a comment
There was a problem hiding this comment.
Reviewed 8f2af6f. Approving the code:
- The build is selected by what the loader preloaded (
next_build, matched on the preload sizes and IOVAs), not by firmware version. - SoCs without
next_buildare unchanged. - A sized preload rule with 0 keeps the old sizes.
- The 27.2 profile is accepted only by its digest.
KUnit covers each T8132 build admitting only its own layout, and the program_add128_slots_test fix is a real uninitialized read.
Two things before merge:
- Overlap with my linux#2642 (J773g, the M4 mini). It adds the same mechanism under the same names:
ane_t8132_platform_26b123,next_build,ane_fw_platform_build(), the sized H16 rules,build_name. Both can't land as they are. Fine with this one going first; #2642 then rebases down to just the J773g 27.2 profile. - Rows. The J713 27.2 row (add-128 1000/1000 exact, MobileNet 16/16) and the J616s no-regression row are good. The build selection now also decides the 26.6.2 case on T8132, which is what the installer gives a J713 today. So it needs one T8132 Mac on the 26.6.2 stub (J604, J713 or J773g) with these modules:
H16 preload identity H16 T8132 26.6.2 25G83 ... accepted, and add-128 exact over 1000 runs.
Nit: the body calls the J616s "T6041". It's the M4 Pro, T6040.
Assisted-by: Claude Opus 5.5
|
Thanks. Fixed the T6040 slip in the body. #2642: agreed, this can go first and #2642 rebases onto it for just the J773g profile. 26.6.2 on T8132: on a 25G83 hand-off the base |
|
No blockers. Build selection in ane_fw_platform_build() comes from the handed-over preload sizes and IOVAs, the base 25G83 build is tried first, and unknown layouts and digests still refuse, so T6040/T6041 and the H13/H14 path are unchanged. 27.2 heap tail = 0x1000036c000, the same as 25G83, so reusing ane_h16_build_t8132_25g83's config_span is consistent. One robustness note: in ane_h16_preload_identity() (ane_h16_backend.c:1864) a profile whose rule size does not match returns -EINVAL, and that ends the |
Problem. On macOS 27.2 (26B123) firmware the M4 (T8132) Neural Engine never starts. iBoot preloads a T8132 image with a new TEXT/DATA split (TEXT 0xbc000, DATA 0x2b0000, DATA at DVA 0x100_000b_c000), but
ane_t8132_platformonly knows the 26.6.2 sizes (0xc0000 / 0x2ac000), so preflight refuses the hand-off with-EINVAL("H16 requires bootloader-reserved no-map TEXT/DATA preload ranges") and every M4 on 27.2 has no ANE.Change.
next_build, the same way the H17 staged path already does. Preflight and probe use the build whose preload sizes and IOVAs match. SoCs withoutnext_build(the M4 Pro and M4 Max H16 table) are unchanged.program_add128_slots_test, which read an uninitialized binding (fails with pattern-initialized stacks; also fails on the base without this series).Testing.
ane_t8132_builds_test(each T8132 build admits only its own layout) andpreload_sized_rule_test.Still to run.
Bring-up log excerpt (J713, 27.2)
MobileNet: per-image top-1 matched the reference on all 16 images, max |logit diff| vs the CPU fp16 chain 0.031-0.078; firmware time 0.663 ms mean over 1000 runs (submit->ack 0.200, report->done 0.461).
How the 27.2 rule was made
The two preload ranges were read from the running Linux (no-map reserved memory, outside System RAM, unclaimed because the driver had refused them) on two boots. The rule's record offsets, rewritten range and digest come from those reads, using the same normalization as
ane_h16_preload_digest(). Nothing from the image goes into the tree except those numbers, as with the existing H16 rules.Assisted-by: LLM (Claude:Opus 5.5)