Skip to content

Commit 166204d

Browse files
sfatimarsspintelpreetha-intelUbuntuhmamidix
authored and
Ted Themistokleous
committed
Ort openvino npu 1.17 master (microsoft#19966)
### Description Add NPU to list of device supported. Added changes for Support to OV 2024.0 Nuget packages removes packaging of OpenVINO DLL Bug Fixes with Python API Reverted Dockerfiles not being maintained. ### Motivation and Context NPU Device has been introduced by Intel in latest client systems OpenVINO 2024.0 release is out. --------- Co-authored-by: Suryaprakash Shanmugam <[email protected]> Co-authored-by: Preetha Veeramalai <[email protected]> Co-authored-by: Ubuntu <[email protected]> Co-authored-by: hmamidix <[email protected]> Co-authored-by: vthaniel <[email protected]> Co-authored-by: saurabhkale17 <[email protected]>
1 parent 75044fc commit 166204d

38 files changed

+275
-843
lines changed

cmake/CMakeLists.txt

+9-28
Original file line numberDiff line numberDiff line change
@@ -1290,34 +1290,6 @@ if (onnxruntime_USE_OPENVINO)
12901290

12911291
add_definitions(-DUSE_OPENVINO=1)
12921292

1293-
if (EXISTS "$ENV{INTEL_OPENVINO_DIR}/deployment_tools/inference_engine/version.txt")
1294-
file(READ $ENV{INTEL_OPENVINO_DIR}/deployment_tools/inference_engine/version.txt VER)
1295-
endif()
1296-
1297-
if (NOT DEFINED ENV{INTEL_OPENVINO_DIR})
1298-
message(FATAL_ERROR "[Couldn't locate OpenVINO] OpenVINO may not have been initialized")
1299-
endif()
1300-
1301-
# Check OpenVINO version for support
1302-
if ($ENV{INTEL_OPENVINO_DIR} MATCHES "2023.0")
1303-
set(OPENVINO_VERSION "2023.0")
1304-
add_definitions(-DOPENVINO_2023_0=1)
1305-
elseif ($ENV{INTEL_OPENVINO_DIR} MATCHES "2023.1")
1306-
set(OPENVINO_VERSION "2023.1")
1307-
add_definitions(-DOPENVINO_2023_1=1)
1308-
elseif ($ENV{INTEL_OPENVINO_DIR} MATCHES "2023.2")
1309-
set(OPENVINO_VERSION "2023.2")
1310-
add_definitions(-DOPENVINO_2023_2=1)
1311-
elseif ($ENV{INTEL_OPENVINO_DIR} MATCHES "2023.3")
1312-
set(OPENVINO_VERSION "2023.3")
1313-
add_definitions(-DOPENVINO_2023_3=1)
1314-
elseif ($ENV{INTEL_OPENVINO_DIR} MATCHES "openvino")
1315-
set(OPENVINO_VERSION "2023.3")
1316-
add_definitions(-DOPENVINO_2023_3=1)
1317-
else()
1318-
message(FATAL_ERROR "Unsupported OpenVINO version: ${INTEL_OPENVINO_DIR}")
1319-
endif()
1320-
13211293
if (onnxruntime_USE_OPENVINO_GPU_FP32)
13221294
add_definitions(-DOPENVINO_CONFIG_GPU_FP32=1)
13231295
endif()
@@ -1334,6 +1306,10 @@ if (onnxruntime_USE_OPENVINO)
13341306
add_definitions(-DOPENVINO_CONFIG_CPU_FP16=1)
13351307
endif()
13361308

1309+
if (onnxruntime_USE_OPENVINO_NPU)
1310+
add_definitions(-DOPENVINO_CONFIG_NPU=1)
1311+
endif()
1312+
13371313
if (onnxruntime_USE_OPENVINO_GPU_FP32_NP)
13381314
add_definitions(-DOPENVINO_CONFIG_GPU_FP32=1)
13391315
add_definitions(-DOPENVINO_DISABLE_GRAPH_PARTITION=1)
@@ -1354,6 +1330,11 @@ if (onnxruntime_USE_OPENVINO)
13541330
add_definitions(-DOPENVINO_DISABLE_GRAPH_PARTITION=1)
13551331
endif()
13561332

1333+
if (onnxruntime_USE_OPENVINO_NPU_NP)
1334+
add_definitions(-DOPENVINO_CONFIG_NPU=1)
1335+
add_definitions(-DOPENVINO_DISABLE_GRAPH_PARTITION=1)
1336+
endif()
1337+
13571338
if (onnxruntime_USE_OPENVINO_HETERO)
13581339
add_definitions(-DOPENVINO_CONFIG_HETERO=1)
13591340
add_definitions(-DDEVICE_NAME="${onnxruntime_USE_OPENVINO_DEVICE}")

cmake/onnxruntime_providers_openvino.cmake

+15-12
Original file line numberDiff line numberDiff line change
@@ -16,23 +16,19 @@
1616
endif()
1717

1818
# Header paths
19-
find_package(InferenceEngine REQUIRED)
20-
find_package(ngraph REQUIRED)
21-
22-
if (OPENVINO_2022_1 OR OPENVINO_2022_2)
2319
find_package(OpenVINO REQUIRED COMPONENTS Runtime ONNX)
24-
list (OV_20_LIBS openvino::frontend::onnx openvino::runtime)
20+
if(OpenVINO_VERSION VERSION_LESS 2023.0)
21+
message(FATAL_ERROR "OpenVINO 2023.0 and newer are supported. Please, latest OpenVINO release")
2522
endif()
2623

2724
if (WIN32)
2825
unset(CMAKE_MAP_IMPORTED_CONFIG_RELWITHDEBINFO)
2926
endif()
3027

28+
list(APPEND OPENVINO_LIB_LIST openvino::frontend::onnx openvino::runtime ${PYTHON_LIBRARIES})
3129
if ((DEFINED ENV{OPENCL_LIBS}) AND (DEFINED ENV{OPENCL_INCS}))
3230
add_definitions(-DIO_BUFFER_ENABLED=1)
33-
list(APPEND OPENVINO_LIB_LIST $ENV{OPENCL_LIBS} ${OV_20_LIBS} ${InferenceEngine_LIBRARIES} ${NGRAPH_LIBRARIES} ngraph::onnx_importer ${PYTHON_LIBRARIES})
34-
else()
35-
list(APPEND OPENVINO_LIB_LIST ${OV_20_LIBS} ${InferenceEngine_LIBRARIES} ${NGRAPH_LIBRARIES} ngraph::onnx_importer ${PYTHON_LIBRARIES})
31+
list(APPEND OPENVINO_LIB_LIST $ENV{OPENCL_LIBS})
3632
endif()
3733

3834
source_group(TREE ${ONNXRUNTIME_ROOT}/core FILES ${onnxruntime_providers_openvino_cc_srcs})
@@ -75,7 +71,14 @@
7571
message(FATAL_ERROR "onnxruntime_providers_openvino unknown platform, need to specify shared library exports for it")
7672
endif()
7773

78-
install(TARGETS onnxruntime_providers_openvino
79-
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
80-
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
81-
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
74+
if (CMAKE_OPENVINO_LIBRARY_INSTALL_DIR)
75+
install(TARGETS onnxruntime_providers_openvino
76+
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
77+
LIBRARY DESTINATION ${CMAKE_OPENVINO_LIBRARY_INSTALL_DIR}
78+
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
79+
else()
80+
install(TARGETS onnxruntime_providers_openvino
81+
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
82+
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
83+
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
84+
endif()

dockerfiles/Dockerfile.openvino

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
#-------------------------------------------------------------------------
2-
# Copyright(C) 2021-2023 Intel Corporation.
2+
# Copyright(C) 2021-2024 Intel Corporation.
33
# SPDX-License-Identifier: MIT
44
#--------------------------------------------------------------------------
55

6-
ARG OPENVINO_VERSION=2023.0.0
6+
ARG OPENVINO_VERSION=2024.0.0
77

88

99
# Build stage
@@ -17,7 +17,7 @@ ARG DEVICE=CPU_FP32
1717
ARG ONNXRUNTIME_REPO=https://github.com/microsoft/onnxruntime.git
1818
ARG ONNXRUNTIME_BRANCH=main
1919

20-
ENV InferenceEngine_DIR=${INTEL_OPENVINO_DIR}/runtime/cmake
20+
ENV OpenVINO_DIR=${INTEL_OPENVINO_DIR}/runtime/cmake
2121

2222
USER root
2323
RUN apt update; apt install -y git protobuf-compiler libprotobuf-dev

dockerfiles/Dockerfile.openvino-centos7

-105
This file was deleted.

dockerfiles/Dockerfile.openvino-csharp

-90
This file was deleted.

0 commit comments

Comments
 (0)