Repository navigation
fix(device): fall back to DMI board name for chip model on ARM64 Linux - #14
Conversation
cpuinfo_chip_model() and device_tree_model() both return None on ARM64 hosts whose kernel emits no Hardware or model name field in /proc/cpuinfo and expose no /proc/device-tree/model. probe() then fails the device_chip_model requirement and no result can be recorded at all. Fall back to /sys/devices/virtual/dmi/id/board_name, the sibling of the file detect_device_name() already reads.
Reviewed at VerdictGood, tightly scoped fix. Nothing below blocks merging. Verified locally: The blast radius is zero, and that is the strongest argument for this change. The diagnosis is unusually thorough: both existing sources traced to the specific missing Substantive comments1. It records a board name in a field that means chip
In fairness, the chain already degrades this way. But it is worth saying so in the doc comment, so that the next person reading 2. Worth checking what else that machine exposes before settling on
|
Review follow-ups on the ARM64 chip-model fallback. - Extract dmi_field(), replacing the duplicated read in detect_device_name(). - Reject DMI placeholder strings (Default string, To Be Filled By O.E.M. and friends) in the chip-model fallback. As the terminal link in the chain an unfiltered placeholder would become a fleet permanent chip model with no signal, which is the one case where this change traded a loud failure for a quiet wrong answer. - Log at debug when the chip model resolves from DMI, so an operator can see why a payload reads the way it does. - Document that this records a board identifier in a field that elsewhere holds silicon names, and that the degradation already exists one link up in device_tree_model. detect_device_name keeps its previous behaviour: dmi_field() applies only the empty check it already did, and the placeholder filter is confined to the chip-model path.
|
Thanks, this is a genuinely useful review. Pushed Checked on the hardware (your point 2)All three candidates, on the EdgeXpert. None of them work here:
So
One thing I did not expect: What changed in
|
|
Filed the three as promised:
|
| /// DGX Spark class boards, where `/proc/cpuinfo` exposes only raw MIDR | ||
| /// fields and no device tree exists at all. |
There was a problem hiding this comment.
This comment says /proc/cpuinfo exposes the raw MIDR fields, and your PR summary lists CPU implementer: 0x41 and CPU part: 0xd85. Those fields identify the silicon, which is what device_chip_model holds on the other platforms. Did you consider a decode of the MIDR fields before the board name, and if so, what ruled it out?
| if DMI_PLACEHOLDERS.contains(&board.to_ascii_lowercase().as_str()) { | ||
| log::debug!("device_chip_model: ignoring DMI placeholder board_name {board:?}"); | ||
| return None; | ||
| } |
There was a problem hiding this comment.
This check is a pure string comparison behind a sysfs read, so no test reaches it and a wrong entry in DMI_PLACEHOLDERS ships unnoticed. Extract fn is_dmi_placeholder(value: &str) -> bool behind #[cfg(any(target_os = "linux", test))], similar to the pattern parse_apple_thermal_state uses for testing. Then cover it with an rstest table that rejects Default string, To Be Filled By O.E.M., and Base Board Product Name and accepts EdgeXpert (MS-C931).
| const DMI_PLACEHOLDERS: [&str; 8] = [ | ||
| "default string", | ||
| "to be filled by o.e.m.", | ||
| "to be filled by oem", | ||
| "system product name", | ||
| "system manufacturer", | ||
| "none", | ||
| "unknown", | ||
| "not applicable", | ||
| ]; |
There was a problem hiding this comment.
system product name and system manufacturer appear in product_name and sys_vendor, not in board_name, so those two entries never match here. The placeholders that firmware does write to board_name are absent, so a host that ships one records it as its permanent device_chip_model with no failure signal. Drop the two dead entries and add these board_name placeholders:
base board product nametype2 - board product namenot specifiedn/aundefinednot available
`system product name` and `system manufacturer` are product_name and sys_vendor placeholders, so they never matched board_name. The board_name placeholders were missing, so a host shipping one would have recorded it as its permanent device_chip_model. - Drop the two dead entries; add `base board product name`, `type2 - board product name`, `not specified`, `n/a`, `undefined` and `not available`. - Extract is_dmi_placeholder() behind cfg(any(linux, test)) and cover it with an rstest table, so a wrong entry in the list fails a test instead of shipping. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
/proc/cpuinfo on GB10-class hosts carries CPU implementer / CPU part even when it has no model name, and those fields identify the silicon, which is what device_chip_model holds on every other platform. Decode them before falling back to the board name. - parse_cpuinfo_arm_cores() maps ARM Ltd (0x41) part numbers to core names using the util-linux lscpu table, so the names match lscpu. Heterogeneous layouts join distinct cores in order of first appearance (GB10: "Cortex-X925 + Cortex-A725"). - Any core that does not decode (another implementer, or a part newer than the table) yields None rather than a partial list, and detection moves on to the DMI board name. - Placed after device_tree_model, so hosts that resolve today report the same value; it also covers ARM hosts with no DMI, which the board-name fallback cannot. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Problem
PlatformDetector::detect()cannot resolvedevice_chip_modelon ARM64 Linux hosts, and becauseprobe()treats it as required, no benchmark result can be recorded at all on those machines.The measurement itself completes; the run then dies at the recording step with:
The two sources tried on Linux both come back
None:cpuinfo_chip_model()readsHardwareandmodel namefrom/proc/cpuinfo. Neither field isemitted on this host;
/proc/cpuinfocarries onlyCPU implementer: 0x41andCPU part: 0xd85 / 0xd87.device_tree_model()reads/proc/device-tree/model, which is empty here.The error message also suggests
--device-name/--device-form-factor, but those live onauth set-device, notbenchmarks run, and neither overrides the chip model. There is nooverride for
device_chip_modelanywhere in the CLI, so the failure is unrecoverable without acode change.
Reproduced on an MSI EdgeXpert (NVIDIA GB10, 128GB unified, Ubuntu 24.04.4 aarch64,
kernel 6.17.0-1026-nvidia). It is not GB10-specific: any ARM64 Linux host whose kernel omits
model nameand exposes no device-tree model node hits the same wall.Solution
Add
/sys/devices/virtual/dmi/id/board_nameas a third fallback in the chip-model chain. That isthe sibling of the file
detect_device_name()already reads, so it needs no new dependency and nonew probing strategy.
On the machine above it resolves to
EdgeXpert (MS-C931).board_namerather thanproduct_namebecause it is the more specific of the two here, andbecause
detect_device_name()already takesproduct_name, so the two fields stay distinctinstead of collapsing to the same string.
Testing
The repository's own
probe::tests::detect_returns_all_required_fieldsis the regression test:it asserts
device_chip_model.is_some()and fails on this hardware without the change.Full local gate, all green on aarch64 Linux:
End to end, a real benchmark now records where it previously aborted:
Resulting payload:
Measured 12.24 tok/s decode, which matches 12.33 tok/s from an independent llama-bench harness on
the same machine and model.
Notes
Two adjacent things I hit while getting here, both out of scope for this PR, happy to file
separately if useful:
LlamaCppFlavorhaswindows-x64-cuda-12-4andwindows-x64-cuda-13-1and nothing else CUDA. Linux arm64 offerslinux-arm64-cpuandlinux-arm64-vulkan. Upstream llama.cpp does not publish a linux-arm64CUDA asset either, so this needs the
url=form with a locally built archive. That part workswell, the
Customflavor path is a good escape hatch.max_memory_usageis gated tolinux-arm64-cpu/linux-x64-cpu/linux-s390x-cpuonLinux, so it bails on any GPU flavor. Expected given (1), noting it in case it is not.