[PATCH] D66038: [Support] heavyweight_hardware_concurrency uses affinity when counting cores fails, and never returns 0

Sam McCall via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 9 16:06:49 PDT 2019


sammccall updated this revision to Diff 214474.
sammccall added a comment.

Rebase


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D66038

Files:
  llvm/include/llvm/Support/Threading.h
  llvm/lib/Support/Threading.cpp


Index: llvm/lib/Support/Threading.cpp
===================================================================
--- llvm/lib/Support/Threading.cpp
+++ llvm/lib/Support/Threading.cpp
@@ -68,7 +68,7 @@
   // ADL.
   int NumPhysical = sys::getHostNumPhysicalCores();
   if (NumPhysical == -1)
-    return std::thread::hardware_concurrency();
+    return llvm::hardware_concurrency();
   return NumPhysical;
 }
 
Index: llvm/include/llvm/Support/Threading.h
===================================================================
--- llvm/include/llvm/Support/Threading.h
+++ llvm/include/llvm/Support/Threading.h
@@ -130,7 +130,7 @@
   /// Get the amount of currency to use for tasks requiring significant
   /// memory or other resources. Currently based on physical cores, if
   /// available for the host system, otherwise falls back to
-  /// thread::hardware_concurrency().
+  /// llvm::hardware_concurrency().
   /// Returns 1 when LLVM is configured with LLVM_ENABLE_THREADS=OFF
   unsigned heavyweight_hardware_concurrency();
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D66038.214474.patch
Type: text/x-patch
Size: 1023 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190809/f8c37eff/attachment.bin>


More information about the llvm-commits mailing list