zheng-da commented on a change in pull request #10317: [MXNET-264] Improve 
performance of MKLDNN in small batch sizes.
URL: https://github.com/apache/incubator-mxnet/pull/10317#discussion_r179305690
 
 

 ##########
 File path: src/operator/nn/mkldnn/mkldnn_batch_norm-inl.h
 ##########
 @@ -234,20 +234,15 @@ void MKLDNNBatchNormForward(const OpContext &ctx, const 
BatchNormParam &param,
     DType* weight_ptr = gamma.data().dptr<DType>();
     DType* bias_ptr = beta.data().dptr<DType>();
     if (!param.fix_gamma) {
-#pragma omp parallel for
-      for (int i = 0; i < channels_; i++) {
-        weight_buf[i] = weight_ptr[i];
-        weight_buf[channels_ + i] = bias_ptr[i];  // bias
-      }
+      memcpy(weight_buf, weight_ptr, sizeof(weight_buf[0]) * channels_);
+      memcpy(&weight_buf[channels_], bias_ptr, sizeof(weight_buf[0]) * 
channels_);
 
 Review comment:
   are you referring to all of the OMP directives? The number of channels is in 
the order of 100. Parallelization overhead is usually larger than the actual 
computation.

----------------------------------------------------------------
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:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to