Used cmake interface in ARM compute (#16929)

This commit is contained in:
Ilya Lavrenov 2023-04-13 22:35:03 +04:00 committed by GitHub
parent 6aeb054e48
commit 85f9d1392c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 51 additions and 2 deletions

View File

@ -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_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_TESTS "unit, behavior and functional tests" OFF)
ie_option (ENABLE_COMPILE_TOOL "Enables compile_tool" ON) ie_option (ENABLE_COMPILE_TOOL "Enables compile_tool" ON)

View File

@ -142,7 +142,11 @@ function(ie_add_onednn)
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}") list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}")
add_subdirectory(onednn EXCLUDE_FROM_ALL) add_subdirectory(onednn EXCLUDE_FROM_ALL)
ov_install_static_lib(dnnl cpu) ov_install_static_lib(dnnl cpu)
if(ARM OR AARCH64)
ov_install_static_lib(arm_compute_core cpu)
endif()
endfunction() endfunction()
if(ENABLE_INTEL_CPU) if(ENABLE_INTEL_CPU)

View File

@ -27,9 +27,50 @@ if(ARM_COMPUTE_INCLUDE_DIR OR ARM_COMPUTE_LIB_DIR)
add_library(half INTERFACE IMPORTED GLOBAL) add_library(half INTERFACE IMPORTED GLOBAL)
set_target_properties(half PROPERTIES set_target_properties(half PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES ${ARM_COMPUTE_INCLUDE_DIR}) 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
$<TARGET_PROPERTY:${acl_library},INTERFACE_INCLUDE_DIRECTORIES>)
endforeach()
# required by oneDNN to attempt to parse ACL version
set(ENV{ACL_ROOT_DIR} "${ARM_COMPUTE_SOURCE_DIR}")
else() else()
set(ARM_COMPUTE_SOURCE_DIR ${intel_cpu_thirdparty_SOURCE_DIR}/ComputeLibrary) 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_BINARY_DIR "${intel_cpu_thirdparty_BINARY_DIR}/ComputeLibrary")
message(STATUS "Configure to build ${ARM_COMPUTE_SOURCE_DIR}") message(STATUS "Configure to build ${ARM_COMPUTE_SOURCE_DIR}")
@ -272,6 +313,8 @@ else()
set_target_properties(arm_compute::arm_compute PROPERTIES set_target_properties(arm_compute::arm_compute PROPERTIES
INTERFACE_LINK_LIBRARIES Threads::Threads) INTERFACE_LINK_LIBRARIES Threads::Threads)
# Helpers for oneDNN intergation
set(ACL_FOUND ON) set(ACL_FOUND ON)
set(ACL_LIBRARIES arm_compute::arm_compute arm_compute::half) set(ACL_LIBRARIES arm_compute::arm_compute arm_compute::half)