Skip to content

Openvino backend for Executorch to enable inference on Intel CPUs, GPUs, NPUs #8573

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 254 commits into from
Mar 28, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
254 commits
Select commit Hold shift + click to select a range
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
8302911
Get openvino backend device from compile specs
ynimmaga Feb 4, 2025
2cda72b
Fixed formatting issues
ynimmaga Feb 4, 2025
f7dc3e3
Fixed formatting issues
ynimmaga Feb 4, 2025
4324809
Merge branch 'openvino_backend' into portable_kernels
ynimmaga Feb 4, 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
70a3b2a
Use to_edge_transform_and_lower in aot_openvino_compiler
cavusmustafa Feb 12, 2025
5ea37c7
Fix input tensor file reading bug
cavusmustafa Feb 12, 2025
6beadb3
Update unit tests
cavusmustafa Feb 12, 2025
4dbe444
Update build-run-openvino.md
ynimmaga Feb 12, 2025
0c07b70
temp changes for debugging
cavusmustafa Feb 12, 2025
b086202
Initial document for openvino backend tests
cavusmustafa Feb 13, 2025
cb91596
Update openvino backend test documentation
cavusmustafa Feb 13, 2025
d756727
Update README.md
cavusmustafa Feb 13, 2025
09b2dbd
Removed debugging lines
cavusmustafa Feb 13, 2025
4953033
Removed comment which was added for debugging
cavusmustafa Feb 13, 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
9d07bbb
Merge pull request #15 from daniil-lyakhov/dl/openvino/model_enabling
cavusmustafa Feb 14, 2025
2e6707d
Merge branch 'openvino_backend' into test_readme_and_example_updates
cavusmustafa Feb 14, 2025
1a20242
Merge pull request #16 from cavusmustafa/test_readme_and_example_updates
cavusmustafa Feb 15, 2025
a980099
Fix for input file path bug
cavusmustafa Feb 15, 2025
e9bac9a
Merge branch 'openvino_backend' into portable_kernels
cavusmustafa Feb 15, 2025
209132b
Test script name change
cavusmustafa Feb 15, 2025
4a27c36
Update README.md
cavusmustafa Feb 15, 2025
3a8c033
Merge pull request #11 from ynimmaga/portable_kernels
cavusmustafa Feb 15, 2025
0a981a6
Code formatting
cavusmustafa Feb 15, 2025
68a2043
Merge pull request #17 from cavusmustafa/code_formatting
cavusmustafa Feb 15, 2025
6b13915
Merge branch 'pytorch:main' into openvino_backend
ynimmaga Feb 18, 2025
ae661a1
Fix for input path bug in validation
cavusmustafa Feb 18, 2025
9de858e
Code formatting
cavusmustafa Feb 18, 2025
88f4823
Disable openvino build by default
cavusmustafa Feb 18, 2025
44b8979
Update build-run-openvino.md
cavusmustafa Feb 18, 2025
b7d302e
Update build-run-openvino.md
cavusmustafa Feb 18, 2025
d3daf53
Update build-run-openvino.md
cavusmustafa Feb 18, 2025
685ceb1
Enabled logging for example
cavusmustafa Feb 18, 2025
f1db517
Update openvino commit id
cavusmustafa Feb 18, 2025
c159421
Update README.md
cavusmustafa Feb 18, 2025
f4d2ce3
Added function comments with inputs and outputs
ynimmaga Feb 18, 2025
6c96e78
Merge pull request #20 from ynimmaga/function_updates
cavusmustafa Feb 18, 2025
8959283
Merge branch 'openvino_backend' into input_validate_fix
cavusmustafa Feb 18, 2025
e7da0cd
Merge pull request #18 from cavusmustafa/input_validate_fix
cavusmustafa Feb 18, 2025
1a74ed9
nncf requirement syntax updated
cavusmustafa Feb 19, 2025
2baa316
Update README.md
cavusmustafa Feb 19, 2025
cbdfc67
Merge pull request #21 from cavusmustafa/requirements_fix_nncf
ynimmaga Feb 19, 2025
4b55597
Build updates for openvino backend
cavusmustafa Feb 21, 2025
1a928d1
Removed executorch_srcs.cmake file
cavusmustafa Feb 21, 2025
cbd0671
Update backends/openvino/CMakeLists.txt
cavusmustafa Feb 21, 2025
8ae15e2
Update backends/openvino/CMakeLists.txt
cavusmustafa Feb 21, 2025
0627e44
Merge pull request #22 from cavusmustafa/build_updates
ynimmaga Feb 21, 2025
514d4c0
Logging added for building openvino backend
cavusmustafa Feb 21, 2025
e6de60e
Merge pull request #23 from cavusmustafa/build_logging
ynimmaga Feb 21, 2025
a28fcf3
Update examples/openvino/aot/README.md
cavusmustafa Feb 21, 2025
fa8feac
Comments
daniil-lyakhov Feb 21, 2025
bb51412
renamed OpenvinoBackend.h to OpenvinoBackend.hpp
cavusmustafa Feb 24, 2025
935e937
Removed using blanket namespaces
cavusmustafa Feb 24, 2025
83d1946
Fix the path for aot readme file
cavusmustafa Feb 25, 2025
e854ee0
Fix the path into aot folder
cavusmustafa Feb 25, 2025
0a18afd
Free processed data after compiling model
cavusmustafa Feb 25, 2025
1620154
Remove directory structure from tutorial readme
cavusmustafa Feb 24, 2025
3e1a061
Move aot insturctions to the main example readme file
cavusmustafa Feb 25, 2025
5627c5e
Delete examples/openvino/aot/README.md
cavusmustafa Feb 25, 2025
a993931
Added link for openvino supported hardware
cavusmustafa Feb 25, 2025
1e63eff
code formatting
cavusmustafa Feb 25, 2025
0e76d93
add aot readme file
cavusmustafa Feb 25, 2025
3b6fd88
remove aot readme file
cavusmustafa Feb 25, 2025
99c832b
add aot readme file
cavusmustafa Feb 25, 2025
73431cf
change make command to use max threads available
cavusmustafa Feb 25, 2025
bb284e4
Renamed yaml file name for unsupported ops
cavusmustafa Feb 25, 2025
ac8df24
License comment line update
cavusmustafa Feb 25, 2025
6051275
atol and rtol update
cavusmustafa Feb 25, 2025
0275c47
Comments
daniil-lyakhov Feb 26, 2025
cec2fb0
Update cmake-out directory
suryasidd Feb 26, 2025
53e7c17
Removed unused packages
suryasidd Feb 26, 2025
ee54b2f
import nncf.torch
daniil-lyakhov Feb 27, 2025
889e313
Merge pull request #24 from daniil-lyakhov/dl/ov/comments
cavusmustafa Feb 27, 2025
8f702aa
Merge branch 'openvino_backend' into surya/pr_updates
suryasidd Feb 28, 2025
bc29b46
Code cleanup
suryasidd Feb 28, 2025
468c890
Merge pull request #27 from ynimmaga/surya/pr_updates
cavusmustafa Feb 28, 2025
a42185a
Merge remote-tracking branch 'ynimmaga/openvino_backend' into first_r…
cavusmustafa Mar 4, 2025
751f087
openvino backend: static lib, pybinding, and test updates
cavusmustafa Mar 4, 2025
629d5a4
Typo fix in openvino backend header file
cavusmustafa Mar 4, 2025
63fd3a2
Update README.md
cavusmustafa Mar 4, 2025
6ce9321
Update README.md
cavusmustafa Mar 4, 2025
173970f
Update README.md
cavusmustafa Mar 4, 2025
213a018
pybinding example added for openvino backend
cavusmustafa Mar 5, 2025
2fcceb2
Update README.md
cavusmustafa Mar 5, 2025
34d1cf3
use pybinding for validation
cavusmustafa Mar 5, 2025
4f3df9a
Use common executor, remove custom openvino executor runner, use pybi…
cavusmustafa Mar 5, 2025
d89429b
code formatting
cavusmustafa Mar 5, 2025
d81f921
renamed openvino_pybinding_example.py to export_and_infer_openvino.py
cavusmustafa Mar 5, 2025
fb3685c
Removed yaml file for unsupported ops (not needed)
cavusmustafa Mar 5, 2025
7d5dd96
Update README.md
cavusmustafa Mar 5, 2025
79e5839
Update README.md
cavusmustafa Mar 6, 2025
ead3a85
Update README.md
cavusmustafa Mar 6, 2025
e30cc4c
build argument update for openvino backend
cavusmustafa Mar 6, 2025
0820520
add is_available call into contructor back
cavusmustafa Mar 6, 2025
3e8e9a1
Fix typo in openvino build script
cavusmustafa Mar 6, 2025
1d37c5c
Fix pybinding build issue and remove is_available call from constructor
cavusmustafa Mar 6, 2025
574d2b0
remove aot folder
cavusmustafa Mar 6, 2025
9251dcf
Update README.md
cavusmustafa Mar 6, 2025
ba711cf
Update README.md
cavusmustafa Mar 6, 2025
634b7e8
--pybind changed to --enable_python
cavusmustafa Mar 6, 2025
473b92e
Update README.md
cavusmustafa Mar 6, 2025
e783581
Update examples/openvino/export_and_infer_openvino.py
cavusmustafa Mar 6, 2025
62d719e
Update backends/openvino/README.md
cavusmustafa Mar 6, 2025
8a8b3db
removed cmake file for openvino example
cavusmustafa Mar 6, 2025
49e2792
Update backends/openvino/README.md
cavusmustafa Mar 6, 2025
cff39cd
Merge pull request #25 from cavusmustafa/first_revise_after_reviews
cavusmustafa Mar 6, 2025
5154ad6
[OpenVINO] Constant folding is removed from the OpenVINOQuantizer
daniil-lyakhov Mar 6, 2025
4685a37
quantize_model cleanup
daniil-lyakhov Mar 5, 2025
0efa875
Update README.md
cavusmustafa Mar 6, 2025
db281b6
updated atol and rtol
cavusmustafa Mar 6, 2025
94a351e
Comments
daniil-lyakhov Mar 6, 2025
4f8ca40
Fix executorch/examples/openvino/README.md
daniil-lyakhov Mar 7, 2025
d47e3d9
Update NNCF version
daniil-lyakhov Mar 7, 2025
4263a12
Added inference option into aot_openvino_compiler.py, removed inferen…
cavusmustafa Mar 7, 2025
1d975c7
Update README.md
cavusmustafa Mar 7, 2025
1d756e6
Update README.md
cavusmustafa Mar 8, 2025
37b56f8
Update README.md
cavusmustafa Mar 8, 2025
4902c8a
Update README.md
cavusmustafa Mar 8, 2025
3539dd7
Merge pull request #30 from daniil-lyakhov/dl/update_nncf
cavusmustafa Mar 8, 2025
ae3a9e7
aot script updated
cavusmustafa Mar 8, 2025
59c90ea
Update README.md
cavusmustafa Mar 8, 2025
8b9f76e
Merge pull request #28 from daniil-lyakhov/dl/ov/remote_constant_folding
ynimmaga Mar 10, 2025
f30ee76
Update README.md
cavusmustafa Mar 10, 2025
ee032ac
Update examples/openvino/aot_openvino_compiler.py
cavusmustafa Mar 10, 2025
e76c440
code formatting
cavusmustafa Mar 10, 2025
3e17d09
Merge pull request #29 from daniil-lyakhov/dl/quantize_model_ex
cavusmustafa Mar 10, 2025
c1ad164
Merge remote-tracking branch 'ynimmaga/openvino_backend' into additio…
cavusmustafa Mar 10, 2025
a02855f
code formatting
cavusmustafa Mar 10, 2025
4eee40d
Merge pull request #31 from cavusmustafa/additional_updates
cavusmustafa Mar 10, 2025
7e7711f
temp fix for unit tests with nncf
cavusmustafa Mar 12, 2025
e0ad620
Merge pull request #33 from cavusmustafa/unit_test_fix_with_nncf
ynimmaga Mar 12, 2025
293b1d5
Update build-run-openvino.md
cavusmustafa Mar 17, 2025
93adab7
preprocess update for latest ov release
cavusmustafa Mar 17, 2025
d743bc0
Update README.md
cavusmustafa Mar 17, 2025
69c1902
Merge pull request #34 from cavusmustafa/updates_for_ov_release
ynimmaga Mar 17, 2025
ca3ec9c
Fix inputs for hf models
suryasidd Mar 19, 2025
ab0cb88
Addressed PR comments
suryasidd Mar 19, 2025
82866db
Merge pull request #35 from ynimmaga/surya/fix_hf_models
cavusmustafa Mar 19, 2025
b1756d1
Update build-run-openvino.md
cavusmustafa Mar 21, 2025
2cf3ecf
Update build-run-openvino.md
cavusmustafa Mar 21, 2025
e3ceba0
Update build-run-openvino.md
cavusmustafa Mar 21, 2025
3d538de
Update build-run-openvino.md
cavusmustafa Mar 21, 2025
24e823f
remove openvino pybind option from executorch install script
cavusmustafa Mar 21, 2025
e0bd72a
Update build-run-openvino.md
cavusmustafa Mar 21, 2025
c884129
Update build-run-openvino.md
cavusmustafa Mar 21, 2025
e04c874
Update README.md
cavusmustafa Mar 21, 2025
f5619e1
Update build-run-openvino.md
cavusmustafa Mar 21, 2025
d1be27e
Update build-run-openvino.md
cavusmustafa Mar 21, 2025
1f0cefc
add openvino pybind option into install_executorch.py
cavusmustafa Mar 21, 2025
65aa705
Update backends/openvino/README.md
cavusmustafa Mar 21, 2025
6f52a9a
Update docs/source/build-run-openvino.md
cavusmustafa Mar 21, 2025
15178ce
Update build-run-openvino.md
cavusmustafa Mar 21, 2025
dc2c72e
Merge pull request #36 from cavusmustafa/updates_for_second_review
ynimmaga Mar 21, 2025
b160608
Merge remote-tracking branch 'executorch/main' into fix_merge_conflicts
cavusmustafa Mar 24, 2025
30c6821
Resolved conflicts with main branch
cavusmustafa Mar 24, 2025
682ae80
code formatting
cavusmustafa Mar 24, 2025
0030fb9
Merge pull request #37 from cavusmustafa/fix_merge_conflicts
ynimmaga Mar 24, 2025
381a65d
Merge branch 'main' into openvino_backend
suryasidd Mar 25, 2025
b496425
Updated build dependencies in docs
suryasidd Mar 25, 2025
de4cef2
Updated docs
suryasidd Mar 25, 2025
a05e3c7
Merge pull request #39 from ynimmaga/docs_update
ynimmaga Mar 25, 2025
3a3e912
pybind update to use new api
cavusmustafa Mar 26, 2025
5a20619
Merge pull request #40 from cavusmustafa/pybind_update
ynimmaga Mar 26, 2025
28af462
fix merge conflict: openvino pybind
cavusmustafa Mar 26, 2025
6258b42
pybind openvino merge update
cavusmustafa Mar 26, 2025
3f53cc2
Merge pull request #42 from cavusmustafa/pybind_merge_fix
ynimmaga Mar 27, 2025
55d5b39
build update for pybind
cavusmustafa Mar 27, 2025
a9010ac
Merge pull request #43 from cavusmustafa/build_update
ynimmaga Mar 27, 2025
f74e3e3
Addressed typechecker issues
suryasidd Mar 27, 2025
4bb3112
Merge pull request #44 from ynimmaga/fix_linter_issues
ynimmaga Mar 27, 2025
bfb6768
Update examples/openvino/README.md
ynimmaga Mar 27, 2025
c01e672
Fixed typechecker issues
suryasidd Mar 27, 2025
43060c0
Merge pull request #45 from ynimmaga/fix_typechecks
ynimmaga Mar 27, 2025
da55f42
initial openvino github action
cavusmustafa Mar 28, 2025
ecbae60
openvino ci script update
cavusmustafa Mar 28, 2025
50aa613
move openvino job into pull.yml
cavusmustafa Mar 28, 2025
dd05013
openvino ci test update
cavusmustafa Mar 28, 2025
9dd9b26
openvino ci update
cavusmustafa Mar 28, 2025
fc9c722
Merge branch 'main' into openvino_backend
cavusmustafa Mar 28, 2025
468974e
openvino ci update
cavusmustafa Mar 28, 2025
e3605f2
openvino ci update
cavusmustafa Mar 28, 2025
bae693f
Merge branch 'main' into openvino_backend
ynimmaga Mar 28, 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
28 changes: 28 additions & 0 deletions .ci/scripts/setup-openvino.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#!/bin/bash
# Copyright (c) Meta Platforms, Inc. and affiliates.
# All rights reserved.
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree.

set -ex

# shellcheck source=/dev/null
source "$(dirname "${BASH_SOURCE[0]}")/utils.sh"

git clone https://github.com/openvinotoolkit/openvino.git
cd openvino && git checkout releases/2025/1
git submodule update --init --recursive
sudo ./install_build_dependencies.sh
mkdir build && cd build
cmake .. -DCMAKE_BUILD_TYPE=Release -DENABLE_PYTHON=ON
make -j$(nproc)

cd ..
cmake --install build --prefix dist

source dist/setupvars.sh
cd ../backends/openvino
pip install -r requirements.txt
cd scripts
./openvino_build.sh --enable_python
16 changes: 16 additions & 0 deletions .ci/scripts/test_openvino.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/bin/bash
# Copyright (c) Meta Platforms, Inc. and affiliates.
# All rights reserved.
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree.

set -ex

# shellcheck source=/dev/null
source "$(dirname "${BASH_SOURCE[0]}")/utils.sh"

source openvino/dist/setupvars.sh
cd backends/openvino/tests
python test_runner.py --test_type ops
python test_runner.py --test_type models
22 changes: 22 additions & 0 deletions .github/workflows/pull.yml
Original file line number Diff line number Diff line change
Expand Up @@ -736,3 +736,25 @@ jobs:
conda activate "${CONDA_ENV}"
# placeholder for mediatek to add more tests
test-openvino-linux:
name: test-openvino-linux
uses: pytorch/test-infra/.github/workflows/linux_job_v2.yml@main
permissions:
id-token: write
contents: read
strategy:
fail-fast: false
with:
runner: linux.2xlarge
docker-image: executorch-ubuntu-22.04-gcc9
submodules: 'true'
ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }}
timeout: 90
script: |
# The generic Linux job chooses to use base env, not the one setup by the image
CONDA_ENV=$(conda env list --json | jq -r ".envs | .[-1]")
conda activate "${CONDA_ENV}"
PYTHON_EXECUTABLE=python bash .ci/scripts/setup-openvino.sh
PYTHON_EXECUTABLE=python bash .ci/scripts/test_openvino.sh
2 changes: 2 additions & 0 deletions .lintrunner.toml
Original file line number Diff line number Diff line change
Expand Up @@ -299,12 +299,14 @@ include_patterns = [
# TODO(https://github.com/pytorch/executorch/issues/7441): Gradually start enabling all folders.
# 'backends/**/*.py',
'backends/arm/**/*.py',
'backends/openvino/**/*.py',
'build/**/*.py',
'codegen/**/*.py',
# 'devtools/**/*.py',
'devtools/visualization/**/*.py',
'docs/**/*.py',
# 'examples/**/*.py',
'examples/openvino/**/*.py',
# 'exir/**/*.py',
# 'extension/**/*.py',
'kernels/**/*.py',
Expand Down
10 changes: 10 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,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" OFF)

option(EXECUTORCH_BUILD_PYBIND "Build the Python Bindings" OFF)

option(EXECUTORCH_BUILD_QNN "Build the Qualcomm backend" OFF)
Expand Down Expand Up @@ -715,6 +717,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 Expand Up @@ -817,6 +823,10 @@ if(EXECUTORCH_BUILD_PYBIND)
list(APPEND _dep_libs mpsdelegate)
endif()

if(EXECUTORCH_BUILD_OPENVINO)
list(APPEND _dep_libs openvino_backend)
endif()

if(EXECUTORCH_BUILD_XNNPACK)
# need to explicitly specify XNNPACK and microkernels-prod
# here otherwise uses XNNPACK and microkernel-prod symbols from libtorch_cpu
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
75 changes: 75 additions & 0 deletions backends/openvino/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
# 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 found in the
# LICENSE file in the root directory of this source tree.

# 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}/tools/cmake/Utils.cmake)

# Find OpenVINO libraries
find_package(OpenVINO REQUIRED)

# Define OpenVINO backend as a static library
add_library(openvino_backend STATIC .)

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

# Include Executorch directories
target_include_directories(openvino_backend PUBLIC ${COMMON_INCLUDE_DIRS})

# Link OpenVINO and ExecuteTorch core libraries
target_link_libraries(openvino_backend PRIVATE openvino::runtime executorch_core)

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

target_link_options_shared_lib(openvino_backend)

if(EXECUTORCH_BUILD_OPENVINO_EXECUTOR_RUNNER)
# Build executor runner binary for openvino backend
list(APPEND openvino_executor_runner_libs openvino_backend executorch)

set(_openvino_executor_runner__srcs
${EXECUTORCH_ROOT}/examples/portable/executor_runner/executor_runner.cpp
${EXECUTORCH_ROOT}/extension/data_loader/file_data_loader.cpp
${EXECUTORCH_ROOT}/extension/evalue_util/print_evalue.cpp
${EXECUTORCH_ROOT}/extension/runner_util/inputs.cpp
${EXECUTORCH_ROOT}/extension/runner_util/inputs_portable.cpp
)
add_executable(openvino_executor_runner ${_openvino_executor_runner__srcs})

list(APPEND openvino_executor_runner_libs)

target_link_libraries(
openvino_executor_runner gflags portable_ops_lib ${openvino_executor_runner_libs}
)
target_compile_options(openvino_executor_runner PUBLIC ${_common_compile_options})
endif()



# Install OpenVINO backend library to the lib directory
install(TARGETS openvino_backend DESTINATION lib)
89 changes: 89 additions & 0 deletions backends/openvino/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
# 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

For more information on the supported hardware, please refer to [OpenVINO System Requirements](https://docs.openvino.ai/2025/about-openvino/release-notes-openvino/system-requirements.html) page.

## Directory Structure

```
executorch
├── backends
│ └── openvino
│ ├── runtime
│ ├── OpenvinoBackend.cpp
│ └── OpenvinoBackend.h
│ ├── scripts
│ └── openvino_build.sh
│ ├── tests
│ ├── CMakeLists.txt
│ ├── README.md
│ ├── __init__.py
│ ├── partitioner.py
│ ├── preprocess.py
│ └── requirements.txt
└── examples
└── openvino
├── aot_optimize_and_infer.py
└── README.md
```

## Build Instructions

### Prerequisites

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

```bash
git clone https://github.com/openvinotoolkit/openvino.git
cd openvino && git checkout releases/2025/1
git submodule update --init --recursive
sudo ./install_build_dependencies.sh
mkdir build && cd build
cmake .. -DCMAKE_BUILD_TYPE=Release -DENABLE_PYTHON=ON
make -j$(nproc)

cd ..
cmake --install build --prefix <your_preferred_install_location>
cd <your_preferred_install_location>
source setupvars.sh
```
Note: The OpenVINO backend is not yet supported with the current OpenVINO release packages. It is recommended to build from source. The instructions for using OpenVINO release packages will be added soon.
For more information about OpenVINO build, refer to the [OpenVINO Build Instructions](https://github.com/openvinotoolkit/openvino/blob/master/docs/dev/build_linux.md).

### 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
```
Note: To achieve optimal performance with NNCF quantization, you should install the latest development version of NNCF (version 2.16.0.dev0+191b53d9 or higher).
3. Navigate to `scripts/` directory.

4. **Build OpenVINO Backend C++ Libraries and Executor Runner**: Once the prerequisites are in place, run the `openvino_build.sh` script to start the build process. By default, OpenVINO backend will be built under `cmake-out/backends/openvino/` as `libopenvino_backend.a`

```bash
./openvino_build.sh
```
**Build OpenVINO Backend Python Package with Pybindings**: To build and install the OpenVINO backend Python package with Python bindings, run the `openvino_build.sh` script with the `--enable_python` argument. This will compile and install the ExecuTorch Python package with the OpenVINO backend into your Python environment. This option will also enable python bindings required to execute OpenVINO backend tests and `export_and_infer_openvino.py` script inside `executorch/examples/openvino` folder.

```bash
./openvino_build.sh --enable_python
```

### 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