onnxruntime
a0d44399 - [EP ABI] Update Graph_GetGraphView() implementation (#26711)

Commit
282 days ago
[EP ABI] Update Graph_GetGraphView() implementation (#26711) ### Description This PR mainly modifies the followings: - Update `Graph_GetGraphView()` implementation. - Make sure EpGraph maintains the min/max node index, so that when querying node outside that range, it can return null. - Provide option to create an EpGraph that contains its parent node when the graph is the subgraph of a control flow op. #### Update Graph_GetGraphView() implementation In some cases, e.g. when model has a node that produces output consumed by multiple nodes, calling the current implementation of `Graph_GetGraphView()` to get a subgraph returns incorrect `OrtGraph.` - Original graph: <img width="414" height="356" alt="image" src="https://github.com/user-attachments/assets/739c092d-0880-4f6e-9351-e08e0e141b35" /> - Incorrect graph after calling `Graph_GetGraphView()` to get the subgraph: It includes three of the nodes from the original graph. The `topk_indices` is the output of the `TopK` and it shouldn't be added as a graph input shown in the graph below. The API implementation has issue handling this case. If we feed this subgraph into TRT parser, it would fail to parse the graph. <img width="349" height="341" alt="image" src="https://github.com/user-attachments/assets/1306e22c-7c5d-45a2-bc18-6864fa2966ba" /> - Correct graph after calling `Graph_GetGraphView()` to get the subgraph: It includes three of the nodes from the original graph. The `topk_indices` now is not added as a graph input. Instead, the `topk_indices` is added as a graph output which is expected as `Mod` is in another subgraph that consumes it, so this subgraph has to make `topk_indices` a graph output. <img width="413" height="350" alt="image" src="https://github.com/user-attachments/assets/b9135690-a341-41b2-9495-184030ab5cff" /> ### Motivation and Context <!-- - Why is this change required? What problem does it solve? - If it fixes an open issue, please link to the issue here. -->
Author
Parents
Loading