diff options
author | Alexandre Ganea <alexandre.ganea@ubisoft.com> | 2021-01-14 17:03:13 -0500 |
---|---|---|
committer | Alexandre Ganea <alexandre.ganea@ubisoft.com> | 2021-01-14 17:03:22 -0500 |
commit | 4fcb25583c3ccbe10c4367d02086269e5fa0bb87 (patch) | |
tree | eb27d266a4eda6c785c3f803cacbd499a5252607 /llvm/lib/Support/Unix/Program.inc | |
parent | b894a9fb237345db64d14ce3881d3195e124df0d (diff) | |
download | llvm-4fcb25583c3ccbe10c4367d02086269e5fa0bb87.zip llvm-4fcb25583c3ccbe10c4367d02086269e5fa0bb87.tar.gz llvm-4fcb25583c3ccbe10c4367d02086269e5fa0bb87.tar.bz2 |
Re-land [Support] On Windows, take the affinity mask into account
The number of hardware threads available to a ThreadPool can be limited if setting an affinity mask.
For example:
> start /B /AFFINITY 0xF lld-link.exe ...
Would let LLD only use 4 hyper-threads.
Previously, there was an outstanding issue on Windows Server 2019 on dual-CPU machines, which was preventing from using both CPU sockets. In normal conditions, when no affinity mask was set, ProcessorGroup::AllThreads was different from ProcessorGroup::UsableThreads. The previous code in llvm/lib/Support/Windows/Threading.inc L201 was improperly assuming those two values to be equal, and consequently was limiting the execution to only one CPU socket.
Differential Revision: https://reviews.llvm.org/D92419
Diffstat (limited to 'llvm/lib/Support/Unix/Program.inc')
-rw-r--r-- | llvm/lib/Support/Unix/Program.inc | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/llvm/lib/Support/Unix/Program.inc b/llvm/lib/Support/Unix/Program.inc index 8f41fc0..fb56fa4 100644 --- a/llvm/lib/Support/Unix/Program.inc +++ b/llvm/lib/Support/Unix/Program.inc @@ -174,7 +174,8 @@ toNullTerminatedCStringArray(ArrayRef<StringRef> Strings, StringSaver &Saver) { static bool Execute(ProcessInfo &PI, StringRef Program, ArrayRef<StringRef> Args, Optional<ArrayRef<StringRef>> Env, ArrayRef<Optional<StringRef>> Redirects, - unsigned MemoryLimit, std::string *ErrMsg) { + unsigned MemoryLimit, std::string *ErrMsg, + BitVector *AffinityMask) { if (!llvm::sys::fs::exists(Program)) { if (ErrMsg) *ErrMsg = std::string("Executable \"") + Program.str() + @@ -182,6 +183,9 @@ static bool Execute(ProcessInfo &PI, StringRef Program, return false; } + assert(!AffinityMask && "Starting a process with an affinity mask is " + "currently not supported on Unix!"); + BumpPtrAllocator Allocator; StringSaver Saver(Allocator); std::vector<const char *> ArgVector, EnvVector; |