Repository navigation
accel/ane: accept an H17 task stream that opens with 1 - #1790
Conversation
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
CHANGES The code is correct as far as I can read it. The read of the opening word at One thing should land before merge: a device run of an H17 program that opens with 1. This change widens what the kernel hands to the H17 firmware, and today the only device evidence is for opening word 0 (the k_proj run used a patched 0). If the firmware treats 1 differently on H17, the gate would let through a stream that has never run. Please add one M5 run of an unpatched Apple matmul or add program (opening word 1), with an output check against a CPU reference, to the PR body. Then this is GREEN from me. Nit: the new sentence in |
cec9bfa to
4bf7e71
Compare
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]>
4bf7e71 to
37796b7
Compare
|
GREEN My earlier CHANGES (at 043b052) asked for one M5 run of an unpatched Apple program whose task stream opens with 1. That is now in the PR body: on the M5 Max (Mac17,11), kernel 7.3.0-k114c-ARCH-p1 (boot eba1142e) built from this PR at 4bf7e71, Apple's compiled Qwen3-4B Delta 4bf7e71 -> 37796b7 (same base 17903f5, compared through the API): Nit, optional: the new comment line in Not run by me: the KUnit suite (the author reports ane-h16-tasks 6 of 6 on an x86 host build; the two base failures named in the PR body are not from this change). |
|
GREEN at 37796b7 Re-review of the H17 task-stream prologue change. My CHANGES at The delta from The hardware ask is now in the PR body: Apple's own compiled Qwen3-4B CI at this head: Not checked by me: the hardware numbers (I read the PR body; there is no device here) and the KUnit run (I did not build it). The PR body itself says two ANE KUnit failures exist on the base commit with and without this change ( |
accel/ane: accept H17 programs from Apple's zin_ane_compiler 10.205 (on #1790)
Apple's current H17 compiler opens the task stream of its matmul and add programs with the u32 1 that H16 uses. The linked MobileNetV1 program opens with 0. The gate demanded 0 for every H17 program, so
H16_LOADrefused the first form with ENOEXEC and no reason in dmesg.Change: for subtype 9 the gate accepts an opening word of 0 or 1 and refuses every other value. The selftest section builder (
tools/testing/selftests/drivers/ane/h16-sections.py) takes the same two openings. Reserved bytes, the task walk and all other checks stay as they were. H16 still requires 1.Found on the 16-inch-class M5 Max (Mac17,11) bring-up: a real Qwen3-4B
k_projmatmul (2560 to 1024) compiled for H17 loads and runs once the word is patched to 0 and Apple's 25 debug symbols are cut in userspace (cosine 0.9999998 against an fp32 reference, p50 341 us per call). The symbol rule stays strict in the kernel.Tests (UML KUnit,
ane-h16-program*,ane-h16-tasks*,hwx_program/final_task_end/symbols):program_h17_hwx_testnow loads the MobileNet program with an opening word of 1 and refuses 2; the H16 and H17 prologue cases pass. Two failures exist on the base commit with and without this change:program_add128_slots_testfails, andhwx_import_bounds_testcrashes UML (copy_from_user fault), which stops the rest of theane-h16-hwxsuite when run whole.Hardware proof of a prologue-1 program, on the M5 Max (Mac17,11) with this change built in (7.3.0-k114c-ARCH-p1, boot eba1142e): Apple's own compiled Qwen3-4B
k_projprogram (2560 to 1024, fp16 weights), task stream opening with 1, only its debug symbols cut in userspace.H16_LOADaccepts it and it runs: against an fp32 CPU reference the output has max abs error 1.08e-3 (reference abs max 2.13), relative L2 4.2e-4, cosine 0.9999998, no NaN, top-16 overlap 16/16, p50 347 us over 20 runs. The same program with the word patched to 0 on the earlier kernel gave the same numbers. Command:sel/ane-run.py --hwx program-p1.hwx --case case-x.bin:case-expected.bin --runs 20(the in-tree selftest builder, now accepting prologue 1 for H17), output compared withnumpyon the host. The tool's own ulp check prints FAIL (446/1024 exact, max 3038 ulp) because the case file compares fp16 bits against an fp32-derived expectation; the error against the fp32 reference above is the measure.