贡献 / #1877

#1877 monitor: check the AMD board name's capacity against the memory the driver reads

open · @phoenixclyde · 0 评论 · 去 GitHub 看

Server & APIAMD / HIP

说明

Our MI50's FRU string is `Radeon Instinct MI50 16GB` on a 32 GB part (PCI ID `1002:66a1`, `mem_info_vram_total` = 34,342,961,152 B = 31.98 GiB), so the Monitor shows `/ 32 GB` next to a name that says 16GB.

`_Amd.name()` reads that string straight out of `product_name`, which the kernel documents as the board's FRU EEPROM contents ("as returned from the FRU"), and a FRU can disagree with what is fitted - a re-badged card or a FRU left at the wrong SKU, both common on second-hand Instinct parts. The memory size, by contrast, comes from the card's own configuration.

This makes the capacity in the name agree with the driver's figure. It is deliberately a consistency check and not a table of known cards:

- a name with **no** capacity (`Radeon Pro VII`) hits `not m` and is returned untouched;
- a name whose capacity **already agrees** hits `== want` and is returned unchanged (`MI60 32GB`, and a true 16 GB MI50 keep their own strings);
- `mem_info_vram_total` missing (`not total`) also returns the name as-is, so a card whose VRAM the driver does not report is unaffected;
- the substitution keeps any suffix after the number, so `... 16GB HBM2` becomes `... 32GB HBM2` rather than dropping it.

On our MI50 this turns `Radeon Instinct MI50 16GB` into `Radeon Instinct MI50 32GB`, read straight off `/metrics`. Output-identical aside from the name; no behaviour elsewhere in `telemetry.py` is touched.

Verified on gfx906 (MI50 32 GB) against the current `main`: `_Amd._int()` is the existing helper for reading a single integer out of sysfs, and the change adds one stdlib import (`import re`) which the module did not previously need.

本站相关内容

相关页面的快捷入口。