Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[DML EP] DML Graph Serialization Bug #19748

Merged
merged 21 commits into from
Mar 31, 2024
Merged

Conversation

sumitsays
Copy link
Contributor

@sumitsays sumitsays commented Mar 1, 2024

Description

This pull request addresses several issues:

  • The DML Graph's nodes were not sorted in a topologically ordered sequence, leading to crashes during deserialization when a child node preceded its parent node. This PR resolves this issue by implementing a topological sorting algorithm before serialization.

  • During the RemoveUnconnectedNodes process:

    • we update intermeidateEdge.FromNodeIndex. Additionally, we must update intermediateEdge.Name when it includes intermediateEdge.FromNodeIndex, as serialization/deserialization heavily relies on edge names.

    • we also eliminate unused edges. Consequently, we must erase inputs (now unused) from corresponding maps serializedGraphInputIndexToSubgraphInputIndex and serializedGraphLargeConstantNameToSubgraphInputIndex.

Motivation and Context

Why is this change required? What problem does it solve?
There are few ONNX Zoo public models which were crashing during deserialization.

@sumitsays
Copy link
Contributor Author

/azp run Windows CPU CI Pipeline

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@sumitsays sumitsays requested a review from jeffbloo March 4, 2024 19:29
PatriceVignola
PatriceVignola previously approved these changes Mar 12, 2024
@tianleiwu
Copy link
Contributor

Does it need be in 1.17.3 patch release?

Copy link
Contributor

@PatriceVignola PatriceVignola left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@sumitsays sumitsays merged commit e1e292f into main Mar 31, 2024
92 of 95 checks passed
@sumitsays sumitsays deleted the user/sumita/fixSerializationbug branch March 31, 2024 21:41
TedThemistokleous pushed a commit to TedThemistokleous/onnxruntime that referenced this pull request May 7, 2024
### Description
This pull request addresses several issues:

- The DML Graph's nodes were not sorted in a topologically ordered
sequence, leading to crashes during deserialization when a child node
preceded its parent node. This PR resolves this issue by implementing a
topological sorting algorithm before serialization.

- During the `RemoveUnconnectedNodes` process:
- we update `intermeidateEdge.FromNodeIndex`. Additionally, we must
update `intermediateEdge.Name` when it includes
`intermediateEdge.FromNodeIndex`, as serialization/deserialization
heavily relies on edge names.

- we also eliminate unused edges. Consequently, we must erase inputs
(now unused) from corresponding maps
`serializedGraphInputIndexToSubgraphInputIndex` and
`serializedGraphLargeConstantNameToSubgraphInputIndex`.


### Motivation and Context
Why is this change required? What problem does it solve?
There are few ONNX Zoo public models which were crashing during
deserialization.
<!-- - - If it fixes an open issue, please link to the issue here. -->

---------

Co-authored-by: Jeff Bloomfield <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants