microsoft / microsoft/WSL

Enabling GPU support when WSL runs inside a Hyper-V VM configured with GPU partitioning

Open
#12,751 10 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

emailed-logs question
Dominant language
C++
Stars
33.7k
Forks
1.8k
Avg merge
3d 17h
Merged PRs (30d)
116

Description

(I asked this question [previously](https://github.com/microsoft/WSL/issues/12698#issuecomment-2734910100) but it was answered erroneously and the issue was closed).

I run WSL inside a Windows 11 Hyper-V VM configured for nested virtualization. This is a development environment and WSL has worked successfully in this manner for many years. I would now like for programs executing in WSL and Docker to take advantage of the internal GPU (Intel Iris Xe Graphics) for some ML related tasks. To this end, **I enabled GPU partitioning for the guest VM** and the GPU now appears both in Device Manager and Task Manager of the guest VM. Programs running in the Windows guest are able to access the GPU so, presumably, partitioning has been configured correctly

**Hyper-V Guest VM**
![Image](https://github.com/user-attachments/assets/da459b5d-a375-49c1-a8c5-ff3b0aba92e4)

Inside the WSL instance of the Hyper-V guest VM, the situation is different. Running `glxinfo -B` shows that it does not recognize the GPU. For comparison, even though I do not need it, I installed WSL in the Hyper-V host, This is what WSL shows when running in the host and inside the VM.
| Hyper-V Host | Hyper-V Guest VM|
|--------|--------|
| ![Image](https://github.com/user-attachments/assets/13977f79-b6bf-47de-9406-153420096cc2) | ![Image](https://github.com/user-attachments/assets/e91aae8f-d35c-4760-a9b9-f186eeece005)|
| ![Image](https://github.com/user-attachments/assets/3f79209d-2c57-4d49-9663-be06b84cac6e) | ![Image](https://github.com/user-attachments/assets/0fad1dff-c53a-4460-806f-95070c87c2b4) |

I would like to know whether enabling GPU support inside WSL is possible in this scenario, and if it is, how to do it.

Thanks!

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the reported comparison with glxinfo -B in WSL on the Hyper-V host and inside the GPU-partitioned guest VM. Investigate whether WSL GPU support is available in this nested configuration; done means establishing a supported configuration or documenting that the scenario is not supported.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker
Domain
computer-graphics, operating-systems
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.