ashutosh-arm commented on code in PR #13918:
URL: https://github.com/apache/tvm/pull/13918#discussion_r1098522045


##########
src/tir/transforms/lower_intrin.cc:
##########
@@ -214,8 +221,15 @@ class IntrinInjecter : public 
tvm::arith::IRMutatorWithAnalyzer {
       // If the numerator's lower bound is known, express the floormod
       // in terms of truncmod using only positive operands.
       arith::ConstIntBound const_int_bound = analyzer_->const_int_bound(op->a);
-      if (const_int_bound->min_value != arith::ConstIntBound::kNegInf &&
-          const_int_bound->min_value < 0 &&
+      // this will depend on the size of op->a
+      int64_t kNegInf;
+      if (op->a.dtype() == DataType::Int(32)) {
+        kNegInf = -std::numeric_limits<int32_t>::max();

Review Comment:
   Looks like two different APIs are in use here for getting the limits. For 
readability, I think same could be used: `tvm::min_value(op->a->dtype))->value` 
vs `std::numeric_limits<int32_t>::max()`?



##########
src/tir/transforms/lower_intrin.cc:
##########
@@ -118,8 +118,15 @@ class IntrinInjecter : public 
tvm::arith::IRMutatorWithAnalyzer {
       // If the numerator's lower bound is known, express the floordiv
       // in terms of truncdiv using only positive operands.
       arith::ConstIntBound const_int_bound = analyzer_->const_int_bound(op->a);
-      if (const_int_bound->min_value != arith::ConstIntBound::kNegInf &&
-          const_int_bound->min_value < 0 &&
+      // this will depend on the size of op->a
+      int64_t kNegInf;
+      if (op->a.dtype() == DataType::Int(32)) {
+        kNegInf = -std::numeric_limits<int32_t>::max();
+      } else {
+        kNegInf = arith::ConstIntBound::kNegInf;
+      }

Review Comment:
   Question: Is there any particular reason limits are modified for `int32_t` 
and not for other dtypes such as `int8_t` or `int16_t`?



-- 
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.

To unsubscribe, e-mail: commits-unsubscr...@tvm.apache.org

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

Reply via email to