Skip to content

ACL cross-compilation leads to KleidiAI aarch64-specific files compilation on non-aarch64 platforms #1161

@alvoron

Description

@alvoron

The issue is reproduced on v25.02 where KleidiAI integration has been introduced.
2 files kai_rhs_pack_kxn_f32p8x1biasf32_f32_f32_neon.c and kai_matmul_clamp_f32_f32_f32p8x1biasf32_6x8x4_neon_mla.c have a platform check:

#if !defined(__aarch64__)
#error This file must be compiled for AArch64.
#else  // Architectural features check.

The issue is reproduced in OpenVINO cross-compile Android ARM 64 CI:
https://github.com/openvinotoolkit/openvino/actions/runs/13652458750/job/38164073920?pr=28669#step:12:3114

third_party/kleidiai/kai/ukernels/matmul/pack/kai_rhs_pack_kxn_f32p8x1biasf32_f32_f32_neon.c:8:2: error: This file must be compiled for AArch64.
#error This file must be compiled for AArch64.
 ^
1 error generated.
scons: *** [build/third_party/kleidiai/kai/ukernels/matmul/pack/kai_rhs_pack_kxn_f32p8x1biasf32_f32_f32_neon.o] Error 1

ComputeLibrary compilation command used in CI:
https://github.com/openvinotoolkit/openvino/actions/runs/13652458750/job/38164073920?pr=28669#step:12:3109

/usr/local/lib/python3.10/dist-packages/cmake/data/bin/cmake -E env /bin/scons neon=1 opencl=0 examples=0 Werror=0 gemm_tuner=0 reference_openmp=0 validation_tests=0 benchmark_tests=0 data_layout_support=all arch=arm64-v8.2-a openmp=0 cppthreads=1 estate=64 install_dir=install --jobs=8 os=android build=cross_compile compiler_cache=sccache toolchain_prefix="/deps/android_tools/ndk-bundle/toolchains/llvm/prebuilt/linux-x86_64/bin/aarch64-linux-android-" compiler_prefix="/deps/android_tools/ndk-bundle/toolchains/llvm/prebuilt/linux-x86_64/bin/" extra_link_flags=\ \ --target=aarch64-none-linux-android29\ --gcc-toolchain=/deps/android_tools/ndk-bundle/toolchains/llvm/prebuilt/linux-x86_64\ --sysroot=/deps/android_tools/ndk-bundle/toolchains/llvm/prebuilt/linux-x86_64/sysroot extra_cxx_flags=-Wsuggest-override\ -g\ -DANDROID\ -fdata-sections\ -ffunction-sections\ -funwind-tables\ -fstack-protector-strong\ -no-canonical-prefixes\ -D_FORTIFY_SOURCE=2\ -Wformat\ -Werror=format-security\ \ \ -fsigned-char\ -ffunction-sections\ -fdata-sections\ -fdiagnostics-show-option\ -Wall\ -Wundef\ -Wmissing-declarations\ -Wno-error=deprecated-declarations\ -Wno-cpp\ -Wno-delete-non-abstract-non-virtual-dtor\ -Wno-error\ -Wno-undef\ -Wno-missing-declarations\ -Wno-macro-redefined\ -Wno-suggest-override\ -fvisibility-inlines-hidden\ \ -Wall\ -Wno-unknown-pragmas\ -fvisibility=internal\ -O3\ -Wno-undef\ -fPIC\ \ --target=aarch64-none-linux-android29\ --gcc-toolchain=/deps/android_tools/ndk-bundle/toolchains/llvm/prebuilt/linux-x86_64\ --sysroot=/deps/android_tools/ndk-bundle/toolchains/llvm/prebuilt/linux-x86_64/sysroot\ -Wno-suggest-override --silent fixed_format_kernels=True build/libarm_compute-static.a

Should I update cross-compilation scons command or some changes is required on ACL side? Probably, these 2 files should be moved from common section of cc_library_static to arm64 section in Android.pb file?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions