Note: I haven't documented CUDA here. I'm lazy (and haven't tested on Arch). See https://documentation.ubuntu.com/wsl/en/latest/howto/gpu-cuda for that on Ubuntu.
So I got this working on both Ubuntu, and Arch. First, start with a fresh install (of archlinux from https://gitlab.archlinux.org/archlinux/archlinux-wsl or Ubuntu from
wsl --install Ubuntu
or https://apps.microsoft.com/detail/9pdxgncfsczv).
- Install
mesa
andvulkan-dzn
. - Run
echo "L+ /tmp/.X11-unix - - - - /mnt/wslg/.X11-unix" | sudo tee /etc/tmpfiles.d/wslg.conf
. (Thanks to microsoft/wslg#43 (comment) for this.) - Create your user account as per https://wiki.archlinux.org/title/Users_and_groups#User_management and confgure it as the default user for WSL as per https://wiki.archlinux.org/title/Install_Arch_Linux_on_WSL#Set_default_user.
su
into the user or open a new terminal tab/window.- Run:
cat << EOF
export GALLIUM_DRIVER=d3d12
for i in "/mnt/wslg/runtime-dir/"*; do
[ "$XDG_RUNTIME_DIR" = "$HOME" ] && XDG_RUNTIME_DIR="/var/run/user/$UID"
if [ ! -L "$XDG_RUNTIME_DIR$(basename "$i")" ]; then
[ -d "$XDG_RUNTIME_DIR$(basename "$i")" ] && rm -r "$XDG_RUNTIME_DIR$(basename "$i")"
ln -s "$i" "$XDG_RUNTIME_DIR$(basename "$i")"
fi
done
EOF | sudo tee /etc/profile.d/wslg.sh`
- Restart WSL with
wsl --shutdown
from CMD/PowerShell and you should see the following (given you install the relevant packages):
$ glxinfo | grep Device
Device: D3D12 (NVIDIA GeForce RTX 4080 SUPER) (0xffffffff)
$ vulkaninfo | grep "GPU id"
WARNING: dzn is not a conformant Vulkan implementation, testing use only.
GPU id = 0 (Microsoft Direct3D12 (NVIDIA GeForce RTX 4080 SUPER))
GPU id = 1 (llvmpipe (LLVM 19.1.7, 256 bits))
GPU id = 0 (Microsoft Direct3D12 (NVIDIA GeForce RTX 4080 SUPER))
GPU id = 1 (llvmpipe (LLVM 19.1.7, 256 bits))
GPU id = 0 (Microsoft Direct3D12 (NVIDIA GeForce RTX 4080 SUPER))
GPU id = 1 (llvmpipe (LLVM 19.1.7, 256 bits))
GPU id : 0 (Microsoft Direct3D12 (NVIDIA GeForce RTX 4080 SUPER)):
GPU id : 1 (llvmpipe (LLVM 19.1.7, 256 bits)):
- OpenGL should already be working. We'll add Vulkan support.
- Go to https://ppa.launchpadcontent.net/kisak/kisak-mesa/ubuntu/pool/main/m/mesa/.
- Look for
mesa-vulkan-drivers_*.deb
. - You'll see
...<LETTER>_<ARCH>.deb
. The letter corresponds to your Ubuntu version codename. In your case, "n" for Noble. - Copy the link for the right package,
https://ppa.launchpadcontent.net/kisak/kisak-mesa/ubuntu/pool/main/m/mesa/mesa-vulkan-drivers_25.0.1~kisak1~n_amd64.deb
in your case. - Run
wget https://ppa.launchpadcontent.net/kisak/kisak-mesa/ubuntu/pool/main/m/mesa/mesa-vulkan-drivers_25.0.1~kisak1~n_amd64.deb
anywhere you have write access to on the Ubuntu WSL instance. - Run
sudo apt install <PACKAGE>
(in your case,sudo apt install mesa-vulkan-drivers_25.0.1~kisak1~n_amd64.deb
. - Run:
cat << EOF
export GALLIUM_DRIVER=d3d12
for i in "/mnt/wslg/runtime-dir/"*; do
[ "$XDG_RUNTIME_DIR" = "$HOME" ] && XDG_RUNTIME_DIR="/var/run/user/$UID"
if [ ! -L "$XDG_RUNTIME_DIR$(basename "$i")" ]; then
[ -d "$XDG_RUNTIME_DIR$(basename "$i")" ] && rm -r "$XDG_RUNTIME_DIR$(basename "$i")"
ln -s "$i" "$XDG_RUNTIME_DIR$(basename "$i")"
fi
done
EOF | sudo tee /etc/profile.d/wslg.sh`
- You should see the following (given you install
mesa-utils
andvulkan-tools
):
$ glxinfo | grep Device
WARNING: dzn is not a conformant Vulkan implementation, testing use only.
WARNING: Some incorrect rendering might occur because the selected Vulkan device (Microsoft Direct3D12 (NVIDIA GeForce RTX 4080 SUPER)) doesn't support base Zink requirements: feats.features.logicOp have_EXT_custom_border_color have_EXT_line_rasterization
Device: D3D12 (NVIDIA GeForce RTX 4080 SUPER) (0xffffffff)
$ vulkaninfo | grep "GPU id"
WARNING: dzn is not a conformant Vulkan implementation, testing use only.
GPU id = 0 (Microsoft Direct3D12 (NVIDIA GeForce RTX 4080 SUPER))
GPU id = 1 (llvmpipe (LLVM 19.1.7, 256 bits))
GPU id = 0 (Microsoft Direct3D12 (NVIDIA GeForce RTX 4080 SUPER))
GPU id = 1 (llvmpipe (LLVM 19.1.7, 256 bits))
GPU id = 0 (Microsoft Direct3D12 (NVIDIA GeForce RTX 4080 SUPER))
GPU id = 1 (llvmpipe (LLVM 19.1.7, 256 bits))
GPU id : 0 (Microsoft Direct3D12 (NVIDIA GeForce RTX 4080 SUPER)):
GPU id : 1 (llvmpipe (LLVM 19.1.7, 256 bits)):
The reason we're using just the Vulkan driver from Kisak's repo. is that the mesa package causes llvmpipe to be used instead of D3D12. Maybe overring GALLIUM_DRIVER
would work - I didn't try.