first ANE dispatch
compile a matmul kernel, run it on Apple Neural Engine, read the result.
prerequisites
- macOS with Apple Silicon (M1/M2/M3/M4)
- Rust toolchain (
rustup)
step 1: create a project
&&
add rane to Cargo.toml:
[dependencies]
rane = { path = "../rane" } # or from crates.io when published
step 2: write the program
use ;
step 3: run
output:
output[0] = 1
what happened
matmul(64, 64, 64)generated MIL text — Apple's model intermediate languagecompile()sent the MIL toaneddaemon via XPC, which compiled it to ANE bytecodeload()uploaded the bytecode to ANE SRAMrun()dispatched the kernel on ANE hardware using IOSurface shared memoryread()read the fp16 result directly from the IOSurface — zero copies