-
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
[ARITH] Migrate simplifier to new infra #3368
Conversation
47a1a33
to
ac5ec4b
Compare
25ec955
to
7f7efe8
Compare
cc @dmlc/tvm-team |
bool target_is_non_neg = expr_map_[target_var].can_prove_non_negative(); | ||
|
||
if (is_greater_) { | ||
result_ += 1; |
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.
I think this may be wrong: if we consider x*2 >= -1
, then it will be transformed into x >= 0 + 1
which excludes x = 0
.
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.
The bound deduction may allow relaxation and is not guaranteed to be tight
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.
But I agree we could start to think about generating tighter bound if possible(by looking into signs)
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.
No, this is wrong, because in this case it is not a relaxation, but rather an overtightening, which is unsound.
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.
Sorry, I meant overtightening, as documented by the API note, we want to find a set in which the condition is always satisfied, so we can eliminate the condition by constraining the loop within that range.
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.
Oh, ok, that makes sense. However I think the DeduceBound function may return an approximation which is not a subset of the true set, because it also performs relaxation. I'm not sure, but I think it might break loop partitioning in some cases.
Thanks, @sgrechanik-h , this PR is now merged |
By the way, I'm a bit concerned that this and some other PRs were merged without sufficient review and discussion. |
Migrate the current usage of simplifier to new infra part of #2588
After this PR. We are no longer dependent on HalideIR's Simplifier, and completely relies on the new integer analysis infrastructure. We might get certain regressions due to slightly different behavior, although the general infra will head to a better direction as we continue to improve the new consistent simplification infrastructure.