tvm-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] [incubator-tvm] roastduck commented on a change in pull request #5600: [TOPI] Improve CUDA softmax scheduling
Date Mon, 18 May 2020 00:13:12 GMT

roastduck commented on a change in pull request #5600:
URL: https://github.com/apache/incubator-tvm/pull/5600#discussion_r426321509



##########
File path: src/tir/transforms/lower_warp_memory.cc
##########
@@ -213,9 +213,13 @@ class WarpAccessRewriter : protected StmtExprMutator {
     alloc_size *= op->dtype.lanes();
     std::tie(warp_index_, width_) = WarpIndexFinder(warp_size_).Find(op->body);
     warp_coeff_ = WarpStoreCoeffFinder(buffer_, warp_index_, analyzer_).Find(op->body);
-    CHECK_EQ(alloc_size % (width_ * warp_coeff_), 0)
-        << "Warp memory must be multiple of the extent of threadIdx.x";
-    warp_group_ = alloc_size / (width_ * warp_coeff_);
+
+    // Align the local memory size. The number of elements may not
+    // be a multiple of width_ * warp_coeff_; round it up.
+    int factor = width_ * warp_coeff_;
+    warp_group_ = (alloc_size + (factor - 1)) / factor;
+    alloc_size = warp_group_ * factor;
+

Review comment:
       Please consider this scenario:
   
   ```
   // bound to threadIdx.y
   for (i = 0; i < 2; i++) {
     // bound to threadIdx.x
     for (j = 0; j < 5; j++) {
       access buffer.warp[(j + 1) % 5]
     }
   }
   ```
   
   Now we are shuffling among Thread 0\~4, and Thread 5\~9. Since we are rounding them up
to Thread 0\~7 and Thread **5\~12 (seems not right as well)**, will there be any conflict
between these two group of threads?




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



Mime
View raw message