Skip to content

Conversation

@mschofie
Copy link
Member

Description

LoadPluginOrProviderBridge is called when attempting to load a Plugin. It uses the passed library_path to attempt to load the Plugin as a Provider - using ProviderLibrary - to see if it can be treated as a 'ProviderBridge'. ProviderLibrary attempts to load the Provider by prefixing the path to the onnxruntime.dll. Plugins needn't be redistributed with OnnxRuntime, so the path to the Plugin may be an absolute path, and if so ProviderLibrary fails. At the same time - however - LoadPluginOrProviderBridge needs to support OnnxRuntime-relative paths: As 'Providers' are migrated to 'Plugins', existing Providers should be usable as Plugins. To accommodate both scenarios, this PR:

  1. Adds support to ProviderLibrary to be created with an absolute path.
  2. Validates the path passed to LoadPluginOrProviderBridge;
    1. if it is absolute, the same absolute path is passed to ProviderLibrary and EpLibraryPlugin.
    2. if the path is not absolute, it is converted to an absolute path by prefixing the OnnxRuntime location, and the same path is passed to ProviderLibrary and EpLibraryPlugin.

Motivation and Context

This PR enables LoadPluginOrProviderBridge to be called with an absolute path to the Plugin, allowing it to be used as a 'ProviderBridge', or with an OnnxRuntime-relative path to the Plugin.

@mschofie mschofie requested a review from skottmckay April 29, 2025 03:21
Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can commit the suggested changes from lintrunner.

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
@skottmckay skottmckay merged commit ad5b97b into main Apr 29, 2025
82 of 88 checks passed
@skottmckay skottmckay deleted the mschofie/absolute-library-path branch April 29, 2025 07:15
vraspar pushed a commit that referenced this pull request May 1, 2025
…#24587)

### Description
`LoadPluginOrProviderBridge` is called when attempting to load a Plugin.
It uses the passed `library_path` to attempt to load the Plugin as a
`Provider` - using `ProviderLibrary` - to see if it can be treated as a
'ProviderBridge'. `ProviderLibrary` attempts to load the Provider by
prefixing the path to the onnxruntime.dll. Plugins needn't be
redistributed with OnnxRuntime, so the path to the Plugin _may_ be an
absolute path, and if so `ProviderLibrary` fails. At the same time -
however - `LoadPluginOrProviderBridge` needs to support
OnnxRuntime-relative paths: As 'Providers' are migrated to 'Plugins',
existing Providers should be usable as Plugins. To accommodate both
scenarios, this PR:

1. Adds support to `ProviderLibrary` to be created with an absolute
path.
2. Validates the path passed to `LoadPluginOrProviderBridge`;
1. if it is absolute, the same absolute path is passed to
`ProviderLibrary` and `EpLibraryPlugin`.
2. if the path is not absolute, it is converted to an absolute path by
prefixing the OnnxRuntime location, and the same path is passed to
`ProviderLibrary` and `EpLibraryPlugin`.

### Motivation and Context
This PR enables `LoadPluginOrProviderBridge` to be called with an
absolute path to the Plugin, allowing it to be used as a
'ProviderBridge', or with an OnnxRuntime-relative path to the Plugin.

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
jywu-msft pushed a commit that referenced this pull request May 1, 2025
### Description

Cherry pick the following into
[rel-1.22.0](https://github.com/microsoft/onnxruntime/tree/rel-1.22.0)

- (#24491)
- (#24509)
- (#24564)
- (#24574)
- (#24582)
- (#24584)
- (#24568)
- (#24587)
- (#24563)
- (#24592)
- (#24526)
- (#24552)
- (#24588)
- (#24605)
- (#24606)

---------

Co-authored-by: Jing Fang <[email protected]>
Co-authored-by: Tianlei Wu <[email protected]>
Co-authored-by: Baiju Meswani <[email protected]>
Co-authored-by: Scott McKay <[email protected]>
Co-authored-by: Mark Schofield <[email protected]>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Edward Chen <[email protected]>
Co-authored-by: Ashwath Shankarnarayan <[email protected]>
Co-authored-by: saurabh <[email protected]>
Co-authored-by: Adrian Lizarraga <[email protected]>
Co-authored-by: Hector Li <[email protected]>
ankitm3k pushed a commit to intel/onnxruntime that referenced this pull request May 12, 2025
…microsoft#24587)

### Description
`LoadPluginOrProviderBridge` is called when attempting to load a Plugin.
It uses the passed `library_path` to attempt to load the Plugin as a
`Provider` - using `ProviderLibrary` - to see if it can be treated as a
'ProviderBridge'. `ProviderLibrary` attempts to load the Provider by
prefixing the path to the onnxruntime.dll. Plugins needn't be
redistributed with OnnxRuntime, so the path to the Plugin _may_ be an
absolute path, and if so `ProviderLibrary` fails. At the same time -
however - `LoadPluginOrProviderBridge` needs to support
OnnxRuntime-relative paths: As 'Providers' are migrated to 'Plugins',
existing Providers should be usable as Plugins. To accommodate both
scenarios, this PR:

1. Adds support to `ProviderLibrary` to be created with an absolute
path.
2. Validates the path passed to `LoadPluginOrProviderBridge`;
1. if it is absolute, the same absolute path is passed to
`ProviderLibrary` and `EpLibraryPlugin`.
2. if the path is not absolute, it is converted to an absolute path by
prefixing the OnnxRuntime location, and the same path is passed to
`ProviderLibrary` and `EpLibraryPlugin`.

### Motivation and Context
This PR enables `LoadPluginOrProviderBridge` to be called with an
absolute path to the Plugin, allowing it to be used as a
'ProviderBridge', or with an OnnxRuntime-relative path to the Plugin.

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
@snnn
Copy link
Contributor

snnn commented Sep 5, 2025

This PR has been included in the rel-1.22.0 branch. Removing the release:1.22.0 label.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants