Repository navigation
Fix initializer callback propagation in OrtGraphToProto subgraphs - #34159
Chi Lo (chilo-ms) merged 1 commit into
Conversation
Share the active callback through synchronous subgraph recursion without wrapping an empty function. Preserve mutable callback state and propagate nested errors. Add nested If serialization, external-data round-trip, and error regressions for both overloads. Assisted-by: OpenAI Codex Signed-off-by: Silu Panda <31051721+SiluPanda@users.noreply.github.com>
|
Azure Pipelines: There may be pipelines that require an authorized user to comment /azp run to run. |
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues were identified for the changes that propagate initializer callbacks into nested subgraphs while sharing callback state.
No open issues 🎉
What changed in this PR
Fixes #34137 in the header-only OrtGraphToProto utility by propagating initializer callbacks into nested subgraphs while sharing mutable callback state. Public signatures and serialization without a callback remain unchanged.
Changes:
- Forward nonempty callbacks by reference during recursive serialization and document traversal-wide state sharing.
- Add CPU regressions covering nested initializer storage, external-data reload and inference, both overloads, empty callbacks, and nested error propagation.
| File | Description |
|---|---|
onnxruntime/test/ep_graph/test_ep_graph.cc |
Adds generated nested-graph tests for callback state, external data, inference, and errors. |
include/onnxruntime/core/providers/utils/ort_graph_to_proto.h |
Forwards callbacks into subgraphs and documents shared callback state. |
Review effort: Balanced
|
Hi Adrian Lizarraga (@adrianlizarraga) Chi Lo (@chilo-ms), could you please review this fix and approve the CI runs if you have access? They currently show |
Description
Forward the initializer-data callback into
OrtGraphToProtosubgraph recursion, keeping the same mutable callback state throughout a traversal. Preserve the empty-callback path and both public function signatures.The recursive call currently omits the callback, so nested initializers silently stay inline and nested callback errors are never reported. Passing the
std::functionby value instead would copy mutable captures into each branch, potentially reusing external-data offsets. A conditionalstd::refwrapper shares the active callback during synchronous recursion without wrapping an empty function.Adds generated, CPU-only regressions in the existing EP graph suite:
Ifbranch;Validation
Built and tested on macOS arm64, Apple Clang 17, CPU-only Release shared-library build, based on
a8246c0d094f1ab0d6bf236228e5e67683321cd7. No minimal build or operator exclusions were used.lintrunnerandgit diff --checkpass.Selected output from the actual local runs
Baseline:
Restored final patch:
Windows execution has not been tested locally. Existing macOS telemetry duplicate-class and model-fixture warnings were not suppressed.
Motivation and Context
Fixes #34137. Thanks to Zarana Kiran Desai (@zadesai) for the reproducer and the reference-forwarding approach.
This fixes the existing header-only EP utility. #33921 concerns FLOAT16 tensor attributes, while #34014 adds a separate serialization C API; neither fixes this callback omission.
AI assistance: OpenAI Codex assisted with implementation, independent source review, and execution of the reported local tests. The results above are from those actual automated runs.