A drop-in replacement for the amdsmi Python package that works inside
WSL2 / Windows β where the native AMD SMI library can't run β so
vLLM and other ROCm tools detect your GPU and start cleanly. Works across
RDNA-generation Radeon / Radeon PRO GPUs and Ryzen AI APUs on WSL2.
pip install amd-smi-wsl
On WSL2 the GPU is exposed through DirectX para-virtualisation β not the native KFD driver.
Under WSL2 any AMD GPU is reached through /dev/dxg + dxgkrnl,
not the native amdgpu KFD driver. The Linux /dev/kfd device and
its sysfs topology simply do not exist, so import amdsmi fails and downstream tools crash
during ROCm platform detection β even though the HIP runtime itself works perfectly. Because this is a
property of the WSL2 stack, it affects Radeon / Radeon PRO GPUs and Ryzen AI APUs alike, across
RDNA generations.
amdsmi import β
β
ROCm platform detection β
β
vLLM startup crash π₯
amd-smi-wsl β
β
queries answered via HIP + Windows interop β
β
vLLM runs π
Binary-compatible import surface, real answers where the platform allows.
Exposes every public symbol of the upstream binding β all 190 amdsmi_*
functions, all enums and the full exception hierarchy. import amdsmi just works.
Device name, GCN arch, VRAM, compute units, UUID and live memory come from torch.cuda (HIP);
PCI id, subsystem id, revision and driver info come from Windows interop.
PyTorch's ROCm build counts devices through amdsmi. A thread-local guard breaks the
recursion so torch falls back to its native HIP device count.
Returns device_id as a hex string ("0x1586") so vLLM resolves the
canonical name from its device map, e.g. AMD_Radeon_8060S.
Features the platform genuinely lacks (RAS/ECC, partitioning, set-mutators, eventsβ¦) raise
AMDSMI_STATUS_NOT_SUPPORTED β exactly like the native library.
Pure-Python, no compiled extensions. torch is expected to be present already and is
intentionally not pinned, so it never fights your ROCm install.
Install where the real amdsmi can't run, then use it like the original.
import amdsmi # this package, not the native one amdsmi.amdsmi_init() h = amdsmi.amdsmi_get_processor_handles()[0] info = amdsmi.amdsmi_get_gpu_asic_info(h) print(info["market_name"]) # AMD Radeon(TM) 8060S Graphics print(info["device_id"]) # 0x1586
Nothing else to configure: on WSL2 the package auto-sets
HSA_ENABLE_DXG_DETECTION=1 at import (before the first
torch.cuda call) so the GPU is enumerated. Set
AMDSMI_WSL_DISABLE=1 to make amdsmi_init() raise
NOT_SUPPORTED for testing a caller's fallback path.
GPU-agnostic by design β validated on WSL2 + AMD Radeon 8060S (Strix Halo, gfx1151) + ROCm 7.2.4 + PyTorch 2.10.0; device-specific values differ on other cards.
| Check | Result |
|---|---|
import amdsmi + amdsmi_init() | OK (no recursion) |
HSA_ENABLE_DXG_DETECTION auto-set on import | unset β 1 |
asic_info["market_name"] | AMD Radeon(TM) 8060S Graphics |
asic_info["device_id"] | 0x1586 |
target_graphics_version | gfx1151 |
test suite (pytest) | 17 passed |
vLLM rocm_platform_plugin() | RocmPlatform |
vLLM get_device_name(0) | AMD_Radeon_8060S |
vLLM is_fully_connected([0]) | True |