PyPI Python License

amd-smi-wsl

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

Why it exists

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.

native amdsmi import βœ— β†’ ROCm platform detection βœ— β†’ vLLM startup crash πŸ’₯
install amd-smi-wsl βœ“ β†’ queries answered via HIP + Windows interop βœ“ β†’ vLLM runs πŸš€

What it does

Binary-compatible import surface, real answers where the platform allows.

πŸ”Œ

100% import-compatible

Exposes every public symbol of the upstream binding β€” all 190 amdsmi_* functions, all enums and the full exception hierarchy. import amdsmi just works.

🧠

Real data sources

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.

♻️

torch re-entrancy safe

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.

🎯

vLLM canonical names

Returns device_id as a hex string ("0x1586") so vLLM resolves the canonical name from its device map, e.g. AMD_Radeon_8060S.

πŸ§ͺ

Honest stubs

Features the platform genuinely lacks (RAS/ECC, partitioning, set-mutators, events…) raise AMDSMI_STATUS_NOT_SUPPORTED β€” exactly like the native library.

πŸ“¦

Zero hard deps

Pure-Python, no compiled extensions. torch is expected to be present already and is intentionally not pinned, so it never fights your ROCm install.

Quickstart

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.

Verified end-to-end

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.

CheckResult
import amdsmi + amdsmi_init()OK (no recursion)
HSA_ENABLE_DXG_DETECTION auto-set on importunset β†’ 1
asic_info["market_name"]AMD Radeon(TM) 8060S Graphics
asic_info["device_id"]0x1586
target_graphics_versiongfx1151
test suite (pytest)17 passed
vLLM rocm_platform_plugin()RocmPlatform
vLLM get_device_name(0)AMD_Radeon_8060S
vLLM is_fully_connected([0])True

Topics

 

amdsmiamd-smirocm wsl2wslhip gpuvllmstrix-halo gfx1151radeonpytorch