[all-commits] [llvm/llvm-project] e9b213: [Support] computeHostNumPhysicalCores: use sched_g...

Fangrui Song via All-commits all-commits at lists.llvm.org
Sat Aug 13 01:36:25 PDT 2022

  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: e9b213131ae9c57f4f151d3206916676135b31b0
  Author: Fangrui Song <i at maskray.me>
  Date:   2022-08-13 (Sat, 13 Aug 2022)

  Changed paths:
    M llvm/lib/Support/Host.cpp

  Log Message:
  [Support] computeHostNumPhysicalCores: use sched_getaffinity for all non-Android Linux with no custom implementation

Make the sched_getaffinity based implementation available to all architectures
(except s390x/x86 which have a custom implementation). The `CPU_ALLOC(2048)`
code supports all `CONFIG_NR_CPUS` values in Linux kernel `arch/*/configs/`.

The function is mainly used by in-process ThinLTO to decide the default number
of threads. Returning -1 will use just one thread.

Android is excluded because of the higher API level requirement:
`sched_getaffinity; # introduced-arm=12 introduced-arm64=21 introduced-x86=12 introduced-x86_64=21`

More information about the All-commits mailing list