[Plugin EP] Add OrtEp::OnSessionInitializationEnd()
Merged
AD
6mo ago+74+74+01234567890123456789-1-1-0123456789
Description
Port IExecutionProvider::OnSessionInitializationEnd() to the public plugin EP C API (OrtEp struct).
This gives plugin EP authors an opportunity to synchronize and clean up temporary resources after session initialization is complete, reducing memory usage and ensuring the first inference run is fast.
Changes
onnxruntime_ep_c_api.h— Added optionalOnSessionInitializationEndfunction pointer to end ofOrtEpstruct (\since Version 1.27).ep_plugin_provider_interfaces.h/.cc— AddedPluginExecutionProvider::OnSessionInitializationEnd()override that delegates to theOrtEpcallback with version (< 27) and null guards.ep_plugin_provider_test.cc— Added 4 unit tests covering: null callback fallback, success, error propagation, and old-version fallback.
Motivation and Context
OnSessionInitializationEnd() already exists on the internal IExecutionProvider (used by DML EP, for example). Plugin EPs built as shared libraries against the public C API had no way to receive this notification. This change closes that gap.
Test Coverage
| Test | Scenario |
|---|---|
OnSessionInitializationEnd_NullCallback | NULL pointer falls back to base class (OK) |
OnSessionInitializationEnd_Success | Callback returns OK |
OnSessionInitializationEnd_Error | Error status propagates |
OnSessionInitializationEnd_OldVersionFallback | Version < 27 bypasses callback |