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

[Relax][Transform] Handle tuple return in RemoveUnusedOutputs #17253

Conversation

Lunderberg
Copy link
Contributor

Prior to this commit, the relax.transform.RemoveUnusedOutputs pass only marked a tuple element as used if it occurred in a TupleGetItem node. This ignored use cases where a tuple is used as an aggregate object, such as returning a tuple from a function. This would collect incorrect results for a Relax function that calls a subroutine, receives a tuple as the return value of the subroutine, then returns that tuple.

This commit updates RemoveUnusedOutputs to look for usage of a tuple object, not just for usage in TupleGetItem.

Closes #17247

Prior to this commit, the `relax.transform.RemoveUnusedOutputs` pass
only marked a tuple element as used if it occurred in a `TupleGetItem`
node.  This ignored use cases where a tuple is used as an aggregate
object, such as returning a tuple from a function.  This would collect
incorrect results for a Relax function that calls a subroutine,
receives a tuple as the return value of the subroutine, then returns
that tuple.

This commit updates `RemoveUnusedOutputs` to look for usage of a tuple
object, not just for usage in `TupleGetItem`.

Closes apache#17247
@tqchen tqchen merged commit ff884b6 into apache:main Sep 6, 2024
19 checks passed
@Lunderberg Lunderberg deleted the relax_handle_tuple_return_in_removeunusedoutputs branch September 6, 2024 20:58
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.

[Bug] RemoveUnusedOutputs give unexpected results
2 participants