[PATCH] D106012: [Support] Get correct number of physical cores on Apple Silicon

Duncan P. N. Exon Smith via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 14 13:31:45 PDT 2021


dexonsmith added inline comments.


================
Comment at: llvm/lib/Support/Host.cpp:1407
 int computeHostNumPhysicalCores() { return sysconf(_SC_NPROCESSORS_ONLN); }
-#elif defined(__APPLE__) && defined(__x86_64__)
+#elif defined(__APPLE__)
 #include <sys/param.h>
----------------
Should this be checking if the target is for macOS? Or does is the functionality below available on all platforms?


================
Comment at: llvm/lib/Support/Host.cpp:1415
   size_t len = sizeof(count);
   sysctlbyname("hw.physicalcpu", &count, &len, NULL, 0);
   if (count < 1) {
----------------
Is this available on iOS?


================
Comment at: llvm/lib/Support/Host.cpp:1420
     nm[1] = HW_AVAILCPU;
     sysctl(nm, 2, &count, &len, NULL, 0);
     if (count < 1)
----------------
Is this available on iOS?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D106012



More information about the llvm-commits mailing list