Skip to content

accel/ane: accept H17 programs from Apple's zin_ane_compiler 10.205 (on #1790) - #1882

Merged
DjDeveloperr merged 2 commits into
aurora-silicon:integration/aurorafrom
m0d16l14n1:j815/ane-h17-zin-hwx
Nov 14, 2026
Merged

DjDeveloperr merged 2 commits into
aurora-silicon:integration/aurorafrom
m0d16l14n1:j815/ane-h17-zin-hwx

Conversation

@m0d16l14n1

Copy link
Copy Markdown
Contributor

Stacked on #1790 (the H17 task stream that opens with 1); the net change is the last commit: m0d16l14n1/linux@37796b7...m0d16l14n1:linux:j815/ane-h17-zin-hwx

H16_LOAD refused, with ENOEXEC and no further reason, every H17 program that the ANECompiler of macOS 27.2 (zin_ane_compiler v10.205.4, TargetArchitecture H17G) writes. It differs from the MobileNet and open H16G programs the validator was written against in five places, none of which names an address the kernel maps or the firmware binds:

  1. __TEXT is not SG_NORELOC beside a __DATA scratch segment: it carries relocations against __KERN_0, which the relocation check walks.
  2. The surfaces and the kernel fill BAR slots 5, 6, 7 (descriptor +0x60) instead of 6, 7, 8 (+0x70). The run must stay in order and consecutive with nothing after it; the operation section is checked against the same qwords as before (its slot is +0x10 * (slot + 1), and the host-built section binds 3, 5, 6, 7).
  3. An LC_NOTE "rt.version" with the runtime version inline (offset 40 into the command, 4 bytes, zero padding).
  4. Stabs N_GSYM/N_LSYM records describing the tensor and element types: no section, value 0, the stabs type number in n_desc.
  5. The empty per-core kernel objects (K…_ne_N) at the end of __kern_0.

Each form is accepted on subtype 9 only; H16 keeps the exact old rules.

KUnit: hwx_h17_zin_test covers each form alone and all together, malformed variants and the H16 refusal (26 checks); it fails on #1790 at its positive checks. The other HWX cases are unchanged and pass.

Tested on J815 (7.3.0, integration/aurora + #1790 + this + the T8142 ANE series): camera-denoise's open low-light network, compiled by this Mac's macOS at 640x360 and 960x540, now validates; the 640x360 program loads on the M5 firmware and its process is created and torn down (H17 LOAD, CREATE, TERMINATE and UNLOAD all status 0). Before this change both programs were refused at H16_LOAD. checkpatch --strict clean.

Part of the J815 (MacBook Air 15-inch, M5, T8142) bring-up: board results are summarised in discussion #135.

Assisted-by: Claude Opus 5.5

joshuaswarren and others added 2 commits November 13, 2026 02:38
Apple's current H17 compiler opens the task stream of its matmul and add
programs with the u32 1 that H16 uses, where the linked MobileNetV1
program opens with 0. The gate demanded 0 for every H17 program, so
H16_LOAD refused the first form with ENOEXEC and no further reason.

Take the prologue from the stream for subtype 9: 0 stays accepted, 1 is
accepted, any other value is refused. The reserved bytes, the task walk
and every other check are unchanged. H16 still requires 1. The selftest
section builder takes the same two openings for subtype 9.

KUnit: program_h17_hwx_test now loads the MobileNet program with an
opening word of 1 and refuses 2; ane_h17_prologue_test and the H16 cases
still pass. program_add128_slots_test fails on the base commit with and
without this change. The hardware run of a prologue-1 program is not yet
done; until then the only device evidence is for prologue 0.

Signed-off-by: Joshua Warren <[email protected]>
Assisted-by: LLM
Signed-off-by: Joshua Warren <[email protected]>
H16_LOAD refused, with ENOEXEC and no further reason, every H17 program
that the ANECompiler of macOS 27.2 (zin_ane_compiler v10.205.4,
TargetArchitecture H17G) writes. camera-denoise's low-light network
compiled this way for J815 never reached the firmware.

That compiler differs from the MobileNet and open H16G programs the
validator was written against in five places. None of them names an
address the kernel maps or the firmware binds:

- __TEXT is not SG_NORELOC beside a __DATA scratch segment: its
  relocations against __KERN_0 are walked by the relocation check.
- The surfaces and the kernel fill BAR slots 5, 6, 7 (descriptor +0x60)
  instead of 6, 7, 8 (+0x70). The run must stay in order and
  consecutive, with nothing after it; the operation section's bindings
  are checked against the same qwords as before.
- An LC_NOTE "rt.version" carries the runtime version inline (offset 40
  into the command, 4 bytes, zero padding).
- Stabs N_GSYM/N_LSYM records describe the tensor and element types,
  with no section and value 0.
- The empty per-core kernel objects (K..._ne_N) sit at the end of
  __kern_0.

Accept each form on subtype 9 only; H16 keeps the exact old rules.

KUnit: hwx_h17_zin_test covers each form alone and all together, with
its malformed variants and the H16 refusal; it fails on the base commit.
The other HWX cases are unchanged. Both 960x540 and 640x360 programs of
the network validate in a host build of this parser; the hardware run is
next.

Assisted-by: Claude Opus 5.5
Signed-off-by: Nick <[email protected]>

@DjDeveloperr DjDeveloperr left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed together with #1790, which this carries: merging this lands #1790's commit too. Every relaxation is subtype 9 only, and H16 keeps the exact old rules:

  • The opening word may be 0 or 1. Anything else is still refused.
  • The BAR run may start at +0x60 on H17. Each slot must still equal a parsed section VM, and the rest of the descriptor is still byte-compared against the zeroed template, so nothing can follow the run.
  • An LC_NOTE must be exactly the 48-byte rt.version form.
  • Stabs N_GSYM/N_LSYM records need no section and value 0, and their strings are still checked.
  • A symbol may sit at its section's end.
  • __TEXT may be without SG_NORELOC beside scratch, with its relocations walked.

None of these lets a program name an address outside its own sections. Programs that loaded before are accepted exactly as before.

host-tests is green on this head. Base drift doesn't touch the ANE files. Approving and merging.

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.

3 participants