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

Illegal instruction error when running under Rosetta on Apple Silicon #35

Closed
robertknight opened this issue Jan 6, 2024 · 1 comment · Fixed by #134
Closed

Illegal instruction error when running under Rosetta on Apple Silicon #35

robertknight opened this issue Jan 6, 2024 · 1 comment · Fixed by #134

Comments

@robertknight
Copy link
Owner

robertknight commented Jan 6, 2024

A user reported ocrs crashing with an "Illegal instruction" error on an M1 Mac, though I was not able to reproduce testing on an M1 myself.

When they ran the tests for RTen, the test_gemm_with_fma_kernel test ran and crashed but everything else passed. This test shouldn't even be run on an Intel Mac. So it looks like the binary was compiled for x86 and run under Rosetta.

AFAIK Rosetta doesn't implement AVX intructions, so that explains the issue. What should happen in this environment is that the fallback SSE kernel gets used instead, so there is likely something in FmaKernel::supported that needs changing.

@robertknight
Copy link
Owner Author

This might be fixed now. There was an issue where FmaKernel::supported checked only for fma, but FmaKernel::kernel used avx2 + fma target features. If it is the case that is_x86_feature_detected!("fma") returned true under Apple Silicon but is_x86_feature_detected!("avx2") return false, this could have explained the issue. This inconsistency has now been resolved.

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 a pull request may close this issue.

1 participant