Skip to content

Update ORT to handle explicit OpSchemaRegisterOnce API in ONNX >= 1.18.0 for fluent chaining #24561

@titaiwangms

Description

@titaiwangms

ORT was leveraging on implicit api ONNX_NAMESPACE::OpSchemaRegistry::OpSchemaRegisterOnce https://github.com/microsoft/onnxruntime/blob/fe97f8b608bbd9131a8de25b0d6b57a9ee30c388/onnxruntime/core/graph/contrib_ops/contrib_defs.h#L39C10-L39C64 to do fluent chaining style as following

ONNX_CONTRIB_OPERATOR_SCHEMA(AllReduce)
.SetDomain(kMSDomain)
.SinceVersion(1)
.Input(0, "input", "tensors to be reduced", "T", OpSchema::Variadic)
.Output(0, "output", "reduced tensors", "T", OpSchema::Variadic)
.TypeConstraint(
"T",
{"tensor(float16)", "tensor(float)", "tensor(double)"},
"Constrain to float, float16 and double tensors.")
.TypeAndShapeInferenceFunction([](ONNX_NAMESPACE::InferenceContext& ctx) {
propagateShapeAndTypeFromFirstInput(ctx);
});

However, the api ONNX_NAMESPACE::OpSchemaRegistry::OpSchemaRegisterOnce will be explicit starting from ONNX==1.18.0.

The PR: onnx/onnx#6378
The change: https://github.com/onnx/onnx/blob/9e379bdd51be054c89b29386f17a2fd731ce190f/onnx/defs/schema.h#L984

It's currently avoid from cmake/patches/onnx.patch within #24449

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions