ceph/cmake/modules/Builduadk.cmake
Rongqi Sun 317465c07b 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>
2024-08-12 18:10:00 +08:00

54 lines
2.3 KiB
CMake

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()