Skip to content

accel/ane: H16 EXECUTE latency 6.6 ms to 0.77 ms - #794

Merged
RyanTheTide merged 3 commits into
aurora-wipfrom
ane/h16-latency
Nov 1, 2026
Merged

RyanTheTide merged 3 commits into
aurora-wipfrom
ane/h16-latency

Conversation

@RyanTheTide

Copy link
Copy Markdown
Contributor

Cuts the H16 (M4 Pro) ANE MobileNetV1 request time from 6.56 ms to 0.77 ms on the J616s.

  • 9544d149 Poll replies in 20-50 us steps for the first 5 ms instead of sleeping 1 ms per poll. Each EXECUTE waits four times, so it paid about 4 ms of sleep regardless of the engine.
  • dfb44270 Per-phase EXECUTE timing in debugfs (ane-h16/<dev>/execute), so the cost of each step is visible.
  • ee818558 Drop the SHA-256 of the whole 8.4 MB HWX snapshot on every EXECUTE. LOAD already hashes and parses it and copies what the firmware reads into private mappings; the snapshot does not change afterwards. That hash was 2.9 ms per request.

Hardware, J616s, fleet14f, aura#37 Stage 2 (boot 14ed1b0b): MobileNetV1 top-1 16/16, host p50 0.767 ms, p90 0.772 ms (firmware round trip 0.73 ms, engine 0.49 ms, kernel outside the firmware 0.02 ms); add-128 2 x 16384/16384 exact; kernel -p3 0, no DART faults.

KUnit 162/162 (x86_64 and arm64), W=1 clean, checkpatch --strict clean.

🤖 Generated with Claude Code

The H16 channel IRQ stays masked, so every wait polls, and each poll slept
a fixed 1 ms. An EXECUTE waits four times (opening gate reply, EXECUTE
ack, completion report, closing gate reply), so it paid at least four
milliseconds of sleep however fast the engine was. MobileNet took 6.6 ms
per request where the H14 path needs about 1.1 ms.

Tell relax() how long the current wait has run and pick the sleep from
that: 20-50 us for the first 5 ms, which covers replies and a whole
inference, then 250 us, and after 50 ms the old 1 ms cadence, so slow
startup waits and stalls cost no more CPU than before. Count every sleep
in the transport so callers can report polls per request.

Assisted-by: LLM
Signed-off-by: Ryan Murray <[email protected]>
The host only saw one number per MobileNet request, so there was no way
to tell engine time from poll latency, copies or userspace overhead.

Time every successful EXECUTE: the opening gate round trip, EXECUTE to
its channel-7 ack, the ack to the first report of the request, that
report to the completion, the closing gate round trip, the whole firmware
span, and the sleeps between polls. The ioctl adds the input copy (with
the output poisoning), the output copy and the whole request.

<debugfs>/ane-h16/<dev>/execute prints the last, mean, minimum and
maximum of each phase since the last reset; writing to it resets. The
same breakdown of each request goes to drm_dbg_driver(). Failed requests
are not counted.

Assisted-by: LLM
Signed-off-by: Ryan Murray <[email protected]>
On the J616s, kit v6 timed MobileNet at 4.0 ms per EXECUTE ioctl while
the firmware span was 1.04 ms and the copies were 26 us: 2.9 ms went
nowhere the breakdown looked. ane_h16_session_execute() ran SHA-256 over
the whole HWX snapshot before each request, 8.4 MB for MobileNet.

LOAD already hashes and parses the snapshot, and copies everything the
firmware reads out of it into private mappings. The snapshot then stays
private and unchanged until the program is freed, so the hash per request
checked nothing new. Keep the cheap resource check and drop the hash.

Time the rest of the ioctl too, so the phases add up: the session lock
wait, the work before the opening gate (prepare) and after the closing
gate reply (finish). The ioctl total now starts before the lock.

Assisted-by: LLM
Signed-off-by: Ryan Murray <[email protected]>
@RyanTheTide
RyanTheTide merged commit b35adc7 into aurora-wip Nov 1, 2026
notmysegv pushed a commit to notmysegv/linux that referenced this pull request Nov 4, 2026
…tion/aurora

Bring integration/aurora up to aurora-wip 52f0a6b, the source of
7.3.0-aurora-fleet14h, promoted on all four machines on 2026-11-02.
The range also covers the fleet14g source b35adc7. It adds aurora-silicon#792,
aurora-silicon#750, aurora-silicon#783, aurora-silicon#784, aurora-silicon#793, aurora-silicon#774, aurora-silicon#794, aurora-silicon#796, aurora-silicon#798, aurora-silicon#800, aurora-silicon#802 and aurora-silicon#801.
No conflicts.

Assisted-by: LLM
Signed-off-by: Ryan Murray <[email protected]>
@RyanTheTide
RyanTheTide deleted the ane/h16-latency branch November 7, 2026 12:07
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.

1 participant