[all-commits] [llvm/llvm-project] 4fcb25: Re-land [Support] On Windows, take the affinity ma...

Alexandre Ganea via All-commits all-commits at lists.llvm.org
Thu Jan 14 14:08:17 PST 2021


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 4fcb25583c3ccbe10c4367d02086269e5fa0bb87
      https://github.com/llvm/llvm-project/commit/4fcb25583c3ccbe10c4367d02086269e5fa0bb87
  Author: Alexandre Ganea <alexandre.ganea at ubisoft.com>
  Date:   2021-01-14 (Thu, 14 Jan 2021)

  Changed paths:
    M llvm/include/llvm/Support/Program.h
    M llvm/lib/Support/Program.cpp
    M llvm/lib/Support/Unix/Program.inc
    M llvm/lib/Support/Windows/Program.inc
    M llvm/lib/Support/Windows/Threading.inc
    M llvm/unittests/Support/ThreadPool.cpp

  Log Message:
  -----------
  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




More information about the All-commits mailing list