WSL2 hypervisor abstracts P-core/E-core topology preventing vectorized thread optimization
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 33.7k
- Forks
- 1.8k
- Avg merge
- 3d 17h
- Merged PRs (30d)
- 116
Description
**Is your feature request related to a problem? Please describe.**
I'm trying to write a portable, grab and go, multithreaded library that uses vectorized ISA extentions (AVX2). I observe a problem with performance that appears to preclude me using the WSL platform for this purpose.
It appears that within WSL/Ubuntu 22.04 Hypervisor, all P-Cores and E-Cores report the same flags caps via cat /proc/cpuinfo. When I spawn num threads = num logical cpus, it *appears* all my avx2 threads will get migrated by native Windows 11 preferred core detection... thus thrashing on capable cores (avoiding illegal instruction). This creates a performance problem and eliminates any benefit from vector optimized multithreaded codes running on WSL. My non-vectorized code runs faster than my vectorized code (ouch).
AFAICT, it is not possible to interrogate P-Cores only to pin and use threads with AVX2 support through this hyper visor.
In my case I noticed Vectorized code performs 15-20% worse than scalar equivalent... ouch.
Sidebar: would "pthread_setaffinity_np() calls may be ignored by hypervisor? Is this behavior documented somewhere?
Use case impact:
- Affects HPC, ML, and scientific computing workloads that depend on vectorized instructions"
- Forces developers to choose between WSL convenience and performance
**Describe the solution you'd like**
Please expose P-Core, E-Core, LP-Core (any core preferencing) capability, interrogation capability into WSL... Especially with flags. My understanding is that Linux Ubuntu Native would expose this capability.
Could you consider:
- Expose core type information through /sys/devices/system/cpu/ or similar
- Ensure thread affinity calls are respected by the hypervisor
- Consider adding WSL-specific APIs for hybrid architecture interrogation
**Describe alternatives you've considered**
The only alternatives I can see is forgoing Linux support for my library... going only Windows native (which limits my ability to develop a portable library)... or not using WSL.... buying access to a bare metal setup for linux...
I want WSL+Windows to be my one stop dev shop please.
**Additional context**
It may be overkill, but for reference I'll push my AVX2 investigation branch to github.com/MichaelRoyceCarroll/montestrike branch: *mrc/cpuSupport*
I hope this is pretty straight forward and helpful for folks... Thanks for wsl its a great tool. Grateful for any feedback!
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the P-core/E-core reporting and affinity behavior described for WSL/Ubuntu 22.04, using /proc/cpuinfo, /sys/devices/system/cpu/, and pthread_setaffinity_np(). Review the mrc/cpuSupport branch for the AVX2 investigation. Done would require an agreed WSL-supported way to interrogate core types and reliably apply affinity, with documented behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- linux, ubuntu
- Domain
- hpc, operating-systems, performance
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100