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:18:31 UTC

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

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

 ##########
 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:
   also, hash tables, while O(1) access time, are pretty expensive for each access (creating the hash) for something like this where you may be doing possibly millions of iterations each pass.  Is there any way to not use a hash table, possibly using more memory?

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