[TensorExpr] Cleanup logic in the TensorExpr fuser pass. (#42938)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/42938
1. Structure the logic in a more straight-forward way: instead of magic
tricks with node iterators in a block we now have a function that
tries to create a fusion group starting from a given node (and pull
everything it can into it).
2. The order in which we're pulling nodes into a fusion group is now
more apparent.
3. The new pass structure automatically allows us to support fusion
groups of size=1.
Test Plan: Imported from OSS
Reviewed By: eellison
Differential Revision: D23084409
Pulled By: ZolotukhinM
fbshipit-source-id: d59fc00c06af39a8e1345a4aed8d829494db084c
Author
Mikhail Zolotukhin