Microsoft Brings GUI Support and GPU Acceleration to Windows Subsystem for Linux
First announced at Build 2019, Windows Subsystem for Linux (WSL) 2 will debut in the Windows 10 May 2020 Update. WSL 2 uses a real Linux kernel to overcome the limitations of WSL 1, which is based on an emulation layer that maps Windows kernel system calls to Linux kernel system calls, allowing Linux binaries to run in Windows unmodified.
WSL appears to be quite popular with developers that want to stay on Windows, with some able to run their entire DevOps workflows on the platform. Nevertheless, even with the improvements coming in WSL 2, the lack of support for GPU hardware acceleration and GUI apps limits its uses. Microsoft is now looking to address those shortcomings.
WSL GPU hardware acceleration
To enable GPU hardware acceleration in WSL 2, Microsoft is implementing GPU Paravirtualization (GPU-PV) for Linux virtual machine (VM) guests. GPU virtualization is integrated into WDDM (Windows Display Driver Model) and is currently used for Windows Defender Application Guard, Windows Sandbox, and other apps. But right now, GPU virtualization only works in Windows guest VMs.
In WDDM version 2.9, Microsoft is adding GPU virtualization support for Linux VMs. WDDM version 2.9 works with a new Linux kernel driver (Dxgkrnl) that uses the GPU-PV protocol to provide user mode Linux access to GPUs. If the host device has more than one GPU, all GPUs are available in the Linux environment, providing that all the GPUs are running WDDM version 2.9 drivers or later.
Say Goodbye to Traditional PC Lifecycle Management
Traditional IT tools, including Microsoft SCCM, Ghost Solution Suite, and KACE, often require considerable custom configurations by T3 technicians (an expensive and often elusive IT resource) to enable management of a hybrid onsite + remote workforce. In many cases, even with the best resources, organizations are finding that these on-premise tools simply cannot support remote endpoints consistently and reliably due to infrastructure limitations.
Direct3D support in WSL
Linux applications will have the same access to the GPU as Windows apps. So, if a Linux app is running alone on a GPU, it will get complete access to the GPU’s resources. The work that Microsoft has been undertaking also provides Linux guests with DirectX features like D3D12 and DxCore. D3D12, which provides access to computing capabilities of GPUs that support Direct3D 12, will have the same features and performance that are available to Windows for Linux guests, with a couple of caveats.
For more detailed technical information, see Microsoft’s blog post here.
AI training support in WSL
Microsoft has also ported DirectML, its machine learning API, to Linux. Not only that, DirectML’s functionality has been expanded to support training workflows.
NVIDIA CUDA, OpenGL, and OpenCL
Microsoft is bringing hardware acceleration for OpenCL and OpenGL through the Mesa library. Before Linux distributions running on WSL 2 can use OpenCL and OpenGL, they will need to update Mesa. Once updated, acceleration will automatically be enabled if the host is using WDDM version 2.9 drivers.
Finally, Microsoft says it is working with NVIDIA to build a version its popular compute API, CUDA, for Linux. Support for CUDA in WSL will arrive with NVIDIA’s WDDM version 2.9 driver. NVIDIA-docker tools are also coming to WSL.
GUI app support in WSL
At this month’s Build, Microsoft demonstrated early work it is carrying out to let developers run Linux GUI apps using the Windows Subsystem for Linux. Microsoft says that its goal is to let Linux GUI programs run seamlessly alongside Windows 10 apps. Until now, it has been possible to run Linux GUI apps on Windows 10 using an X server. But it is unsupported, and performance is poor.
The demo included running Eye of Gnome image viewer, the gedit text editor, and mpv media player. Microsoft says the apps connected to a Wayland server running in WSL. The graphical output was done using an RDP client on the Windows host that connected to the Wayland server.
GUI support in WSL 2 is mainly aimed at developers that would like to run integrated development environments (IDE), and other tools for development, at the same time as Windows apps. WSL 2 should eventually support running any Linux GUI app, but it won’t necessarily be something most people are likely to use.
Better WSL graphics support coming to a Windows Insider build soon
GPU acceleration for WSL 2 is coming to a Windows 10 Insider build within the next few months. Microsoft says that it will share more about availability of GUI app support nearer the end of 2020.