Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
73 commits
Select commit Hold shift + click to select a range
11e7ee5
First commit for openvino backend
ynimmaga Nov 6, 2024
be927aa
Added example for openvino backend
ynimmaga Nov 12, 2024
06759ef
Updated CMakeLists.txt to add openvino build option
ynimmaga Nov 12, 2024
2b5f599
Updated headers for openvino aot steps
ynimmaga Nov 13, 2024
86f685e
Fixed library path errors in cmake
ynimmaga Nov 13, 2024
bb12f60
Configure device with compile spec
ynimmaga Nov 20, 2024
c9c8967
Added aot compiler script for openvino
ynimmaga Nov 21, 2024
f5bd832
Temporary build instructions
ynimmaga Dec 10, 2024
f3dc62c
Added standalone build script for openvino backend
ynimmaga Dec 11, 2024
eec7831
Merge branch 'openvino_backend' of https://github.com/ynimmaga/execut…
ynimmaga Dec 11, 2024
ca852de
Handling multiple inputs/outputs with zero-copy
cavusmustafa Dec 13, 2024
bdddb16
Merge branch 'pytorch:main' into openvino_backend
ynimmaga Dec 19, 2024
9803bd8
Merge branch 'pytorch:main' into openvino_backend
ynimmaga Jan 2, 2025
b1f38f8
Merge branch 'pytorch:main' into openvino_backend
ynimmaga Jan 3, 2025
7c43014
Merge pull request #5 from cavusmustafa/zero_copy_output
ynimmaga Jan 21, 2025
0703814
Added fallback with portable kernels
ynimmaga Jan 21, 2025
0a769be
Added openvino_functions.yaml containing only unsupported ops
ynimmaga Jan 21, 2025
0e6707d
Updated the unsupported ops for fallback
ynimmaga Jan 21, 2025
68a1cd4
Removed redundant example for openvino backend
ynimmaga Jan 21, 2025
4d1b4eb
Reconfigured openvino backend functions
ynimmaga Jan 22, 2025
5c55a56
Updated openvino backend cmake file
ynimmaga Jan 22, 2025
3c6d123
Merge pull request #6 from ynimmaga/portable_kernels
ynimmaga Jan 28, 2025
29d8400
Added arguments for model path and num iters to openvino example
ynimmaga Jan 30, 2025
379937e
Merge pull request #8 from ynimmaga/portable_kernels
cavusmustafa Jan 30, 2025
5806788
Initial unit tests for OpenVINO backend
cavusmustafa Jan 29, 2025
916ba64
Unit test update and cleanup
cavusmustafa Jan 30, 2025
e0b1bb7
Input/Output processing for example and unit tests
cavusmustafa Jan 31, 2025
9108770
Added executorch parameter to openvino_compile call
cavusmustafa Jan 31, 2025
ecbe5e2
New op unit tests added
cavusmustafa Feb 1, 2025
d563e4c
Merge pull request #7 from cavusmustafa/openvino_backend_unit_tests
ynimmaga Feb 1, 2025
a4d7458
Added license headers to the openvino files
ynimmaga Feb 1, 2025
197cdc2
Merge branch 'pytorch:main' into openvino_backend
ynimmaga Feb 2, 2025
268255b
Merge pull request #9 from ynimmaga/doc_changes
ynimmaga Feb 3, 2025
d9d35e2
Merge branch 'pytorch:main' into openvino_backend
ynimmaga Feb 4, 2025
c5ca5c4
Openvino backend model tests added
cavusmustafa Feb 6, 2025
54fac03
removed executorch option into openvino_compile
cavusmustafa Feb 7, 2025
8a5abed
cmake updates for openvino
ynimmaga Feb 9, 2025
415a3ec
Merge pull request #12 from cavusmustafa/model_tests
ynimmaga Feb 9, 2025
2424c72
Added ReadMe for openvino backend
ynimmaga Feb 10, 2025
7f877d4
Merge branch 'pytorch:main' into openvino_backend
ynimmaga Feb 10, 2025
11218a3
Update README.md for openvino backend
ynimmaga Feb 10, 2025
f7e03c5
Added directory structure for openvino backend in ReadMe
ynimmaga Feb 10, 2025
b49e439
Minor updates for README.md
ynimmaga Feb 10, 2025
d122f51
Created README.md for examples
ynimmaga Feb 11, 2025
aad2ac7
delete old Readme file for openvino examples
ynimmaga Feb 11, 2025
050259b
Added OpenVINO tutorial in docs
ynimmaga Feb 11, 2025
81460f3
Updated cmake and build scripts to link against gflags
ynimmaga Feb 11, 2025
7139bac
Update backends/openvino/README.md
ynimmaga Feb 12, 2025
58152a2
remove enable_wheel from openvino build instructions
ynimmaga Feb 12, 2025
c979f52
Merge pull request #13 from ynimmaga/cmake_updates
ynimmaga Feb 12, 2025
541e44d
Update backends/openvino/README.md
ynimmaga Feb 12, 2025
9968178
Updated executorch environment setup in README.md
ynimmaga Feb 12, 2025
32e7cc7
Update environment setup in build-run-openvino.md
ynimmaga Feb 12, 2025
26f05f5
Merge pull request #14 from ynimmaga/doc_changes
ynimmaga Feb 12, 2025
09a4ffb
Added OpenVINO in the main README.md
ynimmaga Feb 12, 2025
5d2784d
added init integration of quantization
alexsu52 Feb 5, 2025
61488d5
deit3_small_patch16_224_in21ft1k
daniil-lyakhov Feb 7, 2025
42155a1
Resnet-like model checked
daniil-lyakhov Feb 7, 2025
7c66314
WIP
daniil-lyakhov Feb 10, 2025
c1fa9e2
Formating
daniil-lyakhov Feb 11, 2025
e2415af
openvino_executor_runner.cpp can run on several inputs
daniil-lyakhov Feb 11, 2025
8cbb117
Validate option / minor
daniil-lyakhov Feb 11, 2025
4b60fb4
Input shape from the input dataset
daniil-lyakhov Feb 11, 2025
e0cd644
--batch_size
daniil-lyakhov Feb 11, 2025
2a04ee6
Adapt subset size to keep +- 300 pics for calibration
daniil-lyakhov Feb 11, 2025
db7dc13
Apply suggestions from code review
daniil-lyakhov Feb 11, 2025
de3f50b
Comments
daniil-lyakhov Feb 11, 2025
17fe62f
OpenVINOQuantizer: constructor arguments have been refined
daniil-lyakhov Feb 11, 2025
c7e0758
set_ignored_scope | readme updates
daniil-lyakhov Feb 12, 2025
19cbc69
openvino_executor_runner.cpp: comments
daniil-lyakhov Feb 14, 2025
0892b9d
Apply suggestions from code review
daniil-lyakhov Feb 14, 2025
d1aa425
aot_openvino_compiler.py: comments
daniil-lyakhov Feb 14, 2025
b9b604d
README
daniil-lyakhov Feb 14, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,8 @@ option(EXECUTORCH_BUILD_MPS "Build the MPS backend" OFF)

option(EXECUTORCH_BUILD_NEURON "Build the backends/mediatek directory" OFF)

option(EXECUTORCH_BUILD_OPENVINO "Build the Openvino backend" ON)

option(EXECUTORCH_BUILD_PYBIND "Build the Python Bindings" OFF)

option(EXECUTORCH_BUILD_QNN "Build the Qualcomm backend" OFF)
Expand Down Expand Up @@ -663,6 +665,10 @@ if(EXECUTORCH_BUILD_NEURON)
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/backends/mediatek)
endif()

if(EXECUTORCH_BUILD_OPENVINO)
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/backends/openvino)
endif()

if(EXECUTORCH_BUILD_QNN)
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/backends/qualcomm)
endif()
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ Platform Support:
- Arm
- Cadence
- MediaTek
- OpenVINO
- Qualcomm
- Vulkan
- XNNPACK
Expand Down
72 changes: 72 additions & 0 deletions backends/openvino/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
# Copyright (c) Intel Corporation
#
# Licensed under the BSD License (the "License"); you may not use this file
# except in compliance with the License. See the license file in the root
# directory of this source tree for more details.

# Set minimum required CMake version
cmake_minimum_required(VERSION 3.19)

# Set project name
project(openvino_backend_project)

# Set C++ standard
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

# Ensure compile_commands.json is generated
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)

# Set up EXECUTORCH_ROOT if not already set
if(NOT EXECUTORCH_ROOT)
set(EXECUTORCH_ROOT ${CMAKE_CURRENT_SOURCE_DIR}/../..)
endif()

# Define common include directories
set(COMMON_INCLUDE_DIRS ${EXECUTORCH_ROOT}/..)

# Include utility CMake scripts from ExecuteTorch
include(${EXECUTORCH_ROOT}/build/Utils.cmake)

# Set OpenVINO directory from environment variable
set(OPENVINO_DIR "$ENV{INTEL_OPENVINO_DIR}")
if(NOT OPENVINO_DIR)
message(FATAL_ERROR "ERROR: INTEL_OPENVINO_DIR environment variable is not set.")
endif()

# Set OpenVINO include directories
set(OPENVINO_INCLUDE_DIRS
${OPENVINO_DIR}/runtime/include
${OPENVINO_DIR}/deployment_tools/inference_engine/include
)

# Set OpenVINO library path
set(OPENVINO_LIB_PATH ${OPENVINO_DIR}/runtime/lib/intel64)

# Try to locate OpenVINO automatically
find_library(OPENVINO_LIB NAMES openvino PATHS ${OPENVINO_LIB_PATH} NO_DEFAULT_PATH)
if(NOT OPENVINO_LIB)
message(FATAL_ERROR "ERROR: OpenVINO library (libopenvino.so) not found in ${OPENVINO_LIB_PATH}")
endif()

# Define OpenVINO backend as a shared library
add_library(openvino_backend SHARED)

# Enable exceptions and RTTI for OpenVINO backend
target_compile_options(openvino_backend PRIVATE -frtti -fexceptions)

# Include ExecuteTorch and OpenVINO directories
target_include_directories(openvino_backend PUBLIC ${COMMON_INCLUDE_DIRS} ${OPENVINO_INCLUDE_DIRS})

# Link OpenVINO and ExecuteTorch core libraries
target_link_libraries(openvino_backend PRIVATE ${OPENVINO_LIB} executorch_core)

# Add source files for OpenVINO backend
target_sources(openvino_backend PRIVATE ${CMAKE_CURRENT_LIST_DIR}/runtime/OpenvinoBackend.cpp)

# Set runtime library path for OpenVINO
target_link_options(openvino_backend PRIVATE -Wl,-rpath=${OPENVINO_LIB_PATH})

# Install OpenVINO backend library to the lib directory
install(TARGETS openvino_backend DESTINATION lib)

90 changes: 90 additions & 0 deletions backends/openvino/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
# OpenVINO Backend for ExecuTorch
The OpenVINO backend enables optimized execution of deep learning models on Intel hardware, leveraging Intel's [OpenVINO toolkit](https://www.intel.com/content/www/us/en/developer/tools/openvino-toolkit/overview.html) for inference acceleration.

## Supported Hardware

OpenVINO backend supports the following hardware:

- Intel CPUs
- Intel integrated GPUs
- Intel discrete GPUs
- Intel NPUs

## Directory Structure

```
executorch
├── backends
│ └── openvino
│ ├── runtime
│ ├── OpenvinoBackend.cpp
│ └── OpenvinoBackend.hpp
│ ├── scripts
│ └── openvino_build.sh
│ ├── tests
│ ├── CMakeLists.txt
│ ├── README.md
│ ├── __init__.py
│ ├── openvino_functions.yaml
│ ├── partitioner.py
│ ├── preprocess.py
│ └── requirements.txt
└── examples
│ └── openvino
│ ├── aot
│ ├── README.md
│ └── aot_openvino_compiler.py
│ └── executor_runner
│ └── openvino_executor_runner.cpp
│ ├── CMakeLists.txt
│ ├── README.md
└── └── openvino_build_example.sh
```

## Build Instructions

### Prerequisites

Before you begin, ensure you have openvino installed and configured on your system:

## TODO: Update with the openvino commit/Release tag once the changes in OpenVINO are merged
## TODO: Add instructions for support with OpenVINO release package

```bash
git clone -b executorch_ov_backend https://github.com/ynimmaga/openvino
cd openvino
git submodule update --init --recursive
mkdir build
cd build
cmake .. -DCMAKE_BUILD_TYPE=Release -DENABLE_PYTHON=ON
make -j<N>

cd ..
cmake --install build --prefix <your_preferred_install_location>
cd <your_preferred_install_location>
source setupvars.sh
```

### Setup

Follow the steps below to setup your build environment:

1. **Setup ExecuTorch Environment**: Refer to the [Environment Setup](https://pytorch.org/executorch/stable/getting-started-setup#environment-setup) guide for detailed instructions on setting up the ExecuTorch environment.

2. **Setup OpenVINO Backend Environment**
- Install the dependent libs. Ensure that you are inside `executorch/backends/openvino/` directory
```bash
pip install -r requirements.txt
```

3. Navigate to `scripts/` directory.

4. **Build OpenVINO Backend**: Once the prerequisites are in place, run the `openvino_build.sh` script to start the build process, OpenVINO backend will be built under `cmake-openvino-out/backends/openvino/` as `libopenvino_backend.so`

```bash
./openvino_build.sh
```

### Run

Please refer to [README.md](../../examples/openvino/README.md) for instructions on running examples of various of models with openvino backend.
5 changes: 5 additions & 0 deletions backends/openvino/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
from .partitioner import OpenvinoPartitioner
from .preprocess import OpenvinoBackend
from .quantizer.quantizer import OpenVINOQuantizer

__all__ = [OpenvinoBackend, OpenvinoPartitioner, OpenVINOQuantizer]
Loading
Loading