Skip to content

Conversation

@Lunderberg
Copy link
Contributor

This commit implements a utility relax.transform.TopologicalSort, which can re-order the bindings that occur in a
relax.DataflowBlock. This is not intended for use in a general-purpose optimization pipeline, but instead as a utility that may be used as needed in specific cases. For example, normalization of unit tests that should not depend on the order of variable binding.

@Lunderberg Lunderberg force-pushed the relax_topological_sort branch 2 times, most recently from dc6e233 to d976e9d Compare March 15, 2024 20:16
This commit implements a utility `relax.transform.TopologicalSort`,
which can re-order the bindings that occur in a
`relax.DataflowBlock`.  This is not intended for use in a
general-purpose optimization pipeline, but instead as a utility that
may be used as needed in specific cases.  For example, normalization
of unit tests that should not depend on the order of variable binding.
@Lunderberg Lunderberg force-pushed the relax_topological_sort branch from d976e9d to 2180f87 Compare March 15, 2024 20:20


def TopologicalSort(order="depth-first", direction="from-inputs") -> tvm.ir.transform.Pass:
"""Sort relax.Dataflow blocks
Copy link
Member

Choose a reason for hiding this comment

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

To be more precise, "Sort bindings in relax.Dataflow blocks with the specified order"?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good call, and updated.

@masahi masahi merged commit fbfa926 into apache:main Mar 17, 2024
@Lunderberg Lunderberg deleted the relax_topological_sort branch March 17, 2024 22:48
thaisacs pushed a commit to thaisacs/tvm that referenced this pull request Apr 3, 2024
* [Relax] Implement relax.transform.TopologicalSort

This commit implements a utility `relax.transform.TopologicalSort`,
which can re-order the bindings that occur in a
`relax.DataflowBlock`.  This is not intended for use in a
general-purpose optimization pipeline, but instead as a utility that
may be used as needed in specific cases.  For example, normalization
of unit tests that should not depend on the order of variable binding.

* Update docstring according to review comment
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

Successfully merging this pull request may close these issues.

2 participants