From 64abb77269ccf1cb40311675d515a65f7a1dae38 Mon Sep 17 00:00:00 2001 From: Hans Date: Mon, 7 Oct 2024 20:37:07 +0800 Subject: [PATCH] chore: tune compile options --- .github/workflows/release.yml | 14 ++++++++------ build.rs | 3 ++- cmake/mingw-w64-aarch64.clang.toolchain.cmake | 8 +++----- 3 files changed, 13 insertions(+), 12 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index ecad423..9c19821 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -125,30 +125,32 @@ jobs: if [[ "$PLATFORM" == "windows" ]]; then EXTRA_CMAKE_ARGS="-DCMAKE_TOOLCHAIN_FILE=../cmake/mingw-w64-${ARCH}.clang.toolchain.cmake" if [[ "$ARCH" == "aarch64" ]]; then - EXTRA_CMAKE_ARGS="${EXTRA_CMAKE_ARGS} -DEXECUTORCH_BUILD_QNN=ON" + EXTRA_CMAKE_ARGS="${EXTRA_CMAKE_ARGS} -DEXECUTORCH_BUILD_QNN=ON -DQNN_SDK_ROOT=$QNN_SDK_ROOT" fi elif [[ "$PLATFORM" == "macos" ]]; then EXTRA_CMAKE_ARGS="-DEXECUTORCH_BUILD_COREML=ON -DCMAKE_OSX_ARCHITECTURES=${ARCH}" elif [[ "$PLATFORM" == "linux" ]] && [[ "$ARCH" == "aarch64" ]]; then EXTRA_CMAKE_ARGS="-DCMAKE_TOOLCHAIN_FILE=../cmake/aarch64-linux-gnu.gcc.toolchain.cmake" fi + if [[ "$ARCH" == "aarch64" ]]; then + EXTRA_CMAKE_ARGS="$EXTRA_CMAKE_ARGS -DEXECUTORCH_XNNPACK_ENABLE_KLEIDI=ON" + fi cmake \ -S . \ -B cmake-out \ + -DCMAKE_BUILD_TYPE=Release \ -DCMAKE_INSTALL_PREFIX=cmake-out \ - -DEXECUTORCH_BUILD_XNNPACK=ON \ + -DEXECUTORCH_ENABLE_LOGGING=ON \ -DEXECUTORCH_BUILD_EXTENSION_DATA_LOADER=ON \ -DEXECUTORCH_BUILD_EXTENSION_MODULE=ON \ -DEXECUTORCH_BUILD_KERNELS_CUSTOM=ON \ -DEXECUTORCH_BUILD_KERNELS_QUANTIZED=ON \ -DEXECUTORCH_BUILD_KERNELS_OPTIMIZED=ON \ -DEXECUTORCH_BUILD_EXTENSION_TENSOR=ON \ - -DQNN_SDK_ROOT=$QNN_SDK_ROOT \ + -DEXECUTORCH_BUILD_PTHREADPOOL=ON \ -DEXECUTORCH_BUILD_CPUINFO=ON \ -DEXECUTORCH_BUILD_XNNPACK=ON \ - -DEXECUTORCH_BUILD_PTHREADPOOL=ON \ - -DEXECUTORCH_BUILD_SDK=ON \ - -DEXECUTORCH_ENABLE_LOGGING=ON \ + -DEXECUTORCH_XNNPACK_SHARED_WORKSPACE=ON \ $EXTRA_CMAKE_ARGS cmake --build cmake-out --target install --config Release -j$(nproc) fi diff --git a/build.rs b/build.rs index 00ffea3..3f242a2 100644 --- a/build.rs +++ b/build.rs @@ -115,7 +115,8 @@ fn main() { // XNNPACK if link_lib(&lib_path, "xnnpack_backend", true).is_ok() { assert!(link_lib(&lib_path, "XNNPACK", false).is_ok()); - let _ = link_lib(&lib_path, "microkernels-prod", false); + assert!(link_lib(&lib_path, "microkernels-prod", false).is_ok()); + let _ = link_lib(&lib_path, "kleidiai", false); } // Vulkan diff --git a/cmake/mingw-w64-aarch64.clang.toolchain.cmake b/cmake/mingw-w64-aarch64.clang.toolchain.cmake index bb20bcd..94ad13c 100644 --- a/cmake/mingw-w64-aarch64.clang.toolchain.cmake +++ b/cmake/mingw-w64-aarch64.clang.toolchain.cmake @@ -9,9 +9,7 @@ set(CMAKE_RANLIB aarch64-w64-mingw32-ranlib) set(CMAKE_STRIP aarch64-w64-mingw32-strip) set(CMAKE_LINKER aarch64-w64-mingw32-ld) -set(CMAKE_C_FLAGS "-march=armv8.4-a") -set(CMAKE_CXX_FLAGS "-march=armv8.4-a") +set(arch_c_flags "-march=armv8.7-a") -# cache flags -set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS}" CACHE STRING "c flags") -set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}" CACHE STRING "c++ flags") +set( CMAKE_C_FLAGS_INIT "${arch_c_flags}" ) +set( CMAKE_CXX_FLAGS_INIT "${arch_c_flags}" )