openvino-inference-engine: add Intel NPU Plugin support#47
openvino-inference-engine: add Intel NPU Plugin support#47liux2085 wants to merge 1 commit intointel:mainfrom
Conversation
1) Added submodules for NPU Plugin: level-zero, level-zero-npu-extensions
and yaml-cpp.
2) Removed the hardcoded -DENABLE_INTEL_NPU=OFF. Add a new
PACKAGECONFIG option intel-npu to toggle NPU plugin support.
3) Included a patch file ("0001-Fix-intel-NPU-plugin-build-issue-with-GCC15.patch")
to address GCC15 build errors by explicitly including "<cstdint>" where necessary.
4) Fix debug source paths in generated NPU dispatcher sources.
The Intel NPU plugin file will be installed to
"/usr/lib64/openvino-2025.3.0/libopenvino_intel_npu_plugin.so".
Signed-off-by: Yongxin Liu <yongxin.liu@windriver.com>
There was a problem hiding this comment.
Pull request overview
This PR adds Intel NPU (Neural Processing Unit) plugin support to the OpenVINO inference engine recipe by introducing required dependencies and configuration options.
Changes:
- Added three new git submodule dependencies for NPU plugin: level-zero, level-zero-npu-extensions, and yaml-cpp
- Introduced a new
intel-npuPACKAGECONFIG option to enable/disable NPU plugin support - Included a GCC15 compatibility patch that adds missing
<cstdint>includes to NPU plugin source files
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| recipes-core/opencv/openvino-inference-engine_2025.3.0.bb | Adds NPU submodule dependencies, removes hardcoded NPU disable flag, adds intel-npu PACKAGECONFIG option, and implements debug source path fix for NPU dispatcher sources |
| recipes-core/opencv/files/0001-Fix-intel-NPU-plugin-build-issue-with-GCC15.patch | Fixes GCC15 build errors by adding <cstdint> includes to NPU plugin header files |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| chmod +x ${WORKDIR}/qemuwrapper | ||
| } | ||
|
|
||
| NPU_INSTALL_CMD = "find ${B}/src/plugins/intel_npu/src/plugin/cross-compiled/ -type f -name \"*_disp.cpp\" -exec sed -i -e \"s%${S}%${TARGET_DBGSRC_DIR}%g\" {} + || bberror \"Failed to update dispatcher source paths\"" |
There was a problem hiding this comment.
The NPU_INSTALL_CMD contains a complex shell command with multiple special characters and escaping. Consider extracting this into a separate shell function or script file for better readability and maintainability.
| SRC_URI += "git://github.com/oneapi-src/level-zero.git;protocol=https;destsuffix=${BB_GIT_DEFAULT_DESTSUFFIX}/thirdparty/level_zero/level-zero;name=level-zero;nobranch=1 \ | ||
| git://github.com/intel/level-zero-npu-extensions.git;protocol=https;destsuffix=${BB_GIT_DEFAULT_DESTSUFFIX}/src/plugins/intel_npu/thirdparty/level-zero-ext;name=level-zero-ext;nobranch=1 \ | ||
| git://github.com/jbeder/yaml-cpp.git;protocol=https;destsuffix=${BB_GIT_DEFAULT_DESTSUFFIX}/src/plugins/intel_npu/thirdparty/yaml-cpp;name=yaml-cpp;nobranch=1 \ | ||
| file://0001-Fix-intel-NPU-plugin-build-issue-with-GCC15.patch \ | ||
| " | ||
| SRCREV_level-zero = "9402907a3ce6987871325e4e1329e053b8e5cf2b" | ||
| SRCREV_level-zero-ext = "f8bba8915e0a5fe8317f7aa48007ecc5a8c179ca" | ||
| SRCREV_yaml-cpp = "da82fd982c260e7f335ce5acbceff24b270544d1" | ||
| SRCREV_FORMAT += "_level-zero_level-zero-ext_yaml-cpp" |
There was a problem hiding this comment.
Could you please consider using system libraries before cloning them into a recipe?
There was a problem hiding this comment.
Hi @kkepka,
Thanks for your review.
-
Regarding level-zero
The level-zero package is currently provided by meta-intel, while meta-openvino does not declare a dependency on meta-intel.
Do you want me to add meta-intel to LAYERDEPENDS of meta-openvino, or is there a preferred alternative? -
Regarding yaml-cpp
Please refer to the following code snippet:
<src/plugins/intel_npu/thirdparty/CMakeLists.txt>
if(ENABLE_INTEL_NPU_PROTOPIPE)
set(YAML_BUILD_SHARED_LIBS OFF)
add_subdirectory(yaml-cpp EXCLUDE_FROM_ALL)
# NB: Suppress warnings in yaml-cpp
if(SUGGEST_OVERRIDE_SUPPORTED)
target_compile_options(yaml-cpp PRIVATE -Wno-suggest-override)
endif()
endif()
OpenVINO does not use a system-provided yaml-cpp for the Intel NPU plugin.
Instead, it vendors yaml-cpp as a third-party component and builds it directly from source as part of the OpenVINO build.
Key points:
set(YAML_BUILD_SHARED_LIBS OFF) forces static library generation (libyaml-cpp.a).
add_subdirectory(yaml-cpp EXCLUDE_FROM_ALL) builds yaml-cpp only when the NPU protopipe is enabled, and it is not exposed as a general project dependency.
The resulting libyaml-cpp.a is linked statically into the NPU plugin, avoiding any runtime dependency on a system yaml-cpp package.
Because of this, no yaml-cpp recipe or runtime dependency is required in the Yocto image.
This design is intentional to keep the NPU plugin self-contained and to avoid ABI or version mismatches with system-provided yaml-cpp.
Please let me know if this aligns with your understanding or if you prefer a different integration approach.
Thanks,
Yongxin
There was a problem hiding this comment.
Hi Yongxin,
thank you for detailed response. Please give me some time to cross check with Openvino and NPU engineers to find out what would be best way across the stack.
Best regards, KK
There was a problem hiding this comment.
yaml-cpp is in meta-oe ref: https://layers.openembedded.org/layerindex/recipe/163426/
Perhaps you can depend on the meta-oe layer ?
Having multiple sources is an issue for maintinence and CVE handling.
Added submodules for NPU Plugin: level-zero, level-zero-npu-extensions
and yaml-cpp.
Removed the hardcoded -DENABLE_INTEL_NPU=OFF. Add a new
PACKAGECONFIG option intel-npu to toggle NPU plugin support.
Included a patch file ("0001-Fix-intel-NPU-plugin-build-issue-with-GCC15.patch")
to address GCC15 build errors by explicitly including "" where necessary.
Fix debug source paths in generated NPU dispatcher sources.
The Intel NPU plugin file will be installed to
"/usr/lib64/openvino-2025.3.0/libopenvino_intel_npu_plugin.so".