jcp-energy: the Neural Engine is reported only once its rail is proved live #158

Merged
dcharlot merged 1 commit from jcp-energy/npu-needs-proof into main 2026-10-05 20:52:35 -04:00

2026-10-05

Transaction Science
jcp-energy: the Neural Engine is reported only once its rail is proved live
All checks were successful
standards workspaces build + test / eoc-rs (pull_request) Successful in 1m54s
standards workspaces build + test / jcp-rs (pull_request) Successful in 1m30s
standards workspaces build + test / proof-rs (pull_request) Successful in 1m11s
standards workspaces build + test / sandbox-rs (pull_request) Successful in 2m12s
standards workspaces build + test / smart-byte-rs (pull_request) Successful in 3m35s
standards workspaces build + test / jouleclaw-rs (pull_request) Successful in 8m55s
standards workspaces build + test / aac-rs (pull_request) Successful in 3m55s
standards workspaces build + test / joule-code-rs (pull_request) Successful in 4m25s
standards workspaces build + test / joulecontract-rs (pull_request) Successful in 1m48s
standards workspaces build + test / map-rs (pull_request) Successful in 2m16s
standards workspaces build + test / mesh-rs (pull_request) Successful in 1m31s
standards workspaces build + test / openpay (pull_request) Successful in 8m19s
standards workspaces build + test / arl-rs (pull_request) Successful in 2m6s
standards workspaces build + test / joule-ui-rs (pull_request) Successful in 2m37s
standards workspaces build + test / jouledesk-rs (pull_request) Successful in 2m34s
standards workspaces build + test / joulehook-rs (pull_request) Successful in 4m14s
standards workspaces build + test / sense-rs (pull_request) Successful in 2m34s
standards workspaces build + test / macOS energy backends (pull_request) Successful in 4m27s
FabricMeter listed the Neural Engine as readable whenever IOReport
opened, and reported its `ANE0` delta over every span. A rail that did
not advance was read as zero, "on an idle fabric that is the truth". On
macOS 27.0.1 an unprivileged reader's ANE0 is frozen. It did not advance
in any of 25 sample intervals over 3 s of Core ML inference on the ANE,
while root powermetrics read 0.47 J of ANE energy over the same span. So
real Neural Engine work was reported as 0 J, which is what the ANE0 fix
set out to stop.

- `npu_rail_liveness(load)`, cached once per process. It runs the shared
  liveness rule over the ANE rails the counter sums, the `ANE Energy`
  aggregate or else every `ANE<n>` rail, with the caller's
  Neural-Engine load between samples. A sample with no ANE rail is no
  sample, so a part without one is Unavailable, never a vacuous Live.
- FabricMeter lists and reports the Neural Engine only once that proof
  says Live.
- The survey now uses the shared rule instead of a single advance over
  60 ms. Its CPU status comes from `ioreport_status()`, and its Neural
  Engine status from the proof. A rail republished in lumps passes a
  one-advance test.

Tests:
- the ANE rails the probe watches match the counter's sum;
- the scripted probe gives Frozen for a holding ANE0, Live for an
  advancing one, Frozen for a lump and for one engine of two, and
  Unavailable with no ANE rail;
- on this Mac the meter lists only the CPU and the GPU, and a load that
  never touches the ANE leaves its rail Frozen.

Mutations caught: emitting the Neural Engine figure unproved, and
dropping the empty-rail filter.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-05 09:18:11 -04:00