jcp-energy: the Neural Engine is reported only once its rail is proved live #158
Loading…
Reference in a new issue
No description provided.
Delete branch "jcp-energy/npu-needs-proof"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Defect.
FabricMeterlisted the Neural Engine as readable whenever IOReport opened. It then reported theANE0delta over every span, and documented that a rail which did not advance reads zero, "on an idle fabric that is the truth".That is not true here. On macOS 27.0.1 an unprivileged reader's
ANE0is frozen. It did not advance in any of 25 sample intervals (100 ms each) over 3 s of Core ML inference running on the ANE. Over the same span, rootpowermetricsread 0.47 J of ANE energy. So real Neural Engine work was reported as 0 J, the "metered as free" outcome theANE0fix (6f2dd38a) set out to stop. Before this change the meter emittedFabricEnergy { fabric: Npu, uj: 0, … }over a span on this Mac.Fix
npu_rail_liveness(load), cached once per process. It runs the shared liveness rule (≥5 advances, ≥80% of intervals, ≥300 ms) over the ANE rails the counter sums: theANE Energyaggregate where a part has one, else everyANE<n>, never both. The caller's load runs between samples and must put work on the Neural Engine; burning CPU moves no ANE rail. A sample with no ANE rail counts as no sample, so a part without one isUnavailable, never a vacuousLive.npu_rail_liveness_cached()reads the cached result.FabricMeterlists and reports the Neural Engine only once that proof says Live.survey()used to call a rail live after one advance over a 60 ms CPU burn. A rail republished in lumps passes that test, which is the case the family rule exists for. The CPU status now comes fromioreport_status()(the sustained rule) and the Neural Engine status from the proof. The GPU check is unchanged.Tests
npu_status_with(the function the cached liveness runs):ANE0holding through the load → Frozen;tests/npu_needs_proof.rs, its own process): unproved, the meter lists only(Cpu, Process), (Gpu, Machine)and gives no Neural Engine figure. A load that never touches the ANE leaves its rail Frozen.Npu, uj: 0;cargo test -p jcp-energypasses all 102 tests. The jcp-rs--workspace --all-targetscheck is clean, and the jcp-energy Linux check adds no new warnings. Clippy reports nothing in the changed code.🤖 Generated with Claude Code