-
Notifications
You must be signed in to change notification settings - Fork 3.8k
Improve IntervalSet's floormod #5367
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
Merged
Merged
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
dafa2c3
Improve floormod.
yongfeng-nv 40b7675
Add tests and lint fix
yongfeng-nv 71f8998
Add a test locking down the improved floormod behavior during bound i…
yongfeng-nv 4a8e173
Add missing comments
yongfeng-nv d043488
Update tests and comments
yongfeng-nv ca883d5
Address review comments: use analyzer->int_set instead of EvalSet.
yongfeng-nv a8cd3c9
Update comments.
yongfeng-nv e31ec5d
Moving IntImm handling to MatchPoint and IsSinglePoint.
yongfeng-nv da901cf
Use CanProve to simplify the addtional comparison in MatchPoint.
yongfeng-nv c948f03
Revert the unecessary changes to MatchPoint and IsSinglePoint, as we …
yongfeng-nv 84951aa
Update floormod with simpler implementation; update corresponding tes…
yongfeng-nv 3d12c26
Tighten the condition to use shape bounds.
yongfeng-nv 6b5fb18
Update comments and a variable.
yongfeng-nv File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -138,7 +138,7 @@ void InferRootBound(const Stage& stage, | |
| Array<IterVar> stage_attach = ctx.attach_path.at(stage->op); | ||
| // The parent set. | ||
| for (const Operation& op : consumers) { | ||
| std::unordered_map<const VarNode*, IntSet> relax_set; | ||
| Map<Var, IntSet> relax_set; | ||
| std::unordered_map<IterVar, IntSet> up_state; | ||
| bool found_attach = false; | ||
| CHECK(ctx.op2stage_.count(op.get())); | ||
|
|
@@ -177,9 +177,9 @@ void InferRootBound(const Stage& stage, | |
| << "InferBound requires every leaf iter var's min equals 0, " | ||
| << "call schedule.normalize to achieve this."; | ||
| if (NeedRelax(iv, found_attach, ctx.bind_map, scope)) { | ||
| relax_set[iv->var.get()] = IntSet::range(vrange); | ||
| relax_set.Set(iv->var, IntSet::range(vrange)); | ||
| if (ctx.bind_map.count(iv)) { | ||
| relax_set[ctx.bind_map.at(iv)->var.get()] = IntSet::range(vrange); | ||
| relax_set.Set(ctx.bind_map.at(iv)->var, IntSet::range(vrange)); | ||
| } | ||
| } | ||
| } | ||
|
|
@@ -191,6 +191,9 @@ void InferRootBound(const Stage& stage, | |
| // Relax if needed. | ||
| std::unordered_map<const VarNode*, IntSet> dom_map; | ||
| arith::Analyzer analyzer; | ||
| for (auto entry : *rmap) { | ||
| analyzer.Bind(entry.first->var, entry.second); | ||
| } | ||
| for (auto iv : op->root_iter_vars()) { | ||
| Range r; | ||
| if (up_state.count(iv)) { | ||
|
|
@@ -199,11 +202,13 @@ void InferRootBound(const Stage& stage, | |
| r = iv->dom; | ||
| } | ||
| if (relax_set.size() != 0) { | ||
| dom_map[iv->var.get()] = EvalSet(r, relax_set); | ||
| dom_map[iv->var.get()] = IntSet::interval( | ||
| analyzer.int_set(r->min, relax_set).min(), | ||
| analyzer.int_set(r->min + r->extent - 1, relax_set).max()); | ||
| } else { | ||
| dom_map[iv->var.get()] = IntSet::range(r); | ||
| } | ||
| analyzer.Bind(iv->var, r); | ||
| analyzer.Bind(iv->var, r, true); | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The previous Bind call binds root IterVars. We have to override them here. Is there a easy way to tell an IterVar root IterVar? If so, we can avoid such binding/overriding. |
||
| } | ||
| op->PropBoundToInputs(op, &analyzer, dom_map, &tmap); | ||
| } | ||
|
|
||
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
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
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.