Commit 6d061556 by Tianqi Chen Committed by GitHub

[PASS] Improve loop partition to remove un-necessary warning. (#766)

* [PASS] Improve loop partition to remove un-necessary warning.

* fix comment
parent 3e2b1618
...@@ -300,8 +300,13 @@ class LoopPartitioner : public IRMutator { ...@@ -300,8 +300,13 @@ class LoopPartitioner : public IRMutator {
std::unordered_map<const Variable*, IntSet> relax_map_; std::unordered_map<const Variable*, IntSet> relax_map_;
}; };
Stmt LoopPartitioner::TryPartition(const Node* node, const Stmt& stmt, Stmt LoopPartitioner::TryPartition(const Node* node,
VarExpr var, Expr min, Expr max, Stmt body, bool partition_thread_scope) { const Stmt& stmt,
VarExpr var,
Expr min,
Expr max,
Stmt body,
bool partition_thread_scope) {
PartitionFinder finder(var, hint_map_, relax_map_); PartitionFinder finder(var, hint_map_, relax_map_);
finder.Visit(body); finder.Visit(body);
const auto& partitions = finder.partitions; const auto& partitions = finder.partitions;
...@@ -340,7 +345,8 @@ Stmt LoopPartitioner::TryPartition(const Node* node, const Stmt& stmt, ...@@ -340,7 +345,8 @@ Stmt LoopPartitioner::TryPartition(const Node* node, const Stmt& stmt,
if (true_itrv.as<arith::IntervalSet>()->i.has_upper_bound()) { if (true_itrv.as<arith::IntervalSet>()->i.has_upper_bound()) {
post_doubt_begin = true_itrv.max() + 1; post_doubt_begin = true_itrv.max() + 1;
if (!can_prove(true_itrv.max() == max)) { if (!can_prove(true_itrv.max() == max)) {
Expr cond = (max - post_doubt_begin >= 0); // require the extent to be non-negative
Expr cond = (max - post_doubt_begin + 1 >= 0);
if (!can_prove(cond)) { if (!can_prove(cond)) {
LOG(WARNING) << "Cannot prove: " << cond LOG(WARNING) << "Cannot prove: " << cond
<< ", when generating the post doubt loop"; << ", when generating the post doubt loop";
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment