[Plugin EP] Add examples for how to run a plugin EP with C++ and Python#536
Open
[Plugin EP] Add examples for how to run a plugin EP with C++ and Python#536
Conversation
Added prerequisites for running inference with a Plugin EP.
Refactor plugin EP registration and session creation for TensorRTEp.
Added instructions for running inference with explicit and automatic EP selection.
Added a note about the location of the mul_1.onnx file.
Updated the README to include code examples for running inference with a Plugin EP and clarified the steps for explicit and automatic EP selection.
Updated README to reflect C++ API usage instead of Python API and added additional prerequisites.
| - A dynamic/shared EP library that exports the functions `CreateEpFactories()` and `ReleaseEpFactory()`. | ||
| - ONNX Runtime built as a shared library (e.g., `onnxruntime.dll` on Windows or `libonnxruntime.so` on Linux), since the EP library relies on the public ORT C API (which is ABI-stable) to interact with ONNX Runtime. | ||
| - The `onnxruntime_providers_shared.dll` (Windows) or `libonnxruntime_providers_shared.so` (Linux) is also required. When a plugin EP is registered, ONNX Runtime internally calls `LoadPluginOrProviderBridge`, which depends on this shared library to determine whether the EP DLL is a plugin or a provider-bridge. | ||
| - If you are using a pre-built ONNX Runtime package, all required libraries (e.g., `onnxruntime.dll`, `onnxruntime_providers_shared.dll`, etc.) are already included. |
Contributor
There was a problem hiding this comment.
The onnxruntime_providers_shared.dll is not required for new EPs that are only using the new binary-stable APIs. If this example is only meant for new EPs, perhaps we don't need to mention it?
Contributor
Author
There was a problem hiding this comment.
Hmm, i think this example is for how to run ORT inference with a plugin ep, so it's worth mentioning onnxruntime_providers_shared.dll is also required.
If users only have onnxruntime.dll but no onnxruntime_providers_shared.dll is present, it will get following error:
unknown file: error: C++ exception with description "C:\Users\lochi\repos\onnxruntime\onnxruntime\core\session\provider_bridge_ort.cc:1789 onnxruntime::ProviderSharedLibrary::Ensure [ONNXRuntimeError] : 1 : FAIL : Error loading "C:\Users\lochi\repos\plugin_trt_ep_test\plugin_execution_providers\test\tensorrt\build\Debug\onnxruntime_providers_shared.dll" which is missing. (Error 126: "The specified module could not be found.")
" thrown in the test body.
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Add two examples to show users how to run a plugin EP with C++ and Python respectively.