Neural Engines

A laptop NPU rated 80 TOPS can run your model slower than a 6 TOPS board. Pick two engines and watch memory, operators and runtimes shrink the headline number.

Learn what an NPU is, why its headline TOPS number misleads, and how to compare neural engines by the runtime and driver that decide what they really deliver.

Pick any two engines below. Compare their peak with what their memory can feed. Flip Dense to halve the sparse claims. Then we build, piece by piece, the estimate, the runtimes, the drivers and the memory budget underneath.

You need a picture of a neural network as layers of arithmetic and a little C or Python. We build the rest from zero.

Built from vendor pages, kernel documentation and runtime docs, all listed in the Field Guide. It follows Export, Partition, Fallback and sits beside Jetson Bring-Up.

Compare two neural engines

Peak TOPS and bandwidths are the vendors' own figures, cited in the Field Guide. Bandwidth is blank where this lesson did not open a source. The 100 operations per byte model is a toy. Orin dense (137.5) is derived by halving, as NVIDIA does for its DLAs (105 sparse, 52.5 dense).

Chapter 0

80 TOPS That Ran the Model Slower

See why the biggest number on a spec sheet is the one that tells you least about your model

A team buys a new laptop for the operator console of a robot. The laptop has a neural processing unit (an NPU: a block of the chip built only to run neural networks) rated at 80 TOPS. In a drawer sits an old embedded board with an NPU rated at 6 TOPS. The team runs the same vision model on both. The old board answers in 4 milliseconds. The laptop takes 5.4.

Nobody lied. The 80 is a real number. It just does not mean what the team thought it meant. This lesson explains what it does mean, and what to read instead.

What a TOPS number counts

A neural network is mostly one small act repeated billions of times: multiply two numbers and add the result to a running total. Hardware people call this a MAC (multiply-accumulate). An NPU is a large grid of MAC units that fire together. TOPS means tera operations per second: trillions of operations each second. A MAC counts as two operations, one multiply and one add.

The vendor computes the headline from the grid itself. Count the MAC units, multiply by two, multiply by the clock speed. Nothing in that sum looks at your model.

peak
The most operations per second the grid could ever do, in TOPS. It assumes every unit works on every cycle.
MACs
The number of multiply-accumulate units that fire on each clock cycle. More units, bigger grid, bigger number.
clock
How many cycles the chip runs each second, in hertz. One gigahertz is a billion cycles per second.

2,048 MACs × 2 × 1 GHz = 4.096 TOPS (Arm quotes “up to 4 TOPS” for its largest Ethos-U85 microNPU)

That is the whole recipe. So a headline is a peak: the speed of a grid that never waits for data and never meets a layer it cannot run. Your model will meet both problems.

Four footnotes hide inside the number

First, the precision. The 80 on a Snapdragon X2 Elite is counted in INT8, small 8-bit whole numbers. A model in 16-bit floating point may run at half that rate or less. Second, sparsity. NVIDIA rates Jetson AGX Orin at 275 TOPS, but its own page says sparse INT8. Sparse means the weights follow a pattern with many zeros that the hardware can skip. For the two Orin DLAs, NVIDIA prints both: 105 sparse and 52.5 dense. Dense is half. Third, what is counted: Intel’s 50 TOPS for Panther Lake counts the NPU alone. Fourth, who publishes: Apple publishes no TOPS figure for the Neural Engine in the M5 at all.

2026 client NPUHeadlineWhat the footnote says
Snapdragon X2 Elite (Extreme)80 TOPSINT8, a vendor claim (Qualcomm's own product page says up to 85 for the Extreme); press reports 228 GB/s of memory bandwidth on the Extreme
Intel Panther Lake, NPU 550 TOPSthe NPU alone
AMD Ryzen AI 400 flagship (HX 475)60 TOPSother parts in the family list 50
Apple M5 Neural EnginenoneApple does not publish a figure

Three ceilings between the headline and your model

The headline sits at the top. Below it sit three ceilings, and the lowest one wins. The first is memory bandwidth: the weights and activations must travel from RAM to the grid, and the wire has a limit. Chapter 2 turns this into a formula. The second is operator coverage: the NPU runs only the layer types its software supports, and the rest go to the CPU. Chapters 3 and 4 show how to count that. The third is the runtime and driver: the software that cuts your model into pieces, sends the NPU its share, and hands back the result. Chapters 4 to 7 cover it.

Try the team’s numbers yourself. The laptop NPU has 80 TOPS and 228 GB/s. The old board has 6 TOPS and, as a toy figure, 25 GB/s. Both fall back to a slow CPU for any layer they cannot run. Slide the coverage down and watch the bars swap places.

Race a big NPU and a small one

Each bar is the time for one inference. Purple is time on the NPU, pink is time on the CPU after fallback. Lower coverage on the laptop hurts it far more than the board.

90%
100 ops/byte

Toy model, illustrative numbers: 10 billion operations per inference; the CPU delivers 0.2 TOPS on fallback layers; the board’s 25 GB/s is made up; the board runs 100% of the model. Peak and 228 GB/s are the vendor figures. Transfers between NPU and CPU are ignored, which flatters the laptop.

At 90% coverage the laptop needs about 5.4 ms and the board 4.0 ms. The laptop’s NPU part is quick. The 10% that fell back to the CPU takes 5 ms on its own, nearly the whole bar. At 100% the laptop wins by a wide margin, about 9 times. The break-even sits near 93% coverage. A few unsupported layers decide which machine is faster.

This is the pattern for the rest of the lesson. First check the real ceiling. Then check what runs where. Then check who owns the software. The hero map at the top gives you the first look. The chapters teach you the other two.

The road

  1. Classes of neural engine: four families, and why the same class does not mean the same runtime.
  2. Achieved TOPS: the roofline estimate that turns peak into a number you can plan with.
  3. Operator coverage: count the fallbacks before you buy.
  4. Runtimes and their binaries: QNN, Core ML, LiteRT, ExecuTorch, TFLite Micro.
  5. Drivers: drivers/accel, vendor modules and the kernel you can move.
  6. MCU-class inference: Ethos-U and the SRAM budget.
  7. Closed stacks: the Apple Neural Engine and Windows ML.
  8. Field Guide: the numbers, a checklist, the estimator as code.
An 80 TOPS NPU runs your model slower than a 6 TOPS NPU. Which cause fits best?

Chapter 1

Classes of Neural Engine

Sort every NPU into one of four families by where it sits and who writes its compiler

Put four boards on a desk. One is a tiny microcontroller board that runs on a coin cell. One is a credit-card computer with a camera port, as used in a smart doorbell. One is a thin laptop. One is a robot brain the size of a paperback. All four say “AI inside” on the box. Each one runs a neural network in a different way.

You can sort them with two questions. How does the NPU reach memory? And who wrote the software that feeds it? The answers define four classes, and each class has its own habits, limits and failure modes.

What is inside any NPU

Every NPU has the same three parts, whatever the brand. First, a MAC array: the grid from Chapter 0. Second, a small, fast, local memory next to the grid, often called SRAM (static RAM, quick but costly per byte), that holds the numbers being worked on right now. Third, a DMA engine (direct memory access: a copier that moves data without the CPU) that fetches weights and activations from big, slow main memory into the SRAM.

A command stream drives all three. It is a list of low-level instructions such as “load this tile of weights, multiply it with that tile of inputs, store the result”. A compiler writes it ahead of time from your model. The CPU does not run the layers. It writes the command stream into memory, tells the NPU to start, and waits. For the Arm Ethos-U family, the compiler is called Vela, and it wraps each supported region of your model into one custom operator that holds the NPU command stream.

Four classes

MCU microNPU. A microNPU is a small NPU that sits beside a Cortex-M microcontroller core. Arm’s Ethos-U65 comes in two sizes, 256 or 512 MACs per cycle. The Ethos-U85 comes in five, from 128 to 2,048, which Arm rates at 256 GOPS to 4 TOPS at 1 GHz. Memory is on-chip SRAM, and its size is set by the part, so read the datasheet. Often there is no operating system. Whether the model fits is the main problem here, and Chapter 6 covers it.

Embedded SoC NPU. An SoC (system on chip) puts Linux-class Arm cores, a GPU, video blocks and an NPU on one die. The NPU shares main DRAM with everything else. Verified peaks: TI AM62A7 up to 2 TOPS, NXP i.MX 8M Plus up to 2.3, Rockchip RK3588 6, TI TDA4VM up to 8. Each vendor ships its own compiler. RK3588 uses RKNN. The TDA4VM uses TI’s TIDL.

Phone and laptop NPU. These are the 50 to 80 TOPS parts: Intel Panther Lake at 50, AMD’s Ryzen AI 9 HX 475 at 60, Snapdragon X2 Elite at 80. The Apple Neural Engine belongs here, with no published figure. The NPU shares fast unified memory with the CPU and GPU. Qualcomm’s X2 Elite Extreme is reported at 228 GB/s. The operating system supplies the runtime layer, and the vendor supplies the driver.

Jetson DLA and GPU. The Jetson AGX Orin has a GPU and two DLAs (deep learning accelerators, fixed-function NPUs). NVIDIA lists 275 sparse INT8 TOPS for the module and 105 sparse for the two DLAs, so about 170 left for the GPU. That is a derived number. All of them share 204.8 GB/s of LPDDR5. One compiler, TensorRT, can target either engine.

Pick a class below. The top half shows its range of peak TOPS on a log scale. The bottom half shows how the NPU is wired to memory.

Climb the class ladder

Top: the class’s peak range among the parts in this lesson. Bottom: the blocks and the path to memory. Thick lines mean wide, shared paths.

Ranges use only the vendor peaks printed in this lesson. Block diagrams are simplified: they show who shares memory, not the real floorplan. Jetson GPU share (about 170 sparse TOPS) is derived as 275 minus 105.

The portability myth

The same class does not mean the same software. The RK3588 (6 TOPS) and the TDA4VM (8 TOPS) are both embedded SoC NPUs. You can put a camera on either. A model compiled for one will not load on the other, because each vendor’s compiler writes a different command stream for a different grid. You port by recompiling from the source model, and your model may meet different unsupported layers on the second chip.

So “it runs on an NPU” is not a portable statement. The honest statement has three parts: which engine, which compiler, which operators. Chapters 3 and 4 give you the tools to say all three.

You compiled a model for the RK3588 NPU and want it on a TDA4VM. What do you do?

Chapter 2

Achieved TOPS: A Worked Estimate

Turn a peak number into a speed you can plan with, using two inputs and one minimum

Picture a kitchen. The chef can chop 80 onions a second. A delivery truck brings 23 onions a second. How many onions get chopped each second? Twenty-three. The chef spends most of the time waiting.

An NPU is the chef. Main memory is the truck. The question is always the same: does the grid wait for data, or does the data wait for the grid? One number tells you which, and it comes from your model, not from the chip.

Operations per byte

Arithmetic intensity is the number of operations a layer does for each byte it moves to or from main memory. A layer with high intensity reuses every byte many times, like a chef who chops one delivered onion into a hundred pieces. A layer with low intensity touches each byte once, then throws it away.

Work it out for a real layer. Take a 3×3 convolution with 64 input channels and 64 output channels on a 56×56 feature map, in INT8, one byte per number. A convolution slides a small filter over an image and sums the products.

  1. MACs. 56 × 56 positions × 64 × 64 channels × 9 filter cells = 115,605,504 MACs, which is 231,211,008 operations.
  2. Bytes. Weights 64 × 64 × 9 = 36,864. Input 56 × 56 × 64 = 200,704. Output the same, 200,704. Total 438,272 bytes.
  3. Intensity. 231,211,008 ÷ 438,272 = about 528 operations per byte.

This count assumes each tensor crosses the memory wire exactly once. Real chips can do worse, never better, so treat it as the best case.

Now the same feature map with a depthwise convolution, the cheap kind that MobileNets use (see Mobile NAS Backbones). Each channel gets its own 3×3 filter and channels never mix. MACs: 56 × 56 × 64 × 9 = 1,806,336, so 3,612,672 operations. Bytes: 576 weights plus 200,704 in plus 200,704 out = 401,984. Intensity: 9 operations per byte. The layer does about 59 times less work per byte moved. A fully connected layer of 4,096 × 4,096 at batch size 1 is the extreme: about 2 operations per byte, because every weight is used once.

The roofline

The roofline model says the speed you achieve is the lower of two limits: the grid’s peak, and what the memory wire can deliver. The wire delivers bandwidth times intensity. Because 1 GB/s times 1 op/byte is 1 giga-op per second, divide by 1,000 to get TOPS.

achieved
The throughput you can expect, in TOPS. Treat it as an upper bound for this layer, not a promise.
u
Utilisation: the share of MAC units that do useful work. A layer with 24 channels on a 16-wide tile fills 24 of 32 slots, so u = 75%.
peak
The headline TOPS from the spec sheet, in the precision your model uses.
BW
Memory bandwidth in GB/s that the NPU can actually use. It is often shared with the CPU and GPU.
I
The layer’s arithmetic intensity in operations per byte, computed as above.

The ridge point is the intensity where the two limits meet: peak divided by bandwidth. Below it a layer is memory-bound. Above it, compute-bound. For Jetson AGX Orin, 275 × 1012 ÷ 204.8 × 109 = 1,343 operations per byte. A model that does 100 operations per byte gets 204.8 × 100 ÷ 1,000 = 20.5 TOPS, which is 7.4% of the headline. The roofline said no long before you ran the model.

The same arithmetic for the Snapdragon X2 Elite Extreme gives a ridge of 80 × 1012 ÷ 228 × 109 = 351 operations per byte. A low ridge point is not a weakness. It means the chip is balanced for more kinds of layers.

Place a layer under the roof

The line is the roof: it climbs with memory bandwidth, then goes flat at peak. Pick an engine and a layer. The dot lands where the layer’s intensity meets the roof.

100%

Layer intensities are computed in this chapter for INT8 with each tensor moved once. Peaks and bandwidths are vendor figures: X2 Elite Extreme 80 TOPS and 228 GB/s, Orin 275 sparse TOPS and 204.8 GB/s, the two DLAs 105 sparse TOPS sharing the same 204.8 GB/s. Utilisation is a knob, not a measurement.

Try the depthwise layer on the X2. Its 9 operations per byte on 228 GB/s allow about 2 TOPS, which is 2.6% of the 80. Switch to the full convolution and the dot jumps right and up. Now move the utilisation slider down. It only matters once the dot sits on the flat part of the roof.

This is the reason a modern mobile network can run poorly on a big NPU. The network has far fewer operations than a ResNet, yet many of them have low intensity. The fix is not a bigger NPU. The fix is to fuse layers so a result stays in SRAM instead of going out to DRAM and back, and to pick a backbone built for the memory system. MobileNetV4 is designed with exactly this roofline in mind.

A layer does 9 operations per byte. The NPU has 80 TOPS and 228 GB/s. What does the roofline say?

Chapter 3

Operator Coverage and the Fallback Cliff

Count the layers an NPU cannot run, because each one costs more than its own time

You export a detector, point it at a new NPU, and the log says “compilation succeeded”. The first run takes three times longer than the spec sheet promised. Nothing crashed. The compiler quietly gave some layers to the CPU, because the NPU could not run them. This is fallback, and it is the most common reason an NPU disappoints.

Export, Partition, Fallback taught the idea in general. This chapter teaches how to count it, because the count is how you compare engines before you buy one.

Operators and partitions

A neural network is a graph of operators: named steps such as Conv, Add, Softmax or Resize. An NPU does not run every operator. Its designers built hardware for a short list, mostly convolutions, matrix multiplies and simple element-wise steps. Everything else needs a general processor.

The runtime therefore does partitioning. It walks the graph in order and groups each unbroken run of supported operators into one subgraph. Each subgraph is compiled into one blob for the NPU. Every unsupported operator stays on the CPU. Where the two meet, the tensors must change hands.

That handoff is the hidden cost. The CPU must stop, flush its caches so the NPU sees fresh data, start the NPU, wait for it, then read the result back. Each switch also splits what the compiler can fuse, so intermediate results that could have stayed in fast SRAM now go out to DRAM. The cost of a switch is often larger than the cost of the layer that caused it.

What the gates look like in practice

Support is not only about operator names. Real runtimes gate on other facts too, and each of these is documented:

Build the habit of asking each runtime for its placement report, because success messages hide it. With Arm’s Vela, the flag is --show-cpu-operations. With ONNX Runtime QNN, set the session option that turns fallback into an error, so the first unsupported operator stops your build.

python# ONNX Runtime on a Snapdragon X: make fallback an error, not a surprise
import onnxruntime as ort
so = ort.SessionOptions()
so.add_session_config_entry("session.disable_cpu_ep_fallback", "1")   # unsupported op -> error
sess = ort.InferenceSession("detector.qdq.onnx", so,
         providers=[("QNNExecutionProvider", {"backend_type": "htp"})])
# option names change between versions; check the QNN EP page for yours

# Arm Ethos-U: list what stayed on the CPU
# $ vela detector_int8.tflite --accelerator-config ethos-u55-128 --show-cpu-operations

A worked count

Take a small toy detector with 14 operators and 3.98 giga-operations in all. The toy NPU delivers 2 TOPS on what it supports, so a perfect run would take 1.99 ms. The CPU fallback path delivers 0.2 TOPS. Three imaginary engines support growing lists of operators. Try each, and move the switch cost.

Count the fallbacks

Purple blocks run on the NPU. Pink blocks fall back to the CPU. Each colour change is a switch that costs time. Pick an engine, then raise the switch cost.

0.5 ms

Toy model. The operator list, each engine’s support list, the 2 TOPS NPU rate, the 0.2 TOPS CPU rate and the switch cost are all illustrative, not from any vendor. The log imitates the kind of report a real compiler prints.

Engine B supports 11 of the 14 operators. That sounds like 79%. But the three missing ones, LayerNorm, GELU and NMS, split the graph into two NPU subgraphs and cause three switches. With a 0.5 ms switch cost, B takes 4.1 ms, about 2 times the ideal 2.0. Engine C has one fallback block at the very end, so its penalty is one switch and 0.15 ms of CPU work, for 2.6 ms.

The lesson is that where the unsupported operator sits matters as much as how many there are. One missing operator in the middle of a network costs two switches. One at the end costs one. A postprocessing step like NMS (non-maximum suppression, which removes duplicate overlapping detection boxes) at the tail is the cheapest fallback you can have, and that is why detectors usually keep it outside the network.

Fix it: symptom, measurement, change

  1. Symptom. Latency is 3 times the plan, yet the compile log is clean.
  2. Measurement. Print the placement. Count unsupported operators, count subgraphs, and note which one sits mid-graph.
  3. Fix. Swap the offending operator for a supported near-twin and retrain (HardSwish for ReLU6, for example). Move tail steps like NMS out of the graph. Fuse operators the exporter left separate.
Two models each have exactly one unsupported operator. In model P it is the last layer. In model Q it is in the middle. Which is usually slower on the NPU?

Chapter 4

Runtimes and Their Binaries

Follow a model from a file you trained to a binary an NPU can load, and learn who made each step

You trained a model in PyTorch. It is a file of weights plus a recipe. An NPU cannot read it. Something must turn that file into the exact bytes the NPU’s command stream needs, and something must load those bytes on a phone at run time. Those two somethings are a compiler and a runtime, and together they decide what your NPU can do.

The map of neural engines is a map of runtimes. Each NPU family has one or two software stacks that reach it. If you pick the NPU, you pick the stack. If you pick the stack, you narrow the NPUs. This chapter lays that map out.

Four words you need

A runtime is a library inside your app. It loads a model, decides which parts run where, and calls the hardware. A delegate (or backend, or execution provider) is a plug-in that owns one kind of hardware and takes the subgraphs the runtime hands to it. The same idea has three names: TensorFlow Lite and LiteRT say delegate, ExecuTorch says backend, ONNX Runtime says execution provider.

A compiled binary is what the delegate produces: the command stream, the weight layout and the memory plan, all fixed for one chip. Ahead-of-time (AOT) compilation makes it on your build machine. On-device compilation, also called just-in-time (JIT), makes it on the phone at first launch. AOT starts fast and needs to know the target chip. JIT works on any chip the vendor supports, and the first run is slow.

One stack per family

ExecuTorch sits across several of these. The ExecuTorch backend overview page lists fifteen: XNNPACK, CUDA, Core ML, MLX, Vulkan, WebGPU, Qualcomm, MediaTek, Arm Ethos-U, Arm Cortex-M, Arm VGF, OpenVINO, NXP, Cadence and Samsung Exynos. You write one export, then choose which backend partitions it.

Choose a target below. The grid shows which runtimes reach it, from the docs this lesson opened. A filled cell means the docs list that route. The note under the grid says what binary you ship.

Find the route to an NPU

Rows are runtimes. Columns are neural engines. Tap an engine to light its column and read what you must ship.

Only routes named in the vendor and runtime pages opened for this lesson are filled. A blank cell means “not shown in those pages”, not “impossible”. LiteRT’s page lists Intel OpenVINO among its NPU routes without detail.

Count the column for the Hexagon NPU. Four routes reach it: Qualcomm’s own toolkit, ONNX Runtime, LiteRT and ExecuTorch. The binaries differ. The model graph you export is the same, so you can move between them. The Apple column has two entries, Core ML and ExecuTorch’s Core ML backend, and the second one calls the first. The Ethos-U column has two as well.

What the calls look like

swift// Core ML: ask for the Neural Engine, but it is a preference
let config = MLModelConfiguration()
config.computeUnits = .cpuAndNeuralEngine         // also .all, .cpuOnly, .cpuAndGPU
let model = try MLModel(contentsOf: modelURL, configuration: config)

python# ExecuTorch: one export, then a partitioner picks the backend
from executorch.exir import to_edge_transform_and_lower
from executorch.backends.xnnpack.partition.xnnpack_partitioner import XnnpackPartitioner
prog = to_edge_transform_and_lower(torch.export.export(model, (x,)), partitioner=[XnnpackPartitioner()])
# swap the partitioner for the Qualcomm, Ethos-U, MediaTek ... one to target an NPU
open("model.pte", "wb").write(prog.to_executorch().buffer)   # the artifact you ship

Both snippets show the shape of the call, not a full app. Read the version of the docs that matches your install, because option names move.

Failure modes

  1. An operator the delegate lacks. Symptom: slow, with a clean build. Measurement: the placement report of Chapter 3. Fix: change the operator or accept the CPU.
  2. A binary built for one chip, shipped to another. Symptom: the load fails, or it silently takes the CPU path. Measurement: log which backend initialised at start-up. Fix: compile per target chip, or choose a runtime with on-device compilation.
  3. A cached compile that went stale. Symptom: a driver update slows the first run again. Measurement: compare first-run and second-run time. Fix: key your cache on driver and runtime versions.
What is the main trade between ahead-of-time and on-device compilation?

Chapter 5

Drivers: drivers/accel, Vendor Blobs, Mainline

Learn who owns each layer between your app and the NPU, and what that ownership costs when the kernel moves

Your team ships a robot. The board comes with a vendor kernel, version 5.10, and an NPU driver the vendor built for it. A year later a security fix lands in the 6.12 kernel and you need it. You try to move. The NPU driver does not build. The vendor says a port is “on the roadmap”. Your whole platform now waits on one company’s schedule.

This is the driver problem, and it is separate from the runtime problem. A runtime fails with a slow model. A driver fails with a board that cannot update.

What a driver does here

The kernel owns the hardware. Your app is a normal process and cannot touch the NPU’s registers. A kernel driver is the code inside the kernel that can. For an NPU its job is small: power the block on and off, allocate memory the NPU can see and map it, and accept jobs, each one a command stream the compiler made plus the buffers it uses.

Everything else lives in userspace, the normal side. A userspace library takes your model, builds the command stream, and talks to the kernel driver through ioctl calls on a device file. A tight kernel part and a large userspace part is the common split, because kernel code is hard to write and risky to change.

The accel subsystem

For years NPUs borrowed the graphics subsystem (DRM) or shipped as private modules. Linux now has a home for them. The kernel documentation says compute accelerators, mainly machine learning devices, get a common interface in drivers/accel/. Their device nodes appear as /dev/accel/accelN, with major number 261. They reuse DRM code, and a driver marks itself with the DRIVER_COMPUTE_ACCEL flag. The separate nodes stop graphics software from mistaking an NPU for a GPU.

The directory listing on the kernel’s master branch names six drivers: amdxdna (AMD’s Ryzen AI NPU), ethosu (Arm Ethos-U), habanalabs, ivpu (Intel’s NPU), qaic (Qualcomm Cloud AI cards) and rocket (the Rockchip NPU in the RK3588). A Phoronix report from late October 2025 said the Ethos-U driver was expected in the 6.19 merge window.

The rocket documentation shows the split clearly. The kernel driver “only handles powering the hardware on and off, buffer allocation and mapping, and job submission”. Everything else sits in a Gallium driver, also called rocket, in the Mesa 3D project. The kernel part is small enough to review in the open. The userspace part is open too.

Trace a request down the stack

Pick a driver model. Each layer is coloured by who owns it. Then press Move to 6.12 and see which layers move with the kernel and which wait for a vendor.

The layers and owners for rocket come from the kernel documentation. For ivpu the kernel directory and the OpenVINO NPU route are confirmed; its firmware and other userspace details were not opened. The vendor-module column describes the typical case, not one named vendor. Whether a particular vendor ports in time varies.

With a mainline driver, the kernel move is a normal upgrade. The driver is in the tree, so the kernel developers who change an internal interface also fix the driver. The 6.12 kernel was released on 17 November 2024 and kernel.org projects its support to December 2028, so it is a sensible target. With a vendor module, the move waits. The module sits outside the tree and was written against the interfaces of one old kernel. Someone must port it, test it and sign it again.

Failure mode: the pinned BSP (board support package)

  1. Symptom. You cannot take a kernel security fix. Your product is stuck on a kernel the community no longer patches.
  2. Measurement. List every out-of-tree module in your image (modinfo shows them), and for each find the oldest kernel it builds on.
  3. Fix. Before you pick an NPU, ask for the driver’s mainline status in writing. Prefer parts whose driver lives in drivers/accel. If you must use a vendor module, budget a port and a test pass into every kernel update. Writing the driver and Jetson platform bring-up show the platform-side work.

One honest limit remains. A mainline kernel driver is not the whole stack. The runtime still decides which operators run, and a mainline driver can still pair with a closed userspace library. Mainline buys you the right to update the kernel. It does not buy you operator coverage.

What does a mainline drivers/accel driver buy a platform team over a vendor module?

Chapter 6

MCU-Class Inference: Ethos-U and TinyEngine

Fit a network into a few hundred kilobytes by counting the one number that decides: peak SRAM

A door sensor listens for the word “open”. It runs on a coin cell, on a microcontroller with no operating system and no DRAM. Its neural network must fit in the chip’s on-chip memory, and that memory is measured in kilobytes. On this machine the first question is not “how fast?” It is “does it fit at all?”

This chapter is a bridge. Two lessons own the deep detail: MCUNet for the search that shapes a network to a memory budget, and TinyEngine for the code generator that runs it. Here we place the MCU class on the map of neural engines and give you the budget arithmetic.

The MCU class, in two parts

A microcontroller (MCU) is a small chip with a CPU, flash and SRAM on one die. Flash holds code and the model’s weights. It is large, cheap, and read-only while the program runs. SRAM holds everything that changes, and it is the scarce one.

Two things speed up a network on this chip. The first is vector instructions on the CPU itself. Arm’s Cortex-M55 adds Helium, a vector extension for M-profile cores, and software libraries such as CMSIS-NN use it for convolutions. ExecuTorch lists a Cortex-M backend for this path. The second is a microNPU beside the core: the Ethos-U55 was the first Arm microNPU and pairs with the Cortex-M55, and the Ethos-U65 and U85 followed. The U85 scales from 128 to 2,048 MACs per cycle, which Arm rates from 256 GOPS to 4 TOPS at 1 GHz.

Both paths use the same fallback rule as Chapter 3. Vela puts supported regions on the Ethos-U and leaves the rest as ordinary CPU kernels, which come from TFLite Micro or CMSIS-NN. The --show-cpu-operations flag tells you which ones stayed behind.

The number that decides: peak SRAM

Weights sit in flash. Activations, the numbers flowing between layers, sit in SRAM. A layer needs its input and its output alive at the same moment, so the memory it needs is input plus output. The peak is the largest such sum over all layers. Firmware allocates one fixed block for it, called the tensor arena.

Work it for a small mobile-style network on a 96×96 colour image, in INT8 so one byte per number. The stem is a 3×3 convolution with stride 2 to 16 channels.

  1. Layer 1. In 96 × 96 × 3 = 27,648 bytes. Out 48 × 48 × 16 = 36,864. Needs 64,512.
  2. Layer 2, a 1×1 expand to 96 channels. In 36,864. Out 48 × 48 × 96 = 221,184. Needs 258,048.
  3. Layer 3, depthwise with stride 2. In 221,184. Out 24 × 24 × 96 = 55,296. Needs 276,480, the peak.

The weights of this block are tiny. The wide middle of an inverted bottleneck is what costs SRAM. A part with 256 KB, which is 262,144 bytes, cannot run it.

Fit the network into SRAM

Each bar is the SRAM one layer needs. The line is your budget. Raise the patch count to run the early layers one tile at a time.

256 KB
1 × 1

The seven layers and their sizes are a toy network computed in this chapter (INT8, 96×96 input). Patch-based numbers divide layers 1 to 3 by the patch count squared, add the 55,296-byte assembled output, and ignore the overlapping border rows a real patch needs. A KB here is 1,024 bytes. Pick the budget from your own part’s datasheet.

At 1×1 the peak is 276,480 bytes, 270 KB, so a 256 KB budget fails and the bar for layer 3 turns red. Raise the patches to 2×2. The early layers now work on a quarter of the image at a time, so the peak falls to 124,416 bytes, 121.5 KB. At 3×3 the peak drops to 96,768, set now by layer 5. More patches stop helping because the later layers become the limit. This idea comes from MCUNetV2’s patch-based inference, and the MCUNet lesson owns its detail, including the extra compute the borders cost.

Failure mode: it does not fit

  1. Symptom. The firmware fails at start-up or the arena allocation returns an error. Or it works until a longer input arrives.
  2. Measurement. Print the arena size the runtime asks for and the per-layer table. Find the layer with the peak.
  3. Fix. Shrink the expand ratio at the peak layer, run early layers in patches, or pick an architecture searched against a memory budget (MCUNet). TinyEngine reorders loops and tiles to cut waste (TinyEngine).
On real hardware. Take an STM32 Nucleo board or an nRF52840 DK, run the same tiny network through TFLite Micro, and read the tensor arena size it needs. Compare it with your table. If you have an Ethos-U board, run Vela with --show-cpu-operations and count the layers it left on the CPU.
Layer input is 36,864 bytes and its output is 221,184 bytes. How much SRAM does that layer need while it runs?

Chapter 7

Closed Stacks: Apple Neural Engine and Snapdragon X

Learn what you can and cannot see inside an NPU stack you do not control, and how to measure it anyway

You ship an iPhone app with a vision model. On your test phone it runs in 12 ms. A customer with an older phone reports 40 ms. You ask the obvious question: did the model run on the Neural Engine on their phone? You cannot ask the Neural Engine. There is no log, no counter, no file to open. You can only watch the clock.

Some stacks are open boxes. Others are closed. This chapter covers two closed ones, the Apple Neural Engine and the Qualcomm Hexagon NPU as reached through ONNX Runtime on Snapdragon X, and teaches how to work with them.

The Apple Neural Engine

Apple publishes no TOPS figure for the Neural Engine in the M5. It also offers one public door, Core ML. You tell Core ML which compute units it may use through MLModelConfiguration.computeUnits. The cases are .all, .cpuOnly, .cpuAndGPU and .cpuAndNeuralEngine. These are preferences, not orders. If a layer cannot run on the requested unit, Core ML may move it.

Xcode offers a Core ML performance report. It lists each layer and which units it can run on. A grey tick at the Neural Engine means “supported”, not “used”. An Apple developer-forum thread shows a model with that tick that ran on the CPU. An Apple engineer replied that an earlier layer probably could not run on the Neural Engine, and that Core ML sometimes avoids switching back because the switch costs time. That is the Chapter 3 lesson again: one early fallback can pull everything after it.

For ground truth several sources point to the Instruments app with its Core ML template, which shows each layer’s assigned unit and timing. One source calls it the only reliable view, which is an opinion, not an Apple statement.

Snapdragon X through ONNX Runtime

On Windows laptops with Snapdragon X, ONNX Runtime’s QNN execution provider reaches the Hexagon NPU. This one is more open about its rules, and the rules matter. The provider page says the HTP backend “only supports quantized models”. Dynamic shapes are unsupported, so you fix every dimension. The quantization tools run only on x86-64, so you quantize on one machine and run on ARM64. You can save the compiled result as a context binary to cut load time. And one setting, session.disable_cpu_ep_fallback, turns fallback into an error. The page was tested with QNN 2.22.x on Snapdragon X parts among others, so check your version.

This lesson did not open the Windows ML pages. The facts above come from the ONNX Runtime provider page only.

An opacity meter

Compare four stacks on three questions. Can you see which operators will run on the NPU before you run? Can you make a fallback a build error? Is the supported-operator list published? A grey answer means I did not open a source for it. Do not read grey as “no”.

Meter the opacity of a stack

Pick a stack. Green means a documented yes, yellow means partly, red means no, grey means not checked. The meter counts the clear greens.

Each answer rests on the page or forum thread named in the Field Guide. Where only a forum answer or a third-party guide supports a cell, the evidence line says so. A grey cell means this lesson did not open a source, not that the feature is absent.

How to measure a closed stack

When you cannot see placement, infer it with differential timing. Run the same model with each allowed set of units and compare. The numbers below are illustrative.

  1. Run with .cpuOnly: 40 ms.
  2. Run with .cpuAndNeuralEngine: 39 ms.
  3. Read. The Neural Engine request changed almost nothing, so most layers probably stayed on the CPU. Fall back to the performance report to find the first layer that cannot run, then change it.

If the second run gave 12 ms, the Neural Engine took most of the work. Keep both numbers in your test suite so a model change that moves a layer off the engine shows up as a regression, not a customer complaint.

On real hardware. Use any Mac or iPhone, or a Snapdragon X laptop. Time the same model under each compute-unit setting, or with fallback turned into an error on the laptop. Record the three numbers in your repo.
Core ML’s performance report shows a Neural Engine tick on every layer, yet the model is slow. What does the tick mean?

Chapter 8

Field Guide

Keep the numbers, the checklist and the estimator, and know where this topic leads next

The headline TOPS number is a peak: MAC units times two times the clock. Your model reaches the lowest of four ceilings. The first is peak itself. The second is memory bandwidth times your model’s operations per byte. The third is operator coverage, because each fallback costs its own time plus a switch. The fourth is the runtime and the driver, which decide what you can ship, see and update. A map of neural engines is a map of runtimes and drivers, with TOPS as one column.

The numbers

EnginePeakMemoryRuntimeDriver
Snapdragon X2 Elite (Extreme)80 TOPS INT8228 GB/s reportedQAIRT / QNN, ORT QNN EP, LiteRTWindows, closed
Intel Panther Lake NPU 550 TOPSnot openedOpenVINOaccel/ivpu
AMD Ryzen AI 9 HX 47560 TOPSnot openedRyzen AI softwareaccel/amdxdna
Apple M5 Neural Engineunpublishednot openedCore MLclosed
Jetson AGX Orin 64GB275 sparse INT8 TOPS204.8 GB/s LPDDR5TensorRTJetson Linux
Orin two DLAs105 sparse, 52.5 denseshared 204.8 GB/sTensorRT, GPU fallbackJetson Linux
TI TDA4VM / AM62A78 / 2 TOPS (8-bit, 1.0 GHz)not openedTIDLTI Linux SDK
NXP i.MX 8M Plus2.3 TOPSnot openedNXP stackcheck the BSP
Rockchip RK35886 TOPS, 3 coresnot openedRKNN or Mesa rocketvendor or accel/rocket
Arm Ethos-U85 / U65up to 4 / 1 TOPS at 1 GHzon-chip SRAMVela, TFLite Micro, ExecuTorchfirmware, or accel/ethosu

Derived: Orin ridge = 275 × 1012 ÷ 204.8 × 109 = 1,343 ops/byte · X2 Elite Extreme ridge = 351 · 3×3 conv (64→64, 56×56, INT8) = 528 ops/byte · depthwise = 9

The terms

TermIn plain words
TOPSTrillions of operations per second. A peak from MACs × 2 × clock.
Arithmetic intensityOperations a layer does per byte it moves to or from main memory.
Ridge pointPeak divided by bandwidth. Below it a layer is memory-bound.
FallbackAn operator the NPU cannot run, so the CPU runs it.
SubgraphAn unbroken run of supported operators compiled as one NPU blob.
Delegate, backend, providerA plug-in that owns one kind of hardware inside a runtime.
Context binaryA saved compile result that cuts load time on the next start.
Tensor arenaThe fixed SRAM block a microcontroller allots for activations.
drivers/accelThe kernel home for NPU drivers, with nodes at /dev/accel/accelN.

The checklist

  1. Read the footnote. Which precision, dense or sparse, which parts counted?
  2. Find the bandwidth the NPU can use, and compute the ridge.
  3. Compute your layers’ intensity. Mark which sit below the ridge.
  4. Get the placement report and count fallbacks, subgraphs and switches.
  5. Make fallback an error in your build wherever the runtime allows it.
  6. Ask for the driver’s mainline status and the oldest kernel it builds on.
  7. On a closed stack, time it under each allowed unit set, on the real device.
  8. Keep a CPU baseline and a parity test for every target (parity).

The core as code

The two code labs of this lesson, the achieved-TOPS estimator and the portability checker, fit in thirty lines. The last two lines reproduce the Chapter 2 numbers.

pythonfrom dataclasses import dataclass

@dataclass
class Engine:
    name: str
    peak_tops: float          # vendor headline, in the precision you run
    bw_gbs: float             # memory bandwidth the NPU can really use

def layer_intensity(macs, bytes_moved):
    return 2 * macs / bytes_moved                      # one MAC = 2 operations

def achieved_tops(e, intensity, utilisation=1.0):
    mem = e.bw_gbs * intensity / 1000.0                # GB/s x op/B = Gop/s -> TOPS
    comp = utilisation * e.peak_tops
    return min(comp, mem), ("memory" if mem < comp else "compute")

def partition(ops, supported):
    """ops: [(name, kind, gop)]. Returns (subgraphs, switches, npu_gop, cpu_gop)."""
    sub = sw = 0; prev = None; npu = cpu = 0.0
    for name, kind, gop in ops:
        ok = kind in supported
        if ok:
            npu += gop
            sub += prev is not True                     # a new unbroken run starts here
        else:
            cpu += gop
        sw += prev is not None and prev != ok               # colour change = a switch
        prev = ok
    return sub, sw, npu, cpu

def latency_ms(ops, supported, npu_tops, cpu_tops, switch_ms):
    sub, sw, npu, cpu = partition(ops, supported)
    return npu / npu_tops + cpu / cpu_tops + sw * switch_ms   # Gop / TOPS = ms

orin = Engine("Jetson AGX Orin", 275, 204.8)
print(achieved_tops(orin, 100))                                  # (20.48, 'memory')
print(achieved_tops(orin, layer_intensity(115_605_504, 438_272)))  # (108.04..., 'memory')
On real hardware. Pick a Jetson Orin developer kit, an STM32 Nucleo with an Ethos-U board, or a Snapdragon X laptop. Run your own model, read the placement report, and fill the table above with measured numbers beside the vendor ones.

Where it sits in the field

This lesson sits between model work and platform work. Before it comes the model path: export, partition, fallback, quantize, compile, prove parity and the inference latency stack. Beside it comes the accelerator’s own design, which another lesson in this series covers, and the roofline in more depth. After it come the platform lessons, such as Jetson platform bring-up, and the Linux background in Embedded Linux.

Keep going

Sources opened for this lesson

The takeaway. Do not ask “how many TOPS?” Ask “how many operations per byte does my model do, what share of it does the runtime place on the NPU, and who updates the driver?” Those three answers predict your speed. The TOPS figure only sets the roof.

Now press Present or Teach and explain, from memory, why an 80 TOPS NPU can lose to a 6 TOPS one. Then go back to the map at the top, pick the Snapdragon and the Jetson, and say which ceiling each one meets first.

Neural Engines: NPU Architectures, Drivers and Runtimes Compared
Export, Partition, Fallback · Back to Gleams