pytorch / QNNPACK

Quantized Neural Network PACKage - mobile-optimized implementation of quantized neural network operators

Home Page:https://code.fb.com/ml-applications/qnnpack/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Building on OSX 10.14 for OS64 (ARM 64) fails

kohenchia opened this issue · comments

I'm getting an undefined symbol error when trying to build on OSX 10.14 for ARM 64:

Command:

$ cmake .. -DCMAKE_TOOLCHAIN_FILE=../../ios-cmake/ios.toolchain.cmake -DIOS_PLATFORM=OS64
$ make

Error:

Scanning dependencies of target sgemm-bench
[ 49%] Building CXX object CMakeFiles/sgemm-bench.dir/bench/sgemm.cc.o
[ 50%] Linking CXX executable sgemm-bench
ld: warning: -headerpad_max_install_names is ignored when used with -bitcode_bundle (Xcode setting ENABLE_BITCODE=YES)
Undefined symbols for architecture arm64:
  "_sgemm_ukernel_5x8__neon", referenced from:
      SGEMM_L1_5x8__neon_Benchmark::BenchmarkCase(benchmark::State&) in sgemm.cc.o
      SGEMM_Op_5x8__neon_Benchmark::BenchmarkCase(benchmark::State&) in sgemm.cc.o
  "_sgemm_ukernel_6x8__neon", referenced from:
      SGEMM_L1_6x8__neon_Benchmark::BenchmarkCase(benchmark::State&) in sgemm.cc.o
      SGEMM_Op_6x8__neon_Benchmark::BenchmarkCase(benchmark::State&) in sgemm.cc.o
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [sgemm-bench] Error 1
make[1]: *** [CMakeFiles/sgemm-bench.dir/all] Error 2
make: *** [all] Error 2

I've been poking around benchmark.h/cpp a bit but it's not clear to me why this would be happening.

I think this is a similar issue to #5, where unset CMAKE_SYSTEM_PROCESSOR breaks arch-dependent source code inclusion in CMakeLists.

That didn't seem to work. Setting CMAKE_SYSTEM_PROCESSOR to x86_64 makes the SIMULATOR64 build work, but the OS64 build still failed.

Does something in the error above suggest that this might be an arch-dependent source code inclusion problem? Isn't it normal to have to compile NEON SGEMM code for ARM 64 targets?

The linker couldn't find sgemm_ukernel_5x8__neon. This symbol is defined in src/sgemm/5x8-neon.c, which is conditionally included only on ARM/ARM64 builds.

This should be fixed with fe983bb