Merged
Conversation
Inject clamps around func calls h(...) when all the following conditions hold: 1. The call is in an indexing context, such as: f(x) = g(h(x)); 2. The schedule for f uses RoundUp or ShiftInwards 3. h is not compute_at within f's produce node 4. The FuncValueBounds of h are smaller than those of its type Conditions (3) and (4) are not yet implemented.
abadams
reviewed
Oct 7, 2021
abadams
reviewed
Oct 7, 2021
abadams
reviewed
Oct 7, 2021
abadams
reviewed
Oct 7, 2021
abadams
reviewed
Oct 7, 2021
abadams
reviewed
Oct 7, 2021
| if (is_inside_indexing) { | ||
| auto bounds = func_bounds.at({call->name, call->value_index}); | ||
| if (bounds_smaller_than_type(bounds, call->type)) { | ||
| // TODO: check that the clamped function's allocation bounds might be wider than its compute bounds |
Member
There was a problem hiding this comment.
Please open an issue or reuse the existing issue to track this, and add the issue ID to the comment.
Member
Author
There was a problem hiding this comment.
Oh, I figured this PR was blocked on implementing this.
Member
There was a problem hiding this comment.
It fixes a miscompilation. I think we can live with a few extra ops instead in the short term.
abadams
approved these changes
Oct 7, 2021
| // TODO(#6297): check that the clamped function's allocation bounds might be wider than its compute bounds | ||
|
|
||
| auto [new_args, changed] = mutate_with_changes(call->args); | ||
| Expr new_call = changed ? call : Call::make(call->type, call->name, new_args, call->call_type, call->func, call->value_index, call->image, call->param); |
Contributor
There was a problem hiding this comment.
(resurrecting a zombie PR...)
Uh, is this right? Shouldn't it be !changed ? call : ... ?
Member
Author
There was a problem hiding this comment.
Yeeeep, that looks like a typo. Want to try changing it to see if tests fail?
steven-johnson
added a commit
that referenced
this pull request
Mar 18, 2022
steven-johnson
added a commit
that referenced
this pull request
Mar 18, 2022
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Inject clamps around func calls h(...) when all the following conditions hold:
Fixes #6131