2

dxdiag tells me I have Intel HD Graphics 520 and AMD Radeon R7 M340

wsl.exe --version returns

WSL version: 1.0.0.0
Kernel version: 5.15.74.2
WSLg version: 1.0.47
MSRDC version: 1.2.3575
Direct3D version: 1.606.4
DXCore version: 10.0.25131.1002-220531-1700.rs-onecore-base2-hyp
Windows version: 10.0.22000.1281

and wsl --status says

Default Distribution: Ubuntu-22.04
Default Version: 2

From inside wsl, uname -a gives

5.19.0-microsoft-standard #2 SMP PREEMPT_DYNAMIC Wed Aug 3 01:11:12 +04 2022 x86_64 x86_64 x86_64 GNU/Linux

and glxinfo -B returns

name of display: :0
display: :0  screen: 0
direct rendering: Yes
Extended renderer info (GLX_MESA_query_renderer):
    Vendor: Mesa/X.org (0xffffffff)
    Device: llvmpipe (LLVM 15.0.4, 256 bits) (0xffffffff)
    Version: 22.2.4
    Accelerated: no
    Video memory: 5936MB
    Unified memory: no
    Preferred profile: core (0x1)
    Max core profile version: 4.5
    Max compat profile version: 4.5
    Max GLES1 profile version: 1.1
    Max GLES[23] profile version: 3.2
OpenGL vendor string: Mesa/X.org
OpenGL renderer string: llvmpipe (LLVM 15.0.4, 256 bits)
OpenGL core profile version string: 4.5 (Core Profile) Mesa 22.2.4 - kisak-mesa PPA
OpenGL core profile shading language version string: 4.50
OpenGL core profile context flags: (none)
OpenGL core profile profile mask: core profile

OpenGL version string: 4.5 (Compatibility Profile) Mesa 22.2.4 - kisak-mesa PPA
OpenGL shading language version string: 4.50
OpenGL context flags: (none)
OpenGL profile mask: compatibility profile

OpenGL ES profile version string: OpenGL ES 3.2 Mesa 22.2.4 - kisak-mesa PPA
OpenGL ES profile shading language version string: OpenGL ES GLSL ES 3.20

There is no /drv/dxg on my system. The content of /usr/lib/x86_64-linux-gnu/dri is

crocus_dri.so
iris_dri.so
nouveau_dri.so
r600_dri.so
swrast_dri.so
vmwgfx_dri.so
d3d12_dri.so
kms_swrast_dri.so
r300_dri.so
radeonsi_dri.so
virtio_gpu_dri.so
zink_dri.so

Is there a way to make gpu acceleration work?

  • @John But when googling I encountered lots of talk about `d3d12` and such under wsl? – მამუკა ჯიბლაძე Nov 24 '22 at 13:53
  • You need WSL 2. See [Enabling GPU acceleration on Ubuntu on WSL2 with the NVIDIA CUDA Platform | Ubuntu](https://ubuntu.com/tutorials/enabling-gpu-acceleration-on-ubuntu-on-wsl2-with-the-nvidia-cuda-platform#1-overview), [Enable NVIDIA CUDA on WSL 2 | Microsoft Learn](https://learn.microsoft.com/en-us/windows/ai/directml/gpu-cuda-in-wsl), [Windows 10 with WSL 2 - Part 1: How to get started with GPU-accelerated models - Qvik](https://qvik.com/news/windows-10-with-wsl-2-part-1-how-to-get-started-with-gpu-accelerated-models/) etc – DavidPostill Nov 24 '22 at 13:57
  • @DavidPostill I do not have NVIDIA card – მამუკა ჯიბლაძე Nov 24 '22 at 14:09

1 Answers1

2

With the recent release of the WSL application package (available from the Microsoft Store or a direct download AppX/MSIX bundle), which you are clearly running, GPU acceleration of WSLg for running Linux applications should be available to many systems. I don't have an AMD system, but my understanding from this devblog post is that it should work on your system.

There are (at least) three things required for GPU accelerated rendering under WSL:

  • A recent release of WSL (which you clearly have):
  • A WSL2 kernel with dxgkrnl support
  • Windows drivers for your GPU with support for WDDM v2.9 or later

Windows/WSL prerequisite

While you seem to already have this in place, I'll include it for other readers. You'll need either:

  • Windows 11: All WSL versions
  • Windows 10: A build number ending in 2311 or higher. You can check this number (the UBR - update-build-number) using (Get-ComputerInfo).WindowsUBR in PowerShell. See the "WSLg on Windows 10: Prerequisites" part of this answer for more information.

A WSL2 kernel with dxgkrnl support

From your output above, I'm hoping your problem is pretty straightforward -- I notice that the kernel version reported by uname -a is different than that reported by wsl --version. I'm assuming that you have a custom kernel compiled and defined in your %userprofile%\.wslconfig? If so, try removing that line, restarting WSL (wsl --shutdown) and check again.

Windows drivers for your GPU with support for WDDM v2.9 or later

Finally, make sure that your Windows drivers for your Radeon include support for WDDM 2.9 or later. This can be confirmed through the dxdiag command in Windows under the Display tab.

If you are below 2.9, make sure you are running the latest Catalyst drivers. I can't tell you for sure if your card will support 2.9 with the latest drivers, but I believe it should.


Additional background reading: DirectX ❤ Linux from the Microsoft DevBlog

NotTheDr01ds
  • 17,574
  • 4
  • 44
  • 81
  • Thanks a lot for the expert answer. You are absolutely right, I built a custom kernel and when I disabled it I got acceleration. Unfortunately performance of glxgears for example is worse than before. Maybe the reason is that I could not get WDDM above 2.7 with the latest drivers chosen by the Radeon installation utility. Maybe there are some third party drivers, or maybe I should also try to install the driver for Ubuntu?? – მამუკა ჯიბლაძე Nov 24 '22 at 20:34
  • 1
    @მამუკაჯიბლაძე Unfortunately likely "no" to both. Linux GPU drivers don't work in WSL because WSL actually provides the pseudo-driver that proxies to the Windows driver. And I likely wouldn't trust any third-party GPU driver -- I've never heard of such a thing, but I could be wrong. – NotTheDr01ds Nov 24 '22 at 22:16