Skip to content

Commit

Permalink
Enabled compilation with ACL from Conan
Browse files Browse the repository at this point in the history
  • Loading branch information
ilya-lavrenov committed Sep 19, 2023
1 parent b3ee795 commit ededc8b
Show file tree
Hide file tree
Showing 7 changed files with 59 additions and 6 deletions.
20 changes: 19 additions & 1 deletion .ci/azure/linux_arm64.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,14 @@ pr:
- 'tools/*'
- 'tests/layer_tests/*'

resources:
repositories:
- repository: conan-center-index
type: github
endpoint: uilianries
name: uilianries/conan-center-index
ref: package/compute-library

variables:
- group: github

Expand All @@ -54,6 +62,7 @@ jobs:
WORK_DIR: $(Pipeline.Workspace)/_w
SHARE_DIR: /mount/cinfsshare/onnxtestdata
TMP_DIR: /mnt/tmp
CONAN_CENTER_INDEX_REPO_DIR: $(REPO_DIR)/../conan-center-index
OPENVINO_CCACHE_DIR: $(SHARE_DIR)/ccache/master/linux_arm64
LD_LIBRARY_PATH: $(Agent.ToolsDirectory)/Python/$(OV_PYTHON_VERSION)/x64/lib
OV_PYTHON_VERSION_MAJOR_MINOR: 3.11
Expand Down Expand Up @@ -111,6 +120,11 @@ jobs:
clean: 'true'
path: openvino

- checkout: conan-center-index
clean: 'true'
submodules: 'true'
path: conan-center-index

- script: |
set -e
python3 -m pip install --upgrade pip
Expand Down Expand Up @@ -148,7 +162,9 @@ jobs:
- script: |
set -e
git submodule update --init -- $(OPENVINO_REPO_DIR)/src/plugins
git submodule update --init -- $(OPENVINO_REPO_DIR)/src/plugins/intel_gpu
git submodule update --init -- $(OPENVINO_REPO_DIR)/src/plugins/intel_cpu/thirdparty/mlas
git submodule update --init -- $(OPENVINO_REPO_DIR)/src/plugins/intel_cpu/thirdparty/onednn
git submodule update --init -- $(OPENVINO_REPO_DIR)/thirdparty/gtest
git submodule update --init -- $(OPENVINO_REPO_DIR)/thirdparty/open_model_zoo
displayName: 'Init submodules for non Conan dependencies'
Expand All @@ -165,6 +181,8 @@ jobs:
echo "[buildenv]" >> $(BUILD_OPENVINO)/linux_arm64
echo "CC=aarch64-linux-gnu-gcc-10" >> $(BUILD_OPENVINO)/linux_arm64
echo "CXX=aarch64-linux-gnu-g++-10" >> $(BUILD_OPENVINO)/linux_arm64
# install ARM Compute explicitly
conan create $CONAN_CENTER_INDEX_REPO_DIR/recipes/compute_library/all --version 23.08 -b missing
# install OpenVINO dependencies
conan install $(OPENVINO_REPO_DIR)/conanfile.txt \
-pr:h $(BUILD_OPENVINO)/linux_arm64 \
Expand Down
2 changes: 2 additions & 0 deletions conan.lock
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,12 @@
"hwloc/2.9.2#1c63e2eccac57048ae226e6c946ebf0e%1688677682.002",
"gflags/2.2.2#48d1262ffac8d30c3224befb8275a533%1676224985.343",
"flatbuffers/23.5.26#b153646f6546daab4c7326970b6cd89c%1685838458.449",
"compute_library/23.08#6942370724cbbaf7848925eef9ffdf0c%1695152537.14029",
"ade/0.1.2c#8c03c130df6dc35186b38ba73a40a71d%1694253992.577"
],
"build_requires": [
"zlib/1.2.13#97d5730b529b4224045fe7090592d4c1%1692672717.049",
"scons/4.3.0#3476cd7ed0d4f2913159fb38dd8d8b7d%1687272946.0",
"protobuf/3.21.12#d9f5f4e3b86552552dda4c0a2e928eeb%1685218275.69",
"protobuf/3.21.9#515ceb0a1653cf84363d9968b812d6be%1678364058.993",
"pkgconf/1.9.5#743ca0d41d35a84b1f89af337ddaa1a0%1688570267.802",
Expand Down
1 change: 1 addition & 0 deletions conanfile.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ onnx/1.14.1
nlohmann_json/[>=3.1.1]
pybind11/[>=2.10.1]
flatbuffers/[>=22.9.24]
compute_library/23.08

[tool_requires]
cmake/[>=3.20]
Expand Down
8 changes: 7 additions & 1 deletion src/plugins/intel_cpu/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ else()
endif()
ie_option(ENABLE_MLAS_FOR_CPU "Enable MLAS for OpenVINO CPU Plugin" ${ENABLE_MLAS_FOR_CPU_DEFAULT})

set(OV_CPU_WITH_DNNL ON)

add_subdirectory(thirdparty)

if(WIN32)
Expand All @@ -56,7 +58,6 @@ if(ENABLE_CPU_DEBUG_CAPS)
add_definitions(-DCPU_DEBUG_CAPS)
endif()

set(OV_CPU_WITH_DNNL ON)
if(OV_CPU_WITH_DNNL)
add_definitions(-DOV_CPU_WITH_DNNL)
endif()
Expand Down Expand Up @@ -128,6 +129,7 @@ if (ENABLE_MLAS_FOR_CPU)
add_definitions(-DOV_CPU_WITH_MLAS)
endif()
target_include_directories(${TARGET_NAME} SYSTEM PRIVATE $<TARGET_PROPERTY:dnnl,INCLUDE_DIRECTORIES>)

# Cross compiled function
# TODO: The same for proposal, proposalONNX, topk
cross_compiled_file(${TARGET_NAME}
Expand All @@ -140,6 +142,10 @@ cross_compiled_file(${TARGET_NAME}

# system dependencies must go last
target_link_libraries(${TARGET_NAME} PRIVATE openvino::pugixml)
if(OV_CPU_WITH_ACL)
target_link_libraries(${TARGET_NAME} PRIVATE arm_compute::arm_compute)
endif()

ov_set_threading_interface_for(${TARGET_NAME})

# must be called after all target_link_libraries
Expand Down
22 changes: 21 additions & 1 deletion src/plugins/intel_cpu/thirdparty/ACLConfig.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,27 @@
# SPDX-License-Identifier: Apache-2.0
#

if(ARM_COMPUTE_INCLUDE_DIR OR ARM_COMPUTE_LIB_DIR)
# conan has a recipe 'compute_library'
find_package(compute_library QUIET CONFIG)

if(compute_library_FOUND)
if(NOT TARGET arm_compute)
add_library(arm_compute INTERFACE)
add_library(arm_compute::arm_compute ALIAS arm_compute)
target_link_libraries(arm_compute INTERFACE compute_library::compute_library)
endif()

# for oneDNN integration
set(ACL_FOUND ON)
set(ACL_LIBRARIES arm_compute::arm_compute)

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 dummy folder
set(ENV{ACL_ROOT_DIR} "${CMAKE_CURRENT_SOURCE_DIR}")
elseif(ARM_COMPUTE_INCLUDE_DIR OR ARM_COMPUTE_LIB_DIR)
set(ARM_COMPUTE_INCLUDE_DIR "" CACHE PATH "Path to ARM Compute Library headers" FORCE)

if(NOT ARM_COMPUTE_LIB_DIR)
Expand Down
10 changes: 8 additions & 2 deletions src/plugins/intel_cpu/thirdparty/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,10 @@ function(ov_add_onednn)

# install static libraries
ov_install_static_lib(dnnl ${OV_CPACK_COMP_CORE})
if(TARGET arm_compute)
# interface target which links with conan's arm_compute::arm_compute
ov_install_static_lib(arm_compute ${OV_CPACK_COMP_CORE})
endif()

if(DNNL_USE_ACL AND NOT BUILD_SHARED_LIBS)
# use ACLConfig.cmake in OpenVINOConfig.cmake in case of static build
Expand All @@ -132,9 +136,11 @@ function(ov_add_onednn)
endif()
endfunction()

if(OV_CPU_WITH_DNNL)
ov_add_onednn()
endif()

if(ENABLE_MLAS_FOR_CPU)
add_subdirectory(mlas)
ov_install_static_lib(mlas ${OV_CPACK_COMP_CORE})
endif()

ov_add_onednn()
2 changes: 1 addition & 1 deletion src/plugins/intel_cpu/thirdparty/onednn
Submodule onednn updated 1 files
+6 −1 src/cpu/platform.cpp

0 comments on commit ededc8b

Please sign in to comment.