You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The current architecture assumes a single GPU throughout the stack. Systems with multiple GPUs (e.g., AMD APU with integrated Radeon Graphics + discrete AMD GPU) suffer from data corruption, missing data, and incorrect display.
Current Problems
Backend
Event payload is single-GPU — HardwareMonitorUpdate has flat fields (gpu_usage, gpu_name, gpu_temperature, etc.) for only one GPU
Event emitter discards all but first GPU — emit_hardware_update() in system_monitor.rs uses gpu_samples.first(), throwing away data for every other GPU
[Linux] GPU name collision — lspci.rs returns the first VGA device matching a vendor ID. Both AMD iGPU and dGPU have vendor 0x1002, so they get the same name. This causes data overwrite in history HashMap and the archive DB
[Linux] get_gpu_usage() returns only first GPU — early return on first AMD card in the DRM enumeration loop
[Windows] get_amd_gpu_usage() averages all adapters — reports meaningless combined usage when iGPU and dGPU coexist
Frontend
Jotai atoms are single-value — graphicUsageHistoryAtom, gpuTempAtom, gpuDedicatedMemoryKbAtom store data for one GPU only
Event listener handles single GPU — useHardwareEventListener.ts reads flat GPU fields from the event payload
Dashboard displays one GPU — DashboardItems.tsx always uses hardwareInfo.gpus?.[0] for real-time data
What Already Works for Multi-GPU
sample_amd_gpu() uses get_amd_gpu_usage_per_adapter() (per-adapter with BDF)
update_gpu_histories() uses HashMap<String, VecDeque> keyed by GPU name
GPU_DATA_ARCHIVE stores per-GPU records with gpu_name
Insights page creates tabs per distinct GPU name from DB
get_gpu_info() on all platforms returns Vec<GraphicInfo>
GPU identification: Use PCI BDF-based gpu_id as the internal key, gpu_name as the display label. Prevents name collision and is consistent with Windows ADL path (deduplicates by BDF)
Do NOT change GpuPlatform trait: The trait is only used by the on-demand get_gpu_usage command (unused by frontend). The monitoring loop uses sample_gpu() directly
Event payload: Replace flat GPU fields with Vec<GpuMonitorData>. Single-GPU systems emit a one-element array — the frontend handles both cases identically
Database: Add optional gpu_id column to GPU_DATA_ARCHIVE. Existing data remains valid since it is queried by gpu_name
Frontend: Add selectedGpuIdAtom for GPU selection. Derived atoms maintain backward-compatible single-GPU reads for chart components
Scope
In scope: Correct per-GPU data collection, storage, and display across all platforms
Out of scope: Simultaneous overlay of multiple GPU lines on a single chart (future enhancement)
Summary
The current architecture assumes a single GPU throughout the stack. Systems with multiple GPUs (e.g., AMD APU with integrated Radeon Graphics + discrete AMD GPU) suffer from data corruption, missing data, and incorrect display.
Current Problems
Backend
HardwareMonitorUpdatehas flat fields (gpu_usage,gpu_name,gpu_temperature, etc.) for only one GPUemit_hardware_update()insystem_monitor.rsusesgpu_samples.first(), throwing away data for every other GPUlspci.rsreturns the first VGA device matching a vendor ID. Both AMD iGPU and dGPU have vendor0x1002, so they get the same name. This causes data overwrite in historyHashMapand the archive DBget_gpu_usage()returns only first GPU — early return on first AMD card in the DRM enumeration loopget_amd_gpu_usage()averages all adapters — reports meaningless combined usage when iGPU and dGPU coexistFrontend
graphicUsageHistoryAtom,gpuTempAtom,gpuDedicatedMemoryKbAtomstore data for one GPU onlyuseHardwareEventListener.tsreads flat GPU fields from the event payloadDashboardItems.tsxalways useshardwareInfo.gpus?.[0]for real-time dataWhat Already Works for Multi-GPU
sample_amd_gpu()usesget_amd_gpu_usage_per_adapter()(per-adapter with BDF)update_gpu_histories()usesHashMap<String, VecDeque>keyed by GPU nameGPU_DATA_ARCHIVEstores per-GPU records withgpu_nameget_gpu_info()on all platforms returnsVec<GraphicInfo>Sub-Issues (in dependency order)
HardwareMonitorUpdateevent payload for multi-GPUDesign Decisions
gpu_idas the internal key,gpu_nameas the display label. Prevents name collision and is consistent with Windows ADL path (deduplicates by BDF)GpuPlatformtrait: The trait is only used by the on-demandget_gpu_usagecommand (unused by frontend). The monitoring loop usessample_gpu()directlyVec<GpuMonitorData>. Single-GPU systems emit a one-element array — the frontend handles both cases identicallygpu_idcolumn toGPU_DATA_ARCHIVE. Existing data remains valid since it is queried bygpu_nameselectedGpuIdAtomfor GPU selection. Derived atoms maintain backward-compatible single-GPU reads for chart componentsScope