azai91 commented on a change in pull request #11611: MKLDNN Forward 
FullyConnected  op cache
URL: https://github.com/apache/incubator-mxnet/pull/11611#discussion_r211483208
 
 

 ##########
 File path: src/operator/nn/mkldnn/mkldnn_fully_connected.cc
 ##########
 @@ -112,21 +207,21 @@ void MKLDNNFCForward(const nnvm::NodeAttrs& attrs, const 
OpContext &ctx,
     out_md = mkldnn::memory::desc(out_dims, 
get_mkldnn_type(out_data[fullc::kOut].dtype()),
       mkldnn::memory::format::any);
   }
-
-  mkldnn::inner_product_forward::primitive_desc ipFwd_pd = GetIPFwd(data, 
weight,
-      param.no_bias ? nullptr : &in_data[fullc::kBias], out_md, ctx.is_train);
-  auto data_mem = data.GetMKLDNNDataReorder(ipFwd_pd.src_primitive_desc());
-  auto weight_mem = 
weight.GetMKLDNNDataReorder(ipFwd_pd.weights_primitive_desc());
+  MKLDNNFullyConnectForward &FCFwd =
+      GetFCFwd(attrs, data, weight, param.no_bias ? nullptr : 
&in_data[fullc::kBias],
+               out_md, ctx.is_train);
+  auto data_mem = 
data.GetMKLDNNDataReorder(FCFwd.ipFwd_pd.src_primitive_desc());
+  auto weight_mem = 
weight.GetMKLDNNDataReorder(FCFwd.ipFwd_pd.weights_primitive_desc());
   auto out_mem = CreateMKLDNNMem(out_data[fullc::kOut],
-      ipFwd_pd.dst_primitive_desc(), req[fullc::kOut]);
-  if (param.no_bias) {
-    MKLDNNStream::Get()->RegisterPrim(mkldnn::inner_product_forward(
-          ipFwd_pd, *data_mem, *weight_mem, *out_mem.second));
+      FCFwd.ipFwd_pd.dst_primitive_desc(), req[fullc::kOut]);
 
 Review comment:
   pass in_data as last argument for CreateMKLDNNMem in case req is WriteInPlace

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


With regards,
Apache Git Services

Reply via email to