fix(doctor): count RAM channels from Locator so EPYC isn't mis-flagged single-channel#108
Merged
Merged
Conversation
…d single-channel (#108) doctor's RAM check counted memory channels by distinct `Bank Locator` values from `dmidecode -t memory`. Desktop boards encode the channel there, but server boards (EPYC/Threadripper) repeat one `BANK 0` for every DIMM and instead carry the channel in the `Locator` letter group (`DIMM_P0_A0`..`DIMM_P0_H0` = channels A..H). So a fully-populated 8-channel EPYC 7642 collapsed to 1 channel and printed a false "RAM is single-channel" warning despite sustaining ~36,880 H/s. _mem_summary now counts distinct channels in BOTH fields and reports the larger: a new `Locator:` rule (anchored so it doesn't also match `Bank Locator:`) extracts the channel letter immediately before the trailing slot number. Taking the max keeps existing desktop dual-channel detection intact and can only raise the count toward truth — a genuine single-channel layout still reads as 1 (its DIMMs share one channel letter). Tests: dependency-free dmidecode fixtures for an 8-channel EPYC (8 × `DIMM_P0_[A-H]0`, all `BANK 0`) asserting 8 channels / no warning, plus a desktop board carrying the channel only in the Locator (`DIMM A1`/ `DIMM B1`). Existing single/dual-channel Bank Locator tests unchanged. `make lint` and `make test-suite` (602 passed) stay green. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
On a fully-populated 8-channel EPYC 7642 (8 DIMMs, one per channel — the optimal layout),
doctorprinted a false warning:The board is genuinely 8-channel: it sustains ~36,880 H/s on RandomX (single-channel would be far lower), and exposes one Locator per channel.
Root cause
_mem_summary()counted memory channels as the number of distinctBank Locatorvalues fromdmidecode -t memory. Desktop boards encode the channel there (BANK 0/P0 CHANNEL A), so the heuristic works. But server boards (EPYC/Threadripper) repeat oneBank Locator: BANK 0for every DIMM and instead carry the channel in theLocatorfield's letter group:So the count collapsed to 1.
Fix
_mem_summarynow counts distinct channels in both fields and reports whichever is larger:/^[ \t]*Locator:/awk rule (anchored so it doesn't also matchBank Locator:) extracts the channel designator viamatch(v,/[A-Za-z][0-9]+$/)— the letter immediately before the trailing slot number (DIMM_P0_A0→A,DIMM A1→A), upper-cased into a separate set.END,channels = max(bank-locator channels, locator channels).Taking the max keeps existing desktop dual-channel detection intact (Bank Locator path untouched) and can only raise the count toward truth — a genuine single-channel layout still reads as 1, since its populated DIMMs share one channel letter.
Tests (dependency-free, in
tests/run.sh)DIMM_P0_[A-H]0, allBank Locator: BANK 0→ asserts8 modules across 8 channelsand no single-channel warning.DIMM A1/DIMM B1, sharedBANK 0) → asserts 2 channels / no warning, proving the Locator path works independently of Bank Locator.Bank Locatortests unchanged and still pass.Verification
make lint(shellcheck +shfmt -i 4): cleanmake test-suite: 602 passed, 0 failed🤖 Generated with Claude Code