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

Support non-topologically sorted graphs #3835

Open
hgaspar opened this issue Feb 20, 2025 · 1 comment
Open

Support non-topologically sorted graphs #3835

hgaspar opened this issue Feb 20, 2025 · 1 comment

Comments

@hgaspar
Copy link

hgaspar commented Feb 20, 2025

While most graphs we encounter are topologically sorted, and while ONNX IR spec specifies that to be the case, for compliance, ( see https://github.com/onnx/onnx/blob/main/docs/IR.md#graphs ), however, we do encounter non topologically sorted graphs on occasion, and furthermore both ORT and Netron seem to support them.

As we build the migraphx IR, we can add nodes before they are defined (and keep a list of undefined ops)... eventually they will be defined! Each new node we encounter, we will first check to see if it is in the "undefined" list.

@pfultz2
Copy link
Collaborator

pfultz2 commented Feb 21, 2025

We use the order in the onnx files to ensure that the order is consistent with the onnx file:

#479

For invalid onnx file, we can write a python script to sort them or we could have a flag to pass to the onnx parser that will sort the nodes first, but we dont want that flag enabled by default because it can change the order of the nodes if they are already sorted.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants