Skip to content

[Build]: target specific option mismatch in softmax kernels for aarch64 #30098

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

Open
2 tasks done
amirbakhtiary23 opened this issue Apr 12, 2025 · 8 comments · May be fixed by #30143
Open
2 tasks done

[Build]: target specific option mismatch in softmax kernels for aarch64 #30098

amirbakhtiary23 opened this issue Apr 12, 2025 · 8 comments · May be fixed by #30143
Assignees
Labels
category: build OpenVINO cmake script / infra platform: arm OpenVINO on ARM / ARM64 support_request
Milestone

Comments

@amirbakhtiary23
Copy link

amirbakhtiary23 commented Apr 12, 2025

OpenVINO Version

master

Operating System

Ubuntu 24.04

Hardware Architecture

X86_64

Target Platform

Orange Pi zero plus, Aarch64 (armv8a)

Build issue description

Hello everyone.
So, I am trying to build OpenVINO for Arm Cortex A53, which is ArmV8a (aarch64), using this toolchain. According to this and this, it supports the following extensions: sve, simd, CRC, fp.

I use the following command to build the source code:

cmake -DCMAKE_TOOLCHAIN_FILE=${TOOLCHAIN_CMAKE} -DDNNL_USE_ACL=ON  \ 
-DOpenCV_DIR=${OPENCV_BUILD}  -DCMAKE_INSTALL_PREFIX=${INSTALL_DIR} \ 
-DENABLE_OV_TF_FRONTEND=OFF -DENABLE_OV_TF_LITE_FRONTEND=OFF \ 
-DENABLE_OV_TF_LITE_FRONTEND=OFF -DENABLE_OV_PADDLE_FRONTEND=OFF \ 
-DENABLE_MLAS_FOR_CPU=OFF -DCMAKE_CXX_FLAGS="-march=armv8-a+sve+simd+crc+fp" \ 
-DENABLE_NEON_FP16=OFF  ..

I also had to modify the arm_compute SConstruct file to build arm_compute. nothing important, just the prefix of auto_toolchain_prefix and changed

elif 'sve' in env['arch']:
            env.Append(CXXFLAGS = ['-march=armv8.2-a+sve+fp16+dotprod'])

on lines 357-358
to

elif 'sve' in env['arch']:
            env.Append(CXXFLAGS = ['-march=armv8-a+sve+simd+fp+crc'])

As you can see, since this architecture does not support fp16, I use the flag ENABLE_NEON_FP16 = OFF.
Everything compiles and links up to 100%. However, at the end, I get this error:

In file included from /media/amir/750GB/orangepi/openvino/src/plugins/intel_cpu/src/nodes/kernels/scaled_attn/common.hpp:23,
                 from /media/amir/750GB/orangepi/openvino/build/src/plugins/intel_cpu/cross-compiled/ANY/softmax.cpp:16:
/media/amir/750GB/orangepi/toolchains/x-tools/aarch64-rpi3-linux-gnu/lib/gcc/aarch64-rpi3-linux-gnu/12.4.0/include/arm_neon.h: In function 'void ov::Extensions::Cpu::ANY::scale_add2_reduce_max(ov::float16*, float, const ov::float16*, const T*, const uint8_t*, bool, size_t, float, ov::float16&) [with bool has_alibi = true; bool has_attn_mask = false; bool has_causal_mask = true; T = float]':
/media/amir/750GB/orangepi/toolchains/x-tools/aarch64-rpi3-linux-gnu/lib/gcc/aarch64-rpi3-linux-gnu/12.4.0/include/arm_neon.h:28984:1: error: inlining failed in call to 'always_inline' 'float16x8_t vmaxq_f16(float16x8_t, float16x8_t)': target specific option mismatch
28984 | vmaxq_f16 (float16x8_t __a, float16x8_t __b)
      | ^~~~~~~~~
In file included from /media/amir/750GB/orangepi/openvino/build/src/plugins/intel_cpu/cross-compiled/ANY/softmax.cpp:19:
/media/amir/750GB/orangepi/openvino/src/plugins/intel_cpu/src/nodes/kernels/scaled_attn/softmax_kernel.hpp:551:26: note: called from here
  551 |         v_max = vmaxq_f16(v_max, v_a);
      |                 ~~~~~~~~~^~~~~~~~~~~~
/media/amir/750GB/orangepi/toolchains/x-tools/aarch64-rpi3-linux-gnu/lib/gcc/aarch64-rpi3-linux-gnu/12.4.0/include/arm_neon.h:29182:1: error: inlining failed in call to 'always_inline' 'float16x8_t vfmaq_f16(float16x8_t, float16x8_t, float16x8_t)': target specific option mismatch
29182 | vfmaq_f16 (float16x8_t __a, float16x8_t __b, float16x8_t __c)
      | ^~~~~~~~~
/media/amir/750GB/orangepi/openvino/src/plugins/intel_cpu/src/nodes/kernels/scaled_attn/softmax_kernel.hpp:535:28: note: called from here
  535 |             v_a = vfmaq_f16(v_a, v_lookup, v_alibi_slope);
      |                   ~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/media/amir/750GB/orangepi/toolchains/x-tools/aarch64-rpi3-linux-gnu/lib/gcc/aarch64-rpi3-linux-gnu/12.4.0/include/arm_neon.h:29040:1: error: inlining failed in call to 'always_inline' 'float16x8_t vmulq_f16(float16x8_t, float16x8_t)': target specific option mismatch
29040 | vmulq_f16 (float16x8_t __a, float16x8_t __b)
      | ^~~~~~~~~
/media/amir/750GB/orangepi/openvino/src/plugins/intel_cpu/src/nodes/kernels/scaled_attn/softmax_kernel.hpp:531:24: note: called from here
  531 |         v_a = vmulq_f16(v_a, v_scale);
      |               ~~~~~~~~~^~~~~~~~~~~~~~
/media/amir/750GB/orangepi/toolchains/x-tools/aarch64-rpi3-linux-gnu/lib/gcc/aarch64-rpi3-linux-gnu/12.4.0/include/arm_neon.h:29040:1: error: inlining failed in call to 'always_inline' 'float16x8_t vmulq_f16(float16x8_t, float16x8_t)': target specific option mismatch
29040 | vmulq_f16 (float16x8_t __a, float16x8_t __b)
      | ^~~~~~~~~
/media/amir/750GB/orangepi/openvino/src/plugins/intel_cpu/src/nodes/kernels/scaled_attn/softmax_kernel.hpp:531:24: note: called from here
  531 |         v_a = vmulq_f16(v_a, v_scale);
      |               ~~~~~~~~~^~~~~~~~~~~~~~
/media/amir/750GB/orangepi/toolchains/x-tools/aarch64-rpi3-linux-gnu/lib/gcc/aarch64-rpi3-linux-gnu/12.4.0/include/arm_neon.h:29182:1: error: inlining failed in call to 'always_inline' 'float16x8_t vfmaq_f16(float16x8_t, float16x8_t, float16x8_t)': target specific option mismatch
29182 | vfmaq_f16 (float16x8_t __a, float16x8_t __b, float16x8_t __c)
      | ^~~~~~~~~
/media/amir/750GB/orangepi/openvino/src/plugins/intel_cpu/src/nodes/kernels/scaled_attn/softmax_kernel.hpp:535:28: note: called from here
  535 |             v_a = vfmaq_f16(v_a, v_lookup, v_alibi_slope);
      |                   ~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/media/amir/750GB/orangepi/toolchains/x-tools/aarch64-rpi3-linux-gnu/lib/gcc/aarch64-rpi3-linux-gnu/12.4.0/include/arm_neon.h:28984:1: error: inlining failed in call to 'always_inline' 'float16x8_t vmaxq_f16(float16x8_t, float16x8_t)': target specific option mismatch
28984 | vmaxq_f16 (float16x8_t __a, float16x8_t __b)
      | ^~~~~~~~~
/media/amir/750GB/orangepi/openvino/src/plugins/intel_cpu/src/nodes/kernels/scaled_attn/softmax_kernel.hpp:551:26: note: called from here
  551 |         v_max = vmaxq_f16(v_max, v_a);
      |                 ~~~~~~~~~^~~~~~~~~~~~
/media/amir/750GB/orangepi/toolchains/x-tools/aarch64-rpi3-linux-gnu/lib/gcc/aarch64-rpi3-linux-gnu/12.4.0/include/arm_neon.h:29450:1: error: inlining failed in call to 'always_inline' 'float16_t vmaxvq_f16(float16x8_t)': target specific option mismatch
29450 | vmaxvq_f16 (float16x8_t __a)
      | ^~~~~~~~~~
/media/amir/750GB/orangepi/openvino/src/plugins/intel_cpu/src/nodes/kernels/scaled_attn/softmax_kernel.hpp:554:21: note: called from here
  554 |     max = vmaxvq_f16(v_max);
      |           ~~~~~~~~~~^~~~~~~
/media/amir/750GB/orangepi/toolchains/x-tools/aarch64-rpi3-linux-gnu/lib/gcc/aarch64-rpi3-linux-gnu/12.4.0/include/arm_neon.h:29040:1: error: inlining failed in call to 'always_inline' 'float16x8_t vmulq_f16(float16x8_t, float16x8_t)': target specific option mismatch
29040 | vmulq_f16 (float16x8_t __a, float16x8_t __b)
      | ^~~~~~~~~
/media/amir/750GB/orangepi/openvino/src/plugins/intel_cpu/src/nodes/kernels/scaled_attn/softmax_kernel.hpp:531:24: note: called from here
  531 |         v_a = vmulq_f16(v_a, v_scale);
      |               ~~~~~~~~~^~~~~~~~~~~~~~
/media/amir/750GB/orangepi/toolchains/x-tools/aarch64-rpi3-linux-gnu/lib/gcc/aarch64-rpi3-linux-gnu/12.4.0/include/arm_neon.h:29182:1: error: inlining failed in call to 'always_inline' 'float16x8_t vfmaq_f16(float16x8_t, float16x8_t, float16x8_t)': target specific option mismatch
29182 | vfmaq_f16 (float16x8_t __a, float16x8_t __b, float16x8_t __c)
      | ^~~~~~~~~
/media/amir/750GB/orangepi/openvino/src/plugins/intel_cpu/src/nodes/kernels/scaled_attn/softmax_kernel.hpp:535:28: note: called from here
  535 |             v_a = vfmaq_f16(v_a, v_lookup, v_alibi_slope);
      |                   ~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/media/amir/750GB/orangepi/toolchains/x-tools/aarch64-rpi3-linux-gnu/lib/gcc/aarch64-rpi3-linux-gnu/12.4.0/include/arm_neon.h:28984:1: error: inlining failed in call to 'always_inline' 'float16x8_t vmaxq_f16(float16x8_t, float16x8_t)': target specific option mismatch
28984 | vmaxq_f16 (float16x8_t __a, float16x8_t __b)
      | ^~~~~~~~~
/media/amir/750GB/orangepi/openvino/src/plugins/intel_cpu/src/nodes/kernels/scaled_attn/softmax_kernel.hpp:551:26: note: called from here
  551 |         v_max = vmaxq_f16(v_max, v_a);
      |                 ~~~~~~~~~^~~~~~~~~~~~
/media/amir/750GB/orangepi/toolchains/x-tools/aarch64-rpi3-linux-gnu/lib/gcc/aarch64-rpi3-linux-gnu/12.4.0/include/arm_neon.h:29450:1: error: inlining failed in call to 'always_inline' 'float16_t vmaxvq_f16(float16x8_t)': target specific option mismatch
29450 | vmaxvq_f16 (float16x8_t __a)
      | ^~~~~~~~~~
/media/amir/750GB/orangepi/openvino/src/plugins/intel_cpu/src/nodes/kernels/scaled_attn/softmax_kernel.hpp:554:21: note: called from here
  554 |     max = vmaxvq_f16(v_max);
      |           ~~~~~~~~~~^~~~~~~
make[2]: *** [src/plugins/intel_cpu/CMakeFiles/openvino_intel_cpu_plugin.dir/build.make:4111: src/plugins/intel_cpu/CMakeFiles/openvino_intel_cpu_plugin.dir/cross-compiled/ANY/softmax.cpp.o] Error 1
make[2]: *** Waiting for unfinished jobs....
In file included from /media/amir/750GB/orangepi/openvino/src/plugins/intel_cpu/src/nodes/kernels/scaled_attn/common.hpp:23,
                 from /media/amir/750GB/orangepi/openvino/build/src/plugins/intel_cpu/cross-compiled/ANY/mha_single_token.cpp:17:
/media/amir/750GB/orangepi/toolchains/x-tools/aarch64-rpi3-linux-gnu/lib/gcc/aarch64-rpi3-linux-gnu/12.4.0/include/arm_neon.h: In function 'void ov::Extensions::Cpu::ANY::attn_reduce(ov::float16*, ov::float16*, size_t, size_t, size_t)':
/media/amir/750GB/orangepi/toolchains/x-tools/aarch64-rpi3-linux-gnu/lib/gcc/aarch64-rpi3-linux-gnu/12.4.0/include/arm_neon.h:28760:1: error: inlining failed in call to 'always_inline' 'float16x8_t vaddq_f16(float16x8_t, float16x8_t)': target specific option mismatch
28760 | vaddq_f16 (float16x8_t __a, float16x8_t __b)
      | ^~~~~~~~~
/media/amir/750GB/orangepi/openvino/build/src/plugins/intel_cpu/cross-compiled/ANY/mha_single_token.cpp:1102:40: note: called from here
 1102 |             result_vec_fp16 = vaddq_f16(result_vec_fp16, o_vec_fp16);
      |                               ~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/media/amir/750GB/orangepi/toolchains/x-tools/aarch64-rpi3-linux-gnu/lib/gcc/aarch64-rpi3-linux-gnu/12.4.0/include/arm_neon.h:28760:1: error: inlining failed in call to 'always_inline' 'float16x8_t vaddq_f16(float16x8_t, float16x8_t)': target specific option mismatch
28760 | vaddq_f16 (float16x8_t __a, float16x8_t __b)
      | ^~~~~~~~~
/media/amir/750GB/orangepi/openvino/build/src/plugins/intel_cpu/cross-compiled/ANY/mha_single_token.cpp:1102:40: note: called from here
 1102 |             result_vec_fp16 = vaddq_f16(result_vec_fp16, o_vec_fp16);
      |                               ~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
make[2]: *** [src/plugins/intel_cpu/CMakeFiles/openvino_intel_cpu_plugin.dir/build.make:4153: src/plugins/intel_cpu/CMakeFiles/openvino_intel_cpu_plugin.dir/cross-compiled/ANY/mha_single_token.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:2961: src/plugins/intel_cpu/CMakeFiles/openvino_intel_cpu_plugin.dir/all] Error 2
make: *** [Makefile:156: all] Error 2

I know the ArmV8.2a is set in multiple cmake files inside the source code, but I thought -DCMAKE_CXX_FLAGS="-march=armv8-a+sve+simd+crc+fp" should overwrite everything. I even turned off FP16.

PS: If I don't overwrite the arch, some modules will be built for armv8.2a

Build script or step-by-step to reproduce

No response

Relevant log output

Issue submission checklist

  • I'm reporting an issue. It's not a question.
  • I checked the problem with the documentation, FAQ, open issues, Stack Overflow, etc., and have not found a solution.
@rkazants rkazants added the category: build OpenVINO cmake script / infra label Apr 13, 2025
@ilya-lavrenov
Copy link
Contributor

Hi @amirbakhtiary23
I managed to compile with x-tools-aarch64-rpi3-linux-gnu-gcc14.tar.xz, but I have to adjust toolchain:

  1. Enable sysroot
set(CMAKE_SYSROOT "${TOOLCHAIN_DIR}/${CROSS_GNU_TRIPLE}/sysroot")
  1. Comment out initial flags:
# Compiler flags
# set(CMAKE_C_FLAGS_INIT       "-mcpu=cortex-a53+crc+simd")
# set(CMAKE_CXX_FLAGS_INIT     "-mcpu=cortex-a53+crc+simd")
# set(CMAKE_Fortran_FLAGS_INIT "-mcpu=cortex-a53+crc+simd")

@amirbakhtiary23
Copy link
Author

amirbakhtiary23 commented Apr 14, 2025

Dear @ilya-lavrenov
Thank you for taking the time.
I have a question though.
Did you set the flag -DCMAKE_CXX_FLAGS="-march=armv8-a+sve+simd+crc+fp"??
I ask this because my target CPU is cortex-a53 (which matches the -march I provided) and compiling for another architecture is not useful to me. Also, it is vital to use the available extensions.

Can you please share the flags you used? I used the flags I mentioned but got some python header or pyconf.h misaing error while using the version you used.

@ilya-lavrenov
Copy link
Contributor

Looks like you combination of compiled flags lead to undetected SVE support and code fallen back to FP16, which is disabled in your case. From errors we see lines result_vec_fp16 = vaddq_f16(result_vec_fp16, o_vec_fp16, which are under else branch of HAVE_SVE:

#if defined(__ARM_FEATURE_FP16_VECTOR_ARITHMETIC)
static void attn_reduce(ov::float16* dst, ov::float16* temp, size_t M, size_t S, size_t temp_stride) {
size_t i = 0;
# if defined(HAVE_SVE)
svbool_t pg = svptrue_b16();
for (; i + vec_len_f16_sve() <= S; i += vec_len_f16_sve()) {
auto* src = temp + i;
auto result_vec_fp16 = svdup_n_f16(0.0f);
for (size_t m = 0; m < M; m++) {
auto o_vec_fp16 = svld1_f16(pg, reinterpret_cast<float16_t*>(src));
result_vec_fp16 = svadd_f16_m(pg, result_vec_fp16, o_vec_fp16);
src += temp_stride;
}
svst1_f16(pg, reinterpret_cast<float16_t*>(dst + i), result_vec_fp16);
}
# else
for (; i + vec_len_f16_neon <= S; i += vec_len_f16_neon) {
auto* src = temp + i;
auto result_vec_fp16 = vdupq_n_f16(0.0f);
for (size_t m = 0; m < M; m++) {
auto o_vec_fp16 = vld1q_f16(reinterpret_cast<float16_t*>(src));
result_vec_fp16 = vaddq_f16(result_vec_fp16, o_vec_fp16);
src += temp_stride;
}
vst1q_f16(reinterpret_cast<float16_t*>(dst + i), result_vec_fp16);
}
# endif

Note, that __ARM_FEATURE_FP16_VECTOR_ARITHMETIC is enabled, which means FP16 is supported. Are you sure that you need to disable FP16 via ENABLE_NEON_FP16?

Could you please provide cmake output?

@amirbakhtiary23
Copy link
Author

amirbakhtiary23 commented Apr 14, 2025

Looks like you combination of compiled flags lead to undetected SVE support and code fallen back to FP16, which is disabled in your case

Yes I noticed that when I examined the code.

This is the cmake output :

-- OpenVINO version is 2025.0.0 (Build 17771)
-- OpenVINO Runtime enabled features:
--
--     CI_BUILD_NUMBER: 2025.0.0-17771-345163f8795
--     ENABLE_LTO = OFF
--     OS_FOLDER = OFF
--     USE_BUILD_TYPE_SUBFOLDER = ON
--     CMAKE_COMPILE_WARNING_AS_ERROR = OFF
--     ENABLE_QSPECTRE = OFF
--     ENABLE_INTEGRITYCHECK = OFF
--     ENABLE_SANITIZER = OFF
--     ENABLE_UB_SANITIZER = OFF
--     ENABLE_THREAD_SANITIZER = OFF
--     ENABLE_COVERAGE = OFF
--     ENABLE_API_VALIDATOR = OFF
--     ENABLE_SSE42 = OFF
--     ENABLE_AVX2 = OFF
--     ENABLE_AVX512F = OFF
--     ENABLE_NEON_FP16 = OFF
--     ENABLE_SVE = ON
--     BUILD_SHARED_LIBS = ON
--     ENABLE_LIBRARY_VERSIONING = ON
--     ENABLE_FASTER_BUILD = OFF
--     ENABLE_CPPLINT = OFF
--     ENABLE_CPPLINT_REPORT = OFF
--     ENABLE_CLANG_FORMAT = OFF
--     ENABLE_NCC_STYLE = OFF
--     ENABLE_UNSAFE_LOCATIONS = OFF
--     ENABLE_FUZZING = OFF
--     ENABLE_PROXY = ON
--     ENABLE_INTEL_CPU = ON
--     ENABLE_ARM_COMPUTE_CMAKE = OFF
--     ENABLE_TESTS = OFF
--     ENABLE_INTEL_GPU = OFF
--     ENABLE_ONEDNN_FOR_GPU = OFF
--     ENABLE_INTEL_NPU = OFF
--     ENABLE_INTEL_NPU_INTERNAL = OFF
--     ENABLE_DEBUG_CAPS = OFF
--     ENABLE_NPU_DEBUG_CAPS = OFF
--     ENABLE_GPU_DEBUG_CAPS = OFF
--     ENABLE_CPU_DEBUG_CAPS = OFF
--     ENABLE_SNIPPETS_DEBUG_CAPS = OFF
--     ENABLE_SNIPPETS_LIBXSMM_TPP = OFF
--     ENABLE_PROFILING_ITT = OFF
--     ENABLE_PROFILING_FILTER = ALL
--     ENABLE_PROFILING_FIRST_INFERENCE = ON
--     SELECTIVE_BUILD = OFF
--     ENABLE_DOCS = OFF
--     ENABLE_PKGCONFIG_GEN = ON
--     THREADING = TBB
--     ENABLE_INTEL_OPENMP = OFF
--     ENABLE_TBBBIND_2_5 = ON
--     ENABLE_TBB_RELEASE_ONLY = ON
--     ENABLE_MULTI = ON
--     ENABLE_AUTO = ON
--     ENABLE_AUTO_BATCH = ON
--     ENABLE_HETERO = ON
--     ENABLE_TEMPLATE = ON
--     ENABLE_PLUGINS_XML = OFF
--     ENABLE_FUNCTIONAL_TESTS = OFF
--     ENABLE_SAMPLES = ON
--     ENABLE_OV_ONNX_FRONTEND = ON
--     ENABLE_OV_PADDLE_FRONTEND = OFF
--     ENABLE_OV_IR_FRONTEND = ON
--     ENABLE_OV_PYTORCH_FRONTEND = OFF
--     ENABLE_OV_JAX_FRONTEND = ON
--     ENABLE_OV_IR_FRONTEND = ON
--     ENABLE_OV_TF_FRONTEND = OFF
--     ENABLE_OV_TF_LITE_FRONTEND = OFF
--     ENABLE_SNAPPY_COMPRESSION = OFF
--     ENABLE_STRICT_DEPENDENCIES = OFF
--     ENABLE_SYSTEM_TBB = OFF
--     ENABLE_SYSTEM_PUGIXML = OFF
--     ENABLE_SYSTEM_FLATBUFFERS = OFF
--     ENABLE_SYSTEM_OPENCL = OFF
--     ENABLE_SYSTEM_PROTOBUF = OFF
--     ENABLE_SYSTEM_SNAPPY = OFF
--     ENABLE_SYSTEM_LEVEL_ZERO = OFF
--     ENABLE_JS = ON
--     ENABLE_OPENVINO_DEBUG = OFF
--
-- CMAKE_VERSION ......................... 3.28.3
-- CMAKE_CROSSCOMPILING .................. TRUE
-- OpenVINO_SOURCE_DIR ................... /home/dsd/test/openvino
-- OpenVINO_BINARY_DIR ................... /home/dsd/test/openvino/build
-- CMAKE_GENERATOR ....................... Unix Makefiles
-- CPACK_GENERATOR ....................... TGZ
-- CMAKE_C_COMPILER_ID ................... GNU
-- CMAKE_CXX_COMPILER_ID ................. GNU
-- CMAKE_CXX_STANDARD .................... 17
-- CMAKE_BUILD_TYPE ...................... Release
-- CMAKE_TOOLCHAIN_FILE .................. /home/dsd/test/x-tools/aarch64-rpi3-linux-gnu.toolchain.cmake
-- LIBC_VERSION .......................... 2.27
-- STDLIB ................................ GNU
-- Protocol Buffers Configuring...
--
-- 3.21.12.0
-- Configuration script parsing status [
--   Description : Protocol Buffers
--   Version     : 3.21.12.0 (3.21.12)
--   Contact     : [email protected]
-- ]
-- Protocol Buffers Configuring done
CMake Warning (dev) at thirdparty/onnx/onnx/CMakeLists.txt:106 (find_package):
  Policy CMP0148 is not set: The FindPythonInterp and FindPythonLibs modules
  are removed.  Run "cmake --help-policy CMP0148" for policy details.  Use
  the cmake_policy command to set the policy and suppress this warning.

This warning is for project developers.  Use -Wno-dev to suppress it.

Generated: /home/dsd/test/openvino/build/thirdparty/onnx/onnx/onnx/onnx_openvino_onnx-ml.proto
Generated: /home/dsd/test/openvino/build/thirdparty/onnx/onnx/onnx/onnx-operators_openvino_onnx-ml.proto
Generated: /home/dsd/test/openvino/build/thirdparty/onnx/onnx/onnx/onnx-data_openvino_onnx.proto
--
-- ******** Summary ********
--   CMake version                     : 3.28.3
--   CMake command                     : /usr/bin/cmake
--   System                            : Linux
--   C++ compiler                      : /home/dsd/test/x-tools/aarch64-rpi3-linux-gnu/bin/aarch64-rpi3-linux-gnu-g++
--   C++ compiler version              : 12.4.0
--   CXX flags                         : -Wsuggest-override -Wsuggest-override -march=armv8-a+sve+simd+crc+fp -fsigned-char -ffunction-sections -fdata-sections -fdiagnostics-show-option -Wall -Wundef -fsigned-char -ffunction-sections -fdata-sections -fdiagnostics-show-option -Wall -Wundef -Wno-suggest-override -Wnon-virtual-dtor
--   Build type                        : Release
--   Compile definitions               : OV_NATIVE_PARENT_PROJECT_ROOT_DIR="openvino";OV_BUILD_POSTFIX="";OV_NATIVE_PARENT_PROJECT_ROOT_DIR="openvino";__STDC_FORMAT_MACROS
--   CMAKE_PREFIX_PATH                 :
--   CMAKE_INSTALL_PREFIX              : /usr/local
--   CMAKE_MODULE_PATH                 :
--
--   ONNX version                      : 1.17.0
--   ONNX NAMESPACE                    : openvino_onnx
--   ONNX_USE_LITE_PROTO               : ON
--   USE_PROTOBUF_SHARED_LIBS          : OFF
--   Protobuf_USE_STATIC_LIBS          : ON
--   ONNX_DISABLE_EXCEPTIONS           : OFF
--   ONNX_DISABLE_STATIC_REGISTRATION  : OFF
--   ONNX_WERROR                       : OFF
--   ONNX_BUILD_TESTS                  : OFF
--   ONNX_BUILD_SHARED_LIBS            :
--   BUILD_SHARED_LIBS                 : OFF
--
--   Protobuf compiler                 :
--   Protobuf includes                 :
--   Protobuf libraries                :
--   BUILD_ONNX_PYTHON                 : OFF
-- Using the multi-header code from /home/dsd/test/openvino/thirdparty/json/nlohmann_json/include/
-- TBB (2021.13.0) is found at /home/dsd/test/openvino/temp/tbb/lib/cmake/TBB
-- Static tbbbind_2_5 package usage is disabled, since oneTBB (ver. 2021.13.0) provides dynamic TBBBind 2.5+
-- STD_FS_NEEDS_STDCXXFS - Add explicit filesystem linker setting: 'stdc++fs'.
-- DNNL_TARGET_ARCH: AARCH64
-- DNNL_LIBRARY_NAME: openvino_onednn_cpu
-- Configure to build /home/dsd/test/openvino/src/plugins/intel_cpu/thirdparty/ComputeLibrary
-- Arm Compute Library: arm_compute::arm_compute;arm_compute::half
-- Arm Compute Library headers: $<TARGET_PROPERTY:arm_compute::arm_compute,INTERFACE_INCLUDE_DIRECTORIES>;$<TARGET_PROPERTY:arm_compute::half,INTERFACE_INCLUDE_DIRECTORIES>
-- Found Git: /usr/bin/git (found version "2.43.0")
-- Enabled testing coverage: CI
-- Enabled workload: INFERENCE
-- Enabled primitives: CONVOLUTION;DECONVOLUTION;CONCAT;LRN;INNER_PRODUCT;MATMUL;POOLING;REDUCTION;REORDER;RNN;SOFTMAX
-- Enabled primitive CPU ISA: ALL
-- Enabled primitive GPU ISA: ALL
-- Enabled GeMM kernels ISA: ALL
-- Primitive cache is enabled
CMake Warning at src/bindings/python/CMakeLists.txt:72 (message):
  Python 3.x Interpreter and Development.Module components are not found.
  OpenVINO Python API will be turned off (ENABLE_PYTHON is OFF)
Call Stack (most recent call first):
  src/bindings/python/CMakeLists.txt:96 (ov_check_python_build_conditions)


CMake Warning at cmake/developer_package/python_requirements.cmake:118 (message):
  Python requirement file
  /home/dsd/test/openvino/src/bindings/python/wheel/requirements-dev.txt is
  not installed,
Call Stack (most recent call first):
  src/bindings/python/CMakeLists.txt:143 (ov_check_pip_packages)


CMake Warning at src/bindings/python/CMakeLists.txt:153 (message):
  patchelf is not found.  It is required to build OpenVINO Runtime wheel.
  Install via `pip install patchelf` or `apt install patchelf`.


CMake Warning at samples/cpp/common/format_reader/CMakeLists.txt:22 (message):
  OpenCV ver.  3.0+ is not found, format_reader will be built without OpenCV
  support


CMake Warning at samples/cpp/benchmark_app/CMakeLists.txt:112 (message):
  OpenCV ver.  3.0+ is not found, benchmark_app will be built without OpenCV
  support.  Set OpenCV_DIR


CMake Warning at samples/c/common/opencv_c_wrapper/CMakeLists.txt:20 (message):
  OpenCV ver.  3.0+ is not found, opencv_c_wrapper is built without OPENCV
  support


-- Register template to be built in build-modules/template
-- Register template_extension to be built in build-modules/template_extension
CMake Warning at cmake/developer_package/shellcheck/shellcheck.cmake:22 (message):
  shellcheck tool is not found
Call Stack (most recent call first):
  scripts/CMakeLists.txt:19 (ov_shellcheck_process)


-- Configuring done (3.7s)
-- Generating done (0.2s)
-- Build files have been written to: /home/dsd/test/openvino/build

The command I used for building:

cmake -DCMAKE_TOOLCHAIN_FILE=${TOOLCHAIN_CMAKE} -DDNNL_USE_ACL=ON  -DENABLE_OV_TF_FRONTEND=OFF -DENABLE_OV_PYTORCH_FRONTEND=OFF -DENABLE_OV_TF_LITE_FRONTEND=OFF -DENABLE_OV_PADDLE_FRONTEND=OFF -DENABLE_MLAS_FOR_CPU=OFF -DCMAKE_CXX_FLAGS="-march=armv8-a+sve+simd+crc+fp" -DENABLE_NEON_FP16=OFF  ..
make -j24

I did do the changes you mentioned. But no luck. the build process can be conducted without -DCMAKE_CXX_FLAGS="-march=armv8-a+sve+simd+crc+fp" with no problem. But I'm 99% sure it will be built for armv8.2a (or at least some of the libs will). Below is the toolchain cmake output:

# For more information, see 
# https://cmake.org/cmake/help/latest/manual/cmake-toolchains.7.html,
# https://cmake.org/cmake/help/book/mastering-cmake/chapter/Cross%20Compiling%20With%20CMake.html, and
# https://tttapa.github.io/Pages/Raspberry-Pi/C++-Development-RPiOS/index.html.

include(CMakeDependentOption)

# System information
set(CMAKE_SYSTEM_NAME "Linux")
set(CMAKE_SYSTEM_PROCESSOR "aarch64")
set(CROSS_GNU_TRIPLE "aarch64-rpi3-linux-gnu"
    CACHE STRING "The GNU triple of the toolchain to use")
set(CMAKE_LIBRARY_ARCHITECTURE "aarch64-linux-gnu")

# Compiler flags
#set(CMAKE_C_FLAGS_INIT       "-mcpu=cortex-a53+crc+simd")
#set(CMAKE_CXX_FLAGS_INIT     "-mcpu=cortex-a53+crc+simd")
#set(CMAKE_Fortran_FLAGS_INIT "-mcpu=cortex-a53+crc+simd")

# Search path configuration
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
# set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)

# Packaging
set(CPACK_DEBIAN_PACKAGE_ARCHITECTURE "arm64")

# Toolchain and sysroot
set(TOOLCHAIN_DIR "${CMAKE_CURRENT_LIST_DIR}/${CROSS_GNU_TRIPLE}")
set(CMAKE_SYSROOT "${TOOLCHAIN_DIR}/${CROSS_GNU_TRIPLE}/sysroot")
list(APPEND CMAKE_BUILD_RPATH "${TOOLCHAIN_DIR}/${CROSS_GNU_TRIPLE}/lib64")

# Compiler binaries
set(CMAKE_C_COMPILER "${TOOLCHAIN_DIR}/bin/${CROSS_GNU_TRIPLE}-gcc"
    CACHE FILEPATH "C compiler")
set(CMAKE_CXX_COMPILER "${TOOLCHAIN_DIR}/bin/${CROSS_GNU_TRIPLE}-g++"
    CACHE FILEPATH "C++ compiler")
set(CMAKE_Fortran_COMPILER "${TOOLCHAIN_DIR}/bin/${CROSS_GNU_TRIPLE}-gfortran"
    CACHE FILEPATH "Fortran compiler")

PS: Can you please use this toolchain so that we are on the same page?

ilya-lavrenov added a commit to ilya-lavrenov/openvino that referenced this issue Apr 15, 2025
@ilya-lavrenov ilya-lavrenov linked a pull request Apr 15, 2025 that will close this issue
@ilya-lavrenov
Copy link
Contributor

Hi @amirbakhtiary23
Managed to reproduce the issue, please try #30143.

BTW, maybe you don't need to set SVE explicitly via -DCMAKE_CXX_FLAGS="-march=armv8-a+sve+simd+crc+fp" ? because we compile our code for different ISAs including SVE. Later, in runtime we select implementation based on ISA of current machine.

In your case, you always compile with SVE even for generic ARM64 machine, which makes code non-portable.

@amirbakhtiary23
Copy link
Author

amirbakhtiary23 commented Apr 17, 2025

Dear @ilya-lavrenov ,
Thank you for taking the time. I was able to build OpenVINO from source using the toolchain I specified (given your update).
However, when I try to run this simple piece of code I get this error : Illegal instruction.
The code :

#include <openvino/openvino.hpp>
#include <vector>
#include <iostream>
int main(){
constexpr size_t ROWS = 1;
constexpr size_t COLS = 10;
std::vector<float> data = {1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f, 8.0f, 9.0f, 10.0f};

float* memory_ptr = data.data();
ov::Core core;

return 0;}

This was just a test to see if I can initialize OpenVINO. The same happens when I try to run benchmark_all.
Maybe this is related to the changes I made in the SConstruct script? Can I specify the path to pre-built Arm Compute during the build? I didn't see any related flag.

@ilya-lavrenov
Copy link
Contributor

Illegal instruction means that -march=armv8-a+sve+simd+crc+fp that you have passed, are not compatible with your running machine.
You can compile OpenCV with the same flags and I suppose the issue will be the same.

@amirbakhtiary23
Copy link
Author

Yeah, I did a bit of digging and I think even though cortex a53 is aarch64 v8a, it does not support sve. I will try without sve and get back to you.

Thank you very much

@ilya-lavrenov ilya-lavrenov added this to the 2025.2 milestone Apr 17, 2025
@ilya-lavrenov ilya-lavrenov added the platform: arm OpenVINO on ARM / ARM64 label Apr 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
category: build OpenVINO cmake script / infra platform: arm OpenVINO on ARM / ARM64 support_request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants