forked from microsoft/onnxruntime
-
Notifications
You must be signed in to change notification settings - Fork 61
[CVS-188379] Add sxs manifest support for openvino.dll #1133
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
Open
n1harika
wants to merge
11
commits into
SxS_Manifest
Choose a base branch
from
niharika/sxs_manifest
base: SxS_Manifest
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 2 commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
1892962
Add sxs manifest support for openvino.dll
n1harika 23fa71f
Merge branch 'ovep-develop' into niharika/sxs_manifest
n1harika 27231a7
Remove signatures before embedding manifests
n1harika 5a7b680
copilot review
n1harika 9d33480
copilot review 2
n1harika 183efbe
Merge branch 'ovep-develop' into niharika/sxs_manifest
n1harika 0cdd53a
copilot review 3
n1harika 2324bb6
coplito review 4
n1harika 7d98ea6
revert cmake change
n1harika 8f89679
all configs are staged- revoke copilot comment
n1harika 96c47ce
Merge branch 'ovep-develop' into niharika/sxs_manifest
MayureshV1 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| <?xml version="1.0" encoding="UTF-8" standalone="yes"?> | ||
| <!-- | ||
| Windows SxS private assembly manifest for the OpenVINO runtime bundled with | ||
| onnxruntime_providers_openvino.dll (legacy EP). | ||
| Installed as bin/openvino_runtime.manifest alongside the provider DLL. | ||
| Version matches the ORT version (MAJOR.MINOR.PATCH.0). | ||
| Configured at build time by CMakeLists.txt — do not edit by hand. | ||
| --> | ||
| <assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0"> | ||
| <assemblyIdentity type="win32" name="openvino_runtime" | ||
| version="@ORT_SXS_VERSION@.0" processorArchitecture="amd64" /> | ||
| @ORT_SXS_ASSEMBLY_FILE_ENTRIES@</assembly> | ||
|
n1harika marked this conversation as resolved.
n1harika marked this conversation as resolved.
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| <?xml version="1.0" encoding="UTF-8" standalone="yes"?> | ||
| <!-- | ||
| SxS dependency manifest embedded into each OV/TBB DLL and | ||
| onnxruntime_providers_openvino.dll. | ||
| Declares a dependency on the openvino_runtime private assembly at the EP version, | ||
| matching the version in assembly.manifest.in. | ||
| Generated by cmake/sxs/embed_manifests.cmake — do not edit by hand. | ||
| --> | ||
| <assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0"> | ||
| <assemblyIdentity type="win32" name="${DLL_BASE_NAME}" | ||
| version="${EP_FILE_VERSION}" processorArchitecture="amd64" /> | ||
|
n1harika marked this conversation as resolved.
|
||
| <dependency> | ||
| <dependentAssembly> | ||
| <assemblyIdentity type="win32" name="openvino_runtime" | ||
| version="${EP_FILE_VERSION}" processorArchitecture="amd64" /> | ||
|
n1harika marked this conversation as resolved.
|
||
| </dependentAssembly> | ||
|
n1harika marked this conversation as resolved.
|
||
| </dependency> | ||
| </assembly> | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,117 @@ | ||
| # Copyright (C) Intel Corporation | ||
| # Licensed under the MIT License | ||
| # | ||
| # Install-time CMake script: embeds SxS manifests into OV+TBB DLLs and | ||
| # onnxruntime_providers_openvino.dll. | ||
| # Run via install(SCRIPT ...) after OV/TBB binaries are installed. | ||
| # | ||
| # Variables injected by install(CODE) in onnxruntime_providers_openvino.cmake: | ||
| # CMAKE_MT — absolute path to mt.exe | ||
| # SXS_SOURCE_DIR — cmake/sxs/ source directory | ||
| # EP_FILE_VERSION — EP version in A.B.C.D form (e.g. 1.28.0.0) | ||
| # OV_TBB_DLL_NAMES — semicolon-separated list of OV+TBB DLL filenames | ||
|
|
||
| cmake_minimum_required(VERSION 3.28) | ||
|
|
||
| set(PROVIDER_DLL_NAME "onnxruntime_providers_openvino") | ||
|
|
||
| # --------------------------------------------------------------------------- | ||
| # Helpers | ||
| # --------------------------------------------------------------------------- | ||
|
|
||
| # Embed a manifest into a DLL as RT_MANIFEST resource ID 2. | ||
| # If the DLL already has a resource ID 2 manifest it is extracted and merged first. | ||
| # Temporary files are written next to the DLL and deleted on completion. | ||
| function(ort_sxs_embed_manifest DLL_PATH MANIFEST_PATH) | ||
| get_filename_component(_dll_dir "${DLL_PATH}" DIRECTORY) | ||
| get_filename_component(_dll_name_we "${DLL_PATH}" NAME_WE) | ||
| set(_existing "${_dll_dir}/existing_${_dll_name_we}.manifest") | ||
|
|
||
| # Try to extract any existing RT_MANIFEST resource ID 2. | ||
| execute_process( | ||
| COMMAND "${CMAKE_MT}" -nologo | ||
| "-inputresource:${DLL_PATH};2" | ||
| "-out:${_existing}" | ||
| RESULT_VARIABLE _rc | ||
| OUTPUT_QUIET ERROR_QUIET) | ||
|
|
||
| if(_rc EQUAL 0 AND EXISTS "${_existing}") | ||
| # Merge existing + new dep manifest, then re-embed. | ||
| execute_process( | ||
| COMMAND "${CMAKE_MT}" -nologo | ||
| "-manifest" "${_existing}" "${MANIFEST_PATH}" | ||
| "-outputresource:${DLL_PATH};2" | ||
| RESULT_VARIABLE _rc2) | ||
| file(REMOVE "${_existing}") | ||
| if(NOT _rc2 EQUAL 0) | ||
| message(FATAL_ERROR | ||
| "SxS manifest embedding: mt.exe merge failed for '${DLL_PATH}' (exit ${_rc2}).") | ||
| endif() | ||
| else() | ||
| # No existing manifest — embed the new one directly. | ||
| execute_process( | ||
| COMMAND "${CMAKE_MT}" -nologo | ||
| "-manifest" "${MANIFEST_PATH}" | ||
| "-outputresource:${DLL_PATH};2" | ||
| RESULT_VARIABLE _rc2) | ||
| if(NOT _rc2 EQUAL 0) | ||
| message(FATAL_ERROR | ||
| "SxS manifest embedding: mt.exe embed failed for '${DLL_PATH}' (exit ${_rc2}).") | ||
| endif() | ||
| endif() | ||
|
n1harika marked this conversation as resolved.
Outdated
|
||
| endfunction() | ||
|
|
||
| # --------------------------------------------------------------------------- | ||
| # Resolve install directory | ||
| # --------------------------------------------------------------------------- | ||
|
|
||
| if(DEFINED ORT_SXS_BIN_DIR AND NOT ORT_SXS_BIN_DIR STREQUAL "") | ||
| set(BIN_DIR "${ORT_SXS_BIN_DIR}") | ||
| else() | ||
| set(BIN_DIR "${CMAKE_INSTALL_PREFIX}/bin") | ||
| endif() | ||
| message(STATUS "SxS manifest embedding: processing '${BIN_DIR}'") | ||
|
|
||
| # --------------------------------------------------------------------------- | ||
| # Step 1: Embed dep manifests into each OV+TBB DLL | ||
| # --------------------------------------------------------------------------- | ||
|
|
||
| foreach(_name IN LISTS OV_TBB_DLL_NAMES) | ||
| set(_dll "${BIN_DIR}/${_name}") | ||
| if(NOT EXISTS "${_dll}") | ||
| continue() # DLL absent for this config (e.g. debug-only DLL in a Release build) | ||
| endif() | ||
| get_filename_component(_name_we "${_name}" NAME_WE) | ||
| set(DLL_BASE_NAME "${_name_we}") | ||
| set(_dep_manifest "${BIN_DIR}/${_name_we}.dep.manifest") | ||
| configure_file("${SXS_SOURCE_DIR}/dep.manifest.in" "${_dep_manifest}") | ||
| ort_sxs_embed_manifest("${_dll}" "${_dep_manifest}") | ||
| file(REMOVE "${_dep_manifest}") | ||
| message(STATUS "SxS manifest embedding: embedded dep manifest in ${_name_we}.dll") | ||
| endforeach() | ||
|
|
||
| # --------------------------------------------------------------------------- | ||
| # Step 2: Embed dep manifest into onnxruntime_providers_openvino.dll | ||
| # --------------------------------------------------------------------------- | ||
|
|
||
| # The provider DLL may be installed to bin/ or lib/ depending on whether it's | ||
| # a SHARED or MODULE library. Check both locations. | ||
| set(_provider_dll "${BIN_DIR}/${PROVIDER_DLL_NAME}.dll") | ||
| if(NOT EXISTS "${_provider_dll}") | ||
| # Try the lib/ sibling directory (MODULE libraries install to LIBRARY dest) | ||
| get_filename_component(_prefix "${BIN_DIR}" DIRECTORY) | ||
| set(_provider_dll "${_prefix}/lib/${PROVIDER_DLL_NAME}.dll") | ||
| endif() | ||
| if(NOT EXISTS "${_provider_dll}") | ||
| message(FATAL_ERROR | ||
| "SxS manifest embedding: '${PROVIDER_DLL_NAME}.dll' not found in '${BIN_DIR}' or '${_prefix}/lib'.") | ||
| endif() | ||
|
|
||
| set(DLL_BASE_NAME "${PROVIDER_DLL_NAME}") | ||
| set(_dep_manifest "${BIN_DIR}/${PROVIDER_DLL_NAME}.dep.manifest") | ||
| configure_file("${SXS_SOURCE_DIR}/dep.manifest.in" "${_dep_manifest}") | ||
| ort_sxs_embed_manifest("${_provider_dll}" "${_dep_manifest}") | ||
| file(REMOVE "${_dep_manifest}") | ||
| message(STATUS "SxS manifest embedding: embedded dep manifest in ${PROVIDER_DLL_NAME}.dll") | ||
|
|
||
| message(STATUS "SxS manifest embedding: done") | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.