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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]