Skip to content

Commit

Permalink
Amend npu build option
Browse files Browse the repository at this point in the history
Create CMake variables for XRT_NPU and XRT_ALVEO in place of NPU and
XRT_DKMS_ALVEO.  Modify CMake files accordingly.

Fix CMake file for CPack to create component specific package for
single component project.  This will be used for NPU builds where
ultimately all but the default npu package will be disabled.

Signed-off-by: Soren Soe <[email protected]>
  • Loading branch information
stsoe committed Nov 23, 2024
1 parent df6db61 commit ec61109
Show file tree
Hide file tree
Showing 8 changed files with 36 additions and 24 deletions.
9 changes: 6 additions & 3 deletions build/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ usage()
echo "[-noert] Do not treat missing ERT FW as a build error"
echo "[-noinit] Do not initialize Git submodules"
echo "[-noctest] Skip unit tests"
echo "[-npu] Build for NPU only. Disable bundling of Alveo Linux drivers. Do not treat missing ERT FW as a build error. Compile XDP plugins for NPU."
echo "[-npu] Build for NPU only, implies -noert and disables bundling of Alveo Linux drivers"
echo "[-with-static-boost <boost> Build binaries using static linking of boost from specified boost install"
echo "[-clangtidy] Run clang-tidy as part of build"
echo "[-pskernel] Enable building of POC ps kernel"
Expand Down Expand Up @@ -160,7 +160,7 @@ while [ $# -gt 0 ]; do
alveo=0
noert=1
cmake_flags+=" -DXDP_CLIENT_BUILD_CMAKE=yes"
cmake_flags+=" -DNPU=1"
cmake_flags+=" -DXRT_NPU=1"
;;
-opt)
dbg=0
Expand Down Expand Up @@ -190,6 +190,7 @@ while [ $# -gt 0 ]; do
;;
-ccache)
export CCACHE_DIR=${CCACHE_DIR:-/scratch/ccache/$USER}
mkdir -p $CCACHE_DIR
cmake_flags+=" -DXRT_CCACHE=1"
shift
;;
Expand Down Expand Up @@ -262,8 +263,10 @@ cmake_flags+=" -DXRT_ENABLE_WERROR=$werror"
# set CMAKE_INSTALL_PREFIX
cmake_flags+=" -DCMAKE_INSTALL_PREFIX=$xrt_install_prefix -DXRT_INSTALL_PREFIX=$xrt_install_prefix"

# Set CMake variable indicating build for Alveo
# Specifying '-npu' disables Alveo
if [[ $alveo == 1 ]]; then
cmake_flags+=" -DXRT_DKMS_ALVEO=ON"
cmake_flags+=" -DXRT_ALVEO=1"
fi

here=$PWD
Expand Down
18 changes: 6 additions & 12 deletions src/CMake/cpackLin.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,12 @@ SET(CPACK_ARCHIVE_COMPONENT_INSTALL ON)
SET(CPACK_DEB_COMPONENT_INSTALL ON)
SET(CPACK_RPM_COMPONENT_INSTALL ON)

if (DEFINED NPU)
SET(CPACK_PACKAGE_NAME "npu")
endif()
# For some reason CMake doesn't populate CPACK_COMPONENTS_ALL when the
# project has only one component, this leads to cpack generating
# pacage without component name appended. To work-around this,
# populate the variable explictly.
get_cmake_property(CPACK_COMPONENTS_ALL COMPONENTS)
message("Install components in the project: ${CPACK_COMPONENTS_ALL}")

# When the rpmbuild occurs for packaging, it uses a default version of
# python to perform a python byte compilation. For the CentOS 7.x OS, this
Expand Down Expand Up @@ -209,13 +212,4 @@ SET(CPACK_PACKAGE_CONTACT "[email protected]")
SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Runtime stack for use with AMD platforms")
SET(CPACK_RESOURCE_FILE_LICENSE "${XRT_SOURCE_DIR}/../LICENSE")

add_custom_target(xrtpkg
echo "COMMAND ${CMAKE_CPACK_COMMAND}"
COMMAND ${CMAKE_CPACK_COMMAND}
COMMAND -mv -f ${CPACK_PACKAGE_FILE_NAME}-xrt.deb ${CPACK_PACKAGE_FILE_NAME}.deb 2> /dev/null
COMMAND -mv -f ${CPACK_PACKAGE_FILE_NAME}-xrt.rpm ${CPACK_PACKAGE_FILE_NAME}.rpm 2> /dev/null
COMMAND -mv -f ${CPACK_PACKAGE_FILE_NAME}-xrt.tar.gz ${CPACK_PACKAGE_FILE_NAME}.tar.gz 2> /dev/null

)

INCLUDE(CPack)
2 changes: 1 addition & 1 deletion src/CMake/nativeLnx.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ message("-- XRT version: ${XRT_VERSION_STRING}")
# -- CPack
include (CMake/cpackLin.cmake)

if (XRT_DKMS_ALVEO STREQUAL "ON")
if (XRT_ALVEO)
message("-- XRT Alveo drivers will be bundled with the XRT package")
set (XRT_DKMS_DRIVER_SRC_BASE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/runtime_src/core")
include (CMake/dkms.cmake)
Expand Down
10 changes: 9 additions & 1 deletion src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,21 @@ include(CMake/settings.cmake)
# set to something different then a development component will be created with
# link libraries and header which are then excluded from runtime component
set (CMAKE_INSTALL_DEFAULT_COMPONENT_NAME "xrt")

# Enable development package by specifying development component name
# If XRT_DEV_COMPONENT is same DEFAULT_COMPONENT then only that package
# is created with both development and run-time content.
#set (XRT_DEV_COMPONENT "xrt-dev")
set (XRT_COMPONENT "xrt")
set (XRT_DEV_COMPONENT "xrt")

# For NPU builds the defalt component is "npu".
if (XRT_NPU)
set (CMAKE_INSTALL_DEFAULT_COMPONENT_NAME "npu")
set (XRT_COMPONENT "npu")
set (XRT_DEV_COMPONENT "npu")
endif(XRT_NPU)

set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${XRT_SOURCE_DIR}/CMake/")

# This makes aiebu submodule use ELFIO from XRT
Expand Down
3 changes: 2 additions & 1 deletion src/runtime_src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ xrt_add_subdirectory(tools/xclbinutil)
xrt_add_subdirectory(xocl)
xrt_add_subdirectory(xrt)

if (XRT_DKMS_ALVEO STREQUAL "ON")
if (XRT_ALVEO)
# Enable building of ERT firmware for Alveo
xrt_add_subdirectory(ert)
endif()

Expand Down
6 changes: 5 additions & 1 deletion src/runtime_src/core/pcie/tools/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,9 @@
#
if(NOT WIN32)
add_subdirectory(cloud-daemon)
add_subdirectory(xbflash.qspi)

if(XRT_ALVEO)
add_subdirectory(xbflash.qspi)
endif(XRT_ALVEO)

endif(NOT WIN32)
10 changes: 6 additions & 4 deletions src/runtime_src/core/pcie/tools/cloud-daemon/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,9 @@ install (FILES ${XRT_HEADER_SRC}
DESTINATION ${XRT_INSTALL_INCLUDE_DIR}
COMPONENT ${XRT_DEV_COMPONENT}
)

add_subdirectory(aws)
add_subdirectory(azure)
add_subdirectory(container)

if (XRT_ALVEO)
add_subdirectory(aws)
add_subdirectory(azure)
add_subdirectory(container)
endif()
2 changes: 1 addition & 1 deletion src/runtime_src/core/tools/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ if (${XRT_NATIVE_BUILD} STREQUAL "yes")
xrt_add_subdirectory(xbmgmt2)
if(NOT WIN32)
xrt_add_subdirectory(xbtop)
if (XRT_DKMS_ALVEO STREQUAL "ON")
if (XRT_ALVEO)
xrt_add_subdirectory(xbflash2)
endif()
xrt_add_subdirectory(nagios)
Expand Down

0 comments on commit ec61109

Please sign in to comment.