Fix GPU name collision for multi-AMD GPU systems on Linux (#1297)#1301
Merged
Conversation
Replace vendor-ID-based lspci lookup with BDF-based resolution so that
each GPU gets a unique name even when multiple AMD GPUs share vendor
0x1002. This prevents history HashMap overwrites and archive DB
collisions.
- Add get_card_bdf() to extract PCI BDF from sysfs symlink
- Add get_gpu_name_from_lspci_by_bdf() to match by PCI slot
- Update collect_linux_gpu_metrics() and get_amd_graphic_info()
- Fall back to "AMD GPU (card{N})" when BDF resolution fails
- Remove unused get_gpu_name_from_lspci_by_vendor_id()
Contributor
There was a problem hiding this comment.
Pull request overview
Improves Linux AMD multi-GPU name resolution by switching from vendor-ID-based lspci matching to PCI BDF-based matching to avoid GPU-name collisions that can overwrite history/DB entries.
Changes:
- Added DRM sysfs PCI BDF extraction (
get_card_bdf) and parsing utilities with unit tests. - Added
lspcilookup by BDF (get_gpu_name_from_lspci_by_bdf) and a pure parsing helper with tests. - Updated Linux GPU sampling/info paths to use BDF-based naming with a per-card fallback name.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
src-tauri/src/services/monitoring_service.rs |
Uses BDF-based lspci naming for AMD in Linux sampling; adds a regression test around GPU history entries. |
src-tauri/src/platform/linux/gpu.rs |
Updates AMD GraphicInfo name resolution to use BDF-based lspci lookup with fallback. |
src-tauri/src/infrastructure/providers/linux/lspci.rs |
Replaces vendor-ID lookup with BDF-based lookup and adds parsing-focused unit tests. |
src-tauri/src/infrastructure/providers/linux/drm_sys.rs |
Adds sysfs symlink parsing to extract PCI BDF for a DRM card, plus unit tests. |
Contributor
Rust Backend Coverage ReportCoverage Details |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Replace vendor-ID-based lspci lookup with BDF-based resolution so that each GPU gets a unique name even when multiple AMD GPUs share vendor 0x1002. This prevents history HashMap overwrites and archive DB collisions.