Skip to content

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
@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