Skip to content

[DRAFT] EP ABI #24887

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

Draft
wants to merge 26 commits into
base: main
Choose a base branch
from
Draft

[DRAFT] EP ABI #24887

wants to merge 26 commits into from

Conversation

adrianlizarraga
Copy link
Contributor

@adrianlizarraga adrianlizarraga commented May 28, 2025

Description

This PRs sets the foundation for the EP ABI, which allows plugin-EPs to interface with ORT using a binary stable interface. A plugin-EP can be built separately from ORT and is not tied to a specific commit of ORT.

Currently, this PR adds basic APIs necessary to allow an example plugin-EP to compile and run a simple model with a single Mul node.

Motivation and Context

Based on #21450

Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR lays the groundwork for a binary-stable plugin EP ABI in ORT, adds a sample plugin EP that runs a single Mul operator, and extends the core/session stack and C APIs to load and invoke plugin EPs.

  • Introduce example_plugin_ep.cc showing how a plugin-EP implements OrtEp and node compute callbacks.
  • Extend the C API (onnxruntime_c_api.h, ep_api.h/cc) and internal types (abi_ep_types.h, ep_plugin_provider_interfaces.*) to support graph/node enumeration and OrtNodeComputeInfo.
  • Update session creation and partitioner code (utils.cc, provider_policy_context.cc, graph_partitioner.cc, etc.) to recognize and wrap plugin EPs.

Reviewed Changes

Copilot reviewed 22 out of 22 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
test/autoep/library/example_plugin_ep.cc Sample EP implementation with MulKernel and EP API usage.
include/onnxruntime/core/session/onnxruntime_c_api.h Add OrtNodeComputeInfo and NodeComputeContext_NodeName.
core/session/ep_api.h / ep_api.cc Implement Graph_Get*, Node_Get*, and EpGraphSupportInfo_AddSupportedNodes.
core/session/ep_plugin_provider_interfaces.* Define PluginExecutionProviderFactory and PluginExecutionProvider.
core/session/utils.cc Construct plugin vs. internal EP factory based on devices.
core/session/provider_policy_context.cc Invoke CreateEp instead of ORT_NOT_IMPLEMENTED.
core/session/ep_factory_internal.* Change constructor signatures to use gsl::span.
core/graph/model_editor_api_types.* / model_editor_c_api.cc Add internal/external conversion and null checks.
core/graph/graph.cc Adapt LoadFromModelEditorApiModel to new ModelEditorGraph.
core/framework/graph_partitioner.cc Update PlaceNode to accept ComputeCapability and handle subgraphs.
core/framework/compute_capability.h Add use_subgraph_name_as_fused_node_name flag.
Comments suppressed due to low confidence (2)

onnxruntime/test/autoep/library/example_plugin_ep.cc:115

  • [nitpick] The variable name type_shape0 is ambiguous. Consider renaming to type_shape_info_input0 (and similarly for type_shape1) for clarity.
OrtTensorTypeAndShapeInfo* type_shape0 = nullptr;

onnxruntime/core/framework/graph_partitioner.cc:366

  • The code now takes a ComputeCapability but still refers to capability.sub_graph, which no longer exists on that type. You need to either restore the IndexedSubGraph parameter or update the logic to use the correct subgraph member from ComputeCapability.
if (nullptr == capability.sub_graph->GetMetaDef()) {

@jywu-msft jywu-msft requested a review from HectorSVC May 31, 2025 20:20
@adrianlizarraga adrianlizarraga requested a review from Copilot May 31, 2025 20:43
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR establishes the foundation for a binary stable EP ABI that enables plugin execution providers (EPs) to interface with ORT independently of a specific commit. The key changes include introducing basic EP APIs with an example plugin-EP implementation, extending C API functionality for EP operations and graph manipulation, and updating internal EP and graph types.

Reviewed Changes

Copilot reviewed 22 out of 22 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
onnxruntime/test/autoep/library/example_plugin_ep.cc Implements the Mul kernel and sets up plugin EP API methods.
onnxruntime/core/session/utils.cc & provider_policy_context.cc Changes to EP factory/provider selection and error propagation.
onnxruntime/core/session/model_editor_c_api.cc Converts internal model editor types to external representations.
onnxruntime/core/session/ep_plugin_provider_interfaces.{h,cc} Introduces plugin EP factory and provider implementations.
Other files (ep_api, ep_factory_internal, graph partitioner, etc.) Updates to support the new EP ABI and internal type enhancements.

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.

1 participant