Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 47 additions & 0 deletions include/onnxruntime/core/session/onnxruntime_ep_c_api.h
Original file line number Diff line number Diff line change
Expand Up @@ -442,6 +442,18 @@ typedef enum OrtEpDataLayout {
OrtEpDataLayout_Default = OrtEpDataLayout_NCHW,
} OrtEpDataLayout;

/**
* \brief Enumeration describing the compatibility state of a compiled model relative to an execution provider.
*
* \since Version 1.23.
*/
typedef enum OrtCompiledModelCompatibility {
OrtCompiledModelCompatibility_EP_NOT_APPLICABLE = 0,
OrtCompiledModelCompatibility_EP_SUPPORTED_OPTIMAL,
OrtCompiledModelCompatibility_EP_SUPPORTED_PREFER_RECOMPILATION,
OrtCompiledModelCompatibility_EP_UNSUPPORTED,
} OrtCompiledModelCompatibility;

/**
* \brief The OrtEp struct provides functions to implement for an execution provider.
* \since Version 1.22.
Expand Down Expand Up @@ -668,6 +680,24 @@ struct OrtEp {
ORT_API2_STATUS(CreateSyncStreamForDevice, _In_ OrtEp* this_ptr,
_In_ const OrtMemoryDevice* memory_device,
_Outptr_ OrtSyncStreamImpl** stream);

/** \brief Get a string with details about the EP stack used to produce a compiled model.
*
* This function gets a compatibility information string that contains details about the execution provider
* used to compile a given model. This string can later be used with ValidateCompiledModelCompatibilityInfo
* to determine if a compiled model is compatible with the EP.
*
* The returned string should be a null-terminated, UTF-8 encoded string. ORT will copy it.
*
* \param[in] this_ptr The OrtEp instance.
* \param[in] graph The OrtGraph instance for which to generate compatibility information.
*
* \snippet{doc} snippets.dox OrtStatus Return Value
*
* \since Version 1.23.
*/
const char*(ORT_API_CALL* GetCompiledModelCompatibilityInfo)(_In_ OrtEp* this_ptr,
_In_ const OrtGraph* graph);
Comment on lines +699 to +700
Copy link
Contributor

Choose a reason for hiding this comment

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

This should use ORT_API_T so we get consistent usage of noexcept.

};

/** \brief The function signature that ORT will call to create OrtEpFactory instances.
Expand Down Expand Up @@ -831,6 +861,23 @@ struct OrtEpFactory {
*/
ORT_API_T(const char*, GetVersion, _In_ const OrtEpFactory* this_ptr);

/** \brief Validate the compatibility of a compiled model with the execution provider.
*
* This function validates if a model produced with the supplied compatibility info string is supported by the underlying EP.
* The EP should check if a compiled model is compatible with the EP and set the model_compatibility parameter accordingly.
*
* \param[in] this_ptr The OrtEpFactory instance.
* \param[in] compatibility_info The compatibility information string that will be used
* \param[out] model_compatibility OrtCompiledModelCompatibility enum value describing the compatibility of the model with the EP.
*
* \snippet{doc} snippets.dox OrtStatus Return Value
*
* \since Version 1.23.
*/
OrtStatus*(ORT_API_CALL* ValidateCompiledModelCompatibilityInfo)(_In_ OrtEpFactory* this_ptr,
Copy link
Contributor

Choose a reason for hiding this comment

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

This should use ORT_API2_STATUS so we get consistent usage of noexcept.

_In_ const char* compatibility_info,
_Out_ OrtCompiledModelCompatibility* model_compatibility);

/** \brief Create an OrtAllocator that can be shared across sessions for the given OrtMemoryInfo.
*
* The factory that creates the EP is responsible for providing the allocators required by the EP.
Expand Down
Loading