@@ -3423,25 +3423,86 @@ ORT_API_STATUS_IMPL(OrtApis::CopyTensors, _In_ const OrtEnv* env,
34233423 API_IMPL_END
34243424}
34253425
3426+ // Validate compiled model compatibility info for specific EP device(s)
3427+ ORT_API_STATUS_IMPL (OrtApis::GetModelCompatibilityForEpDevices,
3428+ _In_reads_ (num_ep_devices) const OrtEpDevice* const * ep_devices,
3429+ _In_ size_t num_ep_devices,
3430+ _In_ const char* compatibility_info,
3431+ _Out_ OrtCompiledModelCompatibility* out_status) {
3432+ API_IMPL_BEGIN
3433+ if (ep_devices == nullptr || num_ep_devices == 0 || compatibility_info == nullptr || out_status == nullptr ) {
3434+ return OrtApis::CreateStatus (ORT_INVALID_ARGUMENT, " Invalid argument provided to GetModelCompatibilityForEpDevices." );
3435+ }
3436+
3437+ // Validate inputs and ensure all devices belong to the same EP/factory
3438+ const OrtEpFactory* first_factory = nullptr ;
3439+ for (size_t i = 0 ; i < num_ep_devices; ++i) {
3440+ if (ep_devices[i] == nullptr ) {
3441+ return OrtApis::CreateStatus (ORT_INVALID_ARGUMENT, " ep_devices contains a null entry." );
3442+ }
3443+ const OrtEpFactory* f = ep_devices[i]->GetMutableFactory ();
3444+ if (i == 0 ) {
3445+ first_factory = f;
3446+ } else if (f != first_factory) {
3447+ return OrtApis::CreateStatus (ORT_INVALID_ARGUMENT, " All ep_devices must be from the same execution provider." );
3448+ }
3449+ }
3450+
3451+ OrtCompiledModelCompatibility status = OrtCompiledModelCompatibility_EP_NOT_APPLICABLE;
3452+ OrtStatus* ort_status = nullptr ;
3453+ OrtEpFactory* factory = ep_devices[0 ]->GetMutableFactory ();
3454+ if (factory && factory->ValidateCompiledModelCompatibilityInfo ) {
3455+ // collect hardware devices corresponding to the ep_devices
3456+ InlinedVector<const OrtHardwareDevice*> hardware_devices;
3457+ hardware_devices.reserve (num_ep_devices);
3458+ for (size_t i = 0 ; i < num_ep_devices; ++i) {
3459+ hardware_devices.push_back (ep_devices[i]->device );
3460+ }
3461+ ort_status = factory->ValidateCompiledModelCompatibilityInfo (factory,
3462+ hardware_devices.data (),
3463+ hardware_devices.size (),
3464+ compatibility_info,
3465+ &status);
3466+ }
3467+ if (ort_status != nullptr ) {
3468+ return ToOrtStatus (ToStatusAndRelease (ort_status));
3469+ }
3470+
3471+ *out_status = status;
3472+ return nullptr ;
3473+ API_IMPL_END
3474+ }
3475+
34263476#else // defined(ORT_MINIMAL_BUILD)
34273477ORT_API_STATUS_IMPL (OrtApis::RegisterExecutionProviderLibrary, _In_ OrtEnv* /* env*/ , _In_ const char * /* registration_name*/ ,
34283478 const ORTCHAR_T* /* path*/ ) {
34293479 API_IMPL_BEGIN
3430- return OrtApis::CreateStatus (ORT_NOT_IMPLEMENTED, " This API in not supported in a minimal build." );
3480+ return OrtApis::CreateStatus (ORT_NOT_IMPLEMENTED, " RegisterExecutionProviderLibrary is not supported in a minimal build." );
34313481 API_IMPL_END
34323482}
34333483
34343484ORT_API_STATUS_IMPL (OrtApis::UnregisterExecutionProviderLibrary, _In_ OrtEnv* /* env*/ ,
34353485 _In_ const char * /* registration_name*/ ) {
34363486 API_IMPL_BEGIN
3437- return OrtApis::CreateStatus (ORT_NOT_IMPLEMENTED, " This API in not supported in a minimal build." );
3487+ return OrtApis::CreateStatus (ORT_NOT_IMPLEMENTED, " UnregisterExecutionProviderLibrary is not supported in a minimal build." );
34383488 API_IMPL_END
34393489}
34403490
34413491ORT_API_STATUS_IMPL (OrtApis::GetEpDevices, _In_ const OrtEnv* /* env*/ ,
34423492 _Outptr_ const OrtEpDevice* const ** /* ep_devices*/ , _Out_ size_t * /* num_ep_devices*/ ) {
34433493 API_IMPL_BEGIN
3444- return OrtApis::CreateStatus (ORT_NOT_IMPLEMENTED, " This API in not supported in a minimal build." );
3494+ return OrtApis::CreateStatus (ORT_NOT_IMPLEMENTED, " GetEpDevices is not supported in a minimal build." );
3495+ API_IMPL_END
3496+ }
3497+
3498+ // Minimal build stub for GetModelCompatibilityForEpDevices to satisfy symbol references from the API table
3499+ ORT_API_STATUS_IMPL (OrtApis::GetModelCompatibilityForEpDevices,
3500+ _In_reads_ (num_ep_devices) const OrtEpDevice* const * /* ep_devices*/ ,
3501+ _In_ size_t /* num_ep_devices*/ ,
3502+ _In_ const char* /* compatibility_info*/ ,
3503+ _Out_ OrtCompiledModelCompatibility* /* out_status*/ ) {
3504+ API_IMPL_BEGIN
3505+ return OrtApis::CreateStatus (ORT_NOT_IMPLEMENTED, " GetModelCompatibilityForEpDevices is not supported in a minimal build." );
34453506 API_IMPL_END
34463507}
34473508
@@ -3453,7 +3514,7 @@ ORT_API_STATUS_IMPL(OrtApis::SessionOptionsAppendExecutionProvider_V2, _In_ OrtS
34533514 _In_reads_(num_op_options) const char* const * /* ep_option_vals*/ ,
34543515 size_t /* num_ep_options*/ ) {
34553516 API_IMPL_BEGIN
3456- return OrtApis::CreateStatus (ORT_NOT_IMPLEMENTED, " This API in not supported in a minimal build." );
3517+ return OrtApis::CreateStatus (ORT_NOT_IMPLEMENTED, " SessionOptionsAppendExecutionProvider_V2 is not supported in a minimal build." );
34573518 API_IMPL_END
34583519}
34593520
@@ -3466,15 +3527,15 @@ ORT_API_STATUS_IMPL(OrtApis::SessionGetEpDeviceForInputs, _In_ const OrtSession*
34663527 _Out_writes_ (num_values) const OrtEpDevice** /* inputs_ep_devices*/ ,
34673528 _In_ size_t /* num_values*/ ) {
34683529 API_IMPL_BEGIN
3469- return OrtApis::CreateStatus (ORT_NOT_IMPLEMENTED, " This API in not supported in a minimal build." );
3530+ return OrtApis::CreateStatus (ORT_NOT_IMPLEMENTED, " SessionGetEpDeviceForInputs is not supported in a minimal build." );
34703531 API_IMPL_END
34713532}
34723533
34733534ORT_API_STATUS_IMPL (OrtApis::CreateSyncStreamForEpDevice, _In_ const OrtEpDevice* /* ep_device*/ ,
34743535 _In_opt_ const OrtKeyValuePairs* /* stream_options*/ ,
34753536 _Outptr_ OrtSyncStream** /* ort_stream*/ ) {
34763537 API_IMPL_BEGIN
3477- return OrtApis::CreateStatus (ORT_NOT_IMPLEMENTED, " This API in not supported in a minimal build." );
3538+ return OrtApis::CreateStatus (ORT_NOT_IMPLEMENTED, " CreateSyncStreamForEpDevice is not supported in a minimal build." );
34783539 API_IMPL_END
34793540}
34803541
@@ -3493,7 +3554,7 @@ ORT_API_STATUS_IMPL(OrtApis::CopyTensors, _In_ const OrtEnv* /*env*/,
34933554 _In_opt_ OrtSyncStream* /* stream*/ ,
34943555 _In_ size_t /* num_tensors*/ ) {
34953556 API_IMPL_BEGIN
3496- return OrtApis::CreateStatus (ORT_NOT_IMPLEMENTED, " This API in not supported in a minimal build." );
3557+ return OrtApis::CreateStatus (ORT_NOT_IMPLEMENTED, " CopyTensors is not supported in a minimal build." );
34973558 API_IMPL_END
34983559}
34993560
@@ -4108,6 +4169,7 @@ static constexpr OrtApi ort_api_1_to_23 = {
41084169 &OrtApis::CopyTensors,
41094170
41104171 &OrtApis::Graph_GetModelMetadata,
4172+ &OrtApis::GetModelCompatibilityForEpDevices,
41114173};
41124174
41134175// OrtApiBase can never change as there is no way to know what version of OrtApiBase is returned by OrtGetApiBase.
0 commit comments