-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Running x86 AVX2 binary on Apple Silicon with Rosetta 2 (macOS 15) #5707
Comments
|
|
Why are you even doing this ? Does our m1 release not work for your m4? |
Ah I see there are some articles about macOS Sequoia's rosetta being able to support avx2, would be good to know if it crashes on an avx2 instruction or something else |
The provided arm64 version runs perfect and fast on macOS! I was curious about the speed of x86 binaries under Rosetta 2. And expected, that the avx2 version could be the fastest x86 binary of the three (like on Intel or Amd). The single core bench gives these results for Stockfish 17 on my mac:
|
Can you run it with lldb and get a stack trace? |
|
Ah I kinda expected this, we add bmi1 to the compiler flags for avx2 since #4202. Pretty much any platform which has avx2 also has this instruction but since apple is adding translations from x86 to arm they don't.. |
Since we distribute arm binaries for mac I don't feel like removing this, if you still want to test the speed you can try to remove the -mbmi from the Makefile and recompile and run your test. |
Thanks for looking into! Just compiled it on my intel mac.
|
Yeah apple's translation isn't the best nor is it even correct, see https://github.com/carsongoodwin32/rosetta2_avx_dive.. 12% slower and wrong result |
I don’t have knowledge if it's different, but it should be pointed out that this reference was analyzing a pre-release (Beta) version of translation. It would certainly be noteworthy to claim that a final release produces wrong results, but I haven't discovered anyone claiming that yet. |
@RogerThiede I just ran the test code from the linked repo on my M1 with macOS 15.1.1 (24B91), with the avx2 code path always giving different results, this did not happen on my reference amd system.
I haven't checked the code in depth and maybe it relies on some undefined behavior, idk. EDIT: There is an open issue on the repository stating that the test code has UB anyway. |
FYI No idea if this could be related but we currently have a bug making use of random TT data in search. |
not related in any way |
Describe the issue
zsh: illegal hardware instruction ./stockfish-macos-x86-64-avx2 compiler
Expected behavior
AVX2 binary should run on macOS 15 with Rosetta 2
Steps to reproduce
Run macOS x86-AVX2 Stockfish 17 in terminal on an Apple Silicon Mac with macOS 15.x
./stockfish-macos-x86-64-avx2 compiler
Anything else?
With Rosetta 2 it should now be possible to use x86 binaries with AVX2 instructions on Apple Silicon macs.
But on an M4 mac running macOS 15.1.1 I get this in the terminal
zsh: illegal hardware instruction ./stockfish-macos-x86-64-avx2 compiler
Operating system
MacOS
Stockfish version
official Stockfish 17 x86-AVX2 for macOS
The text was updated successfully, but these errors were encountered: