Skip to content

Latest commit

 

History

1 Commit

Folders and files

NameName
Last commit message
Last commit date
 
 

Repository files navigation

ROCm on WSL2 — Strix Halo Setup Guide

Last verified: 2026-04-02 Hardware: AMD Ryzen AI MAX+ 395 / Radeon 8060S (gfx1151, RDNA 3.5) Windows driver: Adrenalin 26.3.1 WSL kernel: 6.6.87.2-microsoft-standard-WSL2 Distro: Ubuntu 24.04.4 LTS (Noble) ROCm: 7.2.0 (WSL runtime) / 7.2.1 (userspace tools)


Prerequisites

Windows side

  1. Windows 11 with WSL2 enabled and up to date:

    wsl --version
    wsl --update
  2. AMD Adrenalin driver 26.3.1 or later from AMD Drivers

  3. Windows SDK — install from Windows SDK. The default install path is:

    C:\Program Files (x86)\Windows Kits\10\Include\10.0.26100.0\
    

WSL side

  • CMake >= 3.15
  • GCC >= 11.4
  • git
sudo apt update && sudo apt install -y cmake gcc g++ git

Step 1: Install ROCm 7.2 packages

Follow the ROCm Installation Quick Start to add the repos and install ROCm.

Verify:

ls /opt/rocm-7.2.0/

Step 2: Remove conflicting Ubuntu system packages

Ubuntu 24.04 ships ancient ROCm 5.7 system packages that shadow the ROCm 7.2 libraries. These must be removed:

sudo apt remove libhsa-runtime64-1 libhsakmt1

Why: These install libhsa-runtime64.so.1 and libhsakmt.so.1 into /lib/x86_64-linux-gnu/, which takes precedence over /opt/rocm-7.2.0/lib/ in the default library search path. The old runtime has no WSL/DXG support and will always fail with "ROCk module is NOT loaded."

Step 3: Install the WSL-specific HSA runtime

The standard hsa-rocr package (from the ROCm repo) uses libdrm and talks to /dev/kfd directly — this doesn't work in WSL2. You need the WSL-specific package hsa-runtime-rocr4wsl-amdgpu, which has DXG support built in.

This package should be installed by default from the amdgpu repo (https://repo.radeon.com/amdgpu/30.30/ubuntu). Verify:

dpkg -l | grep rocr4wsl

Expected output:

ii  hsa-runtime-rocr4wsl-amdgpu  25.30.13-2281980.24.04  amd64  AMD HSA Runtime for WSL

If missing, check that the amdgpu repo is configured in /etc/apt/sources.list.d/amdgpu.list:

deb [arch=amd64,i386 signed-by=/etc/apt/keyrings/rocm.gpg] https://repo.radeon.com/amdgpu/30.30/ubuntu noble main

Then:

sudo apt update && sudo apt install hsa-runtime-rocr4wsl-amdgpu

Note: If hsa-rocr (the standard runtime) is installed, it will conflict. Remove it first:

sudo apt remove hsa-rocr

Step 4: Build and install librocdxg

librocdxg is the bridge library that enables ROCm to communicate with the GPU via the Windows DXG interface in WSL2.

cd ~
git clone https://github.com/ROCm/librocdxg.git
cd librocdxg
git checkout develop

Important: Use the develop branch. As of 2026-04-01 it contains a fix (PR #12) for incorrect VRAM pool size reporting under WSL — without it, ROCm only sees memory up to your .wslconfig limit instead of the full UMA allocation.

Build:

export win_sdk='/mnt/c/Program Files (x86)/Windows Kits/10/Include/10.0.26100.0/'

mkdir -p build && cd build
cmake .. -DWIN_SDK="${win_sdk}/shared"
make -j$(nproc)
sudo make install

Fix the library symlink

make install places the new librocdxg.so.1.1.0 into /opt/rocm-7.2.0/lib/, but the existing symlink may still point to an older version (e.g. 1.1.1). Verify and fix:

ls -la /opt/rocm-7.2.0/lib/librocdxg.so*

If librocdxg.so.1 does not point to librocdxg.so.1.1.0:

cd /opt/rocm-7.2.0/lib/
sudo ln -sf librocdxg.so.1.1.0 librocdxg.so.1
sudo ldconfig

Step 5: Set environment variables

Add to ~/.bashrc or ~/.zshrc:

# ROCm WSL2 configuration
export HSA_ENABLE_DXG_DETECTION=1
export LD_LIBRARY_PATH=/opt/rocm-7.2.0/lib:$LD_LIBRARY_PATH
export PATH=/opt/rocm-7.2.1/bin:/opt/rocm/bin:$PATH

Then reload:

source ~/.zshrc  # or ~/.bashrc

What each variable does:

Variable Purpose
HSA_ENABLE_DXG_DETECTION=1 Tells the HSA runtime to detect the GPU via /dev/dxg and load librocdxg
LD_LIBRARY_PATH=/opt/rocm-7.2.0/lib:... Ensures the WSL HSA runtime (7.2.0) is found by ROCm 7.2.1 binaries
PATH=... Makes rocminfo, hipcc, etc. available

Step 6: Verify

rocminfo

Expected output includes:

Load librocdxg.so successully!
Load all DTIF APIs OK!
WSL environment detected.
...
Agent 2
  Name:                    gfx1151
  Marketing Name:          AMD Radeon(TM) 8060S Graphics
  Device Type:             GPU
  Compute Unit:            40

Known issues (as of 2026-04-02)

hipMallocManaged not supported

hipMallocManaged() returns hipErrorNotSupported on gfx1151. ROCm can only allocate in dedicated VRAM, not GTT/shared memory. This means ROCm sees ~60% less usable memory than Vulkan on the same hardware. No fix yet — tracked in ROCm#5944 and ROCm#6050.

bf16 precision bugs for ML training

Documented in ROCm#6034:

  • Batch sizes at or below 2^13 can cause NaN
  • HEAD_DIM = 32 causes NaN (use 64)
  • Network depth > 12 can crash
  • Adam beta2 < 0.97 causes NaN
  • These are cumulative — individually safe configs can NaN when combined

Monitoring and profiling not supported

amd-smi, rocprofiler, and rocm-debugger do not work under WSL. Use Windows-side tools (Task Manager, Adrenalin) for GPU metrics.

JAX not validated

ROCm-supported JAX is not enabled or validated under WSL.


Useful environment variables for ML workloads

# 19x attention speedup via AOTriton (experimental but confirmed by AMD)
export TORCH_ROCM_AOTRITON_ENABLE_EXPERIMENTAL=1

# Do NOT set PYTORCH_HIP_ALLOC_CONF — it crashes PyTorch on gfx1151

Docker usage

When running ROCm containers under WSL2:

docker run -it \
    --device=/dev/dxg \
    -v /usr/lib/wsl/lib/libdxcore.so:/usr/lib/libdxcore.so \
    -v /opt/rocm/lib/librocdxg.so:/usr/lib/librocdxg.so \
    -e HSA_ENABLE_DXG_DETECTION=1 \
    --cap-add=SYS_PTRACE \
    --security-opt seccomp=unconfined \
    --ipc=host \
    --shm-size 8G \
    rocm/pytorch:latest

References

About

Enabling ROCm on WSL with AMD Strix Halo chipset

Resources

Stars

2 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors