You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tvm.apache.org by "areusch (via GitHub)" <gi...@apache.org> on 2023/03/21 00:21:10 UTC

[GitHub] [tvm] areusch commented on a diff in pull request #14347: [TIR] Fix Datatype in Lower TVM Builtin

areusch commented on code in PR #14347:
URL: https://github.com/apache/tvm/pull/14347#discussion_r1142791245


##########
src/tir/transforms/lower_tvm_builtin.cc:
##########
@@ -239,8 +239,9 @@ class BuiltinLower : public StmtExprMutator {
         }
       }
     }
-    PrimExpr total_bytes = make_const(op->extents[0].dtype(), nbytes);
+    PrimExpr total_bytes = make_const(DataType::UInt(64), nbytes);
     for (size_t i = 0; i < op->extents.size(); ++i) {
+      // set total_bytes to uint64 to avoid overflow

Review Comment:
   possible for us to also add a guard check here to verify that total_bytes isn't negative? although...i guess it is kinda unlikely to alloc > (1 << 31) worth of space.



-- 
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-unsubscribe@tvm.apache.org

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