You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mxnet.apache.org by GitBox <gi...@apache.org> on 2018/03/09 00:06:17 UTC

[GitHub] zheng-da commented on a change in pull request #9947: [WIP] Performance optimization for dot(csr, rsp) on cpu

zheng-da commented on a change in pull request #9947: [WIP] Performance optimization for dot(csr, rsp) on cpu
URL: https://github.com/apache/incubator-mxnet/pull/9947#discussion_r173331483
 
 

 ##########
 File path: src/operator/tensor/dot-inl.h
 ##########
 @@ -793,16 +764,21 @@ inline void DotCsrRspDnsImpl(const OpContext& ctx,
             mxnet_op::Kernel<mxnet_op::set_zero, cpu>::Launch(s, num_threads,
                                                               ret->dptr<DType>());
           }
-          num_threads = mxnet_op::get_num_threads<cpu>(ret->shape_[0]);
-          dim_t seg_len = (ret->shape_[0] + num_threads - 1) / num_threads;
+          num_threads = ret->shape_[0];
           if (trans_lhs) {
             LOG(FATAL) << "DotCsrRspDnsImpl has not implemented dot(csr.T, rsp) = dns yet";
           } else {
+            const RType* row_idx_ptr = row_idx_r.dptr<RType>();
+            std::unordered_map<RType, dim_t> row_idx_map;
+            row_idx_map.reserve(nnr * 7);
+            for (dim_t ind = 0; ind < nnr; ind++) {
+              row_idx_map.emplace(row_idx_ptr[ind], ind);
+            }
 
 Review comment:
   if nnr is large, constructing the hashtable can take a long time.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on 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


With regards,
Apache Git Services