From 70e060fae27345bfc7135436db4b4b690d707601 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 10 Mar 2026 13:13:45 +0000 Subject: [PATCH 1/5] Initial plan From 829e446410345935eaeac4a2332aa4c44eb58f07 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 10 Mar 2026 13:21:36 +0000 Subject: [PATCH 2/5] Fix AMD APU unified memory VRAM detection using VIS_VRAM On AMD APUs with unified memory architecture (e.g., AMD Ryzen AI MAX / Strix Halo, GC 12.0.0), both amdsmi_get_gpu_vram_usage and rsmi_dev_memory_total_get(RSMI_MEM_TYPE_VRAM) return only the BIOS carveout (~512 MiB) instead of the actual usable unified memory. VIS_VRAM (RSMI_MEM_TYPE_VIS_VRAM=2) correctly reports the full system memory on APUs because all system memory is CPU-visible. Add the constant to pyrocmsmi and use max(VRAM, VIS_VRAM) in both detection paths so APUs report the correct memory capacity. Co-authored-by: Readon <3614708+Readon@users.noreply.github.com> --- gpustack_runtime/detector/amd.py | 20 +++++++++++++++++++ .../detector/pyrocmsmi/__init__.py | 5 +++++ 2 files changed, 25 insertions(+) diff --git a/gpustack_runtime/detector/amd.py b/gpustack_runtime/detector/amd.py index a00d9bb..469feb2 100644 --- a/gpustack_runtime/detector/amd.py +++ b/gpustack_runtime/detector/amd.py @@ -179,6 +179,16 @@ def detect(self) -> Devices | None: dev_gpu_vram_usage = pyamdsmi.amdsmi_get_gpu_vram_usage(dev) dev_mem = dev_gpu_vram_usage.get("vram_total") dev_mem_used = dev_gpu_vram_usage.get("vram_used") + # On APUs with unified memory (e.g., AMD Strix Halo), VRAM + # reports only the BIOS carveout (~512 MiB); VIS_VRAM reports + # the full usable system memory. Use VIS_VRAM when larger. + with contextlib.suppress(pyrocmsmi.ROCMSMIError): + dev_mem_vis_vram = byte_to_mebibyte( + pyrocmsmi.rsmi_dev_memory_total_get( + dev_idx, pyrocmsmi.RSMI_MEM_TYPE_VIS_VRAM, + ), + ) + dev_mem = max(dev_mem, dev_mem_vis_vram) dev_ecc_count = pyamdsmi.amdsmi_get_gpu_ecc_count( dev, pyamdsmi.AmdSmiGpuBlock.UMC, @@ -189,6 +199,16 @@ def detect(self) -> Devices | None: dev_mem = byte_to_mebibyte( # byte to MiB pyrocmsmi.rsmi_dev_memory_total_get(dev_idx), ) + # On APUs with unified memory (e.g., AMD Strix Halo), VRAM + # reports only the BIOS carveout (~512 MiB); VIS_VRAM reports + # the full usable system memory. Use VIS_VRAM when larger. + with contextlib.suppress(pyrocmsmi.ROCMSMIError): + dev_mem_vis_vram = byte_to_mebibyte( + pyrocmsmi.rsmi_dev_memory_total_get( + dev_idx, pyrocmsmi.RSMI_MEM_TYPE_VIS_VRAM, + ), + ) + dev_mem = max(dev_mem, dev_mem_vis_vram) dev_mem_used = byte_to_mebibyte( # byte to MiB pyrocmsmi.rsmi_dev_memory_usage_get(dev_idx), ) diff --git a/gpustack_runtime/detector/pyrocmsmi/__init__.py b/gpustack_runtime/detector/pyrocmsmi/__init__.py index b8437f1..088b33e 100644 --- a/gpustack_runtime/detector/pyrocmsmi/__init__.py +++ b/gpustack_runtime/detector/pyrocmsmi/__init__.py @@ -62,6 +62,11 @@ ROCMSMI_IOLINK_TYPE_XGMI = 2 ROCMSMI_IOLINK_TYPE_NUMIOLINKTYPES = 3 +## Memory Types ## +RSMI_MEM_TYPE_VRAM = 0 +RSMI_MEM_TYPE_GTT = 1 +RSMI_MEM_TYPE_VIS_VRAM = 2 + ## Error Codes ## ROCMSMI_ERROR_UNINITIALIZED = -99997 ROCMSMI_ERROR_FUNCTION_NOT_FOUND = -99998 From 350061e70f770d698f96a231d4c223bc1de63e1e Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 10 Mar 2026 14:13:13 +0000 Subject: [PATCH 3/5] Initial plan From a5b16bd847d7976304653520a77a2857d54c10d9 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 10 Mar 2026 14:15:54 +0000 Subject: [PATCH 4/5] Fix ruff format issues in amd.py (remove trailing commas per ruff style) Co-authored-by: Readon <3614708+Readon@users.noreply.github.com> --- gpustack_runtime/detector/amd.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/gpustack_runtime/detector/amd.py b/gpustack_runtime/detector/amd.py index 469feb2..f3a4880 100644 --- a/gpustack_runtime/detector/amd.py +++ b/gpustack_runtime/detector/amd.py @@ -185,8 +185,9 @@ def detect(self) -> Devices | None: with contextlib.suppress(pyrocmsmi.ROCMSMIError): dev_mem_vis_vram = byte_to_mebibyte( pyrocmsmi.rsmi_dev_memory_total_get( - dev_idx, pyrocmsmi.RSMI_MEM_TYPE_VIS_VRAM, - ), + dev_idx, + pyrocmsmi.RSMI_MEM_TYPE_VIS_VRAM, + ) ) dev_mem = max(dev_mem, dev_mem_vis_vram) dev_ecc_count = pyamdsmi.amdsmi_get_gpu_ecc_count( @@ -205,8 +206,9 @@ def detect(self) -> Devices | None: with contextlib.suppress(pyrocmsmi.ROCMSMIError): dev_mem_vis_vram = byte_to_mebibyte( pyrocmsmi.rsmi_dev_memory_total_get( - dev_idx, pyrocmsmi.RSMI_MEM_TYPE_VIS_VRAM, - ), + dev_idx, + pyrocmsmi.RSMI_MEM_TYPE_VIS_VRAM, + ) ) dev_mem = max(dev_mem, dev_mem_vis_vram) dev_mem_used = byte_to_mebibyte( # byte to MiB From 8db3232736c3cf9e868c44935c8f6d24503e5dc7 Mon Sep 17 00:00:00 2001 From: Readon Date: Tue, 10 Mar 2026 22:29:54 +0800 Subject: [PATCH 5/5] Fix indentation and formatting in amd.py --- gpustack_runtime/detector/amd.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gpustack_runtime/detector/amd.py b/gpustack_runtime/detector/amd.py index f3a4880..bc19590 100644 --- a/gpustack_runtime/detector/amd.py +++ b/gpustack_runtime/detector/amd.py @@ -187,7 +187,7 @@ def detect(self) -> Devices | None: pyrocmsmi.rsmi_dev_memory_total_get( dev_idx, pyrocmsmi.RSMI_MEM_TYPE_VIS_VRAM, - ) + ), ) dev_mem = max(dev_mem, dev_mem_vis_vram) dev_ecc_count = pyamdsmi.amdsmi_get_gpu_ecc_count( @@ -208,7 +208,7 @@ def detect(self) -> Devices | None: pyrocmsmi.rsmi_dev_memory_total_get( dev_idx, pyrocmsmi.RSMI_MEM_TYPE_VIS_VRAM, - ) + ), ) dev_mem = max(dev_mem, dev_mem_vis_vram) dev_mem_used = byte_to_mebibyte( # byte to MiB