wpan11nv commented on a change in pull request #5600: URL: https://github.com/apache/incubator-tvm/pull/5600#discussion_r426370564
########## 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: Looks like this is a sub-warp related, and I am not following it closely. CUDA __shfl_sync does not support non-power of 2 width. So your example may not be supported. It would be helpful if we have a legal example that would be broken by this patch. Thanks! ---------------------------------------------------------------- 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: us...@infra.apache.org