onnxruntime icon indicating copy to clipboard operation
onnxruntime copied to clipboard

[EP ABI] Add CreateCustomOpDomains() API for plugin EP to register custom ops

Open chilo-ms opened this issue 2 months ago • 0 comments

Description

Currently, the provider-bridge TRT RTX EP and TRT EP supports registering custom op domain list in session option so that it can run model contains TRT specific custom ops.

This PR adds the same feature for plugin EP.

The newly added two APIs, CreateCustomOpDomains() and GetNumCustomOpDomains, is used when running inference on a model that contains EP-specific custom operations.

Workflow:

  1. The EP implements these functions to supply a list of OrtCustomOpDomain instances.
  2. The application calls SessionOptionsAppendExecutionProvider_V2() with the OrtEpDevice containing the plugin EP's factory.
  3. SessionOptionsAppendExecutionProvider_V2() internally appends the provided OrtCustomOpDomain list to the session options.

As a result, any session created from these session options will have these custom op domains registered in ORT, ensuring that the custom ops are properly recognized and validated when the model is loaded.

Node: For compile-based EPs, the EP does not need to provide a concrete kernel implementation for each custom op. Instead, it may provide only placeholder custom ops with the correct names so they can be recognized during model loading.

Motivation and Context

chilo-ms avatar Dec 09 '25 06:12 chilo-ms