Expand description
GPU classification — the SINGLE source of truth for distinguishing AMD discrete GPUs (dGPUs) from integrated GPUs (iGPUs).
§Tenet (v0.3.0 remediation)
“The iGPU is CONSISTENTLY filtered from env vars and is NEVER included — EVER. iGPUs are NOT supported and will ONLY cause issues. Intelligent filtering must avoid including the iGPU from env vars or ANY component, while ensuring dGPUs are never missed.”
This module exists because the crate previously had three divergent
iGPU classifiers (installer.rs::is_igpu_name, bootstrap/env_setup.rs:: is_integrated_gpu_name, and inline checks in hardware.rs /
platform/linux.rs / benchmarks). They disagreed, and three consumers
bypassed filtering entirely (textgen/comfyui hardcoded "0,1";
migraphx_python trusted inherited HIP_VISIBLE_DEVICES). The leaking
iGPU broke the MIGraphX/ONNX worker. Everything now routes through here.
§Classification rule
A device is integrated if ANY of:
- Its PCI device id is in
INTEGRATED_PCI_DEVICE_IDS(structural, definitive — e.g. Raphael0x164e). - Its marketing/lspci name matches
is_integrated_gpu_name(rich curated heuristic: APU codenames, “Ryzen && !RX”, APU model suffixes).
device_is_integrated additionally treats a low-VRAM device
(< 4 GiB) as integrated when the name is ambiguous — but only as a
confirmation, never as the sole reason to drop a device whose VRAM is
unreadable (that would risk missing a real dGPU on kernels without
mem_info_vram_total). dGPUs (Navi 31/32, 24/16 GB) are never caught.
Structs§
- AmdGpu
- AMD discrete GPU discovered via sysfs.
Constants§
- DISCRETE_
MIN_ VRAM_ BYTES - VRAM threshold below which a device is treated as integrated (4 GiB).
- DISCRETE_
PCI_ ID_ TO_ GFX - Authoritative PCI device ID → gfx arch mapping for AMD discrete GPUs.
- INTEGRATED_
GFX_ ARCHS - AMD gfx architectures that are unambiguously integrated (iGPU-only).
- INTEGRATED_
NAME_ PATTERNS - Curated marketing/lspci name fragments indicating an AMD integrated GPU.
- INTEGRATED_
PCI_ DEVICE_ IDS - PCI device IDs of known AMD integrated GPUs (APU/iGPU).
Functions§
- detect_
amd_ gpus - Detect ALL AMD GPUs via lspci + sysfs (includes iGPU; use
detect_discrete_amd_gpusto filter). - detect_
discrete_ amd_ gpus - Detect ONLY discrete AMD GPUs (iGPU filtered out).
- device_
is_ integrated - Combined, fail-safe classification of a single device.
- gfx_
from_ marketing_ name - Resolve gfx arch from marketing name (canonical fallback).
- is_
integrated_ by_ gfx_ arch - Is this gfx architecture string an iGPU-only architecture?
- is_
integrated_ by_ pci_ id - Is this PCI device id a known integrated GPU?
- is_
integrated_ gpu_ name - Does a marketing/lspci/rocminfo name indicate an AMD integrated GPU?
- pci_
id_ to_ gfx - Look up gfx arch by PCI device ID (normalized, case-insensitive).
- read_
vram_ bytes - Read a PCI device’s
mem_info_vram_total(bytes) from sysfs, if available.