openvinotoolkit / mlas

Apache License 2.0
9 stars 9 forks source link

undefined reference to `getCacheSizeMlas(int, bool)' #11

Open JuniperHugh opened 2 months ago

JuniperHugh commented 2 months ago

root@TRITON_ARMHC:/home/custom_ort/mlas/build# make -j 30 [ 96%] Built target mlas [ 98%] Building CXX object examples/CMakeFiles/mlas_exams.dir/main.cpp.o [100%] Linking CXX executable mlas_exams /usr/bin/ld: ../libmlas.a(sgemm.cpp.o): in function getKStride()': sgemm.cpp:(.text+0x18): undefined reference togetCacheSizeMlas(int, bool)' /usr/bin/ld: ../libmlas.a(sgemm.cpp.o): in function MlasGemmBatch(CBLAS_TRANSPOSE, CBLAS_TRANSPOSE, unsigned long, unsigned long, unsigned long, MLAS_SGEMM_DATA_PARAMS const*, unsigned long, IMlasThreadPool*)': sgemm.cpp:(.text+0x2a18): undefined reference togetCacheSizeMlas(int, bool)' collect2: error: ld returned 1 exit status make[2]: [examples/CMakeFiles/mlas_exams.dir/build.make:98: examples/mlas_exams] Error 1 make[1]: [CMakeFiles/Makefile2:126: examples/CMakeFiles/mlas_exams.dir/all] Error 2 make: *** [Makefile:91: all] Error 2

Can you provide the implementation of getCacheSizeMlas(int, bool) that cannot be found in the main branch?

zhangYiIntel commented 2 months ago

Hi @JuniperHugh This getCacheSizeMlas is a forward declaration in this MLAS fork, the actual implementation is defined at OpenVINO at https://github.com/openvinotoolkit/openvino/blob/master/src/plugins/intel_cpu/src/mlas/thread_pool.cpp. We does this hack because the cahce_size vary from chip to chip, and we rely on OpenVINO's implementation.

A quick workaround maybe define a getCacheSizeMlas in your application, then link it to MLAS library.

JuniperHugh commented 2 months ago

@zhangYiIntel Got it, thank you for your reply