Documentation
¶
Overview ¶
Command bundlereuse compiles a MIL program to a Neural Engine bundle once, then reopens that bundle — in this process and in a second process, with the source MIL and its weights deleted — and checks that every arm computes the same answer as a float64 CPU reference.
Compilation is the expensive part of the private e5rt route: the aned daemon lowers MIL to a signed hardware program, which takes hundreds of milliseconds to seconds, while binding and dispatch are microseconds. A deployed program wants to pay that once. e5rt.OpenBundle is the interface for it, and until this example nothing outside the package's own tests called it.
What "reuse" has to mean to be worth anything ¶
A program that reopened a bundle and silently recompiled from the source would look exactly like one that reused it — same answer, same code path from the caller's side. So this example deletes the model directory, weights and all, between compiling and reopening. What that establishes is narrower than "no recompilation happened": it establishes that neither OpenBundle nor the second process fell back to the caller-side MIL and weights, because those no longer exist. What aned does internally when it materializes a compiled bundle is not observed here.
The second process is a genuinely separate one, spawned after the source is gone. It shares this program's code-signing identity and has it as a parent. That is the case E5RT bundle reuse has been observed in; reuse after an aned reboot or from an unrelated process is not measured here and this program does not claim it.
What each check would catch ¶
Every arm is compared against a float64 CPU evaluation of the convolution. An arm that loaded a different or stale program fails here.
The reopened arms are compared against the freshly compiled arm as well, which is a tighter bar than the reference: both run the same fp16 program on the same hardware, so they should agree exactly, not merely closely.
A mutation control runs two inputs through one opened program and requires the second execution both to move and to match its own recomputed reference. Two fresh opens would show only that two opens react to two inputs; running twice through one program is what a stale output or rebinding bug would fail, and it is what a decode loop needs.
The second process declares how many values it returns, and the parent re-checks that count. Six malformed child results are fed to the parser on every run to prove it still refuses them. Without this, a truncated result compared over its prefix was reported identical.
An unrelated-process arm opens the bundle from a process that started before the model existed, runs in its own session and process group, shares no file descriptors with the compiler, and touches nothing until after the source MIL and weights are gone. It is compared against the freshly compiled arm exactly like the second-process arm. What remains outside the claim: the opener still runs as the same user as whoever ran this program, so reuse across a uid change stays unmeasured.
A wrong function name and a damaged bundle file are both required to be refused, and they fail at different native entry points. Without them, "the bundle opened" would be evidence only that OpenBundle returns non-nil.
Compile and open are timed separately, so the number that motivates the whole interface is visible rather than asserted. Compile time varies substantially between runs, so the printed ratio is a diagnostic showing the order of magnitude, not a benchmark figure.