Skip to content

fix: inference: parse the rocm-smi probe the probe already ran - #2047

Merged
lollipopkit merged 2 commits into
lollipopkit:mainfrom
pwu2775-dev:fix/rocm-dead-probe
Dec 3, 2026
Merged

lollipopkit merged 2 commits into
lollipopkit:mainfrom
pwu2775-dev:fix/rocm-dead-probe

Conversation

@pwu2775-dev

Copy link
Copy Markdown
Contributor

What this changes

probe_command asks every machine with rocm-smi for its cards — product names and VRAM, JSON, on every probe — and parse_probe had no "rocm" arm, so the line was dropped on the floor. A real command's cost on each probe, and nothing to show for it.

The machine this matters on is exactly where rocm-smi is the only source: an iGPU or a container whose sysfs carries no mem_info_vram_total — the DRM probe there saw the card as vendor 0x1002 with a zero read, and reported an unnamed "AMD GPU" carrying no memory.

The answer is read now:

  • Each card's gpu_type/market_name and its vram.total unit-converted to MiB (MB/GB/KB/B).
  • It replaces the DRM probe's blind slot (a card with no figure) rather than sitting beside it — one card, said once, now with a name and a memory figure.
  • Cards beyond the DRM probe's blind slots are appended as-is: they are real cards too, and rocm-smi is the only place their names appear.
  • Where sysfs already answered with a real VRAM figure, rocm-smi's output is left unread — the two would otherwise list the same card twice.

How it was tested

Two new tests in inference.rs: one where the DRM probe read zero and rocm-smi's two cards replace the blind slot and extend the list (MB and GB units both exercised), one where sysfs already answered and rocm-smi's copy is skipped. cargo test -p sbm_parser --lib — 315 passed; the 2 monitor_agent shell-validation failures fail identically on unmodified main on this Windows machine (environment, not this change — noted in #2011 where the maintainer merged it as-is). cargo clippy -p sbm_parser clean.

No Dart, no ARB, no monitor/ change.

probe_command has asked every machine with rocm-smi for its cards —
product names and VRAM, JSON, every probe — and parse_probe had no
"rocm" arm, so the line was dropped on the floor: a real command's
cost on each probe, and nothing to show for it. An iGPU or a container
whose sysfs carries no mem_info_vram_total is exactly where rocm-smi is
the only source: the DRM probe saw the card as vendor 0x1002 with a
zero read, and said "AMD GPU" with no memory.

The answer is read now: each card's gpu_type/market_name and its VRAM
unit-converted to MiB, replacing the DRM probe's blind slot (a card
with no figure) rather than sitting beside it, and appended as-is when
there were more cards than blind slots. Where sysfs already answered
with a real figure, rocm-smi's output is left unread — the two would
have listed the same card twice.
@pwu2775-dev

Copy link
Copy Markdown
Contributor Author

I have read the CLA Document and I hereby sign the CLA

@coderabbitai

coderabbitai Bot commented Dec 3, 2026 •

Copy link
Copy Markdown
Contributor

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Essentials
  • Run ID: b66f11e8-33da-4bc1-b2bb-43b380b2f821

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • Trigger review
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

@lollipopkit

Copy link
Copy Markdown
Owner

Two issues against real probe_command() output:

  1. Wrong rocm-smi --json schema: rocm-smi --showproductname --showmeminfo vram --json (rocm_smi.py) emits flat string-valued keys per cardN — "Card Series" (or "Card series" on older ROCm) for the card name and "VRAM Total Memory (B)" as a byte string (e.g. "21458059264"), not "gpu_type" / "market_name" or nested "vram": {"total": ..., "unit": ...}. Also skip non-card top-level keys such as "system".
  2. Line-order bug causing duplicate GPUs: probe_command() prints rocm= before drm=, so the "rocm" if !drm_amd.iter().any(|vram| *vram > 0) guard is always true on real output (drm_amd is still empty), and hw.gpus.extend(rocm_gpus) duplicates every card sysfs also reported. The dedup test only passed because it put drm= before rocm=. Reconciling rocm_gpus and drm_amd should happen after the loop (preferring rocm-smi's product name when both are present).

@lollipopkit
lollipopkit merged commit df2ecca into lollipopkit:main Dec 3, 2026
22 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants