Repository navigation
H14 linked: later slices of a multi-task layer reuse the L2 input - #14
Merged
RyanTheTide merged 1 commit intoNov 1, 2026
Merged
Conversation
On the M2, MobileNetV1 as one H14 program went wrong at layer 9, the first layer split into two tasks that read their input from scratch DRAM (prefix p8 rel. L2 4.8e-4, p9 0.67), while the same two tasks are correct when they read the program input. Apple's compiler never emits a second slice that reloads the input. In every decoded multi-task H14 layer the first task loads the input (from scratch with DependencyMode 1, from the program input, or from L2) and the later slices reuse what it staged in L2. Those slices carry no source TileDMA records and no 0x504/0x514/0x518 words, their NE repeat fields (0x38 bits 15:8) equal the NE class, ResultCfg (0x530) drops the DMA-source bits 0x500030, and every task of the layer except the program's last keeps LiveOuts 0x1fffffff. The linker now emits that form. On the M2 (7.3.0-aurora-tt3) the second slice of layer 9 had computed on zeros (its 128 channels equalled relu(bias)); with input reuse both slices match the CPU (rel. L2 5.5e-4, cold and warm). The whole linked MobileNetV1 224 with real weights now agrees with the CPU on top-1 for 16/16 images (top-5 overlap 5.0, worst logit rel. L2 1.28e-3, repeated output stable) at 1.128 to 1.212 ms p50, 1.60 ms p99 over 1000 passes (was 1.370 ms p50 with wrong output). The new compile-only probes (research/mint_h14_s2_chains.py, six h14_s2link records) add stride-2 consumers, including h14_s2link_pw1024_pws2_2048, a six-slice stride-2 layer that reads scratch DRAM. test_h14_linked_reuse_oracles.py checks the rule on all twelve decoded chain programs (19 reuse slices). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Stacked on #11. Fixes the wrong MobileNet output on the M2 from layer 9 on.
Layer 9 is the first layer split into two tasks that read their input from scratch DRAM. On the M2 the second task computed on zeros: its 128 output channels equalled relu(bias) while the first task's channels were correct (p9 slice rel. L2 5e-4 and 1.00). The same two tasks are correct when they read the program input.
Apple's compiler never emits a second slice that reloads the input. To check that for the case at hand,
research/mint_h14_s2_chains.pycompiles six new chains compile-only (h14_s2link_*, decoded with this repository's parser like the rest of the h14-mobile corpus), including a six-slice stride-2 layer that reads scratch DRAM. In every decoded multi-task H14 layer only the first task loads the input. Later slices carry no source TileDMA and no 0x504/0x514/0x518 words, set the 0x38 repeat fields to the NE class, drop 0x500030 from ResultCfg 0x530, and every task of the layer except the program's last keeps LiveOuts 0x1fffffff. The linker now emits that form.M2, 7.3.0-aurora-tt3, real weights
Host
make test-h14-paritypieces: 722 H14 oracle parity cases, fixture programs, conv CLI corpus (610 records, 6 linked chains), encoding test, newtest_h14_linked_reuse_oracles.py(12 decoded chain programs, 19 reuse slices).test_h14_mobilenet_package.pypasses on a fresh package.Not changed: Apple also uses an 8-channel interleaved scratch layout and clears the low bits of header word 4 on middle tasks. Ours stay planar and unchanged, and the device results above do not need either.
🤖 Generated with Claude Code