fix: detect Intel Arc on multi-card hosts and collect real memory stats#2358
Open
GiulioSavini wants to merge 3 commits intogetarcaneapp:mainfrom
Open
fix: detect Intel Arc on multi-card hosts and collect real memory stats#2358GiulioSavini wants to merge 3 commits intogetarcaneapp:mainfrom
GiulioSavini wants to merge 3 commits intogetarcaneapp:mainfrom
Conversation
Member
✅ Snyk checks have passed. No issues have been found so far.
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse. |
card0 on a passthrough VM is usually a VirtIO adapter, not the Arc GPU. intel_gpu_top without -d always grabbed the first card, so the real GPU was never queried. Also the stats function was a stub that never actually called intel_gpu_top. Now it targets each Intel card by PCI vendor ID and parses the JSON output for real VRAM figures. Added a sysfs fallback so the card shows up even when intel_gpu_top isn't installed (ARM, minimal images). Fixes getarcaneapp#999
70a3d1b to
1551f59
Compare
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.
Fixes #999
Problem
On Proxmox (and similar setups where
/dev/drihas more than one card) theIntel Arc GPU was invisible in the dashboard. Two independent root causes:
Wrong card selected —
intel_gpu_topwithout-ddefaults to thefirst DRI device (
card0), which on a passthrough VM is typically theVirtIO display adapter. The actual Arc GPU sits on
card1(or higher) andwas never queried.
Stub implementation —
getIntelStats()was a placeholder that returneda single hardcoded
"Intel GPU"entry with zero memory figures and nevercalled
intel_gpu_topat all.No sysfs fallback — if
intel_gpu_topwas not in$PATH(ARM builds,minimal containers) the GPU didn't appear in the dashboard at all.
Changes
findIntelDRICards()/sys/class/drm/card*/device/vendorfor PCI vendor0x8086— returns only real Intel cards, ignoring VirtIO or other non-Intel adapters regardless of card indexhasIntelGPUInternal()detectGPUs()as a sysfs fallback whenintel_gpu_topis absentdetectGPUs()intel_gpu_topprobe fails, tries sysfs detection so the GPU still appears in the dashboardgetIntelStats()intel_gpu_top -d drm:<path> -J -s 100 -c 1per card to get discrete VRAM stats (total/used) on Arc/Xe; gracefully falls back to zero memory when the tool is unavailable or the GPU has no local memory (iGPU)intelGPUName()device/labelfrom sysfs for a human-readable name; falls back to"Intel GPU (cardN)"Testing
Tested with
go vetand existing unit tests (go test ./backend/internal/api/...).Full hardware validation requires a multi-card Proxmox host with an Intel Arc
GPU — the fix directly addresses the setup described in #999.
Disclaimer Greptiles Reviews use AI, make sure to check over its work.
To better help train Greptile on our codebase, if the comment is useful and valid Like the comment, if its not helpful or invalid Dislike
To have Greptile Re-Review the changes, mention
greptileai.Greptile Summary
This PR fixes Intel Arc GPU invisibility on multi-card hosts (e.g. Proxmox) by replacing the placeholder
getIntelStatswith a real implementation that enumerates Intel DRI cards via sysfs vendor IDs, targets each card individually withintel_gpu_top -d drm:<path>, and adds a sysfs-only fallback indetectGPUswhen the tool is absent. The core logic is sound. Remaining findings are all P2:findIntelDRICardsviolates the project-wideInternalsuffix convention for unexported functions,fmt.Errorf("...: %w", nil)produces a confusing<nil>in the error message when the JSON array is empty, and the unknown-unit branch defaults silently to bytes without a log warning.Confidence Score: 5/5
Safe to merge — all three findings are P2 style/quality suggestions that don't affect correctness or runtime behaviour.
The implementation logic is correct: sysfs vendor-ID scanning, per-card intel_gpu_top invocation, JSON parsing with both array and object formats, and nil-memory guard for iGPUs all look sound. The three open comments are purely about naming convention, error-message clarity, and a missing warn log — none blocks the fix from working correctly in production.
backend/internal/api/ws_handler.go — three minor P2 issues in the new Intel GPU functions
Prompt To Fix All With AI
Reviews (1): Last reviewed commit: "fix: Intel Arc not showing on multi-card..." | Re-trigger Greptile
Context used: