fix(server): use GTT memory for Strix Halo VRAM monitoring#9
Open
jane-alesi wants to merge 1 commit into
Open
Conversation
On AMD Strix Halo (gfx1105) and Strix Point (gfx1102) APUs, the GPU uses unified GTT memory as its primary pool. The existing VRAM monitor only reads mem_info_vram_* (2GB LPDDR5 buffer), causing false 99% pressure readings and log spam (600+ lines/min). This fix: 1. Detects unified memory GPUs via KFD gfx_target_version 2. On unified GPUs, computes (vram_used + gtt_used) / (vram_total + gtt_total) 3. On discrete GPUs, uses the existing vram_only path 4. Skips nvidia-smi subprocess spawn entirely on AMD (reduces log spam) Tested on: Ryzen AI MAX+ 395 (gfx1105), 126GB unified memory. Before: VRAM pressure 99%, 600 log lines/min After: VRAM pressure 0.13%, 0 VRAM log lines/min
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.
What
Fix false VRAM pressure readings on AMD Strix Halo (gfx1105) and Strix Point (gfx1102) systems.
The VRAM monitor only reads
mem_info_vram_*(2GB LPDDR5 chip) and ignoresmem_info_gtt_*(124GB GTT). On Strix Halo, models run entirely in GTT — the LPDDR5 is a tiny buffer.Symptoms Before Fix
nvidia-smisubprocess spawningSymptoms After Fix
Technical Details
Strix Halo uses a unified memory architecture. The kernel exposes two memory pools:
mem_info_vram_*— 2GB LPDDR5 chip (tiny buffer)mem_info_gtt_*— 124GB GTT (where models actually live)The fix detects unified-memory GPUs by checking KFD
gfx_target_version(gfx1102, gfx1105) and computes pressure as(vram_used + gtt_used) / (vram_total + gtt_total).Discrete AMD GPUs (7900 XTX, etc.) and NVIDIA GPUs use the existing path unchanged.
nvidia-smi skip: Uses PCI vendor ID scanning (
/sys/bus/pci/devices/*/vendor==0x10de) — more robust than KFD-only check since KFD may not be present on all AMD systems.Files Changed
src/cpp/include/lemon/system_info.h— header-onlyhas_unified_memory()inline functionsrc/cpp/include/lemon/system_info.h—is_strix_apu()declaration inSystemInfoclasssrc/cpp/server/system_info.cpp— GTT-aware VRAM calculation + PCI-based nvidia-smi skipsrc/cpp/server/system_info.cpp—is_strix_apu()implementation (KFD gfx_target_version scan)test/cpp/test_amd_vram.cpp— unit tests for has_unified_memory() and vram ratio calculationCMakeLists.txt— test target for test_amd_vramRelated Issues