[Unity][Pass] Reuse prior infra to implement more complete DCE#14334
[Unity][Pass] Reuse prior infra to implement more complete DCE#14334MasterJH5574 merged 6 commits intoapache:unityfrom
Conversation
|
Thanks for contributing to TVM! Please refer to the contributing guidelines https://tvm.apache.org/docs/contribute/ for useful information and tips. Please request code reviews from Reviewers by @-ing them in a comment.
Generated by tvm-bot |
|
At the high level, #14043 is based on a fix-point algorithm to remove unused dataflow statements iteratively. While I think @spectrometerHBH 's impl is more efficient based on the assumption from the dataflow block. |
|
BTW, although this patch uses |
|
I think we can simply trim it and consolidate the use |
|
For now:
|
|
@ganler Thanks for the clarification! |
As a follow-up to #14262, I just noticed that I previously implemented a function called `RemoveAllUnused` (#14043) that can do function-wise DCE and should be more complete than #14262 as `RemoveAllUnused` can also remove dead dataflow blocks (added two test-cases to show that). For now: - `tvm.relax.transform.DeadCodeElimination` is the pass for running DCE over an IRModule. - `tvm.relax.analysis.remove_all_unused` is a function for running DCE over a function. `tvm.relax.transform.DeadCodeElimination` is implemented based on `tvm.relax.analysis.remove_all_unused`. I did not sync the function name for the two, as I saw there are other uses for `RemoveAllUnused` so just want to be conservative first.
As a follow-up to #14262, I just noticed that I previously implemented a function called `RemoveAllUnused` (#14043) that can do function-wise DCE and should be more complete than #14262 as `RemoveAllUnused` can also remove dead dataflow blocks (added two test-cases to show that). For now: - `tvm.relax.transform.DeadCodeElimination` is the pass for running DCE over an IRModule. - `tvm.relax.analysis.remove_all_unused` is a function for running DCE over a function. `tvm.relax.transform.DeadCodeElimination` is implemented based on `tvm.relax.analysis.remove_all_unused`. I did not sync the function name for the two, as I saw there are other uses for `RemoveAllUnused` so just want to be conservative first.
As a follow-up to #14262, I just noticed that I previously implemented a function called `RemoveAllUnused` (#14043) that can do function-wise DCE and should be more complete than #14262 as `RemoveAllUnused` can also remove dead dataflow blocks (added two test-cases to show that). For now: - `tvm.relax.transform.DeadCodeElimination` is the pass for running DCE over an IRModule. - `tvm.relax.analysis.remove_all_unused` is a function for running DCE over a function. `tvm.relax.transform.DeadCodeElimination` is implemented based on `tvm.relax.analysis.remove_all_unused`. I did not sync the function name for the two, as I saw there are other uses for `RemoveAllUnused` so just want to be conservative first.
As a follow-up to #14262, I just noticed that I previously implemented a function called `RemoveAllUnused` (#14043) that can do function-wise DCE and should be more complete than #14262 as `RemoveAllUnused` can also remove dead dataflow blocks (added two test-cases to show that). For now: - `tvm.relax.transform.DeadCodeElimination` is the pass for running DCE over an IRModule. - `tvm.relax.analysis.remove_all_unused` is a function for running DCE over a function. `tvm.relax.transform.DeadCodeElimination` is implemented based on `tvm.relax.analysis.remove_all_unused`. I did not sync the function name for the two, as I saw there are other uses for `RemoveAllUnused` so just want to be conservative first.
As a follow-up to #14262, I just noticed that I previously implemented a function called
RemoveAllUnused(#14043) that can do function-wise DCE and should be more complete than #14262 asRemoveAllUnusedcan also remove dead dataflow blocks (added two test-cases to show that).Sorry, I should have mentioned that earlier to avoid duplication... but still I am putting a patch here in case it is desired.
cc: @spectrometerHBH @tqchen