[PATCH] D92419: [Support] On Windows, take the affinity mask into account
Alexandre Ganea via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Dec 1 12:27:04 PST 2020
aganea created this revision.
aganea added reviewers: hans, mehdi_amini, MaskRay, amccarth.
Herald added subscribers: llvm-commits, dexonsmith, hiraditya.
Herald added a project: LLVM.
aganea requested review of this revision.
Now using the affinity mask when it's set, thus limiting the number of processors available to the ThreadPool.
For example:
> start /B /AFFINITY 0xF lld-link.exe ...
Would let LLD only use 4 hyper-threads.
This also fixes an issue on a 48-core Windows Server 2019, which was preventing from using both CPU sockets. In that case, `ProcessorGroup::AllThreads` was retrieved as 64 for each group, but `ProcessorGroup::UsableThreads` was set to 48 (which is the max possible for each group). The previous code in `llvm/lib/Support/Windows/Threading.inc` L201 was improperly assuming those values would be equal when the affinity mask was fully set. I've tested the new code on a wide variety of configurations & OSes (Windows Server 2016, 2019 and Windows 10).
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D92419
Files:
llvm/include/llvm/Support/Program.h
llvm/lib/Support/Program.cpp
llvm/lib/Support/Unix/Program.inc
llvm/lib/Support/Windows/Program.inc
llvm/lib/Support/Windows/Threading.inc
llvm/unittests/Support/ThreadPool.cpp
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D92419.308735.patch
Type: text/x-patch
Size: 11955 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20201201/aa74804b/attachment.bin>
More information about the llvm-commits
mailing list