onnxruntime
f09204c6 - Add Implicit inputs for conditional nodes branches part of node fusio… (#28690)

Commit
33 days ago
Add Implicit inputs for conditional nodes branches part of node fusio… (#28690) This pull request improves the partitioning utilities in ONNX Runtime by optimizing internal data structures and fixing an important bug related to implicit inputs in control flow nodes (such as `If`). It also adds a new test to verify correct handling of implicit inputs from `If` nodes. The main changes are as follows: ### Performance and Data Structure Improvements * Replaced `std::unordered_set` and `std::vector` with `InlinedHashSet` and `InlinedVector` for several collections in `partitioning_utils.cc` to improve performance and reduce heap allocations. This affects node and node argument tracking throughout `MakeComputeCapability`. ### Bug Fixes: Implicit Input Handling * Fixed a bug in `MakeComputeCapability` where implicit inputs from nodes containing subgraphs (such as `If` nodes) were not properly collected and surfaced as MetaDef inputs. The code now explicitly collects implicit inputs only when the node contains a subgraph. * Corrected output collection logic to ensure that outputs are only added to the ordered outputs list if they are not already present and not graph outputs, preventing duplicates and omissions. ### Testing Improvements * Added a new unit test `TestImplicitInputsFromIfNode` in `partitioning_utils_test.cc` to verify that implicit inputs (inputs used inside subgraphs but not explicit node inputs) are correctly surfaced in the MetaDef inputs for `If` nodes. The test builds a model with an `If` node whose branches use an implicit input and checks that this input appears in the MetaDef.
Author
Parents
Loading