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

Apple M1 chip - illegal hardware instruction #46178

Closed
SaschaHeyer opened this issue Jan 5, 2021 · 16 comments
Closed

Apple M1 chip - illegal hardware instruction #46178

SaschaHeyer opened this issue Jan 5, 2021 · 16 comments
Assignees
Labels
stat:awaiting response subtype:macOS type:build/install

Comments

@SaschaHeyer
Copy link

@SaschaHeyer SaschaHeyer commented Jan 5, 2021

System information

  • OS Platform and Distribution (e.g., Linux Ubuntu 16.04): MacOS Big Sur 11.0.1
  • TensorFlow installed from (source or binary): https://www.tensorflow.org/install/pip
  • TensorFlow version: Latest stable (pip)
  • Python version: Python 3.8.5
  • Installed using virtualenv? pip? conda?: exactly like in the instruction https://www.tensorflow.org/install/pip
  • Bazel version (if compiling from source): /
  • GCC/Compiler version (if compiling from source): /
  • CUDA/cuDNN version: /
  • GPU model and memory: /

Describe the problem

After running the verification steps

python -c "import tensorflow as tf;print(tf.reduce_sum(tf.random.normal([1000, 1000])))"

The following error appear

illegal hardware instruction

Any other info / logs
This issue only appear on the Mac with the Apple M1 chip. The same setup procedure https://www.tensorflow.org/install/pip works fine on my other Mac`s.

@SaschaHeyer SaschaHeyer added the type:build/install label Jan 5, 2021
@mihaimaruseac
Copy link
Collaborator

@mihaimaruseac mihaimaruseac commented Jan 5, 2021

We don't support the M1 chip. This comes from an Apple fork.

@SaschaHeyer
Copy link
Author

@SaschaHeyer SaschaHeyer commented Jan 5, 2021

Hello Mihai,

thanks for your quick response.
This information rather surprises me especially since Apple and TensorFlow did quite some advertising about it.

  • This means we will have to work on some kind of private Apple fork rather then on the official TensorFlow version?
  • Are there any plans to integrate this directly into TensorFlow?
  • This also means we are bounded to TensorFlow 2.4 on Apple M1 Macs?

It seems somehow odd to use a fork just because it is another chip.

@mihaimaruseac
Copy link
Collaborator

@mihaimaruseac mihaimaruseac commented Jan 5, 2021

The new chip is on ARM, afaik. We only release x86_64 official pips and leave everything else to the community.

there is #45404 to make this repo build on the ARM chips but will take a while until it lands and we still don't have this supported during release time. We have less than 1 engineer left for releasing.

@SaschaHeyer
Copy link
Author

@SaschaHeyer SaschaHeyer commented Jan 5, 2021

In the near future, we’ll be making updates like this even easier for users 
to get these performance numbers by integrating the forked version into
the TensorFlow master branch.

https://blog.tensorflow.org/2020/11/accelerating-tensorflow-performance-on-mac.html

Can you provide us an ETA for that?

Great to see the community is working on that #45404. But it usually takes a lot of time till builds are implemented and integrated. That means I have to rely on Apple and their support. This is a big issue in my opinion.

@ravikyram ravikyram added the subtype:macOS label Jan 6, 2021
@ravikyram ravikyram assigned ymodak and unassigned ravikyram Jan 6, 2021
@mihaimaruseac
Copy link
Collaborator

@mihaimaruseac mihaimaruseac commented Jan 6, 2021

Afaik Apple has not communicated at all with the team that does the releases. Given that there is only 1 person (actually less since releases are not prioritized), there cannot be an ETA.

@ymodak ymodak added the stat:awaiting response label Jan 6, 2021
@Young1783
Copy link

@Young1783 Young1783 commented Jan 8, 2021

#46044 (comment)
I hope this comment will help you before merge the Apple fork, which seems it will be a longgggg time.
:)

@ben-xD
Copy link

@ben-xD ben-xD commented Jan 14, 2021

Shouldn't it work when using Rosetta 2 though? Unfortunately it doesn't when running arch -x86_64 python -c "import tensorflow as tf;print(tf.reduce_sum(tf.random.normal([1000, 1000])))"

Edit: Looks like this goes over how to fix it: Compile TensorFlow from source using Bazel on Rosetta 2 #46044 (comment)

@mihaimaruseac
Copy link
Collaborator

@mihaimaruseac mihaimaruseac commented Jan 14, 2021

For Rosetta2: see #46044 (master branch should be able to compile, 2.4 branch waiting for a patch release)
For M1 chip, we landed #45404 so now if you compile this repo from source you should also get a working TF.

We are currently looking at how we can provide ongoing support.

I think we can close this now and leave #46044 open.

@OneCricketeer
Copy link

@OneCricketeer OneCricketeer commented Jan 21, 2021

The blog post specifically links to a separate tensorflow repo that needs to be built, not the version that comes from PyPi

https://blog.tensorflow.org/2020/11/accelerating-tensorflow-performance-on-mac.html

@ymodak
Copy link
Contributor

@ymodak ymodak commented Jan 27, 2021

Closing this issue in the light of #45404. Thanks!

@ymodak ymodak closed this as completed Jan 27, 2021
@google-ml-butler
Copy link

@google-ml-butler google-ml-butler bot commented Jan 27, 2021

Are you satisfied with the resolution of your issue?
Yes
No

@nijatmursali
Copy link

@nijatmursali nijatmursali commented Jun 11, 2021

Is there any update on this issue? Now it is June 12th and I'm still getting this error.

@Genius3435
Copy link

@Genius3435 Genius3435 commented Jun 24, 2021

I wanted to add that I get this not just with tensorflow, but with gcc/g++ (more often if I have some optimization/target pragmas), and with lots of things that use gcc/g++, like a rust crate I just tried to run.

@shanu12joshi
Copy link

@shanu12joshi shanu12joshi commented Jul 7, 2021

Hey, It's July I am still facing the issue, Is there a solution yet?

@msk-psp
Copy link

@msk-psp msk-psp commented Jul 23, 2021

You guys must see this post
https://developer.apple.com/metal/tensorflow-plugin/

this post describes how to import TensorFlow with there plugins

@YeungYathin
Copy link

@YeungYathin YeungYathin commented Feb 19, 2022

I am M1 Pro user. I met this problem after activating the virtual environment Anaconda and installing tensorflow. When I run my program and it failed. I'm perplexed about it and hope that Tim Cook can help me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stat:awaiting response subtype:macOS type:build/install
Projects
None yet
Development

No branches or pull requests