wkcn commented on a change in pull request #16218: Improving performance of 
argmax operator
URL: https://github.com/apache/incubator-mxnet/pull/16218#discussion_r326428347
 
 

 ##########
 File path: src/operator/tensor/broadcast_reduce_op_index.cu
 ##########
 @@ -43,5 +43,18 @@ NNVM_REGISTER_OP(pick)
 NNVM_REGISTER_OP(_backward_pick)
 .set_attr<FCompute>("FCompute<gpu>", PickOpBackward<gpu>);
 
+template<>
+int DefineNumbWorkers<gpu>(const TShape &shape, int axis) {
+  const auto nSteps = static_cast<uint32_t>(shape[axis]);
+  const auto nThreads = shape.Size()/nSteps;
+  if (nThreads > nSteps)
+    return 1;
+
+  const auto a = static_cast<float>(nSteps)/nThreads;
+  const auto b = log2f(a);
+  const auto numbWorkers = pow(2, (b * 5 + 28)/11);
 
 Review comment:
   Why is the number of workers pow(2, (b * 5 + 28)/11)?

----------------------------------------------------------------
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:
[email protected]


With regards,
Apache Git Services

Reply via email to