wpan11nv commented on a change in pull request #5600:
URL: https://github.com/apache/incubator-tvm/pull/5600#discussion_r426314749
##########
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:
Added tests. Without this fix, this test will assert.
----------------------------------------------------------------
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]