Fix CustomOp forward compatibility: cap version instead of rejecting

Merged
CH
4mo ago
+44-6

Description

Remove the blanket version check in CustomOpKernel that prevented custom ops compiled against a newer ORT from loading on an older runtime. Instead, cap the version passed to GetApi() at ORT_API_VERSION.

This aligns custom ops with the EP plugin ABI pattern where forward compatibility is supported via runtime version detection. Individual newer functions in OrtCustomOp (CreateKernelV2, InferOutputShapeFn, GetMayInplace, etc.) are already gated by per-function version checks throughout custom_ops.cc, making the blanket reject both redundant and harmful.

The EP is responsible for not calling API functions newer than the runtime version -- the same contract as the EP plugin interface.

Motivation and Context