Support ONNX overloaded functions (IR version 10+)#28275
Conversation
Add support for the overload field in FunctionProto and NodeProto, as specified in ONNX IR version 10. Functions are now uniquely identified by the triple (domain, name, overload) instead of just (domain, name). Changes: - function_utils.h: GetFunctionIdentifier accepts optional overload param - function_utils.cc: CreateSchema takes overload for correct lookup - graph.h: Node class gains overload_ member, Overload()/SetOverload() - graph.cc: Store overload from NodeProto, serialize in ToProto, copy on AddNode, use overload in function resolution - model.cc: Include overload in all function map keys - graph_partitioner.cc: Include overload in not-inlined function tracking - function_test.cc: Add tests for overloaded and backward-compatible cases Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Adds ONNX IR v10+ model-local function overload support so function dispatch can differentiate multiple FunctionProtos with the same (domain, name) by additionally keying on overload.
Changes:
- Extend function identifier/keying and schema creation to include
overload(when present). - Persist
NodeProto.overloadthroughNodeload/copy/serialize paths and use it for function resolution. - Update function inlining/partitioning bookkeeping and add unit tests covering overloaded + backward-compatible cases.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| onnxruntime/core/graph/function_utils.h | Extends GetFunctionIdentifier and CreateSchema signature to accept optional overload and include it in function keys. |
| onnxruntime/core/graph/function_utils.cc | Uses overload-aware identifiers for local function lookup and improves the thrown error context. |
| include/onnxruntime/core/graph/graph.h | Adds Node::overload_ with Overload()/SetOverload() accessors for IR v10+ dispatch. |
| onnxruntime/core/graph/graph.cc | Loads/serializes/copies node overload; uses overload when resolving model-local function templates. |
| onnxruntime/core/graph/model.cc | Stores model-local functions and templates keyed by (domain, name, overload). |
| onnxruntime/core/framework/graph_partitioner.cc | Tracks not-inlined functions using overload-aware identifiers. |
| onnxruntime/test/framework/function_test.cc | Adds tests validating correct resolution of overloaded functions and backward compatibility when overload is empty. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
@copilot is this complete? Anything missing from the changeset? |
The changeset looks complete. Here's what's covered:
The ORT flatbuffers format ( Two new tests cover the overloaded dispatch ( |
Add support for the overload field in FunctionProto and NodeProto, as specified in ONNX IR version 10. Functions are now uniquely identified by the triple (domain, name, overload) instead of just (domain, name).
Changes:
Description
Support overloaded model-local functions as per ONNX spec.
Motivation and Context
Support ONNX spec.