tvm-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] [incubator-tvm] wpan11nv commented on a change in pull request #5498: [Optimization] Warp level reduction support for CUDA
Date Thu, 07 May 2020 07:28:11 GMT

wpan11nv commented on a change in pull request #5498:
URL: https://github.com/apache/incubator-tvm/pull/5498#discussion_r421294707



##########
File path: src/tir/transforms/lower_warp_memory.cc
##########
@@ -265,10 +265,11 @@ class WarpAccessRewriter : protected StmtExprMutator {
           << op->index << " local_index=" << local_index;
       PrimExpr load_value = LoadNode::make(
           op->dtype, op->buffer_var, local_index, op->predicate);
+      PrimExpr mask = IntImm(DataType::UInt(32), 0xFFFFFFFF);

Review comment:
       It is fine for this simple case.I think it is better to emit as follows:
   ```
   for (int i_inner_outer = 0; i_inner_outer < 2; ++i_inner_outer) {
     float val = __shfl_sync(__activemask(), A_warp[(i_inner_outer)], ((((int)threadIdx.x)
+ 1) & 31));
     if ((((((int)blockIdx.x) * 64) + (i_inner_outer * 32)) + ((int)threadIdx.x)) < 100)
{
       ( (float*)B)[((((((int)blockIdx.x) * 64) + (i_inner_outer * 32)) + ((int)threadIdx.x)))]
= val;
     }
   }
   ```
   This avoids calling shfl_sync inside divergent if-stmt here.




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