-
Notifications
You must be signed in to change notification settings - Fork 3.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[TIR][Transform] Optional data-flow analysis in RemoveNoOp #13217
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 |
This PR is currently a draft, as its branch includes #13130. To maintain independent commits, this will be rebased onto main later. |
118693c
to
bf5df93
Compare
bf5df93
to
9344280
Compare
@tvm-bot rerun |
606f744
to
2467e29
Compare
@tvm-bot rerun |
Previously, `RemoveNoOp` would remove statements that could be locally analyzed as having no effect (e.g. `For` with empty loop extents). This commit adds opt-in use of data-flow analysis to identify two types of statements that are no-ops based on their context: * Buffer stores that are overwritten without ever being read. ```python buf[i] = 5 # Overwritten by next statement buf[i] = 10 ``` * Storing a value that is already known to be present. ```python buf[0:16] = T.ramp(0, 16, 1) buf[5] = 5 # Previous load already stored this value ```
2467e29
to
aa4206d
Compare
Looks like it's currently a compile-time failure, though I'm not sure why. I found a missing |
It made it past the compilation stage, so the rebase resolved that issue. Still running into the crash in |
Found it! The Moving the update of |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very cool feature and interesting test cases!
This simplification was introduced in apache#13217, and was erroneously removed in apache#13933. This commit re-enables this simplification, and adds unit tests to prevent any future regression.
Previously,
RemoveNoOp
would remove statements that could be locally analyzed as having no effect (e.g.For
with empty loop extents). This commit adds opt-in use of data-flow analysis to identify two types of statements that are no-ops based on their context:Buffer stores that are overwritten without ever being read.
Storing a value that is already known to be present.