WSL icon indicating copy to clipboard operation
WSL copied to clipboard

wslc preview: Missing --device flag and /dev/kfd CDI mapping breaks AMD ROCm GPU passthrough

Open Blaimno opened this issue 5 months ago • 7 comments

Windows Version

Microsoft Windows [Version 10.0.26200.8655]

WSL Version

WSL-Version: 2.9.3.0

Are you using WSL 1 or WSL 2?

  • [x] WSL 2
  • [ ] WSL 1

Kernel Version

wslc backend VM kernel

Distro Version

alpine:latest (probe) and yanwk/comfyui-boot:rocm7

Other Software

Hardware: AMD Radeon 9070XT

Framework: AMD ROCm 7.2

Workload: ComfyUI / PyTorch (ROCm build)

Repro Steps

Attempt to run a ROCm-based container via the new wslc public preview using an AMD GPU.

Run the command using the --gpus all flag to map the hardware:

wslc run -d --name=comfyui-amd --gpus all -e HSA_OVERRIDE_GFX_VERSION=12.0.0 -p 8188:8188 yanwk/comfyui-boot:rocm7

Check container logs (wslc logs comfyui-amd) and observe the PyTorch crash: RuntimeError: No HIP GPUs are available.

To verify the hardware mount in the container namespace, run a basic probe:

wslc run --rm alpine ls -la /dev

Observe that /dev/dxg may be present (if DirectML is mapped), but /dev/kfd (Kernel Fusion Driver) and /dev/dri are completely missing from the container's device namespace.

Attempt to bypass this by manually volume mounting the devices (-v /dev/kfd:/dev/kfd), which fails due to standard Linux cgroup permissions.

Expected Behavior

The --gpus all CDI specification should map raw AMD compute devices (/dev/kfd and /dev/dri) into the container namespace alongside /dev/dxg so ROCm workloads can run natively.

Alternatively, wslc should support the standard Docker/Podman --device and --group-add flags to allow users to manually pass through AMD hardware with the correct cgroup permissions.

Actual Behavior

The wslc container namespace fundamentally lacks access to /dev/kfd and /dev/dri. Because --gpus all seems strictly tied to NVIDIA or DirectML mapping, and because the CLI omits the --device flag entirely, AMD users are currently locked out of running native ROCm ML workloads in WSL Containers.

Diagnostic Logs

Output of wslc run --rm alpine ls -la /dev proving the AMD compute devices are missing from the container namespace:

total 4
drwxr-xr-x    5 root     root           340 Jul  3 14:28 .
drwxr-xr-x    1 root     root          4096 Jul  3 14:28 ..
lrwxrwxrwx    1 root     root            11 Jul  3 14:28 core -> /proc/kcore
lrwxrwxrwx    1 root     root            13 Jul  3 14:28 fd -> /proc/self/fd
crw-rw-rw-    1 root     root        1,   7 Jul  3 14:28 full
drwxrwxrwt    2 root     root            40 Jul  3 14:28 mqueue
crw-rw-rw-    1 root     root        1,   3 Jul  3 14:28 null
lrwxrwxrwx    1 root     root             8 Jul  3 14:28 ptmx -> pts/ptmx
drwxr-xr-x    2 root     root             0 Jul  3 14:28 pts
crw-rw-rw-    1 root     root        1,   8 Jul  3 14:28 random
drwxrwxrwt    2 root     root            40 Jul  3 14:28 shm
lrwxrwxrwx    1 root     root            15 Jul  3 14:28 stderr -> /proc/self/fd/2
lrwxrwxrwx    1 root     root            15 Jul  3 14:28 stdin -> /proc/self/fd/0
lrwxrwxrwx    1 root     root            15 Jul  3 14:28 stdout -> /proc/self/fd/1
crw-rw-rw-    1 root     root        5,   0 Jul  3 14:28 tty
crw-rw-rw-    1 root     root        1,   9 Jul  3 14:28 urandom
crw-rw-rw-    1 root     root        1,   5 Jul  3 14:28 zero

Blaimno avatar Jul 03 '26 14:07 Blaimno

Logs are required for review from WSL team

If this a feature request, please reply with '/feature'. If this is a question, reply with '/question'. Otherwise, please attach logs by following the instructions below, your issue will not be reviewed unless they are added. These logs will help us understand what is going on in your machine.

How to collect WSL logs

Download and execute collect-wsl-logs.ps1 in an administrative powershell prompt:

Invoke-WebRequest -UseBasicParsing "https://raw.githubusercontent.com/microsoft/WSL/master/diagnostics/collect-wsl-logs.ps1" -OutFile collect-wsl-logs.ps1
Set-ExecutionPolicy Bypass -Scope Process -Force
.\collect-wsl-logs.ps1

The script will output the path of the log file once done.

If this is a networking issue, please use .\collect-wsl-logs.ps1 -LogProfile networking instead, following the instructions in Collect WSL logs for networking issues

Once completed please upload the output files to this GitHub issue.

See Collect WSL logs (recommended method).

If you choose to email these logs instead of attaching them to the bug, please send them to [email protected] with the GitHub issue number in the subject, and include a link to your GitHub issue comment in the message body, and reply with '/emailed-logs'.

github-actions[bot] avatar Jul 03 '26 14:07 github-actions[bot]

Diagnostic information
Detected appx version: 2.9.3.0

github-actions[bot] avatar Jul 03 '26 14:07 github-actions[bot]

Hi @craigloewen-msft Could you please let me know if there are any updates on this feature?

anilmartha avatar Jul 14 '26 01:07 anilmartha

Hi, any updates on the --device flag?

desmati avatar Oct 04 '26 19:10 desmati

Hey folks sorry no big updates as of right now - this is a feature level item that we'd investigate in the future. Our focus has been on getting this product out to GA first.

craigloewen-msft avatar Oct 05 '26 22:10 craigloewen-msft

I’ve now completed an independent physical A/B validation related to this issue on AMD Strix Halo (gfx1151).

The key result is that, in the tested configuration, native Linux /dev/kfd passthrough was not required for ROCm/HIP compute inside WSLC.

With matched WSL-aware ROCm userspace:

  • wslc ... --gpus all → HIP compute succeeded 3/3
  • corresponding control without GPU projection → HIP initialisation failed 3/3
  • with /dev/dxg present and the DXG backend enabled → succeeded 3/3
  • disabling DXG backend detection → failed 3/3 This supports /dev/dxg + ROCDXG/HSA/HIP userspace as a working AMD GPU path under WSL Containers for the tested Strix Halo environment, rather than requiring /dev/kfd passthrough.

No Microsoft source patch was required for this configuration.

I’ve published the full validation, methodology, raw evidence and reproducibility material here:

https://nhapplied.co.uk/ace.html

The page links through to the permanent Zenodo technical record and evidence package.

Scope is deliberately limited to the tested gfx1151 configuration; this does not establish that the same path currently works for the Radeon 9070 XT or every ROCm workload.

Hopefully this is useful in separating the --device feature request from the question of whether AMD ROCm compute can already operate through the existing WSLC /dev/dxg path.

nigelhutch avatar Oct 20 '26 06:10 nigelhutch