GetCustomOpDomains property

Pointer<NativeFunction<OrtStatusPtr Function(Pointer<OrtEpFactory> this_ptr, Pointer<Pointer<OrtCustomOpDomain>> domains, Size num_domains)>> GetCustomOpDomains
getter/setter pair

\brief Gets the EP-specific OrtCustomOpDomains.

This function is used when running inference on a model that contains EP-specific custom operations.

Workflow:

  1. The EP factory implements this function to supply a list of OrtCustomOpDomain instances.
  2. The application either 1) calls SessionOptionsAppendExecutionProvider_V2() with an OrtEpDevice containing the plugin EP's factory or 2) enables auto ep selection.
    1. SessionOptionsAppendExecutionProvider_V2() appends the provided OrtCustomOpDomains to the session options or 2) ORT registers the OrtCustomOpDomains provided by the EP devices that could be potentially selected.

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.

Plugin EPs can provide two types of custom ops:

  1. A full OrtCustomOp with a concrete kernel implementation
  • A Plugin EP can supply an OrtCustomOp and a corresponding CustomKernel::Compute() implementation.
  • In GetCapability(), it calls EpGraphSupportInfo_AddSingleNode() to inform ORT that the custom node should NOT be fused or compiled. Instead, ORT should invoke the custom node's Compute() function at runtime.
  1. A "placeholder" OrtCustomOp with an empty kernel implementation
  • A compile-based Plugin EP can supply an OrtCustomOp whose CustomKernel::Compute() does nothing. The purpose is to satisfy model validation during model loading by registering the custom op as a valid operator in the session.
  • In GetCapability(), the EP should call EpGraphSupportInfo_AddNodesToFuse() to notify ORT that this custom node should be fused and compiled by the EP.
  • In Compile(), the EP executes its compiled bits to perform inference for the fused custom node.

Note: The OrtCustomOpDomain instances must be valid while any session is using them. EP factory has the responsibility to release OrtCustomOpDomain instances it creates. It happens automatically if using the C++ Ort::CustomOpDomain class.

\paramin this_ptr The OrtEpFactory instance. \paramout domains Array of num_domains elements pre-allocated by ORT that should be filled with OrtCustomOpDomain instances created by the EP. The num_domains is the value returned by GetNumCustomOpDomains(). \paramin num_domains The size of the domains array pre-allocated by ORT.

\snippet{doc} snippets.dox OrtStatus Return Value

\since Version 1.24.

Implementation

external ffi.Pointer<
  ffi.NativeFunction<
    OrtStatusPtr Function(
      ffi.Pointer<OrtEpFactory> this_ptr,
      ffi.Pointer<ffi.Pointer<OrtCustomOpDomain>> domains,
      ffi.Size num_domains,
    )
  >
>
GetCustomOpDomains;