[Unity][Pass] Include FoldDataflowBlockOutput in CanonicalizeBindings#15791
Merged
yongwww merged 8 commits intoapache:unityfrom Oct 23, 2023
Merged
Conversation
Contributor
Author
|
Please review @sunggg @kparzysz-quic |
Contributor
kparzysz-quic
left a comment
There was a problem hiding this comment.
For
@tvm.script.ir_module
class Input:
@R.function
def main() -> R.Tensor((), "int32"):
with R.dataflow():
a = R.const(1)
b = a
c = b
d = c
n = d
R.output(n)
return n
the result is
@I.ir_module
class Module:
@R.function
def main() -> R.Tensor((), dtype="int32"):
with R.dataflow():
a: R.Tensor((), dtype="int32") = R.const(1, "int32")
b: R.Tensor((), dtype="int32") = a
c: R.Tensor((), dtype="int32") = a
d: R.Tensor((), dtype="int32") = a
n: R.Tensor((), dtype="int32") = a
R.output(n)
return n
The result should be
class Module:
@R.function
def main() -> R.Tensor((), dtype="int32"):
with R.dataflow():
n: R.Tensor((), dtype="int32") = R.const(1, "int32")
R.output(n)
return n
Contributor
kparzysz-quic
left a comment
There was a problem hiding this comment.
A more general question is whether we also want to eliminate a = b, where both are solely dataflow vars. All occurrences of a could be replaced with b.
Contributor
Author
|
I hadn't thrown in the functionality from dead code elimination, but it would probably be easy to add it, so I'll try that. |
Contributor
Author
|
It was indeed easy to throw in the extra functionality. |
416e47b to
9437e91
Compare
Contributor
Author
|
As it happens, #15840 handles the elision of unnecessary bindings, so I'll remove it from this PR. |
9437e91 to
896f464
Compare
Contributor
Author
|
@tvm-bot rerun |
Contributor
|
Failed to re-run CI in https://github.com/apache/tvm/actions/runs/6397260771 Detailswith response |
yongwww
approved these changes
Oct 23, 2023
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
As discussed in certain community meetings,
FoldDataflowBlockOutputis a bit of a clumsy outlier of a pass, resulting in a cludge like #15474 to try to make it easier to use. In this PR, the functionality of that pass is included inCanonicalizeBindings(it can be done just as a further transformation onDataflowBlocks) and the separate pass is removed.