tvm-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] [incubator-tvm] yongfeng-nv commented on a change in pull request #5367: Improve IntervalSet's floormod
Date Wed, 22 Apr 2020 19:51:41 GMT

yongfeng-nv commented on a change in pull request #5367:
URL: https://github.com/apache/incubator-tvm/pull/5367#discussion_r413277656



##########
File path: src/arith/int_set.cc
##########
@@ -372,7 +387,27 @@ class IntervalSetEvaluator :
   }
 
   IntervalSet Eval(const PrimExpr& val) {
-    return this->VisitExpr(val);
+    IntervalSet result = this->VisitExpr(val);
+    // Use the IterVar range info bound to analyzer to further simplify
+    // and reduce the interval
+    auto min_value_expr = analyzer_->Simplify(result->min_value);
+    auto max_value_expr = analyzer_->Simplify(result->max_value);
+    auto min_bd = analyzer_->const_int_bound(min_value_expr);
+    auto max_bd = analyzer_->const_int_bound(max_value_expr);
+    if (min_bd->max_value == min_bd->min_value && max_bd->max_value == max_bd->min_value)
{
+      const auto* min_ptr = result->min_value.as<IntImmNode>();
+      const auto* max_ptr = result->max_value.as<IntImmNode>();
+      // The following if statement is necessary.  When result is a single point of IntImm,
such as
+      // [0, 0], both 0s refer the same ObjectRef.  We really don't want to create a new
[0, 0]
+      // IntervalSet and have 0s refer two different ObjectRef.  They will confuse APIs,
such as
+      // IntervalSetEvaluator::MatchPoint() and IntervalSetNode::IsSinglePoint().
+      if (min_ptr && max_ptr && min_bd->min_value == min_ptr->value
&&

Review comment:
       Moved the IntImm handling to MatchPoint and IntervalSetNode::IsSinglePoint().  Reverted
changes here.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



Mime
View raw message