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

 ##########
 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:
   got it, thanks! we noticed the same performance issue for smaller networks 
too (eg: mnist) . Lower OMP_NUM_THREADS (eg: 4 -vs- 36) was giving better 
performance.
   

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