Skip to content
This repository has been archived by the owner on Nov 17, 2023. It is now read-only.

[mkldnn-1.0] add mkldnn subgraph fc #16468

Merged
merged 3 commits into from
Oct 16, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -161,11 +161,6 @@ static void MKLDNNQuantizedElemwiseAddForward(const nnvm::NodeAttrs& attrs, cons
std::vector<mkldnn::memory::desc> in_desc;
in_desc.push_back(dataA_mem->get_desc());
in_desc.push_back(dataB_mem->get_desc());
size_t i_ndim = in_data[quantized_elemwise_add_enum::kDataA].shape().ndim();
mkldnn::memory::dims i_dims = mkldnn::memory::dims(i_ndim);
for (size_t i = 0; i < i_ndim; i++) {
i_dims[i] = static_cast<int>(in_data[quantized_elemwise_add_enum::kDataA].shape()[i]);
}
auto output_desc = dataA_mem->get_desc();
output_desc.data.data_type = static_cast<mkldnn_data_type_t>(output_data_type);
mkldnn::sum::primitive_desc pdesc(output_desc, scales, in_desc, engine);
Expand Down
6 changes: 3 additions & 3 deletions src/operator/subgraph/mkldnn/mkldnn_fc-inl.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

#ifndef MXNET_OPERATOR_SUBGRAPH_MKLDNN_MKLDNN_FC_INL_H_
#define MXNET_OPERATOR_SUBGRAPH_MKLDNN_MKLDNN_FC_INL_H_
#if MXNET_USE_MKLDNN == 1
#if MXNET_USE_MKLDNN == 100

#include <string>
#include <utility>
Expand Down Expand Up @@ -55,7 +55,7 @@ static inline mkldnn::algorithm GetMKLDNNEltwiseAlgo(const std::string op_name)
else
LOG(FATAL) << "Unsupported eltwise fusion op: " << op_name;

return mkldnn::algorithm::algorithm_undef;
return mkldnn::algorithm::undef;
}

static inline bool IsOutputUint8(const MKLDNNFCFullParam& full_param) {
Expand All @@ -79,5 +79,5 @@ static inline bool IsOutputUint8(const MKLDNNFCFullParam& full_param) {
} // namespace op
} // namespace mxnet

#endif // MXNET_USE_MKLDNN == 1
#endif // MXNET_USE_MKLDNN == 100
#endif // MXNET_OPERATOR_SUBGRAPH_MKLDNN_MKLDNN_FC_INL_H_
4 changes: 2 additions & 2 deletions src/operator/subgraph/mkldnn/mkldnn_fc.cc
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
* \author Ciyong Chen
*/

#if MXNET_USE_MKLDNN == 1
#if MXNET_USE_MKLDNN == 100

#include <utility>
#include <vector>
Expand Down Expand Up @@ -466,4 +466,4 @@ NNVM_REGISTER_OP(_sg_mkldnn_fully_connected)
} // namespace op
} // namespace mxnet

#endif // if MXNET_USE_MKLDNN == 1
#endif // if MXNET_USE_MKLDNN == 100
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@

#ifndef MXNET_OPERATOR_SUBGRAPH_MKLDNN_MKLDNN_FC_POST_QUANTIZE_PROPERTY_H_
#define MXNET_OPERATOR_SUBGRAPH_MKLDNN_MKLDNN_FC_POST_QUANTIZE_PROPERTY_H_
#if MXNET_USE_MKLDNN == 1
#if MXNET_USE_MKLDNN == 100

#include <string>
#include <vector>
Expand Down Expand Up @@ -218,5 +218,5 @@ class SgMKLDNNFCPostQuantizeProperty : public SubgraphProperty {
} // namespace op
} // namespace mxnet

#endif // if MXNET_USE_MKLDNN == 1
#endif // if MXNET_USE_MKLDNN == 100
#endif // MXNET_OPERATOR_SUBGRAPH_MKLDNN_MKLDNN_FC_POST_QUANTIZE_PROPERTY_H_
4 changes: 2 additions & 2 deletions src/operator/subgraph/mkldnn/mkldnn_fc_property.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@

#ifndef MXNET_OPERATOR_SUBGRAPH_MKLDNN_MKLDNN_FC_PROPERTY_H_
#define MXNET_OPERATOR_SUBGRAPH_MKLDNN_MKLDNN_FC_PROPERTY_H_
#if MXNET_USE_MKLDNN == 1
#if MXNET_USE_MKLDNN == 100

#include <string>
#include <vector>
Expand Down Expand Up @@ -223,5 +223,5 @@ class SgMKLDNNFCProperty : public SubgraphProperty {
} // namespace op
} // namespace mxnet

#endif // if MXNET_USE_MKLDNN == 1
#endif // if MXNET_USE_MKLDNN == 100
#endif // MXNET_OPERATOR_SUBGRAPH_MKLDNN_MKLDNN_FC_PROPERTY_H_
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

#ifndef MXNET_OPERATOR_SUBGRAPH_MKLDNN_MKLDNN_POST_QUANTIZE_ALIGN_SCALE_PROPERTY_H_
#define MXNET_OPERATOR_SUBGRAPH_MKLDNN_MKLDNN_POST_QUANTIZE_ALIGN_SCALE_PROPERTY_H_
#if MXNET_USE_MKLDNN == 1
#if MXNET_USE_MKLDNN == 100

#include <string>
#include <vector>
Expand Down Expand Up @@ -168,5 +168,5 @@ class SgMKLDNNPostQuantizeAlignScaleProperty : public SubgraphProperty {
} // namespace op
} // namespace mxnet

#endif // if MXNET_USE_MKLDNN == 1
#endif // if MXNET_USE_MKLDNN == 100
#endif // MXNET_OPERATOR_SUBGRAPH_MKLDNN_MKLDNN_POST_QUANTIZE_ALIGN_SCALE_PROPERTY_H_
12 changes: 6 additions & 6 deletions src/operator/subgraph/mkldnn/mkldnn_subgraph_property.cc
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@ MXNET_REGISTER_SUBGRAPH_BACKEND(MKLDNN)
MXNET_REGISTER_SUBGRAPH_PROPERTY(MKLDNN, SgMKLDNNConvProperty);

#endif // MXNET_USE_MKLDNN == 100
#if MXNET_USE_MKLDNN == 1
#if MXNET_USE_MKLDNN == 100
MXNET_REGISTER_SUBGRAPH_PROPERTY(MKLDNN, SgMKLDNNFCProperty);
#endif // MXNET_USE_MKLDNN == 1
#endif // MXNET_USE_MKLDNN == 100
#if MXNET_USE_MKLDNN == 100
MXNET_REGISTER_SUBGRAPH_BACKEND(MKLDNN_QUANTIZE)
.set_attr("context", Context::CPU());
Expand All @@ -46,20 +46,20 @@ MXNET_REGISTER_SUBGRAPH_PROPERTY(MKLDNN_QUANTIZE, SgMKLDNNConvProperty)
.set_attr("quantize", true);

#endif // MXNET_USE_MKLDNN == 100
#if MXNET_USE_MKLDNN == 1
#if MXNET_USE_MKLDNN == 100

MXNET_REGISTER_SUBGRAPH_PROPERTY(MKLDNN_QUANTIZE, SgMKLDNNFCProperty)
.set_attr("quantize", true);
#endif // MXNET_USE_MKLDNN == 1
#endif // MXNET_USE_MKLDNN == 100
#if MXNET_USE_MKLDNN == 100
MXNET_REGISTER_SUBGRAPH_PROPERTY(MKLDNN_QUANTIZE, SgMKLDNNPostQuantizeProperty);
#endif // MXNET_USE_MKLDNN == 100

#if MXNET_USE_MKLDNN == 1
#if MXNET_USE_MKLDNN == 100
MXNET_REGISTER_SUBGRAPH_PROPERTY(MKLDNN_QUANTIZE, SgMKLDNNFCPostQuantizeProperty);

MXNET_REGISTER_SUBGRAPH_PROPERTY(MKLDNN_QUANTIZE, SgMKLDNNPostQuantizeAlignScaleProperty);
#endif // MXNET_USE_MKLDNN == 1
#endif // MXNET_USE_MKLDNN == 100
#if MXNET_USE_MKLDNN == 100
} // namespace op
} // namespace mxnet
Expand Down