Documentation
¶
Overview ¶
Command pipelinelogits runs a language model's logits tail — final RMSNorm, classifier projection, softmax — as one linked e5rt.Pipeline on the Neural Engine, and checks every probability against a float64 CPU reference.
The other e5rt examples each encode a bespoke stream by hand. This one uses the package's own multi-stage interface: three independently compiled MIL programs, two links, one Execute. The point of the interface is that a linked pair of ports is bound to one E5RT buffer object, so this program stages no host copy between the stages. That is what is measured here — it is not an observation of device-internal movement, and it does not establish that the platform performs no hidden copy of its own.
Why a logits tail ¶
It is the part of a decoder that a host round trip hurts most and that no other example covers. It is also the smallest interesting chain whose stages do not commute: RMSNorm before the projection is not the projection before RMSNorm, so a demo that silently ran the stages in the wrong order, or that dropped one, could not match the reference by luck.
The three programs come from x/ane/mil's GenFinalRMSNorm, GenClassifierForward and GenSoftmaxVocab. Until this program was written none of the three had a caller anywhere in the module — they had never been compiled, let alone run. Their first execution is here.
What is checked, and what each check would catch ¶
Every output probability is compared against a float64 CPU evaluation of the whole three-stage composition. A stage that ran the wrong arithmetic fails here.
The same three programs are run again as three separate [e5rt.Program]s with the host copying between them, and the two arms must agree. This is the control on the links specifically: the staged arm reaches the same answer by a route that uses no links at all, so if the linked arm agrees with it, the links carried what the host copies carried.
The linked ports are checked to be one buffer and not two, by writing through stage 0's output and reading the bytes back through stage 1's input. Two buffers that happen to hold equal values would pass a value comparison and fail this.
A mutation control perturbs one input element and requires the output to move by far more than the fp16 agreement tolerance. Without it, a program that returned a stale or constant buffer would pass every check above.
Two malformed pipelines — a link between ports of different sizes, and a link that runs backwards — are required to be refused. A validator that accepted everything would let the first three checks pass while proving nothing about the shape of the interface.
The compiler's chosen backend is printed for each stage. The device mask is a permission and not a placement, so the emitted main_<backend> directory is the only local evidence that this ran on the engine at all.