Uh oh!
There was an error while loading. Please reload this page.
[Unity][Pass] Include FoldDataflowBlockOutput in CanonicalizeBindings - #15791
Conversation
slyubomirsky
commented
Sep 21, 2023
Please review @sunggg@kparzysz-quic |
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
Uh oh!
There was an error while loading. Please reload this page.
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.
slyubomirsky
commented
Oct 2, 2023
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. |
slyubomirsky
commented
Oct 2, 2023
It was indeed easy to throw in the extra functionality. |
416e47b to
9437e91Compareslyubomirsky
commented
Oct 2, 2023
As it happens, #15840 handles the elision of unnecessary bindings, so I'll remove it from this PR. |
9437e91 to
896f464Compareslyubomirsky
commented
Oct 3, 2023
@tvm-bot rerun |
Failed to re-run CI in https://github.com/apache/tvm/actions/runs/6397260771 Detailswith response |
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.