You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tvm.apache.org by GitBox <gi...@apache.org> on 2020/03/30 09:53:27 UTC

[GitHub] [incubator-tvm] hzfan commented on a change in pull request #5092: [TIR][PASS] dtype rewrite for indexing variables

hzfan commented on a change in pull request #5092: [TIR][PASS] dtype rewrite for indexing variables
URL: https://github.com/apache/incubator-tvm/pull/5092#discussion_r400065401
 
 

 ##########
 File path: src/tir/pass/unroll_loop.cc
 ##########
 @@ -160,7 +160,9 @@ class LoopUnroller : public StmtExprMutator {
     PrimExpr extent = tir::Simplify(op->extent);
     const IntImmNode  *v1 = extent.as<IntImmNode>();
     int value = -1;
-    if (v1 != nullptr) {
+    // integers that do not fit in int32_t are treated as symbolic,
+    // as it's impossible to unroll such large loops
+    if (v1 != nullptr && v1->value <= std::numeric_limits<int>::max()) {
 
 Review comment:
   My motivation here is to prevent overflow in the next line (which uses int):
   
   ```
   value = static_cast<int>(v1->value);
   ```
   
   IMO it might be fine to use `int` here, as it's consistent with other parts of the pass. What do you think?

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


With regards,
Apache Git Services