This is an archive of the discontinued LLVM Phabricator instance.

[Support] Get correct number of physical cores on Apple Silicon
ClosedPublic

Authored by steven_wu on Jul 14 2021, 1:26 PM.

Details

Summary

Fix a bug that computeHostNumPhysicalCores is fallback to default
unknown when building for Apple Silicon macs.

rdar://80533675

Diff Detail

Event Timeline

steven_wu created this revision.Jul 14 2021, 1:26 PM
steven_wu requested review of this revision.Jul 14 2021, 1:26 PM
Herald added a project: Restricted Project. · View Herald TranscriptJul 14 2021, 1:26 PM
arphaman accepted this revision.Jul 14 2021, 1:28 PM
This revision is now accepted and ready to land.Jul 14 2021, 1:28 PM
This revision was landed with ongoing or failed builds.Jul 14 2021, 1:30 PM
This revision was automatically updated to reflect the committed changes.
dexonsmith added inline comments.Jul 14 2021, 1:31 PM
llvm/lib/Support/Host.cpp
1407

Should this be checking if the target is for macOS? Or does is the functionality below available on all platforms?

1415

Is this available on iOS?

1420

Is this available on iOS?

steven_wu added inline comments.Jul 14 2021, 1:39 PM
llvm/lib/Support/Host.cpp
1415

Yes, they are in iOS public SDK. I checked before I apply the fix.

dexonsmith added inline comments.Jul 14 2021, 1:56 PM
llvm/lib/Support/Host.cpp
1407

Great -- I had assumed this was an intentional iOS-related carve out, but looking back:

  • 7943fecee8726 added it for linux (on x86)
  • db46b7d217ed4 added it for darwin (on x86)

and it seems like the "x86" part was probably just cargo-culted from the Linux side.

steven_wu added inline comments.Jul 14 2021, 2:06 PM
llvm/lib/Support/Host.cpp
1407

Let me see if I can turn on Host.cpp test for AS.

thakis added a subscriber: thakis.Jul 14 2021, 3:05 PM

This breaks tests on m1 bots: http://45.33.8.238/macm1/13971/step_11.txt

Please take a look and revert for now if it takes a while to fix.