Repository navigation
Neo ANE: hold DRAM and fabric floors while the engine runs, keep gating off back-to-back (MobileNet 2.3-2.5 -> 1.25-1.31 ms) - #1137
Merged
Conversation
…uests The H17 path still sends 0x002d 0 before and 0x002d 1 after every EXECUTE. On the Neo (T8140) that costs 68-78 us of each MobileNet request (gate open 43-52 us, gate close 20-26 us, debugfs means over 300-3400 requests on fleet22), out of 2.2 ms. The session hold that commit fedd276 ("accel/ane: h16: keep dynamic power gating off across back-to-back requests") added for H16 is generic: gating goes back on 2 ms after the last request ended, before TERMINATE and UNLOAD and before system sleep, and a firmware booted again from the preload starts with gating on. Set the same 2 ms hold for the H17 backend. Signed-off-by: Ryan Murray <[email protected]> Assisted-by: LLM
On the Neo (T8140) nothing raises the memory controller (DCS) or the SoC fabric while the Neural Engine runs: the CLPC only follows CPU and GPU load. A MobileNetV1 EXECUTE then takes 2.3-2.5 ms. With DCS 4 and fabric 3, the floor the GPU already gets for streaming work, it takes 1.25-1.31 ms; the engine time drops from 1.8-2.0 ms to about 1.0 ms. Add an ANE input next to the host GPU one. A driver gets a client with apple_clpc_ane_get() and reports work in flight with apple_clpc_ane_set_active(). The client has its own reference, so a late publication or put after the CLPC went away is harmless, and getting it never defers: without a bound CLPC the ANE runs without the floor. An idle-to-active edge samples at once, a request shorter than the sampling period is latched until the next sample, and the per-SoC ANE rail states then merge with the CPU and GPU demand under the usual hold. T8140 asks for DCS 4 and fabric 3. Other SoCs have no ANE input. A root-only debugfs file, ane_states, overrides the two states (clamped to each rail) for measurements, and the status file reports the ANE input and reason bit 32. KUnit covers demand and hold, short requests, provider removal, cold wake, a missing provider and the state overrides. Signed-off-by: Ryan Murray <[email protected]> Assisted-by: LLM
Get the CLPC ANE client at the program stage and report each EXECUTE through the session's busy hook, so the CLPC raises DRAM and the SoC fabric while the H17 engine works. Without a CLPC nothing changes. On the Neo this takes MobileNetV1 from 2.31-2.50 ms to 1.25-1.31 ms per EXECUTE (300 requests, three rounds, ane_states 0 0 against 4 3). Signed-off-by: Ryan Murray <[email protected]> Assisted-by: LLM
The CLPC host test compiles the driver's sample path from clpc.c, which now also calls apple_clpc_ane_input_demand(). Extract that helper too, stub its client and lock, and check that T8140 ANE work votes DRAM 4 and fabric 3 (0x34) with reason bit 32, that a request shorter than one sample is still seen once, and that the vote expires after the hold. A new negative control drops the ANE demand and must fail. Signed-off-by: Ryan Murray <[email protected]> Assisted-by: LLM
RyanTheTide
added a commit
that referenced
this pull request
Nov 7, 2026
Brings aurora-wip up to fleet25: DT descriptions (#1029, #1030, #1112), the J715 board (#1129), Stockholm NFC (#1042, #1136), the AV1 tile check (#1100), the M4 Max ANE profile and AVD quirk (#1088, #1091), boot-log fixes (#1103, #1104) and the Neo ANE memory floor (#1137). Conflicts: macaudio.c and apple,macaudio.yaml, where aurora-wip's J813 and J873 entries and integration's J715 entries were added at the same spot. Keep all of them. Signed-off-by: Ryan Murray <[email protected]> Assisted-by: LLM
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.
What
The Neo's Neural Engine (T8140, H17) ran MobileNetV1 at 2.2-2.5 ms per request, while the M4 Pro ANE runs the same kind of program in 0.57 ms. Most of that time is spent waiting on memory: nothing raises the DRAM controller (DCS) or the SoC fabric while the ANE runs, because the CLPC only follows CPU and GPU load. Busy CPUs made the ANE faster, which is how this showed up.
Four commits:
accel/ane: h17: keep dynamic power gating off across back-to-back requests. H16 got this in fedd276. H17 still sent the gate command before and after every EXECUTE. With the same 2 ms hold, back-to-back requests skip both commands (gate open 42-66 us and gate close 24-27 us become 0.1 and 0.0 us).soc: apple: clpc: raise DRAM and fabric floors for ANE work. Adds an ANE input to the CLPC next to the host GPU input. A driver gets a client withapple_clpc_ane_get()and reports work in flight withapple_clpc_ane_set_active(). An idle-to-active edge samples at once, and a request shorter than the sampling period is latched until the next sample. The per-SoC rail states then merge with CPU and GPU demand under the usual hold. T8140 asks for DCS 4 and fabric 3, the same floor the GPU gets for streaming work. Other SoCs have no ANE input. The client never defers, so without a CLPC the ANE runs as before. A root-only debugfs file,ane_states, overrides the states for measurements.accel/ane: h17: hold the CLPC memory floor while an EXECUTE runs. The H17 backend reports each EXECUTE through the existing session busy hook.tools/asahi: cover the CLPC ANE input in the host demand test. The CLPC host test compiles the driver's sample path, which now calls the ANE helper. It now also checks that T8140 ANE work votes 0x34 with reason 32, that a request shorter than one sample is still seen once, and that the vote expires after the hold. It also adds an omit-ane-demand negative control.H16 (J616s) is not changed. It already holds the PMC soc-max floor per request through its
perfpower domain. H17 cannot take a second power domain without reworking how its loader hand-off binds, so it uses the CLPC.Benchmark (Neo, J700)
Method: MobileNetV1 224 (kit-ss1-neo program, one linked 28-task H17 program),
ane-run.pywith 300 EXECUTEs per run. Times are host p50/p90 around the EXECUTE ioctl, plus the driver's debugfsane-h17/.../executephase means. The runs are interleaved A/B/C, three rounds, on one boot, switching the CLPC ANE states between runs throughane_states.Test kernel 7.3.0-aurora-fleet23anex2 = fleet23 (810b92c) + this series + two unrelated fixes (T604x pmgr, H13 perf). One-shot boot 5c56c6e8, silent, 11-08 00:20.
Single cold requests (one EXECUTE per process, 8 runs) with the default states: engine time 940-1058 us, so the latch also catches one-off requests.
Gate hold, same boot: gate open 0.1 us and gate close 0.0 us per request. On fleet23 (boot f955b7be, same kit) they were 42-66 us and 24-27 us.
Earlier cross-check on fleet22 (boot fc023511): holding the PMC DCS floor some other way (AP agent 3 = 0x4 through the ProRes perf consumer) gave p50 2241-2374 us without the floor and 1287-1462 us with it.
Gates
run-host-tests.py --only clpcpasses, and all 10 negative controls fail as they should (omit-ane-demand included).--only anepasses 3/3.🤖 Generated with Claude Code