Skip to content

armgit / uzu

Public Imported from GitHub
0

A high-performance inference engine for AI models

keisoku m5 fix

eugene01cdbbad90a5
diff --git a/crates/keisoku/README.md b/crates/keisoku/README.md
index 7be096e44..e407731f5 100644
--- a/crates/keisoku/README.md
+++ b/crates/keisoku/README.md
@@ -29,3 +29,28 @@ println!("CPU energy: {}", sample.get::<EnergyRail<Cpu>>());
## Platform
Apple only. `interval_measurement` (IOReport) is macOS-only; iOS exposes the `Device` instant subset.
+
+### Per-part IOReport differences
+
+The bandwidth group is named `PMP` on some parts and `PMP0` on others, with `PMP1` for a second die.
+This does not follow the generations: an M4 Max resolves it under `PMP` while an M5 Max needs `PMP0`.
+All three names are subscribed and classified, so `DramHistogram` and `AneBandwidth` work regardless of
+which one a given SoC uses — do not assume a rule from the chip's generation.
+
+Memory traffic comes from two sources and neither covers every part:
+
+| | `DramBytes` (`AMC Stats`) | `DramHistogram` (`PMP*`) |
+| --- | --- | --- |
+| M1 | yes | no |
+| M2, M2 Pro, M4 | yes | yes |
+| M3 Max, M4 Pro, M4 Max, M5 Max | no | yes |
+
+`DramBytes` reads from `AMC Stats`, and where it is unavailable `IOReportCreateSubscription` refuses
+that group outright — the channels remain enumerable but cannot be subscribed to. Every part measured
+has one of the two, but code that needs memory traffic should handle either being zero.
+
+M1 also publishes no memory energy channels at all, so `EnergyRail<Ram>` is zero there.
+
+`EnergyRail<Ram>` is the memory subsystem rather than the DRAM dies: where the `DRAM`, `DCS` and `AMCC`
+channels are published separately, all three are summed. They respond differently to workload shape, so
+they are distinct consumers rather than duplicates.
diff --git a/crates/keisoku/src/sys/ioreport/channels.rs b/crates/keisoku/src/sys/ioreport/channels.rs
index 87d1f228c..1a0c9c7f5 100644
--- a/crates/keisoku/src/sys/ioreport/channels.rs
+++ b/crates/keisoku/src/sys/ioreport/channels.rs
@@ -16,6 +16,8 @@ impl Channels {
(IoReportGroups::ENERGY_MODEL, obfstr!("Energy Model"), None::<&str>),
(IoReportGroups::AMC_STATS, obfstr!("AMC Stats"), None),
(IoReportGroups::PMP, obfstr!("PMP"), None),
+ (IoReportGroups::PMP, obfstr!("PMP0"), None),
+ (IoReportGroups::PMP, obfstr!("PMP1"), None),
] {
if !groups.contains(flag) {
continue;
diff --git a/crates/keisoku/src/sys/ioreport/decode/group_id.rs b/crates/keisoku/src/sys/ioreport/decode/group_id.rs
index 2a792536d..13f730b5d 100644
--- a/crates/keisoku/src/sys/ioreport/decode/group_id.rs
+++ b/crates/keisoku/src/sys/ioreport/decode/group_id.rs
@@ -15,7 +15,7 @@ impl GroupId {
GroupId::EnergyModel
} else if group == obfstr!("AMC Stats") {
GroupId::AmcStats
- } else if group == obfstr!("PMP") {
+ } else if group == obfstr!("PMP") || group == obfstr!("PMP0") || group == obfstr!("PMP1") {
GroupId::Pmp
} else {
GroupId::Other