Skip to main content

Module gpu

Module gpu 

Source
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:

  1. Its PCI device id is in INTEGRATED_PCI_DEVICE_IDS (structural, definitive — e.g. Raphael 0x164e).
  2. 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.

Constants§

DISCRETE_MIN_VRAM_BYTES
VRAM threshold below which a device is treated as integrated (4 GiB).
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§

device_is_integrated
Combined, fail-safe classification of a single device.
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?
read_vram_bytes
Read a PCI device’s mem_info_vram_total (bytes) from sysfs, if available.