[PATCH] D84764: Fix computeHostNumPhysicalCores() for Linux on POWER and Linux on Z

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 31 11:24:11 PDT 2020


MaskRay added a comment.

> Fix: provide custom implementation of getHostNumPhysicalCores for Linux on Power and Linux on Z.

computeHostNumPhysicalCores() is designed to respect CPU affinity.
SupportTests Threading.PhysicalConcurrency may fail if taskset -c is specified.

I fixed the test in cd53ded557c3487b8dae2f9de894fdb5b75cb8c8 <https://reviews.llvm.org/rGcd53ded557c3487b8dae2f9de894fdb5b75cb8c8>. Please refer to the x86 implementation if you want to support both hyper threading & affinity.



================
Comment at: llvm/lib/Support/Host.cpp:1275
+#elif (defined(__linux__) &&                                                   \
+       (defined(__ppc__) || defined(__powerpc__) || defined(__s390x__)))
+#include <unistd.h>
----------------
`defined(__ppc__) || defined(__powerpc__) ` is redundant. 

You could just use `defined(__powerpc__)`


================
Comment at: llvm/unittests/Support/Host.cpp:45
+           (Host.getOS() == Triple::Linux &&
+            (Host.isPPC64() || Host.isSystemZ()));
   }
----------------
Did you want to enable powerpc32 as well?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D84764/new/

https://reviews.llvm.org/D84764



More information about the llvm-commits mailing list