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-Silion Macs don't support SVE instructions for Highway. #32

Open
xiaobao520123 opened this issue Oct 16, 2024 · 3 comments
Open

Comments

@xiaobao520123
Copy link

xiaobao520123 commented Oct 16, 2024

I'm using 2021 M1 Max MacBook Pro to compile vectorlite.
One of its dependenies, highway, is using SVE which Apple-Silicon Macs don't support.

**Version of C++:**
/Library/Developer/CommandLineTools/usr/bin/c++ -v
Apple clang version 16.0.0 (clang-1600.0.26.3)
Target: arm64-apple-darwin24.0.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin

**Error detail:**
[19/41] /Library/Developer/CommandLineTools/usr/bin/c++ -DHWY_STATIC_DEFINE -DTOOLCHAIN_MISS_ASM_HWCAP_H -DTOOLCHAIN_MISS_SYS_AUXV_H -I/Users/xiaobao/project/vectorlite/vcpkg/buildtrees/highway/src/1.2.0-9e5d3e7297.clean -fPIC -g -std=c++17 -arch arm64 -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX15.0.sdk -fPIC -fvisibility=hidden -fvisibility-inlines-hidden -Wno-builtin-macro-redefined -D__DATE__=\"redacted\" -D__TIMESTAMP__=\"redacted\" -D__TIME__=\"redacted\" -fmerge-all-constants -Wall -Wextra -Wconversion -Wsign-conversion -Wvla -Wnon-virtual-dtor -Wcast-align -Wfloat-overflow-conversion -Wfloat-zero-conversion -Wfor-loop-analysis -Wgnu-redeclared-enum -Winfinite-recursion -Wself-assign -Wstring-conversion -Wtautological-overlap-compare -Wthread-safety-analysis -Wundefined-func-template -fno-cxx-exceptions -fno-slp-vectorize -fno-vectorize -fdiagnostics-show-option -fcolor-diagnostics -Wc++2a-extensions -fmath-errno -fno-exceptions -Wno-psabi -MD -MT CMakeFiles/hwy_contrib.dir/hwy/contrib/sort/vqsort_i32a.cc.o -MF CMakeFiles/hwy_contrib.dir/hwy/contrib/sort/vqsort_i32a.cc.o.d -o CMakeFiles/hwy_contrib.dir/hwy/contrib/sort/vqsort_i32a.cc.o -c /Users/xiaobao/project/vectorlite/vcpkg/buildtrees/highway/src/1.2.0-9e5d3e7297.clean/hwy/contrib/sort/vqsort_i32a.cc
FAILED: CMakeFiles/hwy_contrib.dir/hwy/contrib/sort/vqsort_i32a.cc.o 
/Library/Developer/CommandLineTools/usr/bin/c++ -DHWY_STATIC_DEFINE -DTOOLCHAIN_MISS_ASM_HWCAP_H -DTOOLCHAIN_MISS_SYS_AUXV_H -I/Users/xiaobao/project/vectorlite/vcpkg/buildtrees/highway/src/1.2.0-9e5d3e7297.clean -fPIC -g -std=c++17 -arch arm64 -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX15.0.sdk -fPIC -fvisibility=hidden -fvisibility-inlines-hidden -Wno-builtin-macro-redefined -D__DATE__=\"redacted\" -D__TIMESTAMP__=\"redacted\" -D__TIME__=\"redacted\" -fmerge-all-constants -Wall -Wextra -Wconversion -Wsign-conversion -Wvla -Wnon-virtual-dtor -Wcast-align -Wfloat-overflow-conversion -Wfloat-zero-conversion -Wfor-loop-analysis -Wgnu-redeclared-enum -Winfinite-recursion -Wself-assign -Wstring-conversion -Wtautological-overlap-compare -Wthread-safety-analysis -Wundefined-func-template -fno-cxx-exceptions -fno-slp-vectorize -fno-vectorize -fdiagnostics-show-option -fcolor-diagnostics -Wc++2a-extensions -fmath-errno -fno-exceptions -Wno-psabi -MD -MT CMakeFiles/hwy_contrib.dir/hwy/contrib/sort/vqsort_i32a.cc.o -MF CMakeFiles/hwy_contrib.dir/hwy/contrib/sort/vqsort_i32a.cc.o.d -o CMakeFiles/hwy_contrib.dir/hwy/contrib/sort/vqsort_i32a.cc.o -c /Users/xiaobao/project/vectorlite/vcpkg/buildtrees/highway/src/1.2.0-9e5d3e7297.clean/hwy/contrib/sort/vqsort_i32a.cc
**fatal error: error in backend: Calling convention SVE_VectorCall is unsupported on Darwin.**
c++: error: clang frontend command failed with exit code 70 (use -v to see invocation)
Apple clang version 16.0.0 (clang-1600.0.26.3)
Target: arm64-apple-darwin24.0.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin
c++: note: diagnostic msg:
@xiaobao520123 xiaobao520123 changed the title Apple-Silion Macs don't support SVE instructions in Highway. Apple-Silion Macs don't support SVE instructions for Highway. Oct 16, 2024
@larsimmisch
Copy link

I've run into the same problem. Following google/highway#2356, I tried setting -DHWY_DISABLED_TARGETS=HWY_ALL_SVE in vectorlite/vcpkg/ports/highway/portfile.cmake, but that didn't work (seems that that flag would be passed to CMake, and does not affect preprocessor definitions)

Did you manage to get this to work?

@xiaobao520123
Copy link
Author

I've run into the same problem. Following google/highway#2356, I tried setting -DHWY_DISABLED_TARGETS=HWY_ALL_SVE in vectorlite/vcpkg/ports/highway/portfile.cmake, but that didn't work (seems that that flag would be passed to CMake, and does not affect preprocessor definitions)

Did you manage to get this to work?

yeah, I've contacted the author and he also suggested adding the flag to highway. But CMake would never pass this flag down into the library. So I installed LLVM 15 using Homebrew and switch the toolchain from Xcode to LLVM.
And it works in my case to compile vectorlite on my M1 Max machine.

@jan-wassenberg
Copy link

Hi, Highway TL here. The recommended -DHWY_DISABLED_TARGETS=HWY_ALL_SVE is a compiler flag and can be passed there via CMake by export CXXFLAGS=-DHWY_DISABLED_TARGETS=HWY_ALL_SVE before running CMake.

FYI we are also in touch with Arm on fixing this compiler issue.

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

No branches or pull requests

3 participants