GetCompatibilityInfoFromModel property
\brief Extract EP compatibility info from a precompiled model file.
Parses the model file to extract the compatibility info string for a specific execution provider from the model's metadata properties. This is only applicable to models that have been precompiled for an EP (e.g., via OrtCompileApi). Standard ONNX models do not contain this information.
The compatibility info string must be valid UTF-8 without embedded NUL characters.
\note This API performs standalone model parsing, separate from session creation. This means the protobuf parsing cost is incurred here and again during session creation. It is intended for scenarios where applications need to check compatibility before deciding whether to proceed with session creation, such as providing early user feedback.
\note This operation parses the full ONNX ModelProto from disk. For very large models, consider using GetCompatibilityInfoFromModelBytes with a pre-loaded buffer if the model is already in memory.
The compatibility info can then be passed to GetModelCompatibilityForEpDevices to check if a precompiled model is compatible with the current system.
\paramin model_path Path to the ONNX model file.
\paramin ep_type The execution provider type string. Must be non-empty.
Use OrtApi::EpDevice_EpName to get this value from an OrtEpDevice.
\paramin allocator Allocator to use for the output string. Use OrtApi::GetAllocatorWithDefaultOptions.
\paramout compatibility_info Output pointer to the compatibility info string.
Returns nullptr if no compatibility info exists for the specified EP.
Caller must free with OrtApi::AllocatorFree when non-null.
\snippet{doc} snippets.dox OrtStatus Return Value
\since Version 1.24.
Implementation
external ffi.Pointer<
ffi.NativeFunction<
OrtStatusPtr Function(
ffi.Pointer<ffi.Char> model_path,
ffi.Pointer<ffi.Char> ep_type,
ffi.Pointer<OrtAllocator> allocator,
ffi.Pointer<ffi.Pointer<ffi.Char>> compatibility_info,
)
>
>
GetCompatibilityInfoFromModel;