Skip to content

Commit dfa3946

Browse files
committed
UD2025.44 Content
1 parent 10443bb commit dfa3946

File tree

1,460 files changed

+52782
-22323
lines changed

Some content is hidden

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

1,460 files changed

+52782
-22323
lines changed

.gitattributes

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,6 @@
1010
./sw_runtime_kernels/kernels/prebuild/act_shave_bin/* filter=lfs diff=lfs merge=lfs -text
1111
./sw_runtime_kernels/kernels/prebuild/*.elf filter=lfs diff=lfs merge=lfs -text
1212
./sw_runtime_kernels/kernels/prebuild/*.xdat filter=lfs diff=lfs merge=lfs -text
13+
*.png filter=lfs diff=lfs merge=lfs -text
14+
*.svg filter=lfs diff=lfs merge=lfs -text
15+
*.vsdx filter=lfs diff=lfs merge=lfs -text

CMakeLists.txt

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ endif()
7070
include(cmake/flatbuffers.cmake)
7171
include(cmake/bundle_static_library.cmake)
7272
include(cmake/embed_bin_file.cmake)
73+
include(cmake/add_native_exec_target.cmake)
7374
include(cmake/add_tool_target.cmake)
7475
include(cmake/coverage.cmake)
7576
include(cmake/log_level.cmake)
@@ -115,28 +116,29 @@ if(ENABLE_PREBUILT_LLVM_MLIR_LIBS)
115116
list(APPEND CMAKE_PREFIX_PATH ${MLIR_BINARY_PKG_DIR}/lib/cmake/mlir)
116117
else()
117118
message(STATUS "Include LLVM by source files")
118-
# When vpux-plugin is built independently, MLIRConfig.cmake is under this dir
119-
list(APPEND CMAKE_PREFIX_PATH ${PROJECT_BINARY_DIR}/lib/cmake/mlir)
120-
# When vpux-plugin is added as OPENVINO_EXTRA_MODULES, MLIRConfig.cmake is under this dir
121-
list(APPEND CMAKE_PREFIX_PATH ${OpenVINO_BINARY_DIR}/lib/cmake/mlir)
122-
# When vpux-plugin is added in monorepo, MLIRConfig.cmake is under this dir
123-
if(ENABLE_NPU_MONO)
124-
if(NOT DEFINED NPU_MONO_BUILD_DIR)
125-
message(FATAL_ERROR "Cannot find `npu_mono` build directory")
119+
if (ANDROID)
120+
# To find MLIR/LLVM packages in Android build, we have to set the paths manually
121+
# because Android NDK set CMAKE_FIND_ROOT_PATH that is appended to CMAKE_PREFIX_PATH
122+
set(MLIR_DIR ${CMAKE_BINARY_DIR}/lib/cmake/mlir)
123+
set(LLVM_DIR ${CMAKE_CURRENT_BINARY_DIR}/thirdparty/llvm-project/llvm/lib/cmake/llvm)
124+
else()
125+
# When vpux-plugin is built independently, MLIRConfig.cmake is under this dir
126+
list(APPEND CMAKE_PREFIX_PATH ${PROJECT_BINARY_DIR}/lib/cmake/mlir)
127+
# When vpux-plugin is added as OPENVINO_EXTRA_MODULES, MLIRConfig.cmake is under this dir
128+
list(APPEND CMAKE_PREFIX_PATH ${OpenVINO_BINARY_DIR}/lib/cmake/mlir)
129+
# When vpux-plugin is added in monorepo, MLIRConfig.cmake is under this dir
130+
if(ENABLE_NPU_MONO)
131+
if(NOT DEFINED NPU_MONO_BUILD_DIR)
132+
message(FATAL_ERROR "Cannot find `npu_mono` build directory")
133+
endif()
134+
list(APPEND CMAKE_PREFIX_PATH ${NPU_MONO_BUILD_DIR}/lib/cmake/mlir)
126135
endif()
127-
list(APPEND CMAKE_PREFIX_PATH ${NPU_MONO_BUILD_DIR}/lib/cmake/mlir)
128136
endif()
129137
endif()
130138

131139
add_subdirectory(thirdparty EXCLUDE_FROM_ALL)
132140

133-
set(VPUNN_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/vpucostmodel")
134-
set(VPUNN_BINARY_DIR "${CMAKE_CURRENT_BINARY_DIR}/thirdparty/vpucostmodel")
135141

136-
set(VPUNN_INCLUDE_DIRS
137-
"${VPUNN_SOURCE_DIR}/include"
138-
"${VPUNN_BINARY_DIR}/include"
139-
)
140142

141143
if(ENABLE_DEVELOPER_BUILD)
142144
add_compile_definitions(VPUX_DEVELOPER_BUILD)

README.md

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

77
[![ubuntu_22](https://github.com/openvinotoolkit/npu_compiler/actions/workflows/ubuntu_22.yml/badge.svg?branch=develop&event=push)](https://github.com/openvinotoolkit/npu_compiler/actions/workflows/ubuntu_22.yml?query=event%3Apush)
88
[![ubuntu_24](https://github.com/openvinotoolkit/npu_compiler/actions/workflows/ubuntu_24.yml/badge.svg?branch=develop&event=push)](https://github.com/openvinotoolkit/npu_compiler/actions/workflows/ubuntu_24.yml?query=event%3Apush)
9-
[![Windows (2022)](https://github.com/openvinotoolkit/npu_compiler/actions/workflows/windows_2022.yml/badge.svg?branch=develop&event=push)](https://github.com/openvinotoolkit/npu_compiler/actions/workflows/windows_2022.yml)
9+
[![Windows (2022)](https://github.com/openvinotoolkit/npu_compiler/actions/workflows/windows_2022.yml/badge.svg?branch=develop&event=push)](https://github.com/openvinotoolkit/npu_compiler/actions/workflows/windows_2022.yml?query=event%3Apush)
1010

1111
[![OpenVINO Docs](https://img.shields.io/badge/OpenVINO-documentation-blue)](https://docs.openvino.ai/)
1212
[![OpenVINO Downloads](https://img.shields.io/badge/OpenVINO-downloads-blue)](https://www.intel.com/content/www/us/en/developer/tools/openvino-toolkit/download.html)

cmake/add_native_exec_target.cmake

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#
2+
# Copyright (C) 2025 Intel Corporation.
3+
# SPDX-License-Identifier: Apache-2.0
4+
#
5+
6+
# For Android, we use the native tools from the prebuilt binaries.
7+
function(add_native_exec_target NATIVE_TARGET_NAME)
8+
# Tools must be built for the host machine in Release mode
9+
set(NATIVE_EXEC_TOOL_DIR "${OUTPUT_ROOT}/bin/intel64/Release")
10+
find_program(NATIVE_TOOL_EXEC ${NATIVE_TARGET_NAME} PATHS ${NATIVE_EXEC_TOOL_DIR} NO_DEFAULT_PATH NO_CACHE)
11+
if(NOT NATIVE_TOOL_EXEC)
12+
message(FATAL_ERROR "${NATIVE_TARGET_NAME} executable not found in ${NATIVE_EXEC_TOOL_DIR}. "
13+
"Please build the native tools first.")
14+
endif()
15+
16+
add_executable(${NATIVE_TARGET_NAME} IMPORTED GLOBAL)
17+
set_target_properties(${NATIVE_TARGET_NAME} PROPERTIES IMPORTED_LOCATION "${NATIVE_TOOL_EXEC}")
18+
message(STATUS "native ${NATIVE_TARGET_NAME} executable found: ${NATIVE_TOOL_EXEC}")
19+
endfunction()

cmake/compile_options_llvm.cmake

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,4 +30,11 @@ macro(set_llvm_flags)
3030
set(LLVM_BUILD_UTILS ON CACHE BOOL "" FORCE)
3131
set(LLVM_INSTALL_UTILS ON CACHE BOOL "" FORCE)
3232
set(LLVM_ABI_BREAKING_CHECKS "FORCE_OFF" CACHE STRING "" FORCE)
33+
34+
if(ANDROID)
35+
set(LLVM_ENABLE_ZLIB OFF CACHE BOOL "" FORCE)
36+
set(LLVM_ENABLE_LIBXML2 OFF CACHE BOOL "" FORCE)
37+
set(LLVM_ENABLE_LIBEDIT OFF CACHE BOOL "" FORCE)
38+
set(LLVM_USE_HOST_TOOLS ON CACHE BOOL "" FORCE)
39+
endif()
3340
endmacro()

cmake/embed_bin_file.cmake

Lines changed: 22 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -3,54 +3,41 @@
33
# SPDX-License-Identifier: Apache-2.0
44
#
55

6-
function(vpux_embed_bin_file)
6+
function(npu_embed_bin_file)
77
set(options)
8-
set(oneValueArgs SOURCE_FILE HEADER_FILE VARIABLE_NAME)
8+
set(oneValueArgs TARGET SOURCE_FILE HEADER_FILE VARIABLE_NAME)
99
set(multiValueArgs)
1010
cmake_parse_arguments(ARG "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
1111

12+
if(NOT ARG_TARGET)
13+
message(FATAL_ERROR "Missing TARGET argument in npu_embed_bin_file")
14+
endif()
1215
if(NOT ARG_SOURCE_FILE)
13-
message(FATAL_ERROR "Missing SOURCE_FILE argument in vpux_embed_bin_file")
16+
message(FATAL_ERROR "Missing SOURCE_FILE argument in npu_embed_bin_file")
1417
endif()
1518
if(NOT ARG_HEADER_FILE)
16-
message(FATAL_ERROR "Missing HEADER_FILE argument in vpux_embed_bin_file")
19+
message(FATAL_ERROR "Missing HEADER_FILE argument in npu_embed_bin_file")
1720
endif()
1821
if(NOT ARG_VARIABLE_NAME)
19-
message(FATAL_ERROR "Missing VARIABLE_NAME argument in vpux_embed_bin_file")
22+
message(FATAL_ERROR "Missing VARIABLE_NAME argument in npu_embed_bin_file")
2023
endif()
2124

2225
if(NOT EXISTS ${ARG_SOURCE_FILE})
2326
message(FATAL_ERROR "File '${ARG_SOURCE_FILE}' does not exist")
2427
endif()
2528

26-
file(READ ${ARG_SOURCE_FILE} hex_string HEX)
27-
string(LENGTH "${hex_string}" hex_string_length)
28-
29-
string(REGEX REPLACE "([0-9a-f][0-9a-f])" "static_cast<char>(0x\\1), " hex_array "${hex_string}")
30-
math(EXPR hex_array_size "${hex_string_length} / 2")
31-
32-
if (hex_array_size LESS "1000")
33-
message(FATAL_ERROR "File '${ARG_SOURCE_FILE}' too small, check that git-lfs pull step has been done.")
34-
endif()
35-
36-
set(content "
37-
const char ${ARG_VARIABLE_NAME}[] = { ${hex_array} };
38-
const size_t ${ARG_VARIABLE_NAME}_SIZE = ${hex_array_size};
39-
")
40-
41-
# tracking of rewrite is required to avoid rebuild of the whole MLIR compiler
42-
# in case of cmake rerun. Need to rebuild only if content of SOURCE_FILE is changed
43-
set(rewrite_file ON)
44-
if(EXISTS ${ARG_HEADER_FILE})
45-
file(READ ${ARG_HEADER_FILE} current_content)
46-
string(SHA256 current_hash "${current_content}")
47-
string(SHA256 new_hash "${content}")
48-
if(current_hash STREQUAL new_hash)
49-
set(rewrite_file OFF)
50-
endif()
51-
endif()
52-
53-
if(rewrite_file)
54-
file(WRITE ${ARG_HEADER_FILE} "${content}")
55-
endif()
29+
add_custom_command(
30+
OUTPUT ${ARG_HEADER_FILE}
31+
DEPENDS ${ARG_SOURCE_FILE}
32+
COMMAND ${CMAKE_COMMAND}
33+
-DSOURCE_FILE=${ARG_SOURCE_FILE}
34+
-DHEADER_FILE=${ARG_HEADER_FILE}
35+
-DVARIABLE_NAME=${ARG_VARIABLE_NAME}
36+
-P ${PROJECT_SOURCE_DIR}/cmake/prepare_cost_model_binary.cmake
37+
COMMENT "Generating VPUNN header '${ARG_HEADER_FILE}'"
38+
VERBATIM)
39+
40+
add_custom_target(
41+
${ARG_TARGET} ALL
42+
DEPENDS ${ARG_HEADER_FILE})
5643
endfunction()

cmake/flatbuffers.cmake

Lines changed: 0 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -62,53 +62,4 @@ function(vpux_add_flatc_target FLATC_TARGET_NAME)
6262
${FLATC_DST_DIR}
6363
)
6464

65-
vpux_gf_version_generate(${FLATC_SRC_DIR} "${FLATC_DST_DIR}/schema")
66-
67-
endfunction()
68-
69-
find_package(Git REQUIRED)
70-
function(vpux_gf_version_generate SRC_DIR DST_DIR)
71-
72-
execute_process(
73-
COMMAND ${GIT_EXECUTABLE} describe --tags
74-
WORKING_DIRECTORY ${SRC_DIR}
75-
OUTPUT_VARIABLE GIT_DESCRIBE_DIRTY
76-
OUTPUT_STRIP_TRAILING_WHITESPACE
77-
)
78-
79-
if ("${GIT_DESCRIBE_DIRTY}" STREQUAL "")
80-
message(WARNING "ELF version cannot be read from ${SRC_DIR}")
81-
set(GIT_DESCRIBE_DIRTY "v3.35.2")
82-
endif()
83-
84-
string(REGEX REPLACE "^v([0-9]+)\\..*" "\\1" VERSION_MAJOR "${GIT_DESCRIBE_DIRTY}")
85-
string(REGEX REPLACE "^v[0-9]+\\.([0-9]+).*" "\\1" VERSION_MINOR "${GIT_DESCRIBE_DIRTY}")
86-
string(REGEX REPLACE "^v[0-9]+\\.[0-9]+\\.([0-9]+).*" "\\1" VERSION_PATCH "${GIT_DESCRIBE_DIRTY}")
87-
88-
set(content "
89-
#ifndef GF_VERSION_H
90-
#define GF_VERSION_H
91-
92-
#define MVCNN_VERSION_MAJOR ${VERSION_MAJOR}
93-
#define MVCNN_VERSION_MINOR ${VERSION_MINOR}
94-
#define MVCNN_VERSION_PATCH ${VERSION_PATCH}
95-
96-
#endif")
97-
set(dst_file "${DST_DIR}/gf_version.h")
98-
99-
# tracking of rewrite is required to avoid rebuild of big part of the product
100-
# in case of cmake rerun. Need to rebuild only if GF version is changed
101-
set(rewrite_file ON)
102-
if(EXISTS ${dst_file})
103-
file(READ ${dst_file} current_content)
104-
string(SHA256 current_hash "${current_content}")
105-
string(SHA256 new_hash "${content}")
106-
if(current_hash STREQUAL new_hash)
107-
set(rewrite_file OFF)
108-
endif()
109-
endif()
110-
111-
if(rewrite_file)
112-
file(WRITE ${dst_file} "${content}")
113-
endif()
11465
endfunction()
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
#
2+
# Copyright (C) 2025 Intel Corporation.
3+
# SPDX-License-Identifier: Apache-2.0
4+
#
5+
6+
function(prepare_cost_model_binary SOURCE_FILE HEADER_FILE VARIABLE_NAME)
7+
if(NOT SOURCE_FILE)
8+
message(FATAL_ERROR "Missing SOURCE_FILE argument in prepare_cost_model_binary")
9+
endif()
10+
if(NOT HEADER_FILE)
11+
message(FATAL_ERROR "Missing HEADER_FILE argument in prepare_cost_model_binary")
12+
endif()
13+
if(NOT VARIABLE_NAME)
14+
message(FATAL_ERROR "Missing VARIABLE_NAME argument in prepare_cost_model_binary")
15+
endif()
16+
17+
if(NOT EXISTS ${SOURCE_FILE})
18+
message(FATAL_ERROR "File '${SOURCE_FILE}' does not exist")
19+
endif()
20+
21+
find_package(Git QUIET REQUIRED)
22+
execute_process(
23+
COMMAND ${GIT_EXECUTABLE} lfs pull
24+
WORKING_DIRECTORY "${PROJECT_SOURCE_DIR}/thirdparty/vpucostmodel")
25+
26+
file(READ ${SOURCE_FILE} hex_string HEX)
27+
string(LENGTH "${hex_string}" hex_string_length)
28+
29+
string(REGEX REPLACE "([0-9a-f][0-9a-f])" "static_cast<char>(0x\\1), " hex_array "${hex_string}")
30+
math(EXPR hex_array_size "${hex_string_length} / 2")
31+
32+
if (hex_array_size LESS "1000")
33+
message(FATAL_ERROR "File '${SOURCE_FILE}' too small, check that git-lfs pull step has been done.")
34+
endif()
35+
36+
set(content "
37+
const char ${VARIABLE_NAME}[] = { ${hex_array} };
38+
const size_t ${VARIABLE_NAME}_SIZE = ${hex_array_size};
39+
")
40+
41+
# tracking of rewrite is required to avoid rebuild of the whole MLIR compiler
42+
# in case of cmake rerun. Need to rebuild only if content of SOURCE_FILE is changed
43+
set(rewrite_file ON)
44+
if(EXISTS ${HEADER_FILE})
45+
file(READ ${HEADER_FILE} current_content)
46+
string(SHA256 current_hash "${current_content}")
47+
string(SHA256 new_hash "${content}")
48+
if(current_hash STREQUAL new_hash)
49+
set(rewrite_file OFF)
50+
endif()
51+
endif()
52+
53+
if(rewrite_file)
54+
file(WRITE ${HEADER_FILE} "${content}")
55+
endif()
56+
endfunction()
57+
58+
prepare_cost_model_binary(${SOURCE_FILE} ${HEADER_FILE} ${VARIABLE_NAME})

docs/plugin.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@ The compiler is based on the MLIR project. There are two different ways for the
4545

4646
An engine backend is an abstraction layer on top of underlying APIs used to execute models. It is meant to include all the required functionality and infrastructure required to execute multiple models in parallel on one or multiple devices. Multiple engine backends are supported by the plugin:
4747
* L0 (Level Zero) backend
48-
* IMD backend
4948

5049
&nbsp;
5150
## Model Compilation

src/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ if(BUILD_COMPILER_FOR_DRIVER)
1616
add_subdirectory(vpux_driver_compiler)
1717
endif()
1818

19+
1920
add_subdirectory(vpux_utils)
2021

2122
add_subdirectory(vpux_compiler)

0 commit comments

Comments
 (0)