Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature] Enhanced Hyper-V GPU Passthrough for Seamless Linux Development in Windows #12182

Open
DanialPahlavan opened this issue Oct 18, 2024 · 3 comments
Labels

Comments

@DanialPahlavan
Copy link

Is your feature request related to a problem? Please describe.
As a researcher, I rely heavily on Windows due to its rich ecosystem of software that's invaluable for my work. However, I find Linux much more comfortable for development. I've tried running Linux on a Windows emulator, but the experience wasn't satisfying. This led me to dual-boot both Windows 11 and Ubuntu. Unfortunately, I encounter issues when trying to run graphical software on Linux via WSL, even with WSLg; it lacks the polish and stability of a full Linux boot.

Describe the solution you'd like
I suggest enhancing Hyper-V to allow Linux VMs to fully leverage dedicated graphics hardware, similar to KVM. This would enable a near-metal virtualization experience, allowing full utilization of hardware resources while maintaining a Linux desktop environment within Windows. This setup would keep everything organized under Hyper-V. Moreover, installing graphical applications via WSL clutters the Windows Start menu, disrupting its organization. An optimized Hyper-V setup would offer a unified, efficient development environment without needing to dual boot.

Describe alternatives you've considered
I've considered and currently use dual booting as an alternative, but this requires frequent system restarts, which is disruptive to my workflow. Another alternative is using WSLg, but as mentioned, it lacks the stability and organization needed for a professional development environment.

Additional context
Enhancing Hyper-V to support GPU passthrough and near-metal virtualization for Linux would revolutionize the way we utilize Linux on Windows. It would eliminate the need for dual booting and make tools like VS Code seamlessly integrate with the full Linux desktop environment. Windows would shift to performance mode when running such VMs, minimizing resource overhead and acting as an efficient host. This would enable simultaneous use of tools like Photoshop on Windows while running a full Linux development environment.

Copy link

Logs are required for review from WSL team

If this a feature request, please reply with '/feature'. If this is a question, reply with '/question'.
Otherwise please attach logs by following the instructions below, your issue will not be reviewed unless they are added. These logs will help us understand what is going on in your machine.

How to collect WSL logs

Download and execute collect-wsl-logs.ps1 in an administrative powershell prompt:

Invoke-WebRequest -UseBasicParsing "https://raw.githubusercontent.com/microsoft/WSL/master/diagnostics/collect-wsl-logs.ps1" -OutFile collect-wsl-logs.ps1
Set-ExecutionPolicy Bypass -Scope Process -Force
.\collect-wsl-logs.ps1

The script will output the path of the log file once done.

If this is a networking issue, please use collect-networking-logs.ps1, following the instructions here

Once completed please upload the output files to this Github issue.

Click here for more info on logging
If you choose to email these logs instead of attaching to the bug, please send them to [email protected] with the number of the github issue in the subject, and in the message a link to your comment in the github issue and reply with '/emailed-logs'.

View similar issues

Please view the issues below to see if they solve your problem, and if the issue describes your problem please consider closing this one and thumbs upping the other issue to help us prioritize it!

Open similar issues:

Note: You can give me feedback by thumbs upping or thumbs downing this comment.

@elsaco
Copy link

elsaco commented Oct 18, 2024

@DanialPahlavan for what you're proposing IOMMU is required. Run (get-vmhost).iovsupport and if it returns false you're out of luck! If true then you have what's needed already for a setup you described above.

@DanialPahlavan
Copy link
Author

DanialPahlavan commented Oct 19, 2024

@DanialPahlavan for what you're proposing IOMMU is required. Run (get-vmhost).iovsupport and if it returns false you're out of luck! If true then you have what's needed already for a setup you described above.

@elsaco
Thank you for the response. I've had experience enabling IOMMU in Linux, and I’ve already made sure that all relevant BIOS settings are enabled on my system. The key issue here is that while these capabilities exist for Hyper-V in Windows, the same level of support doesn't apply when using Linux as the guest OS. There are some tricks to enable this in Windows, but unfortunately, they don't extend to Linux environments.

I've successfully used IOMMU to run both Windows and Linux, passing through the GPU to each. However, I cannot achieve the same results on Windows with Hyper-V that I can with KVM. My core idea is for Hyper-V to support GPU passthrough and near-metal virtualization for both Linux and Windows VMs seamlessly. This would allow full hardware utilization and enable Linux to run with near-metal virtualization, similar to KVM.

Many users face difficulties due to graphical issues, and when graphical software is installed via WSL, it disrupts Windows' organization, cluttering the Start menu. Having a Hyper-V structure that provides near-metal virtualization for both Linux and Windows would dramatically improve workflows for developers. Heavy applications could be run more efficiently, and machine learning engineers could benefit from GPU passthrough, allowing them to execute models without facing Windows-related limitations. The result would be higher performance, especially with graphical workloads. Ideally, the system could even allow GPU resources to be reassigned back to Windows without needing to restart, enhancing flexibility and productivity.📈🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants