Skip to content

Commit 74e32d9

Browse files
authored
NPU Driver 1.8.0 release unified 2024WW36 (#49)
Signed-off-by: Wludzik, Jozef <[email protected]> Co-authored-by: Schulfer, Magdalena <[email protected]> Co-authored-by: Pawlak, Jakub [email protected] Co-authored-by: Pradzynski, Krystian [email protected] Co-authored-by: Tabaka, Mateusz [email protected]
1 parent 885b648 commit 74e32d9

File tree

112 files changed

+2325
-1802
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

112 files changed

+2325
-1802
lines changed

CMakeLists.txt

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ if (${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.24")
1010
cmake_policy(SET CMP0135 NEW)
1111
endif()
1212

13-
set(STACK_VERSION 1.6.0 CACHE STRING "Main project version")
13+
set(STACK_VERSION 1.8.0 CACHE STRING "Main project version")
1414
project(npu-linux-driver VERSION ${STACK_VERSION})
1515

1616
set(BUILD_NUMBER "dev-0" CACHE STRING "Build number composed of name and unique number used as driver version")
@@ -34,12 +34,11 @@ set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
3434

3535
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
3636

37-
option(ENABLE_OPENVINO_PACKAGE "Enable building the OpenVINO + VPUX Plugin package" OFF)
38-
option(ENABLE_VPUX_COMPILER_BUILD "Enable building compiler in driver" OFF)
39-
option(ENABLE_VPUX_COMPILER_CACHE "Enable downloading compiler in driver" ON)
37+
option(ENABLE_OPENVINO_PACKAGE "Enable building the OpenVINO + NPU Plugin package" OFF)
38+
option(ENABLE_NPU_COMPILER_BUILD "Enable building compiler in driver" OFF)
4039

4140
message(STATUS "option ENABLE_OPENVINO_PACKAGE: ${ENABLE_OPENVINO_PACKAGE}")
42-
message(STATUS "option ENABLE_VPUX_COMPILER_BUILD: ${ENABLE_VPUX_COMPILER_BUILD}")
41+
message(STATUS "option ENABLE_NPU_COMPILER_BUILD: ${ENABLE_NPU_COMPILER_BUILD}")
4342

4443
include(GNUInstallDirs)
4544

@@ -53,7 +52,7 @@ add_subdirectory(third_party)
5352
add_subdirectory(umd)
5453
add_subdirectory(validation)
5554

56-
include(cmake/packages.cmake)
55+
include(cmake/packaging/setup.cmake)
5756

5857
# You may your custom commands in .local.cmake, i.e. driver compilation, running tests.
5958
include(${CMAKE_CURRENT_SOURCE_DIR}/.local.cmake OPTIONAL)

cmake/compiler_flags.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ add_compile_options(
2525
-fdebug-prefix-map=${CMAKE_SOURCE_DIR}=.
2626
)
2727

28-
if(NOT ${LINUX_SYSTEM_NAME} STREQUAL "cros sdk")
28+
if(NOT ${LINUX_SYSTEM_NAME} STREQUAL "cros_sdk")
2929
add_compile_options(
3030
# Enable macro security features
3131
-D_FORTIFY_SOURCE=2

cmake/detect_linux_system.cmake

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright 2022-2023 Intel Corporation.
1+
# Copyright 2022-2024 Intel Corporation.
22
#
33
# This software and the related documents are Intel copyrighted materials, and
44
# your use of them is governed by the express license under which they were
@@ -29,5 +29,5 @@ function(read_os_release ENTRY VAR_OUTPUT)
2929
set(${VAR_OUTPUT} ${OUTPUT} PARENT_SCOPE)
3030
endfunction()
3131

32-
read_os_release(NAME LINUX_SYSTEM_NAME)
32+
read_os_release(ID LINUX_SYSTEM_NAME)
3333
read_os_release(VERSION_ID LINUX_SYSTEM_VERSION_ID)

cmake/packages.cmake

Lines changed: 0 additions & 84 deletions
This file was deleted.
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
#
2+
# Copyright (C) 2024 Intel Corporation
3+
#
4+
# SPDX-License-Identifier: MIT
5+
6+
find_program(DPKG_EXECUTABLE dpkg REQUIRED)
7+
8+
include(${CPACK_PROJECT_CONFIG_FILE})
9+
10+
set(CPACK_GENERATOR DEB)
11+
12+
# Create package per component
13+
set(CPACK_DEB_COMPONENT_INSTALL ON)
14+
15+
# Enable detection of component dependencies
16+
set(CPACK_DEBIAN_PACKAGE_SHLIBDEPS ON)
17+
list(APPEND SHLIBDEPS_PRIVATE_DIRS ${CMAKE_LIBRARY_OUTPUT_DIRECTORY})
18+
list(APPEND SHLIBDEPS_PRIVATE_DIRS ${OPENVINO_LIBRARY_DIR})
19+
list(APPEND SHLIBDEPS_PRIVATE_DIRS ${OPENCV_LIBRARY_DIR})
20+
set(CPACK_DEBIAN_PACKAGE_SHLIBDEPS_PRIVATE_DIRS ${SHLIBDEPS_PRIVATE_DIRS})
21+
22+
# Component conflicts
23+
set(CPACK_DEBIAN_LEVEL-ZERO_PACKAGE_CONFLICTS "level-zero, level-zero-devel")
24+
25+
# Get Debian architecture
26+
execute_process(
27+
COMMAND ${DPKG_EXECUTABLE} --print-architecture
28+
OUTPUT_VARIABLE OUT_DPKG_ARCH
29+
OUTPUT_STRIP_TRAILING_WHITESPACE
30+
COMMAND_ERROR_IS_FATAL ANY)
31+
32+
set(PACKAGE_POSTFIX_NAME ${CPACK_PACKAGE_VERSION}_${LINUX_SYSTEM_NAME}${LINUX_SYSTEM_VERSION_ID}_${OUT_DPKG_ARCH}.deb)
33+
foreach(COMPONENT ${CPACK_COMPONENTS_ALL})
34+
string(TOUPPER ${COMPONENT} COMPONENT_UPPER)
35+
set(CPACK_DEBIAN_${COMPONENT_UPPER}_FILE_NAME ${CPACK_PACKAGE_NAME}-${COMPONENT}_${PACKAGE_POSTFIX_NAME})
36+
if (${COMPONENT_UPPER}_POSTINST)
37+
list(APPEND CPACK_DEBIAN_${COMPONENT_UPPER}_PACKAGE_CONTROL_EXTRA ${${COMPONENT_UPPER}_POSTINST})
38+
endif()
39+
if (${COMPONENT_UPPER}_PRERM)
40+
list(APPEND CPACK_DEBIAN_${COMPONENT_UPPER}_PACKAGE_CONTROL_EXTRA ${${COMPONENT_UPPER}_PRERM})
41+
endif()
42+
if (${COMPONENT_UPPER}_POSTRM)
43+
list(APPEND CPACK_DEBIAN_${COMPONENT_UPPER}_PACKAGE_CONTROL_EXTRA ${${COMPONENT_UPPER}_POSTRM})
44+
endif()
45+
if (${COMPONENT_UPPER}_DEPENDS)
46+
set(CPACK_DEBIAN_${COMPONENT_UPPER}_PACKAGE_DEPENDS ${${COMPONENT_UPPER}_DEPENDS})
47+
endif()
48+
endforeach()
49+
50+
set(CPACK_DEBIAN_DEBUGINFO_PACKAGE OFF)
51+
set(CPACK_DEBIAN_LEVEL-ZERO_DEBUGINFO_PACKAGE ON)
52+
set(CPACK_DEBIAN_LEVEL-ZERO-NPU_DEBUGINFO_PACKAGE ON)
53+
set(CPACK_DEBIAN_DRIVER-COMPILER-NPU_DEBUGINFO_PACKAGE ON)
54+
set(CPACK_DEBIAN_VALIDATION-NPU_DEBUGINFO_PACKAGE ON)
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#
2+
# Copyright (C) 2024 Intel Corporation
3+
#
4+
# SPDX-License-Identifier: MIT
5+
6+
7+
find_program(EBUILD_EXECUTABLE ebuild REQUIRED)
8+
9+
set(CPACK_GENERATOR External)
10+
set(CPACK_SET_DESTDIR ON)
11+
set(CPACK_EXTERNAL_ENABLE_STAGING ON)
12+
set(CPACK_EXTERNAL_PACKAGE_SCRIPT ${CMAKE_CURRENT_LIST_DIR}/ebuild_package_script.cmake)
Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
#
2+
# Copyright (C) 2024 Intel Corporation
3+
#
4+
# SPDX-License-Identifier: MIT
5+
#
6+
7+
8+
function(strip_script SCRIPT_FILENAME OUTPUT_CONTENT)
9+
# Remove comments, empty lines or lines like 'set -e..'
10+
execute_process(COMMAND
11+
sh -c "sed -e '/^#/d' -e '/^$/d' -e '/set -/d' ${SCRIPT_FILENAME}"
12+
OUTPUT_VARIABLE TMP_OUTPUT_CONTENT
13+
COMMAND_ERROR_IS_FATAL ANY)
14+
set(${OUTPUT_CONTENT} ${TMP_OUTPUT_CONTENT} PARENT_SCOPE)
15+
endfunction()
16+
17+
18+
find_program(EBUILD_EXECUTABLE ebuild REQUIRED)
19+
20+
string(REPLACE "-" "." PACKAGE_VERSION "${CPACK_PACKAGE_VERSION}")
21+
22+
set(PACKAGES_DESTINATION "${CPACK_PACKAGE_DIRECTORY}/packages")
23+
set(REPO_NAME "intel-npu")
24+
set(CATEGORY_NAME "intel-npu-drivers")
25+
26+
foreach(COMPONENT IN LISTS CPACK_COMPONENTS_ALL)
27+
string(TOUPPER ${COMPONENT} COMPONENT_UPPER)
28+
set(PACKAGE_NAME "${CPACK_PACKAGE_NAME}-${COMPONENT}")
29+
set(PACKAGE_DATA "${CPACK_TEMPORARY_DIRECTORY}/${COMPONENT}")
30+
set(PACKAGE_METADATA_DIR "${CPACK_TEMPORARY_DIRECTORY}/${REPO_NAME}/${CATEGORY_NAME}/${PACKAGE_NAME}")
31+
set(PACKAGE_DESCRIPTION "${CPACK_COMPONENT_${COMPONENT_UPPER}_DESCRIPTION}")
32+
33+
file(MAKE_DIRECTORY "${PACKAGE_METADATA_DIR}")
34+
35+
set(EBUILD_FILE "${PACKAGE_METADATA_DIR}/${PACKAGE_NAME}-${PACKAGE_VERSION}.ebuild")
36+
37+
file(WRITE "${EBUILD_FILE}"
38+
"EAPI=7\n"
39+
"DESCRIPTION=\"${PACKAGE_DESCRIPTION}\"\n"
40+
"SLOT=\"0\"\n"
41+
"KEYWORDS=\"~amd64\"\n"
42+
"S=\"${PACKAGE_DATA}\"\n")
43+
44+
if (${COMPONENT_UPPER}_DEPENDS)
45+
file(APPEND "${EBUILD_FILE}"
46+
"RDEPENDS=\"${${COMPONENT_UPPER}_DEPENDS}\"\n")
47+
endif()
48+
49+
file(APPEND "${EBUILD_FILE}"
50+
"\n"
51+
"src_install() {\n"
52+
" mkdir -p \${D}\n"
53+
" cp -r \${S}/* \${D}\n"
54+
"}\n")
55+
56+
if (${COMPONENT_UPPER}_POSTINST)
57+
strip_script(${${COMPONENT_UPPER}_POSTINST} POSTINST)
58+
file(APPEND "${EBUILD_FILE}"
59+
"\n"
60+
"pkg_postinst() {\n"
61+
"${POSTINST}"
62+
"}\n")
63+
endif()
64+
65+
if (${COMPONENT_UPPER}_PRERM)
66+
strip_script(${${COMPONENT_UPPER}_PRERM} PRERM)
67+
file(APPEND "${EBUILD_FILE}"
68+
"\n"
69+
"pkg_prerm() {\n"
70+
"${PRERM}"
71+
"}\n")
72+
endif()
73+
74+
if (${COMPONENT_UPPER}_POSTRM)
75+
strip_script(${${COMPONENT_UPPER}_POSTRM} POSTRM)
76+
file(APPEND "${EBUILD_FILE}"
77+
"\n"
78+
"pkg_postrm() {\n"
79+
"${POSTRM}"
80+
"}\n")
81+
endif()
82+
83+
# Generate manifest
84+
execute_process(COMMAND
85+
${EBUILD_EXECUTABLE} ${EBUILD_FILE} manifest
86+
COMMAND_ERROR_IS_FATAL ANY)
87+
88+
# Create temporary dir for portage
89+
set(PORTAGE_TMPDIR "${CPACK_TEMPORARY_DIRECTORY}/portage_tmpdir")
90+
file(MAKE_DIRECTORY "${PORTAGE_TMPDIR}")
91+
92+
if (${COMPONENT} IN_LIST EXTERNAL_COMPONENTS)
93+
set(COMPONENT_TYPE "external")
94+
else()
95+
set(COMPONENT_TYPE "internal")
96+
endif()
97+
98+
set(PKGDIR "${PACKAGES_DESTINATION}/${COMPONENT_TYPE}")
99+
file(MAKE_DIRECTORY "${PKGDIR}")
100+
101+
# Create package
102+
set(ENV_VARS "BINPKG_COMPRESS=zstd PORTAGE_USERNAME=$(id -un) PORTAGE_GRPNAME=$(id -gn) PORTAGE_TMPDIR=${PORTAGE_TMPDIR} PKGDIR=${PKGDIR}")
103+
execute_process(COMMAND
104+
sh -c "${ENV_VARS} ${EBUILD_EXECUTABLE} ${EBUILD_FILE} package"
105+
COMMAND_ERROR_IS_FATAL ANY)
106+
endforeach()

cmake/packaging/postinst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
set -e -o pipefail
1616

17-
if lsmod | grep intel_vpu > /dev/null; then
17+
if lsmod | grep intel_vpu > /dev/null && [ -e "$(modinfo -n intel_vpu 2> /dev/null)" ]; then
1818
rmmod intel_vpu
1919
modprobe intel_vpu
2020
fi

cmake/packaging/setup.cmake

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
#
2+
# Copyright (C) 2022-2024 Intel Corporation
3+
#
4+
# SPDX-License-Identifier: MIT
5+
#
6+
7+
8+
if(${CMAKE_VERSION} VERSION_LESS "3.20")
9+
# Using older version stucks on detecting the package dependencies
10+
message(STATUS "CPack Debian in driver is not supported by cmake version less than 3.20.1")
11+
return()
12+
endif()
13+
14+
# Base information
15+
set(CPACK_PACKAGE_NAME "intel")
16+
set(CPACK_PACKAGE_VENDOR "Intel")
17+
set(CPACK_PACKAGE_CONTACT "Intel Corporation")
18+
set(CPACK_PACKAGE_VERSION ${PROJECT_VERSION}.${BUILD_NUMBER})
19+
set(CPACK_PROJECT_CONFIG_FILE ${CMAKE_BINARY_DIR}/CPackProjectConfigFile.cmake)
20+
21+
# Component descriptions
22+
set(CPACK_COMPONENT_DRIVER-COMPILER-NPU_DESCRIPTION "Intel(R) Driver Compiler for NPU hardware\n\
23+
The driver compiler enables compilation of OpenVINO IR models using Level Zero Graph Extension API.")
24+
set(CPACK_COMPONENT_FW-NPU_DESCRIPTION "Intel(R) Firmware package for NPU hardware\n\
25+
Firmware files required by IVPU kernel module.")
26+
set(CPACK_COMPONENT_LEVEL-ZERO-NPU_DESCRIPTION "Intel(R) Level Zero Driver for NPU hardware\n\
27+
Library implements Level Zero API to interract with NPU hardware.")
28+
set(CPACK_COMPONENT_VALIDATION-NPU_DESCRIPTION "Intel(R) Validation applications for NPU\n\
29+
Set of application required for testing of Intel(R) Level Zero Driver for NPU hardware.")
30+
31+
file(WRITE ${CPACK_PROJECT_CONFIG_FILE}
32+
"set(FW-NPU_POSTINST ${CMAKE_CURRENT_LIST_DIR}/postinst)\n"
33+
"set(EXTERNAL_COMPONENTS driver-compiler-npu;fw-npu;level-zero-npu)\n")
34+
35+
# Component list
36+
get_cmake_property(CPACK_COMPONENTS_ALL COMPONENTS)
37+
list(REMOVE_ITEM CPACK_COMPONENTS_ALL level-zero-devel)
38+
list(REMOVE_ITEM CPACK_COMPONENTS_ALL openvino_standalone_package)
39+
40+
if (EXISTS "/etc/debian_version")
41+
set(PACKAGE_TYPE "deb")
42+
elseif(EXISTS "/etc/portage")
43+
set(PACKAGE_TYPE "ebuild")
44+
else()
45+
message(FATAL_ERROR "Unable to detect package type for this system")
46+
endif()
47+
48+
include(${CMAKE_CURRENT_LIST_DIR}/generators/${PACKAGE_TYPE}.cmake)
49+
include(CPack)

compiler/CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,5 @@
1010
# or implied warranties, other than those that are expressly stated in
1111
# the License.
1212

13-
include(openvino_package.cmake)
14-
include(vpux_compiler.cmake)
13+
include(openvino.cmake)
14+
include(npu_compiler.cmake)

0 commit comments

Comments
 (0)