Skip to content

accel/ane: recover a T600x engine after a hang without an event - #1660

Merged
RyanTheTide merged 2 commits into
integration/aurorafrom
fix/ane-t6000-hang-recovery
Nov 12, 2026
Merged

RyanTheTide merged 2 commits into
integration/aurorafrom
fix/ane-t6000-hang-recovery

Conversation

@RyanTheTide

Copy link
Copy Markdown
Contributor

A job that hangs on the T6000 Neural Engine (M1 Pro/Max) no longer needs a reboot. The driver recovers the engine and the next job runs.

#1446 kept the engine wedged after a hang without a completion event, because every job after the recovery hung the same way. The task-manager file does not survive the recovery power cycle; it comes back at its reset values (nothing committed, no valid descriptor slot, TM_STATUS idle). The retained-state drain then cleared TQ_EN bit 13 together with the enable bit. Without bit 13 the task manager never dispatches: the next descriptor sits pending in its queue while TM_STATUS reads idle. The drain now clears only the enable bit.

Before the power cycle the driver also tries the per-queue abort: START plus the queue number, then wait for queue idle and a pending count of zero, then clear both descriptor slots and the ownership word. A task stalled below the task manager never lets the abort be taken, and the power cycle stops it instead. The drain now clears both descriptor slots before the ownership word. The engine is wedged until reboot only after three recoveries in a row without a completed job. T8103 keeps its single recovery. tm_abort=0 turns the abort off.

Tests

  • KUnit (arm64, accel/ane suites): 262/262, including the updated ane-tm-recovery cases. checkpatch --strict is clean.
  • M1 Pro, fleet67 with this ane.ko loaded at run time (the module source is byte-identical to this branch). A 70-task program that hangs (-110, no event) was run 5 times. After each hang the driver recovered, then three good jobs ran:
    • a 1-task conv: relL2 2.2e-4 vs float64, 50 runs;
    • a 3-task program: relL2 3.0e-4;
    • MobileNet classification of 20 photos: top-1 and top-5 equal to the CPU on all 20.
  • Two hangs back to back, then the same good jobs: all passed.
  • 0 DART faults, wedged stayed 0, no reboot.
  • Speed did not change. MobileNet p50 was 485 us with the stock module, 485 us with this one, and 484 us after 7 hangs. The 99-task MobileNet ran at 3673-3674 us in all three.
  • Before the fix the same hang wedged the engine until reboot.

linux#1446 kept a T600x engine wedged until reboot once a job hung
without a completion event, because every job after the recovery hung
the same way. The task-manager file was thought to survive the power
cycle. It does not: after the cycle it reads its reset values (nothing
committed, no valid descriptor slot, TM_STATUS idle). The retained-state
drain then cleared TQ_EN bit 13 along with the enable bit. That bit
reads set after every power-on, and without it the TM never dispatches:
the next descriptor stays pending in its queue while TM_STATUS reads
idle, so that job timed out too.

Clear only the enable bit (12) in the drain; the re-arm sets it again.

Before the power cycle, abort the hung queue in the task manager while
the engine is still powered: write the queue number with START to the
abort register, wait for START to clear, then for the queue to report
hardware idle with no descriptor pending, and only then invalidate both
descriptor slots, clear the ownership word and restore the queue
priority. Every poll reads the DART latch before the engine. A task
stalled below the task manager never lets the abort be taken; the power
cycle stops it then. The tm_abort parameter (default on) turns the
abort off.

A hang without an event is recoverable again on T600x. The engine is
wedged until reboot only after three recoveries in a row without one
completed job. T8103 keeps its single recovery.

The drain also cleared only the first descriptor slot, and cleared the
ownership word before it. Clear both slots, then the ownership word, as
the normal completion path does.

Assisted-by: LLM
Signed-off-by: Ryan Murray <[email protected]>
The completion-poll harness compiles the production ane_tm.c. Give it
the abort-path registers and the recovery counter, and check the new
policy: a T600x hang is aborted and recovered, a hang after three
recoveries in a row without a completed job wedges the engine, and T8103
keeps its single recovery.

Assisted-by: LLM
Signed-off-by: Ryan Murray <[email protected]>
@RyanTheTide
RyanTheTide merged commit bc7a5eb into integration/aurora Nov 12, 2026
1 check passed
@RyanTheTide
RyanTheTide deleted the fix/ane-t6000-hang-recovery branch November 12, 2026 08:26
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