Microsoft: Linux GUI apps coming to Windows 10 WSL along with GPU access

Microsoft also wants its DirectX-based Linux GPU kernel driver upstreamed to the Linux kernel, but there's resistance.

Microsoft Build 2020: All developers need to know
22:53

Windows 10's Windows System for Linux (WSL) will soon let developers run Linux GUI apps, while Linux guests on Windows will soon gain access to GPU power for hardware acceleration.    

WSL is currently only available via the console, but WSL2 will let developers run Linux GUI applications on Windows without a third-party X server. WSL2 will ship with the soon-to-be-released Windows 10 May 2020 Update.    

Microsoft is using its DirectX (Direct 3D 12/D3D12) APIs for graphics – typically for gaming on Windows PCs – to bring GPU hardware acceleration to Linux-based machine-learning workloads running on WSL2 and headed for the cloud.

SEE: Cheat sheet: Windows 10 PowerToys (free PDF)    

To achieve this, Microsoft is introducing a custom DirectX-based Linux GPU kernel driver – the dxgkrnl Linux Edition – for WSL2's Linux kernel, which creates a path to supported GPU hardware. Basically, it's a virtualized GPU driver that only works when on Microsoft's Hyper-V. 

This is aimed at developers who use WSL2 on a PC to test workloads that will be deployed in the cloud inside Linux containers.  

As Microsoft explains, GPU virtualization has been available to Windows running inside a VM or container, but not Linux guests. With WDDM (Windows Display Driver Model) version 2.9, this expands GPU virtualization to Linux guests.    

"Applications running inside the Linux environment have the same access to the GPU as native applications on Windows," says Steve Pronovost, a Microsoft partner development lead

"There is no partitioning of resources between Linux and Windows or limit imposed on Linux applications. The sharing is completely dynamic based on who needs what. 

"There are basically no differences between two Windows applications sharing a GPU versus a Linux and a Windows application sharing the same GPU. If a Linux application is alone on a GPU, it can consume all its resources."

Microsoft says the new GPU improvements for Linux will land in an upcoming Windows Insider Fast Ring build "soon". 

The company adds that it is working on getting its new Linux driver upstreamed to the Linux kernel and has open-sourced the driver. 

"This is the real and full D3D12 API, no imitations, pretender or reimplementation here… this is the real deal," says Pronovost. 

"libd3d12.so is compiled from the same source code as d3d12.dll on Windows but for a Linux target. It offers the same level of functionality and performance (minus virtualization overhead)."

SEE: Microsoft: We were wrong about open source, but luckily you can change

But as Linux news site Phoronix points out, the Direct 3D 12 libraries are closed source, and the idea of upstreaming it to the Linux kernel has been met with resistance among some Linux kernel maintainers, especially around the Direct Rendering Manager (DRM) subsystem of the Linux kernel for handling access to the GPU.     

Dave Airlie, the Linux kernel graphics maintainer commented: "This is a driver that connects a binary blob interface in the Windows kernel drivers to a binary blob that you run inside a Linux guest. It's a binary transport between two binary pieces.

"Personally this holds little of interest to me, I can see why it might be nice to have this upstream, but I don't foresee any other Linux distributor ever enabling it or having to ship it, it's purely a WSL2 pipe. I'm not saying I'd be happy to see this in the tree, since I don't see the value of maintaining it upstream, but it probably should just exist in a drivers/hyperv type area."

word-image-71.png

Dxgkrnl is a brand-new kernel driver for Linux that exposes the /dev/dxg device to user mode Linux.  

Image: Microsoft