summaryrefslogtreecommitdiffstats
path: root/cmake/modules/Builduadk.cmake
diff options
context:
space:
mode:
authorRongqi Sun <sunrongqi@huawei.com>2024-06-28 09:39:33 +0200
committerRongqi Sun <sunrongqi@huawei.com>2024-08-12 12:10:00 +0200
commit317465c07b348d3b9c91f0295ae9db29fa4dddf6 (patch)
treebef68b3518d4e848314750492d6e9028c0828320 /cmake/modules/Builduadk.cmake
parentMerge pull request #58883 from idryomov/wip-backport-create-resourceattrerror (diff)
downloadceph-317465c07b348d3b9c91f0295ae9db29fa4dddf6.tar.xz
ceph-317465c07b348d3b9c91f0295ae9db29fa4dddf6.zip
uadk: add uadk support
This patch add UADK Acceleration for zlib compressor [UADK: Userspace Acceleration Development Kit](https://github.com/Linaro/uadk) 1. Unity: one set of interfaces to support enc and comp acceleration 2. Efficiency: userspace zerocopy based on IOMMU & SVA(shared virtual address) 3. Security: the IOMMU limits the access rights and security boundaries of devices and processes 4. Compatibility: all acc devices can join this opensource project Test on Kunpeng 920 platform, compression offload based on UadkAccel: 1. save almost 50% cpu usage compared with no-isal compression in RBD 4M workload 2. save almost 40% cpu usage compared with no-isal compression in RGW put op (4M) workload 3. lower cpu usage, better performance Signed-off-by: Rongqi Sun <sunrongqi@huawei.com>
Diffstat (limited to 'cmake/modules/Builduadk.cmake')
-rw-r--r--cmake/modules/Builduadk.cmake53
1 files changed, 53 insertions, 0 deletions
diff --git a/cmake/modules/Builduadk.cmake b/cmake/modules/Builduadk.cmake
new file mode 100644
index 00000000000..e3b11f32aaf
--- /dev/null
+++ b/cmake/modules/Builduadk.cmake
@@ -0,0 +1,53 @@
+function(build_uadk)
+ set(UADK_INSTALL_DIR ${CMAKE_BINARY_DIR}/src/uadk/install)
+ set(UADK_INCLUDE_DIR ${UADK_INSTALL_DIR}/include)
+ set(UADK_LIBRARY_DIR ${UADK_INSTALL_DIR}/lib)
+ set(UADK_WD_LIBRARY ${UADK_LIBRARY_DIR}/libwd.a)
+ set(UADK_WD_COMP_LIBRARY ${UADK_LIBRARY_DIR}/libwd_comp.a)
+ set(UADK_WD_ZIP_LIBRARY ${UADK_LIBRARY_DIR}/uadk/libhisi_zip.a)
+ set(configure_cmd env ./configure --prefix=${UADK_INSTALL_DIR})
+ list(APPEND configure_cmd --with-pic --enable-static --disable-shared --with-static_drv)
+
+ include(ExternalProject)
+ ExternalProject_Add(uadk_ext
+ UPDATE_COMMAND "" # this disables rebuild on each run
+ GIT_REPOSITORY "https://github.com/Linaro/uadk.git"
+ GIT_CONFIG advice.detachedHead=false
+ GIT_SHALLOW 1
+ GIT_TAG "master"
+ SOURCE_DIR "${PROJECT_SOURCE_DIR}/src/uadk"
+ BUILD_IN_SOURCE 1
+ CMAKE_ARGS -DCMAKE_CXX_COMPILER=which g++
+ CONFIGURE_COMMAND ./autogen.sh COMMAND ${configure_cmd}
+ BUILD_COMMAND make
+ BUILD_BYPRODUCTS ${UADK_WD_LIBRARY} ${UADK_WD_COMP_LIBRARY} ${UADK_WD_ZIP_LIBRARY}
+ INSTALL_COMMAND make install
+ LOG_CONFIGURE ON
+ LOG_BUILD ON
+ LOG_INSTALL ON
+ LOG_MERGED_STDOUTERR ON
+ LOG_OUTPUT_ON_FAILURE ON)
+
+ ExternalProject_Get_Property(uadk_ext source_dir)
+ set(UADK_INCLUDE_DIR ${UADK_INCLUDE_DIR} PARENT_SCOPE)
+
+ add_library(uadk::uadk UNKNOWN IMPORTED)
+ add_library(uadk::uadkwd UNKNOWN IMPORTED)
+ add_library(uadk::uadkzip UNKNOWN IMPORTED)
+ add_dependencies(uadk::uadk uadk_ext)
+ add_dependencies(uadk::uadkwd uadk_ext)
+ add_dependencies(uadk::uadkzip uadk_ext)
+ file(MAKE_DIRECTORY ${UADK_INCLUDE_DIR})
+ set_target_properties(uadk::uadk PROPERTIES
+ INTERFACE_INCLUDE_DIRECTORIES ${UADK_INCLUDE_DIR}
+ IMPORTED_LINK_INTERFACE_LANGUAGES "C"
+ IMPORTED_LOCATION "${UADK_WD_COMP_LIBRARY}")
+ set_target_properties(uadk::uadkwd PROPERTIES
+ INTERFACE_INCLUDE_DIRECTORIES ${UADK_INCLUDE_DIR}
+ IMPORTED_LINK_INTERFACE_LANGUAGES "C"
+ IMPORTED_LOCATION "${UADK_WD_LIBRARY}")
+ set_target_properties(uadk::uadkzip PROPERTIES
+ INTERFACE_INCLUDE_DIRECTORIES ${UADK_INCLUDE_DIR}
+ IMPORTED_LINK_INTERFACE_LANGUAGES "C"
+ IMPORTED_LOCATION "${UADK_WD_ZIP_LIBRARY}")
+endfunction()