[PATCH] D25564: Add interface to compute number of physical cores on host system

Mehdi AMINI via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 13 12:52:22 PDT 2016


mehdi_amini added a comment.

In https://reviews.llvm.org/D25564#569461, @kparzysz wrote:

> In https://reviews.llvm.org/D25564#569457, @mehdi_amini wrote:
>
> > The reason is that if you have for instance very memory heavy tasks, and you know (by experiment) that you don't benefit much from hyper-threading in terms of runtime, it seems more friendly to kick less threads (divide memory peak by 2).
>
>
> Then what's stopping us from returning that number as "preferred number of concurrent tasks"?


Do you mean having `llvm::thread::hardware_concurrency()`returning the  "preferred number of concurrent tasks"?
This does not seem a good idea to me, because there was an important "if" in the explanation above: "if you have for instance very memory heavy tasks, and you know (by experiment) that you don't benefit much from hyper-threading in terms of runtime".

> Instead we have something motivated by x86 that may or may not work well on other architectures.

I'm not sure how to solve it differently than delegating such logic to the client of this API, i.e. I see this API is a basic-block to build other APIs. 
This other API could be for instance `llvm::thread::hardware_coarse_concurrency()`. This is where I would handle handle architecture specific choices (and default to `hardware_concurrency`).


Repository:
  rL LLVM

https://reviews.llvm.org/D25564





More information about the llvm-commits mailing list