microsoft / microsoft/WSL

WSL2 下无法直通 AMD Radeon RX 7800 XT (RDNA3),`lspci` 无输出,`/dev/dri` 不存在。

Open
#40,464 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

GPU
Dominant language
C++
Stars
33.7k
Forks
1.8k
Avg merge
3d 17h
Merged PRs (30d)
116

Description

### Windows Version

Windows 11 版本 10.0.26200.8037

### WSL Version

WSL 2.6.3 + Ubuntu 24.04

### Are you using WSL 1 or WSL 2?

- [x] WSL 2
- [ ] WSL 1

### Kernel Version

6.6.87.2-1

### Distro Version

Ubuntu 24.04.4 LTS

### Other Software

_No response_

### Repro Steps

1. 全新安装 Windows 11 版本 26200.8037,开启 Hyper-V 和虚拟机平台。
2. 在 BIOS 中启用 SVM、IOMMU、Above 4G Decoding、ReBAR。
3. 安装 AMD Adrenalin 26.2.2 驱动(非 AI 捆绑包)。
4. 安装 WSL 2.6.3,设置 WSL 2 为默认版本。
5. 安装 Ubuntu 24.04:
wsl --install -d Ubuntu-24.04
6. 在 Ubuntu 中安装 ROCm 7.2(WSL 专用模式):
wget https://repo.radeon.com/amdgpu-install/7.2/ubuntu/noble/amdgpu-install_7.2.70200-1_all.deb
sudo apt install ./amdgpu-install_7.2.70200-1_all.deb
sudo amdgpu-install --usecase=wsl,rocm --no-dkms
7. 重启 WSL(wsl --shutdown)后重新进入 Ubuntu。
8. 执行:
lspci | grep -i vga
ls /dev/dri/
sudo dmesg | grep -i dxg
rocminfo

### Expected Behavior

- `lspci | grep VGA` 应该显示 AMD Radeon RX 7800 XT
- `/dev/dri` 目录应当存在,且包含 `card0`、`renderD128`
- `rocminfo` 正常输出 GPU 信息,不崩溃
- `python3 -c "import torch; print(torch.cuda.is_available())"` 输出 True

### Actual Behavior

- `lspci | grep VGA` 无任何输出
- `/dev/dri` 目录不存在
- `dmesg` 显示错误:
PCI: System does not support PCI
misc dxg: dxgkio_query_adapter_info: Ioctl failed: -22
misc dxg: dxgkio_query_adapter_info: Ioctl failed: -2

text
- `rocminfo` 崩溃并报错:
`Assertion \`props.EngineId.ui32.Major && "HSA_OVERRIDE_GFX_VERSION may be needed"' failed.`
- `python3 -c "import torch; print(torch.cuda.is_available())"` 输出 False

### Diagnostic Logs

**Windows 版本**:
cmd /c ver
Microsoft Windows [版本 10.0.26200.8037]

**WSL 版本**:
wsl --version
WSL 版本: 2.6.3.0
内核版本: 6.6.87.2-1
WSLg 版本: 1.0.66
MSRDC 版本: 1.2.5716
Direct3D 版本: 1.611.1-81528511
DXCore 版本: 10.0.26100.1-240331-1655.ge-release
Windows 版本: 10.0.26200.8037

**Ubuntu 版本**:
lsb_release -a
Distributor ID: Ubuntu
Description: Ubuntu 24.04.4 LTS
Release: 24.04
Codename: noble

**ROCm 安装方式**:
sudo amdgpu-install --usecase=wsl,rocm --no-dkms

**dmesg 完整错误**:
[ 0.588472] PCI: System does not support PCI
[ 0.868579] AMD-Vi: AMD IOMMUv2 functionality not available on this system
[ 2.320100] misc dxg: dxgkio_query_adapter_info: Ioctl failed: -22
[ 2.324405] misc dxg: dxgkio_query_adapter_info: Ioctl failed: -2

**环境变量已设置**:
echo $HSA_OVERRIDE_GFX_VERSION
11.0.0

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the reported commands: lspci, ls /dev/dri, dmesg, rocminfo, and the PyTorch CUDA check in the listed WSL 2.6.3 and Ubuntu 24.04 environment. Compare the PCI and dxg errors with the expected GPU passthrough behavior; done means the adapter is visible, /dev/dri is populated, rocminfo no longer crashes, and the PyTorch check returns True.

Written by the indexing model from the issue text.

Assessment

Tech stack
linux, pytorch, ubuntu
Domain
operating-systems
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.