diff --git a/cmake/features.cmake b/cmake/features.cmake index ea70019396c..5d0102ba63f 100644 --- a/cmake/features.cmake +++ b/cmake/features.cmake @@ -8,6 +8,8 @@ ie_dependent_option (ENABLE_INTEL_CPU "CPU plugin for OpenVINO Runtime" ON "RISCV64 OR X86 OR X86_64 OR AARCH64" OFF) +ie_dependent_option (ENABLE_ARM_COMPUTE_CMAKE "Enable ARM Compute build via cmake" OFF "ENABLE_INTEL_CPU" OFF) + ie_option (ENABLE_TESTS "unit, behavior and functional tests" OFF) ie_option (ENABLE_COMPILE_TOOL "Enables compile_tool" ON) diff --git a/src/plugins/intel_cpu/thirdparty/CMakeLists.txt b/src/plugins/intel_cpu/thirdparty/CMakeLists.txt index 87a8255f860..7a74a207fbc 100644 --- a/src/plugins/intel_cpu/thirdparty/CMakeLists.txt +++ b/src/plugins/intel_cpu/thirdparty/CMakeLists.txt @@ -142,7 +142,11 @@ function(ie_add_onednn) list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}") add_subdirectory(onednn EXCLUDE_FROM_ALL) + ov_install_static_lib(dnnl cpu) + if(ARM OR AARCH64) + ov_install_static_lib(arm_compute_core cpu) + endif() endfunction() if(ENABLE_INTEL_CPU) diff --git a/src/plugins/intel_cpu/thirdparty/FindACL.cmake b/src/plugins/intel_cpu/thirdparty/FindACL.cmake index a989bf32dee..dfcaed51341 100644 --- a/src/plugins/intel_cpu/thirdparty/FindACL.cmake +++ b/src/plugins/intel_cpu/thirdparty/FindACL.cmake @@ -27,9 +27,50 @@ if(ARM_COMPUTE_INCLUDE_DIR OR ARM_COMPUTE_LIB_DIR) add_library(half INTERFACE IMPORTED GLOBAL) set_target_properties(half PROPERTIES INTERFACE_INCLUDE_DIRECTORIES ${ARM_COMPUTE_INCLUDE_DIR}) +elseif(ENABLE_ARM_COMPUTE_CMAKE) + set(ARM_COMPUTE_SOURCE_DIR "${intel_cpu_thirdparty_SOURCE_DIR}/ComputeLibrary") + set(ARM_COMPUTE_BINARY_DIR "${intel_cpu_thirdparty_BINARY_DIR}/ComputeLibrary") + + function(ov_build_compute_library) + # build ComputeLibrary as static libraries + set(BUILD_SHARED_LIBS OFF) + # ComputeLibrary settings + set(ARM_COMPUTE_GRAPH_ENABLED OFF CACHE BOOL "" FORCE) + # disable OpenMP + set(OPENMP OFF CACHE BOOL "" FORCE) + # and use std::threads instead + set(CPPTHREADS OFF CACHE BOOL "" FORCE) + # SVE is not supported on Darwin + if(CMAKE_HOST_APPLE) + set(ENABLE_SVE OFF CACHE BOOL "" FORCE) + set(ARM_COMPUTE_ENABLE_SVE OFF CACHE BOOL "" FORCE) + set(ARM_COMPUTE_ENABLE_SVEF32MM OFF CACHE BOOL "" FORCE) + endif() + + add_subdirectory(${ARM_COMPUTE_SOURCE_DIR} ${ARM_COMPUTE_BINARY_DIR} EXCLUDE_FROM_ALL) + + add_library(ArmCompute::Half INTERFACE IMPORTED GLOBAL) + set_target_properties(ArmCompute::Half PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES "${ARM_COMPUTE_SOURCE_DIR}/include") + endfunction() + + ov_build_compute_library() + + # Helpers for oneDNN intergation + + set(ACL_FOUND ON) + set(ACL_LIBRARIES arm_compute_core ArmCompute::Half) + + foreach(acl_library IN LISTS ACL_LIBRARIES) + list(APPEND ACL_INCLUDE_DIRS + $) + endforeach() + + # required by oneDNN to attempt to parse ACL version + set(ENV{ACL_ROOT_DIR} "${ARM_COMPUTE_SOURCE_DIR}") else() - set(ARM_COMPUTE_SOURCE_DIR ${intel_cpu_thirdparty_SOURCE_DIR}/ComputeLibrary) - set(ARM_COMPUTE_BINARY_DIR ${intel_cpu_thirdparty_BINARY_DIR}/ComputeLibrary) + set(ARM_COMPUTE_SOURCE_DIR "${intel_cpu_thirdparty_SOURCE_DIR}/ComputeLibrary") + set(ARM_COMPUTE_BINARY_DIR "${intel_cpu_thirdparty_BINARY_DIR}/ComputeLibrary") message(STATUS "Configure to build ${ARM_COMPUTE_SOURCE_DIR}") @@ -272,6 +313,8 @@ else() set_target_properties(arm_compute::arm_compute PROPERTIES INTERFACE_LINK_LIBRARIES Threads::Threads) + # Helpers for oneDNN intergation + set(ACL_FOUND ON) set(ACL_LIBRARIES arm_compute::arm_compute arm_compute::half)