merrymercy commented on a change in pull request #5898:
URL: https://github.com/apache/incubator-tvm/pull/5898#discussion_r444982909



##########
File path: src/tir/analysis/verify_gpu_code.cc
##########
@@ -62,6 +64,9 @@ class GPUCodeVerifier : public StmtVisitor {
       size_t size = static_cast<size_t>(op->constant_allocation_size());
       shared_memory_per_block_ += size * op->dtype.bytes() * op->dtype.lanes();
     }
+    if (op->dtype.lanes() > 1) {
+      valid_ &= op->dtype.lanes() * op->dtype.bytes() <= 
static_cast<int>(max_vector_bytes_);

Review comment:
       Cast INT64_MAX to int will cause overflow. You should cast the LHS.

##########
File path: src/tir/analysis/verify_gpu_code.cc
##########
@@ -62,6 +64,9 @@ class GPUCodeVerifier : public StmtVisitor {
       size_t size = static_cast<size_t>(op->constant_allocation_size());
       shared_memory_per_block_ += size * op->dtype.bytes() * op->dtype.lanes();
     }
+    if (op->dtype.lanes() > 1) {
+      valid_ &= op->dtype.lanes() * op->dtype.bytes() <= 
static_cast<int>(max_vector_bytes_);

Review comment:
       Cast INT64_MAX to int will cause an overflow. You should cast the LHS.




----------------------------------------------------------------
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:
[email protected]


Reply via email to