Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support Apple M1 Silicon #2335

Merged
merged 6 commits into from
Nov 22, 2020
Merged

support Apple M1 Silicon #2335

merged 6 commits into from
Nov 22, 2020

Conversation

nihui
Copy link
Member

@nihui nihui commented Nov 20, 2020

  • recognize apple m1
    - [ ] cpu affinity on macos/ios

@codecov-io
Copy link

codecov-io commented Nov 20, 2020

Codecov Report

Merging #2335 (5604b7a) into master (fb59eeb) will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #2335   +/-   ##
=======================================
  Coverage   85.96%   85.96%           
=======================================
  Files         475      475           
  Lines       84558    84558           
=======================================
  Hits        72688    72688           
  Misses      11870    11870           
Impacted Files Coverage Δ
src/cpu.cpp 57.29% <ø> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update fb59eeb...5604b7a. Read the comment docs.

#if __APPLE__
static int set_sched_affinity(const CpuSet& thread_affinity_mask)
{
// https://developer.apple.com/library/archive/releasenotes/Performance/RN-AffinityAPI/index.html
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a quite outdated document. Apple will not allow developers to set CPU affinity. In OS X 10.5 it worked, later it became a suggestion to OS X, then in 10.10 or so (as well in later ones), macOS will ignore any affinity settings.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It returns KERN_NOT_SUPPORTED
QAQ

Copy link
Contributor

@BlueCocoa BlueCocoa Nov 22, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems that we have no choice but trusts the thread scheduler in macOS. (I also tried processor_exit to shutdown some cores, but that only works on the Intel ones.) I'm afraid that there's no way for us to do this...

Sad but true, QwQ

@nihui nihui merged commit 1184404 into Tencent:master Nov 22, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants