Repository navigation
accel/ane: run the Neural Engine on the base M2 (T8112) - #633
Closed
RyanTheTide wants to merge 3 commits into
Closed
RyanTheTide wants to merge 3 commits into
RyanTheTide wants to merge 3 commits into
Conversation
The base M2 (T8112) has a power gate word at +0x8b8 of the ANE "set" window. It reads 0x30000000 (bits 29:28 set, closed) at boot, and macOS clears it and waits for bits 29:28 to read 0 after ANE_SYS is on and before it writes the ANE_SYS_CPU power state. On power off it writes 0x30000000 back after the states are off. The driver only read the word after power up and refused when it was closed, which is what a first run on a T8112 reported: "PWGATE closed (word 0x30000000, ane_cpu 0x1f0003ff)", with no DART or ANE fault. Do what macOS does, in its order. power-domains[0] of the T8112 node is ane_sys_cpu, whose parent is ane_sys, so a genpd notifier on that domain runs after ane_sys is on and before ane_sys_cpu is written (PRE_ON), and after ane_sys_cpu is off and before ane_sys goes off (OFF). The notifier opens the gate on PRE_ON and closes it on OFF. It writes only the two known values: any other word fails the power up without a write, and a gate that does not open within 100 ms is closed again and fails it. The notifier is registered before the device link that resumes the domain. The SoCs without pwgate_off in their match data (T6020, T6021, T6022) are unchanged. The check after power up stays, for a boot that left ane_sys_cpu on with the gate closed. Assisted-by: LLM Signed-off-by: Ryan Murray <[email protected]>
The M2 family ANE runs an Apple firmware image that is fetched on the machine itself and never shipped with the kernel. A system that has not fetched it yet is in a normal state, but the probe logged a firmware loader warning and an error on every boot. With the T8112 node enabled that would put two error lines in every base M2 boot log. Request the image without the loader warning and, when the file does not exist, log one info line that names the file and the tool that installs it, and fail the probe with -ENODEV. This happens before any hardware access, as before. Other load errors still log an error. Assisted-by: LLM Signed-off-by: Ryan Murray <[email protected]>
Enable the ANE, its mailbox, its three DARTs and the seven ANE power states on every T8112 board. The driver now opens the ANE power gate in the order macOS uses, which was the step that stopped the first run on a T8112. Without the firmware image the probe stops before any hardware access and logs one info line, so a machine that has not fetched it is not affected. Assisted-by: LLM Signed-off-by: Ryan Murray <[email protected]>
Contributor
Author
|
fleet12 carried this PR (one trivial include conflict with #669, resolved by keeping both headers). The image boots clean on the M2 and the other three machines. The M2 power-gate path itself is still untested: the M2 boots the boot.bin DTB set, where the ANE nodes stay disabled, and the ANE firmware hasn't been fetched there. So ane_t6021 never binds and there is no /dev/accel. That test still needs the ANE-enabled DTB set plus the firmware fetch from the ANE report. Leaving it unmerged per the note above. 🤖 Generated with Claude Code |
This was referenced Oct 31, 2026
RyanTheTide
added a commit
that referenced
this pull request
Oct 31, 2026
…261031 accel/ane: enable the base M2 Neural Engine (replaces #633)
Contributor
Author
|
Superseded by #694, merged into aurora-wip. |
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.
This turns the Neural Engine on for the base M2 (T8112). The M1 family already runs (ane.ko), and the M2 Pro, Max and Ultra already run (ane_t6021.ko). The base M2 had the driver match data and the DT nodes, but the nodes were disabled and the driver refused at the ANE power gate.
What changes
PWGATE closed (word 0x30000000, ane_cpu 0x1f0003ff), no DART or ANE fault. macOS clears the word after ANE_SYS is on and before it writes ANE_SYS_CPU, and sets it again after the states are off. The driver now does the same, from a genpd notifier on power-domains[0] (ane_sys_cpu, parent ane_sys), which runs at exactly those two points. It writes only the two known values and refuses anything else without a write. It is driven by the existingpwgate_offmatch data, so T6020, T6021 and T6022 are unchanged. No new parameter.omarchy-ane-firmware-fetch, pinned to the 13.5 image, which matches the stub of every Asahi-installed M2) and never shipped. A machine without it got a loader warning and an error on every boot. Now it gets one info line and the probe stops before any hardware access, as before. This keeps the clean boot log on M2s that have not fetched it.Tested
drivers/accel/ane/with W=1 (no new warnings; the two existingt2h_buf/t2h_ioqwarnings are in untouched code). checkpatch --strict is clean on all three commits. A full fleet10-config build (Image, modules, dtbs) as7.3.0-aurora-fleet10anefor the M2 test is queued on the buildbox; I will note the result here.CHECK_DTBS=yfor t8112-j413/j415/j473/j493: 327 warnings before and after, identical, none on the ANE nodes./Volumes/AuroraS500/aurora-ctl/reports/ane-20261030/SUMMARY.md.Note for the ref Macs: the M2 boots the DTB set in boot.bin (
dtbs-04a63b117), not the kernel's, so commit 3 alone does not change what the M2 sees. The report has an ANE-enabled copy of that set's j413 DTB (only the 12 status properties differ).M1 for comparison
On the M1 Pro (fleet10, unchanged driver) the userspace stack runs the add fixture 20/20 bit-exact, and a two-program graph (sum = a + b, y = sum * b) matches a CPU fp16 reference on 1535 of 1536 lanes over 24 cases; the one other lane is 1 ulp off.
🤖 Generated with Claude Code