intel / hexl

Intel:registered: Homomorphic Encryption Acceleration Library accelerates modular arithmetic operations used in homomorphic encryption
https://intel.github.io/hexl
Apache License 2.0
216 stars 49 forks source link

build fails on Mac (M1) #138

Closed Janmajayamall closed 1 year ago

Janmajayamall commented 1 year ago

running cmake --build build fails with following on M1 mac

`[ 1%] Building C object cmake/third-party/cpu-features/cpu-features-build/CMakeFiles/unix_based_hardware_detection.dir/src/hwcaps.c.o [ 1%] Built target unix_based_hardware_detection [ 2%] Building C object cmake/third-party/cpu-features/cpu-features-build/CMakeFiles/utils.dir/src/filesystem.c.o [ 4%] Building C object cmake/third-party/cpu-features/cpu-features-build/CMakeFiles/utils.dir/src/stack_line_reader.c.o [ 5%] Building C object cmake/third-party/cpu-features/cpu-features-build/CMakeFiles/utils.dir/src/string_view.c.o [ 5%] Built target utils [ 6%] Building C object cmake/third-party/cpu-features/cpu-features-build/CMakeFiles/cpu_features.dir/src/cpuinfo_arm.c.o In file included from /Users/janmajayamall/desktop/hexl/build/cmake/third-party/cpu-features/cpu-features-src/src/cpuinfo_arm.c:15: /Users/janmajayamall/desktop/hexl/build/cmake/third-party/cpu-features/cpu-features-src/include/cpuinfo_arm.h:118:2: error: "Including cpuinfo_arm.h from a non-arm target."

error "Including cpuinfo_arm.h from a non-arm target."

^ 1 error generated. make[2]: [cmake/third-party/cpu-features/cpu-features-build/CMakeFiles/cpu_features.dir/src/cpuinfo_arm.c.o] Error 1 make[1]: [cmake/third-party/cpu-features/cpu-features-build/CMakeFiles/cpu_features.dir/all] Error 2 make: *** [all] Error 2`

Janmajayamall commented 1 year ago

After updating 32b49eb5e7809052a28422cfde2f2745fbb0eb76 to 4e191a4cc872263c60eb473550e2b7d2965690f9 (latest commit on cpu-features main branch) here . I am running into:

[ 1%] Built target unix_based_hardware_detection [ 5%] Built target utils [ 17%] Built target cpu_features [ 18%] Building CXX object hexl/CMakeFiles/hexl.dir/eltwise/eltwise-mult-mod.cpp.o clang: error: the clang compiler does not support '-march=native' make[2]: *** [hexl/CMakeFiles/hexl.dir/eltwise/eltwise-mult-mod.cpp.o] Error 1 make[1]: *** [hexl/CMakeFiles/hexl.dir/all] Error 2 make: *** [all] Error 2

Janmajayamall commented 1 year ago

I think we need to check whether target is x86 and then only use -march=native, otherwise use -mcpu=native.

Any idea on how to achieve this ?

joserochh commented 1 year ago

Hello @Janmajayamall, what version of Clang do you have?

Janmajayamall commented 1 year ago

hey @joserochh! I have Apple clang version 13.1.6 (clang-1316.0.21.2.5)

joserochh commented 1 year ago

Hello @Janmajayamall. Sorry for the late response. Are you looking to benefit from AVX512 by using this library?

The Intel HE Acceleration Library Targets Intel CPUs and we actually recommend using a processor with Intel AVX512DQ support, with best performance on processors supporting Intel AVX512-IFMA52. Looking at the issue you raised here this problem seems to be specific to the M1 chip which unfortunately does not provide support for AVX512.

I am going to proceed by closing this issue as we do not support for M1 CPU.