access2rohit commented on a change in pull request #16104: Faster Transpose 2D
URL: https://github.com/apache/incubator-mxnet/pull/16104#discussion_r321501352
 
 

 ##########
 File path: src/operator/tensor/matrix_op-inl.h
 ##########
 @@ -257,6 +257,29 @@ struct TransposeParam : public 
dmlc::Parameter<TransposeParam> {
   }
 };
 
+
+template<typename xpu, typename DType>
+MSHADOW_XINLINE void Transpose2D(DType *in, DType *out, index_t shape_0, 
index_t shape_1) {
+// ensure cache line hits and prevent cache miss for any configuration
+index_t blocksize = 32;
+index_t n = shape_0;
+index_t p = shape_1;
+
+for (index_t i = 0; i < n; i += blocksize) {
+  #pragma omp parallel for
+    for (index_t j = 0; j < p; j += blocksize) {
+        // transpose the block
+        #pragma unroll 4
 
 Review comment:
   add comment explaining why unroll by 4 ?

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


With regards,
Apache Git Services

Reply via email to