

WSL2 support USB/IP to allow USB devices to be shared from the Windows host to the Linux distribution. This package accelerates workflows on AMD, Intel, and NVIDIA GPUs.Īgain, this is done through the Windows GPU drivers, with the DirectML libraries running in WSL2 knowing how to proxy data between the Linux implementation and the Windows host driver.ġ USB drivers can be an exception to this rule. Writing ML tasks on WSL2 is, if I understand correctly, done through DirectML, with TensorFlow (1 and 2) and PyTorch implementations for the technology. GPU compute tasks are handled by WSL2 DirectML (and, for Nvidia, CUDA) libraries that are "injected" into the distribution (container) when it starts. As you can probably picture, the Windows display driver for your hardware is being used for this function.

Graphics capabilities are provided through WSLg, which actually uses the RDP protocol to display Wayland and X applications in a virtual RDP session that WSL automatically connects to from Windows. The container relies on the host VM's (WSL2's in this case) kernel and drivers (virtual WSL2 drivers, in this case). Again, inside containers, we rarely install hardware drivers. This is similar to the way Docker and other container technologies work. Your Ubuntu distribution runs inside a "container" inside that VM, using namespaces and cgroups. For instance, when interacting with VirtualBox, you install the VirtualBox display driver, and the host operating system provides the hardware display driver. As it is virtualized anyway, we would rarely install hardware drivers into it. As end users, we don't actually interact with the VM itself. WSL2 itself is a "managed virtual machine". WSL2 is an interesting combination of technologies:

As mentioned in the comments, you don't actually install (most 1) hardware drivers into Ubuntu when it is running under WSL2.
