Unverified Commit bbb9a566 authored by Scott Cyphers's avatar Scott Cyphers Committed by GitHub

Initialize CPU transformer the same way for static and non-static linking (#3516)

* Initialize CPU transformer the same way for static and non-static linking.

* Initialize earlier
parent 5e8783ae
...@@ -78,11 +78,7 @@ namespace ngraph ...@@ -78,11 +78,7 @@ namespace ngraph
} }
} }
REGISTER_OP_BUILDER(Add); void register_builders_add_cpp() { REGISTER_OP_BUILDER(Add); }
#ifdef NGRAPH_CPU_STATIC_LIB_ENABLE
void register_builders_add_cpp() {}
#endif
} }
} }
} }
...@@ -67,11 +67,7 @@ namespace ngraph ...@@ -67,11 +67,7 @@ namespace ngraph
functors.emplace_back(functor); functors.emplace_back(functor);
} }
REGISTER_OP_BUILDER(AllReduce); void register_builders_allreduce_cpp() { REGISTER_OP_BUILDER(AllReduce); }
#ifdef NGRAPH_CPU_STATIC_LIB_ENABLE
void register_builders_allreduce_cpp() {}
#endif
} }
} }
} }
...@@ -209,11 +209,7 @@ namespace ngraph ...@@ -209,11 +209,7 @@ namespace ngraph
functors.emplace_back(functor); functors.emplace_back(functor);
} }
REGISTER_OP_BUILDER(ArgMax); void register_builders_argmax_cpp() { REGISTER_OP_BUILDER(ArgMax); }
#ifdef NGRAPH_CPU_STATIC_LIB_ENABLE
void register_builders_argmax_cpp() {}
#endif
} }
} }
} }
...@@ -209,10 +209,7 @@ namespace ngraph ...@@ -209,10 +209,7 @@ namespace ngraph
functors.emplace_back(functor); functors.emplace_back(functor);
} }
REGISTER_OP_BUILDER(ArgMin); void register_builders_argmin_cpp() { REGISTER_OP_BUILDER(ArgMin); }
#ifdef NGRAPH_CPU_STATIC_LIB_ENABLE
void register_builders_argmin_cpp() {}
#endif
} }
} }
} }
...@@ -195,12 +195,12 @@ namespace ngraph ...@@ -195,12 +195,12 @@ namespace ngraph
functors.emplace_back(functor); functors.emplace_back(functor);
} }
} }
REGISTER_OP_BUILDER(AvgPool);
REGISTER_OP_BUILDER(AvgPoolBackprop);
#ifdef NGRAPH_CPU_STATIC_LIB_ENABLE void register_builders_avg_pool_cpp()
void register_builders_avg_pool_cpp() {} {
#endif REGISTER_OP_BUILDER(AvgPool);
REGISTER_OP_BUILDER(AvgPoolBackprop);
}
} }
} }
} }
...@@ -511,15 +511,14 @@ namespace ngraph ...@@ -511,15 +511,14 @@ namespace ngraph
external_function, node, args, out, true, false); external_function, node, args, out, true, false);
} }
REGISTER_OP_BUILDER(BatchNormTraining); void register_builders_batch_norm_cpp()
REGISTER_OP_BUILDER(BatchNormInference); {
REGISTER_OP_BUILDER(BatchNormTrainingRelu); REGISTER_OP_BUILDER(BatchNormTraining);
REGISTER_OP_BUILDER(BatchNormInferenceRelu); REGISTER_OP_BUILDER(BatchNormInference);
REGISTER_OP_BUILDER(BatchNormTrainingBackprop); REGISTER_OP_BUILDER(BatchNormTrainingRelu);
REGISTER_OP_BUILDER(BatchNormInferenceRelu);
#ifdef NGRAPH_CPU_STATIC_LIB_ENABLE REGISTER_OP_BUILDER(BatchNormTrainingBackprop);
void register_builders_batch_norm_cpp() {} }
#endif
} }
} }
} }
...@@ -87,10 +87,8 @@ namespace ngraph ...@@ -87,10 +87,8 @@ namespace ngraph
functors.emplace_back(functor); functors.emplace_back(functor);
} }
} }
REGISTER_OP_BUILDER(BoundedRelu);
#ifdef NGRAPH_CPU_STATIC_LIB_ENABLE void register_builders_bounded_relu_cpp() { REGISTER_OP_BUILDER(BoundedRelu); }
void register_builders_bounded_relu_cpp() {}
#endif
} }
} }
} }
...@@ -186,7 +186,6 @@ namespace ngraph ...@@ -186,7 +186,6 @@ namespace ngraph
} }
return functor; return functor;
} }
REGISTER_CF_BUILDER(Broadcast);
template <> template <>
void Builder::BUILDER_DECL(ngraph::op::Broadcast) void Builder::BUILDER_DECL(ngraph::op::Broadcast)
...@@ -231,10 +230,11 @@ namespace ngraph ...@@ -231,10 +230,11 @@ namespace ngraph
} }
} }
REGISTER_OP_BUILDER(Broadcast); void register_builders_broadcast_cpp()
#ifdef NGRAPH_CPU_STATIC_LIB_ENABLE {
void register_builders_broadcast_cpp() {} REGISTER_CF_BUILDER(Broadcast);
#endif REGISTER_OP_BUILDER(Broadcast);
}
} }
} }
} }
...@@ -43,10 +43,11 @@ namespace ngraph ...@@ -43,10 +43,11 @@ namespace ngraph
}; };
functors.emplace_back(functor); functors.emplace_back(functor);
} }
REGISTER_OP_BUILDER(BroadcastDistributed);
#ifdef NGRAPH_CPU_STATIC_LIB_ENABLE void register_builders_broadcast_distributed_cpp()
void register_builders_broadcast_distributed_cpp() {} {
#endif REGISTER_OP_BUILDER(BroadcastDistributed);
}
} }
} }
} }
...@@ -171,10 +171,7 @@ namespace ngraph ...@@ -171,10 +171,7 @@ namespace ngraph
} }
} }
REGISTER_OP_BUILDER(Concat); void register_builders_concat_cpp() { REGISTER_OP_BUILDER(Concat); }
#ifdef NGRAPH_CPU_STATIC_LIB_ENABLE
void register_builders_concat_cpp() {}
#endif
} }
} }
} }
...@@ -114,10 +114,7 @@ namespace ngraph ...@@ -114,10 +114,7 @@ namespace ngraph
functors.emplace_back(functor); functors.emplace_back(functor);
} }
REGISTER_OP_BUILDER(Convert); void register_builders_convert_cpp() { REGISTER_OP_BUILDER(Convert); }
#ifdef NGRAPH_CPU_STATIC_LIB_ENABLE
void register_builders_convert_cpp() {}
#endif
} }
} }
} }
...@@ -103,10 +103,8 @@ namespace ngraph ...@@ -103,10 +103,8 @@ namespace ngraph
}; };
functors.emplace_back(functor); functors.emplace_back(functor);
} }
REGISTER_CPU_OP_BUILDER(ConvertLayout);
#ifdef NGRAPH_CPU_STATIC_LIB_ENABLE void register_builders_convert_layout_cpp() { REGISTER_CPU_OP_BUILDER(ConvertLayout); }
void register_builders_convert_layout_cpp() {}
#endif
} }
} }
} }
...@@ -821,21 +821,20 @@ namespace ngraph ...@@ -821,21 +821,20 @@ namespace ngraph
} }
} }
REGISTER_OP_BUILDER(Convolution); void register_builders_convolution_cpp()
REGISTER_OP_BUILDER(ConvolutionRelu); {
REGISTER_OP_BUILDER(ConvolutionBias); REGISTER_OP_BUILDER(Convolution);
REGISTER_OP_BUILDER(ConvolutionBiasAdd); REGISTER_OP_BUILDER(ConvolutionRelu);
REGISTER_OP_BUILDER(ConvolutionBackpropData); REGISTER_OP_BUILDER(ConvolutionBias);
REGISTER_OP_BUILDER(ConvolutionBackpropFilters); REGISTER_OP_BUILDER(ConvolutionBiasAdd);
REGISTER_OP_BUILDER(ConvolutionBiasBackpropFiltersBias); REGISTER_OP_BUILDER(ConvolutionBackpropData);
REGISTER_OP_BUILDER(GroupConvolution); REGISTER_OP_BUILDER(ConvolutionBackpropFilters);
REGISTER_OP_BUILDER(ConvolutionAdd); REGISTER_OP_BUILDER(ConvolutionBiasBackpropFiltersBias);
REGISTER_OP_BUILDER(GroupConvolutionBias); REGISTER_OP_BUILDER(GroupConvolution);
REGISTER_OP_BUILDER(DeconvolutionBias) REGISTER_OP_BUILDER(ConvolutionAdd);
#ifdef NGRAPH_CPU_STATIC_LIB_ENABLE REGISTER_OP_BUILDER(GroupConvolutionBias);
void register_builders_convolution_cpp() {} REGISTER_OP_BUILDER(DeconvolutionBias);
#endif }
} // namespace cpu } // namespace cpu
} // namespace runtime } // namespace runtime
} // namespace ngraph } // namespace ngraph
...@@ -262,10 +262,7 @@ namespace ngraph ...@@ -262,10 +262,7 @@ namespace ngraph
functors.emplace_back(functor); functors.emplace_back(functor);
} }
REGISTER_OP_BUILDER(Dot); void register_builders_dot_cpp() { REGISTER_OP_BUILDER(Dot); }
#ifdef NGRAPH_CPU_STATIC_LIB_ENABLE
void register_builders_dot_cpp() {}
#endif
} }
} }
} }
...@@ -126,10 +126,7 @@ namespace ngraph ...@@ -126,10 +126,7 @@ namespace ngraph
functors.emplace_back(functor); functors.emplace_back(functor);
} }
REGISTER_OP_BUILDER(Dropout); void register_builders_dropout_cpp() { REGISTER_OP_BUILDER(Dropout); }
#ifdef NGRAPH_CPU_STATIC_LIB_ENABLE
void register_builders_dropout_cpp() {}
#endif
} }
} }
} }
...@@ -244,10 +244,7 @@ namespace ngraph ...@@ -244,10 +244,7 @@ namespace ngraph
functors.emplace_back(functor); functors.emplace_back(functor);
} }
REGISTER_OP_BUILDER(EmbeddingLookup); void register_builders_embedding_lookup_cpp() { REGISTER_OP_BUILDER(EmbeddingLookup); }
#ifdef NGRAPH_CPU_STATIC_LIB_ENABLE
void register_builders_embedding_lookup_cpp() {}
#endif
} }
} }
} }
...@@ -71,10 +71,8 @@ namespace ngraph ...@@ -71,10 +71,8 @@ namespace ngraph
functors.emplace_back(functor); functors.emplace_back(functor);
} }
} }
REGISTER_OP_BUILDER(Erf);
#ifdef NGRAPH_CPU_STATIC_LIB_ENABLE void register_builders_erf_cpp() { REGISTER_OP_BUILDER(Erf); }
void register_builders_erf_cpp() {}
#endif
} }
} }
} }
...@@ -236,10 +236,7 @@ namespace ngraph ...@@ -236,10 +236,7 @@ namespace ngraph
functors.emplace_back(functor); functors.emplace_back(functor);
} }
REGISTER_OP_BUILDER(Gather); void register_builders_gather_cpp() { REGISTER_OP_BUILDER(Gather); }
#ifdef NGRAPH_CPU_STATIC_LIB_ENABLE
void register_builders_gather_cpp() {}
#endif
} // namespace cpu } // namespace cpu
} // namespace runtime } // namespace runtime
} // namespace ngraph } // namespace ngraph
...@@ -138,10 +138,7 @@ namespace ngraph ...@@ -138,10 +138,7 @@ namespace ngraph
functors.emplace_back(functor); functors.emplace_back(functor);
} }
REGISTER_OP_BUILDER(GatherND); void register_builders_gather_nd_cpp() { REGISTER_OP_BUILDER(GatherND); }
#ifdef NGRAPH_CPU_STATIC_LIB_ENABLE
void register_builders_gather_nd_cpp() {}
#endif
} }
} }
} }
...@@ -47,10 +47,10 @@ namespace ngraph ...@@ -47,10 +47,10 @@ namespace ngraph
return; return;
} }
REGISTER_OP_BUILDER(GetOutputElement); void register_builders_get_output_element_cpp()
#ifdef NGRAPH_CPU_STATIC_LIB_ENABLE {
void register_builders_get_output_element_cpp() {} REGISTER_OP_BUILDER(GetOutputElement);
#endif }
} }
} }
} }
...@@ -85,10 +85,8 @@ namespace ngraph ...@@ -85,10 +85,8 @@ namespace ngraph
functors.emplace_back(functor); functors.emplace_back(functor);
} }
} }
REGISTER_OP_BUILDER(CPULeakyRelu);
#ifdef NGRAPH_CPU_STATIC_LIB_ENABLE void register_builders_leaky_relu_cpp() { REGISTER_OP_BUILDER(CPULeakyRelu); }
void register_builders_leaky_relu_cpp() {}
#endif
} }
} }
} }
...@@ -122,10 +122,7 @@ namespace ngraph ...@@ -122,10 +122,7 @@ namespace ngraph
functors.emplace_back(functor); functors.emplace_back(functor);
} }
REGISTER_OP_BUILDER(LRN); void register_builders_lrn_cpp() { REGISTER_OP_BUILDER(LRN); }
#ifdef NGRAPH_CPU_STATIC_LIB_ENABLE
void register_builders_lrn_cpp() {}
#endif
} }
} }
} }
...@@ -107,10 +107,8 @@ namespace ngraph ...@@ -107,10 +107,8 @@ namespace ngraph
}; };
functors.emplace_back(functor); functors.emplace_back(functor);
} }
REGISTER_OP_BUILDER(Lstm);
#ifdef NGRAPH_CPU_STATIC_LIB_ENABLE void register_builders_lstm_cpp() { REGISTER_OP_BUILDER(Lstm); }
void register_builders_lstm_cpp() {}
#endif
} }
} }
} }
...@@ -393,12 +393,12 @@ namespace ngraph ...@@ -393,12 +393,12 @@ namespace ngraph
cg->get_transpose_arg1()); cg->get_transpose_arg1());
} }
REGISTER_OP_BUILDER(MatmulBias); void register_builders_matmul_bias_cpp()
REGISTER_OP_BUILDER(BatchMatMul); {
REGISTER_OP_BUILDER(BatchMatMulTranspose); REGISTER_OP_BUILDER(MatmulBias);
#ifdef NGRAPH_CPU_STATIC_LIB_ENABLE REGISTER_OP_BUILDER(BatchMatMul);
void register_builders_matmul_bias_cpp() {} REGISTER_OP_BUILDER(BatchMatMulTranspose);
#endif }
} }
} }
} }
...@@ -37,10 +37,7 @@ namespace ngraph ...@@ -37,10 +37,7 @@ namespace ngraph
BUILD_REDUCTION_FUNCTOR(Max, max); BUILD_REDUCTION_FUNCTOR(Max, max);
} }
REGISTER_OP_BUILDER(Max); void register_builders_max_cpp() { REGISTER_OP_BUILDER(Max); }
#ifdef NGRAPH_CPU_STATIC_LIB_ENABLE
void register_builders_max_cpp() {}
#endif
} }
} }
} }
...@@ -333,13 +333,13 @@ namespace ngraph ...@@ -333,13 +333,13 @@ namespace ngraph
functors.emplace_back(functor); functors.emplace_back(functor);
} }
REGISTER_OP_BUILDER(MaxPool); void register_builders_max_pool_cpp()
REGISTER_OP_BUILDER(MaxPoolBackprop); {
REGISTER_OP_BUILDER(MaxPoolWithIndices); REGISTER_OP_BUILDER(MaxPool);
REGISTER_OP_BUILDER(MaxPoolWithIndicesBackprop); REGISTER_OP_BUILDER(MaxPoolBackprop);
#ifdef NGRAPH_CPU_STATIC_LIB_ENABLE REGISTER_OP_BUILDER(MaxPoolWithIndices);
void register_builders_max_pool_cpp() {} REGISTER_OP_BUILDER(MaxPoolWithIndicesBackprop);
#endif }
} }
} }
} }
...@@ -37,10 +37,7 @@ namespace ngraph ...@@ -37,10 +37,7 @@ namespace ngraph
BUILD_REDUCTION_FUNCTOR(Min, min); BUILD_REDUCTION_FUNCTOR(Min, min);
} }
REGISTER_OP_BUILDER(Min); void register_builders_min_cpp() { REGISTER_OP_BUILDER(Min); }
#ifdef NGRAPH_CPU_STATIC_LIB_ENABLE
void register_builders_min_cpp() {}
#endif
} }
} }
} }
...@@ -108,10 +108,7 @@ namespace ngraph ...@@ -108,10 +108,7 @@ namespace ngraph
} }
} }
REGISTER_OP_BUILDER(OneHot); void register_builders_one_hot_cpp() { REGISTER_OP_BUILDER(OneHot); }
#ifdef NGRAPH_CPU_STATIC_LIB_ENABLE
void register_builders_one_hot_cpp() {}
#endif
} }
} }
} }
...@@ -112,8 +112,6 @@ namespace ngraph ...@@ -112,8 +112,6 @@ namespace ngraph
} }
} }
REGISTER_OP_BUILDER(Pad);
template <> template <>
NodeExecutorTy Builder::BUILDER_CF_DECL(ngraph::op::Pad) NodeExecutorTy Builder::BUILDER_CF_DECL(ngraph::op::Pad)
{ {
...@@ -170,10 +168,12 @@ namespace ngraph ...@@ -170,10 +168,12 @@ namespace ngraph
return functor; return functor;
} }
} }
REGISTER_CF_BUILDER(Pad);
#ifdef NGRAPH_CPU_STATIC_LIB_ENABLE void register_builders_pad_cpp()
void register_builders_pad_cpp() {} {
#endif REGISTER_OP_BUILDER(Pad);
REGISTER_CF_BUILDER(Pad);
}
} }
} }
} }
...@@ -37,10 +37,7 @@ namespace ngraph ...@@ -37,10 +37,7 @@ namespace ngraph
BUILD_REDUCTION_FUNCTOR(Product, product); BUILD_REDUCTION_FUNCTOR(Product, product);
} }
REGISTER_OP_BUILDER(Product); void register_builders_product_cpp() { REGISTER_OP_BUILDER(Product); }
#ifdef NGRAPH_CPU_STATIC_LIB_ENABLE
void register_builders_product_cpp() {}
#endif
} }
} }
} }
...@@ -583,11 +583,11 @@ namespace ngraph ...@@ -583,11 +583,11 @@ namespace ngraph
} }
} }
REGISTER_OP_BUILDER(Dequantize); void register_builders_quantization_cpp()
REGISTER_OP_BUILDER(Quantize); {
#ifdef NGRAPH_CPU_STATIC_LIB_ENABLE REGISTER_OP_BUILDER(Dequantize);
void register_builders_quantization_cpp() {} REGISTER_OP_BUILDER(Quantize);
#endif }
} }
} }
} }
...@@ -703,14 +703,14 @@ namespace ngraph ...@@ -703,14 +703,14 @@ namespace ngraph
} }
} }
REGISTER_OP_BUILDER(QuantizedConvolution); void register_builders_quantized_conv_cpp()
REGISTER_OP_BUILDER(QuantizedConvolutionRelu); {
REGISTER_OP_BUILDER(QuantizedConvolutionBias); REGISTER_OP_BUILDER(QuantizedConvolution);
REGISTER_OP_BUILDER(QuantizedConvolutionBiasAdd); REGISTER_OP_BUILDER(QuantizedConvolutionRelu);
REGISTER_OP_BUILDER(QuantizedConvolutionBiasSignedAdd); REGISTER_OP_BUILDER(QuantizedConvolutionBias);
#ifdef NGRAPH_CPU_STATIC_LIB_ENABLE REGISTER_OP_BUILDER(QuantizedConvolutionBiasAdd);
void register_builders_quantized_conv_cpp() {} REGISTER_OP_BUILDER(QuantizedConvolutionBiasSignedAdd);
#endif }
} }
} }
} }
...@@ -258,11 +258,12 @@ namespace ngraph ...@@ -258,11 +258,12 @@ namespace ngraph
functors.emplace_back(functor); functors.emplace_back(functor);
} }
} }
REGISTER_OP_BUILDER(QuantizedDotBias);
REGISTER_OP_BUILDER(QuantizedDot); void register_builders_quantized_dot_cpp()
#ifdef NGRAPH_CPU_STATIC_LIB_ENABLE {
void register_builders_quantized_dot_cpp() {} REGISTER_OP_BUILDER(QuantizedDotBias);
#endif REGISTER_OP_BUILDER(QuantizedDot);
}
} }
} }
} }
...@@ -101,10 +101,8 @@ namespace ngraph ...@@ -101,10 +101,8 @@ namespace ngraph
throw ngraph_error("Unsupported QuantizedMatmul"); throw ngraph_error("Unsupported QuantizedMatmul");
} }
} }
REGISTER_OP_BUILDER(QuantizedMatmul);
#ifdef NGRAPH_CPU_STATIC_LIB_ENABLE void register_builders_quantized_matmul_cpp() { REGISTER_OP_BUILDER(QuantizedMatmul); }
void register_builders_quantized_matmul_cpp() {}
#endif
} }
} }
} }
...@@ -82,11 +82,11 @@ namespace ngraph ...@@ -82,11 +82,11 @@ namespace ngraph
functors.emplace_back(functor); functors.emplace_back(functor);
} }
REGISTER_OP_BUILDER(Any); void register_builders_reduce_function_cpp()
REGISTER_OP_BUILDER(All); {
#ifdef NGRAPH_CPU_STATIC_LIB_ENABLE REGISTER_OP_BUILDER(Any);
void register_builders_reduce_function_cpp() {} REGISTER_OP_BUILDER(All);
#endif }
} }
} }
} }
...@@ -132,11 +132,11 @@ namespace ngraph ...@@ -132,11 +132,11 @@ namespace ngraph
} }
} }
REGISTER_OP_BUILDER(Relu); void register_builders_relu_cpp()
REGISTER_OP_BUILDER(ReluBackprop); {
#ifdef NGRAPH_CPU_STATIC_LIB_ENABLE REGISTER_OP_BUILDER(Relu);
void register_builders_relu_cpp() {} REGISTER_OP_BUILDER(ReluBackprop);
#endif }
} }
} }
} }
...@@ -134,10 +134,7 @@ namespace ngraph ...@@ -134,10 +134,7 @@ namespace ngraph
} }
} }
REGISTER_OP_BUILDER(ReplaceSlice); void register_builders_replace_slice_cpp() { REGISTER_OP_BUILDER(ReplaceSlice); }
#ifdef NGRAPH_CPU_STATIC_LIB_ENABLE
void register_builders_replace_slice_cpp() {}
#endif
} }
} }
} }
...@@ -160,7 +160,6 @@ namespace ngraph ...@@ -160,7 +160,6 @@ namespace ngraph
} }
return functor; return functor;
} }
REGISTER_CF_BUILDER(Reshape);
template <> template <>
void Builder::BUILDER_DECL(ngraph::op::Reshape) void Builder::BUILDER_DECL(ngraph::op::Reshape)
...@@ -247,10 +246,11 @@ namespace ngraph ...@@ -247,10 +246,11 @@ namespace ngraph
functors.emplace_back(functor); functors.emplace_back(functor);
} }
REGISTER_OP_BUILDER(Reshape); void register_builders_reshape_cpp()
#ifdef NGRAPH_CPU_STATIC_LIB_ENABLE {
void register_builders_reshape_cpp() {} REGISTER_CF_BUILDER(Reshape);
#endif REGISTER_OP_BUILDER(Reshape);
}
} }
} }
} }
...@@ -62,10 +62,7 @@ namespace ngraph ...@@ -62,10 +62,7 @@ namespace ngraph
functors.emplace_back(functor); functors.emplace_back(functor);
} }
REGISTER_OP_BUILDER(Reverse); void register_builders_reverse_cpp() { REGISTER_OP_BUILDER(Reverse); }
#ifdef NGRAPH_CPU_STATIC_LIB_ENABLE
void register_builders_reverse_cpp() {}
#endif
} }
} }
} }
...@@ -79,10 +79,7 @@ namespace ngraph ...@@ -79,10 +79,7 @@ namespace ngraph
functors.emplace_back(functor); functors.emplace_back(functor);
} }
REGISTER_OP_BUILDER(ReverseSequence); void register_builders_reverse_sequence_cpp() { REGISTER_OP_BUILDER(ReverseSequence); }
#ifdef NGRAPH_CPU_STATIC_LIB_ENABLE
void register_builders_reverse_sequence_cpp() {}
#endif
} }
} }
} }
...@@ -102,10 +102,8 @@ namespace ngraph ...@@ -102,10 +102,8 @@ namespace ngraph
}; };
functors.emplace_back(functor); functors.emplace_back(functor);
} }
REGISTER_OP_BUILDER(Rnn);
#ifdef NGRAPH_CPU_STATIC_LIB_ENABLE void register_builders_rnn_cpp() { REGISTER_OP_BUILDER(Rnn); }
void register_builders_rnn_cpp() {}
#endif
} }
} }
} }
...@@ -139,10 +139,8 @@ namespace ngraph ...@@ -139,10 +139,8 @@ namespace ngraph
} }
} }
} }
REGISTER_OP_BUILDER(ScatterAdd);
#ifdef NGRAPH_CPU_STATIC_LIB_ENABLE void register_builders_scatter_add_cpp() { REGISTER_OP_BUILDER(ScatterAdd); }
void register_builders_scatter_add_cpp() {}
#endif
} }
} }
} }
...@@ -156,10 +156,7 @@ namespace ngraph ...@@ -156,10 +156,7 @@ namespace ngraph
functors.emplace_back(functor); functors.emplace_back(functor);
} }
REGISTER_OP_BUILDER(ScatterNDAdd); void register_builders_scatter_nd_add_cpp() { REGISTER_OP_BUILDER(ScatterNDAdd); }
#ifdef NGRAPH_CPU_STATIC_LIB_ENABLE
void register_builders_scatter_nd_add_cpp() {}
#endif
} }
} }
} }
...@@ -62,10 +62,7 @@ namespace ngraph ...@@ -62,10 +62,7 @@ namespace ngraph
functors.emplace_back(functor); functors.emplace_back(functor);
} }
REGISTER_OP_BUILDER(Select); void register_builders_select_cpp() { REGISTER_OP_BUILDER(Select); }
#ifdef NGRAPH_CPU_STATIC_LIB_ENABLE
void register_builders_select_cpp() {}
#endif
} }
} }
} }
...@@ -185,13 +185,13 @@ namespace ngraph ...@@ -185,13 +185,13 @@ namespace ngraph
functors.emplace_back(functor); functors.emplace_back(functor);
} }
REGISTER_OP_BUILDER(Sigmoid); void register_builders_sigmoid_cpp()
REGISTER_OP_BUILDER(SigmoidBackprop); {
REGISTER_OP_BUILDER(SigmoidMultiply); REGISTER_OP_BUILDER(Sigmoid);
REGISTER_OP_BUILDER(SigmoidMultiplyBackprop); REGISTER_OP_BUILDER(SigmoidBackprop);
#ifdef NGRAPH_CPU_STATIC_LIB_ENABLE REGISTER_OP_BUILDER(SigmoidMultiply);
void register_builders_sigmoid_cpp() {} REGISTER_OP_BUILDER(SigmoidMultiplyBackprop);
#endif }
} }
} }
} }
...@@ -187,10 +187,7 @@ namespace ngraph ...@@ -187,10 +187,7 @@ namespace ngraph
} }
} }
REGISTER_OP_BUILDER(Slice); void register_builders_slice_cpp() { REGISTER_OP_BUILDER(Slice); }
#ifdef NGRAPH_CPU_STATIC_LIB_ENABLE
void register_builders_slice_cpp() {}
#endif
} }
} }
} }
...@@ -195,10 +195,7 @@ namespace ngraph ...@@ -195,10 +195,7 @@ namespace ngraph
} }
} }
REGISTER_OP_BUILDER(Softmax); void register_builders_softmax_cpp() { REGISTER_OP_BUILDER(Softmax); }
#ifdef NGRAPH_CPU_STATIC_LIB_ENABLE
void register_builders_softmax_cpp() {}
#endif
} }
} }
} }
...@@ -139,10 +139,7 @@ namespace ngraph ...@@ -139,10 +139,7 @@ namespace ngraph
functors.emplace_back(functor); functors.emplace_back(functor);
} }
REGISTER_OP_BUILDER(GenerateMask); void register_builders_state_cpp() { REGISTER_OP_BUILDER(GenerateMask); }
#ifdef NGRAPH_CPU_STATIC_LIB_ENABLE
void register_builders_state_cpp() {}
#endif
} }
} }
} }
...@@ -37,10 +37,7 @@ namespace ngraph ...@@ -37,10 +37,7 @@ namespace ngraph
BUILD_REDUCTION_FUNCTOR(Sum, sum); BUILD_REDUCTION_FUNCTOR(Sum, sum);
} }
REGISTER_OP_BUILDER(Sum); void register_builders_sum_cpp() { REGISTER_OP_BUILDER(Sum); }
#ifdef NGRAPH_CPU_STATIC_LIB_ENABLE
void register_builders_sum_cpp() {}
#endif
} }
} }
} }
...@@ -75,10 +75,7 @@ namespace ngraph ...@@ -75,10 +75,7 @@ namespace ngraph
} }
} }
REGISTER_OP_BUILDER(Tile); void register_builders_tile_cpp() { REGISTER_OP_BUILDER(Tile); }
#ifdef NGRAPH_CPU_STATIC_LIB_ENABLE
void register_builders_tile_cpp() {}
#endif
} }
} }
} }
...@@ -210,10 +210,7 @@ namespace ngraph ...@@ -210,10 +210,7 @@ namespace ngraph
functors.emplace_back(functor); functors.emplace_back(functor);
} }
REGISTER_OP_BUILDER(TopK); void register_builders_topk_cpp() { REGISTER_OP_BUILDER(TopK); }
#ifdef NGRAPH_CPU_STATIC_LIB_ENABLE
void register_builders_topk_cpp() {}
#endif
} }
} }
} }
...@@ -124,10 +124,7 @@ namespace ngraph ...@@ -124,10 +124,7 @@ namespace ngraph
} }
} }
REGISTER_OP_BUILDER(UpdateSlice); void register_builders_update_slice_cpp() { REGISTER_OP_BUILDER(UpdateSlice); }
#ifdef NGRAPH_CPU_STATIC_LIB_ENABLE
void register_builders_update_slice_cpp() {}
#endif
} }
} }
} }
...@@ -17,9 +17,11 @@ ...@@ -17,9 +17,11 @@
#include <tbb/tbb_stddef.h> #include <tbb/tbb_stddef.h>
#include "cpu_backend_visibility.h" #include "cpu_backend_visibility.h"
#include "ngraph/graph_util.hpp" #include "ngraph/graph_util.hpp"
#include "ngraph/runtime/backend_manager.hpp" #include "ngraph/runtime/backend_manager.hpp"
#include "ngraph/runtime/cpu/cpu_backend.hpp" #include "ngraph/runtime/cpu/cpu_backend.hpp"
#include "ngraph/runtime/cpu/cpu_builder_registry.hpp"
#include "ngraph/runtime/cpu/cpu_call_frame.hpp" #include "ngraph/runtime/cpu/cpu_call_frame.hpp"
#include "ngraph/runtime/cpu/cpu_external_function.hpp" #include "ngraph/runtime/cpu/cpu_external_function.hpp"
#include "ngraph/runtime/cpu/cpu_tensor_view.hpp" #include "ngraph/runtime/cpu/cpu_tensor_view.hpp"
...@@ -40,8 +42,13 @@ runtime::BackendConstructor* runtime::cpu::get_backend_constructor_pointer() ...@@ -40,8 +42,13 @@ runtime::BackendConstructor* runtime::cpu::get_backend_constructor_pointer()
public: public:
std::shared_ptr<runtime::Backend> create(const std::string& config) override std::shared_ptr<runtime::Backend> create(const std::string& config) override
{ {
// Force TBB to link to the backend static bool s_is_initialized = false;
tbb::TBB_runtime_interface_version(); if (!s_is_initialized)
{
s_is_initialized = true;
tbb::TBB_runtime_interface_version();
ngraph::runtime::cpu::register_builders();
}
return make_shared<runtime::cpu::CPU_Backend>(); return make_shared<runtime::cpu::CPU_Backend>();
} }
}; };
...@@ -86,7 +93,6 @@ runtime::cpu::CPU_Backend::~CPU_Backend() ...@@ -86,7 +93,6 @@ runtime::cpu::CPU_Backend::~CPU_Backend()
{ {
m_exec_map.clear(); m_exec_map.clear();
} }
shared_ptr<runtime::cpu::CPU_CallFrame> runtime::cpu::CPU_Backend::make_call_frame( shared_ptr<runtime::cpu::CPU_CallFrame> runtime::cpu::CPU_Backend::make_call_frame(
const shared_ptr<runtime::cpu::CPU_ExternalFunction>& external_function, const shared_ptr<runtime::cpu::CPU_ExternalFunction>& external_function,
ngraph::pass::PassConfig& pass_config, ngraph::pass::PassConfig& pass_config,
...@@ -239,7 +245,6 @@ bool runtime::cpu::CPU_Backend::is_supported(const Node& op) const ...@@ -239,7 +245,6 @@ bool runtime::cpu::CPU_Backend::is_supported(const Node& op) const
{ {
return true; return true;
} }
bool runtime::cpu::CPU_Backend::is_supported_property(const Property prop) const bool runtime::cpu::CPU_Backend::is_supported_property(const Property prop) const
{ {
if (prop == Property::memory_attach) if (prop == Property::memory_attach)
......
...@@ -614,66 +614,69 @@ namespace ngraph ...@@ -614,66 +614,69 @@ namespace ngraph
return build_cf_dispatcher_cpu; return build_cf_dispatcher_cpu;
} }
REGISTER_OP_BUILDER(Constant); void register_cpu_builders()
REGISTER_OP_BUILDER(Result); {
REGISTER_OP_BUILDER(Subtract); REGISTER_OP_BUILDER(Constant);
REGISTER_OP_BUILDER(Multiply); REGISTER_OP_BUILDER(Result);
REGISTER_OP_BUILDER(Divide); REGISTER_OP_BUILDER(Subtract);
REGISTER_OP_BUILDER(Power); REGISTER_OP_BUILDER(Multiply);
REGISTER_OP_BUILDER(Abs); REGISTER_OP_BUILDER(Divide);
REGISTER_OP_BUILDER(Acos); REGISTER_OP_BUILDER(Power);
REGISTER_OP_BUILDER(Asin); REGISTER_OP_BUILDER(Abs);
REGISTER_OP_BUILDER(Atan); REGISTER_OP_BUILDER(Acos);
REGISTER_OP_BUILDER(Ceiling); REGISTER_OP_BUILDER(Asin);
REGISTER_OP_BUILDER(Cos); REGISTER_OP_BUILDER(Atan);
REGISTER_OP_BUILDER(Cosh) REGISTER_OP_BUILDER(Ceiling);
REGISTER_OP_BUILDER(Floor); REGISTER_OP_BUILDER(Cos);
REGISTER_OP_BUILDER(Negative); REGISTER_OP_BUILDER(Cosh);
REGISTER_OP_BUILDER(Exp); REGISTER_OP_BUILDER(Floor);
REGISTER_OP_BUILDER(Log); REGISTER_OP_BUILDER(Negative);
REGISTER_OP_BUILDER(Sqrt); REGISTER_OP_BUILDER(Exp);
REGISTER_OP_BUILDER(Sign); REGISTER_OP_BUILDER(Log);
REGISTER_OP_BUILDER(Sin); REGISTER_OP_BUILDER(Sqrt);
REGISTER_OP_BUILDER(Sinh); REGISTER_OP_BUILDER(Sign);
REGISTER_OP_BUILDER(Tan); REGISTER_OP_BUILDER(Sin);
REGISTER_OP_BUILDER(Tanh); REGISTER_OP_BUILDER(Sinh);
REGISTER_OP_BUILDER(Tan);
REGISTER_OP_BUILDER(Not); REGISTER_OP_BUILDER(Tanh);
REGISTER_OP_BUILDER(Equal);
REGISTER_OP_BUILDER(NotEqual); REGISTER_OP_BUILDER(Not);
REGISTER_OP_BUILDER(Greater); REGISTER_OP_BUILDER(Equal);
REGISTER_OP_BUILDER(GreaterEq); REGISTER_OP_BUILDER(NotEqual);
REGISTER_OP_BUILDER(Less); REGISTER_OP_BUILDER(Greater);
REGISTER_OP_BUILDER(LessEq); REGISTER_OP_BUILDER(GreaterEq);
REGISTER_OP_BUILDER(Maximum); REGISTER_OP_BUILDER(Less);
REGISTER_OP_BUILDER(Minimum); REGISTER_OP_BUILDER(LessEq);
REGISTER_OP_BUILDER(And); REGISTER_OP_BUILDER(Maximum);
REGISTER_OP_BUILDER(Or); REGISTER_OP_BUILDER(Minimum);
REGISTER_OP_BUILDER(Xor); REGISTER_OP_BUILDER(And);
REGISTER_OP_BUILDER(Or);
REGISTER_CF_BUILDER(Add); REGISTER_OP_BUILDER(Xor);
REGISTER_CF_BUILDER(Subtract);
REGISTER_CF_BUILDER(Multiply); REGISTER_CF_BUILDER(Add);
REGISTER_CF_BUILDER(Divide); REGISTER_CF_BUILDER(Subtract);
REGISTER_CF_BUILDER(Minimum); REGISTER_CF_BUILDER(Multiply);
REGISTER_CF_BUILDER(Maximum); REGISTER_CF_BUILDER(Divide);
REGISTER_CF_BUILDER(Abs); REGISTER_CF_BUILDER(Minimum);
REGISTER_CF_BUILDER(Negative); REGISTER_CF_BUILDER(Maximum);
REGISTER_CF_BUILDER(Relu); REGISTER_CF_BUILDER(Abs);
REGISTER_CF_BUILDER(Sqrt); REGISTER_CF_BUILDER(Negative);
REGISTER_CF_BUILDER(Floor); REGISTER_CF_BUILDER(Relu);
REGISTER_CF_BUILDER(Ceiling); REGISTER_CF_BUILDER(Sqrt);
REGISTER_CF_BUILDER(Equal); REGISTER_CF_BUILDER(Floor);
REGISTER_CF_BUILDER(NotEqual); REGISTER_CF_BUILDER(Ceiling);
REGISTER_CF_BUILDER(Greater); REGISTER_CF_BUILDER(Equal);
REGISTER_CF_BUILDER(GreaterEq); REGISTER_CF_BUILDER(NotEqual);
REGISTER_CF_BUILDER(Less); REGISTER_CF_BUILDER(Greater);
REGISTER_CF_BUILDER(LessEq); REGISTER_CF_BUILDER(GreaterEq);
REGISTER_CF_BUILDER(And); REGISTER_CF_BUILDER(Less);
REGISTER_CF_BUILDER(Or); REGISTER_CF_BUILDER(LessEq);
REGISTER_CF_BUILDER(Xor); REGISTER_CF_BUILDER(And);
REGISTER_CF_BUILDER(Sign); REGISTER_CF_BUILDER(Or);
REGISTER_CF_BUILDER(Not); REGISTER_CF_BUILDER(Xor);
REGISTER_CF_BUILDER(Sign);
REGISTER_CF_BUILDER(Not);
}
} }
} }
} }
...@@ -374,48 +374,24 @@ ...@@ -374,48 +374,24 @@
return functor; return functor;
#define REGISTER_OP_BUILDER(OP) \ #define REGISTER_OP_BUILDER(OP) \
static struct __register_##OP##_builder \ GetGlobalBuildDispatcher().insert( \
{ \ {type_index(typeid(ngraph::op::OP)), &runtime::cpu::Builder::build<ngraph::op::OP>})
__register_##OP##_builder() \
{ \
GetGlobalBuildDispatcher().insert({type_index(typeid(ngraph::op::OP)), \
&runtime::cpu::Builder::build<ngraph::op::OP>}); \
} \
} __register_##OP##_builder_instance;
#define REGISTER_CPU_OP_BUILDER(OP) \ #define REGISTER_CPU_OP_BUILDER(OP) \
static struct __register_##OP##_builder \ GetGlobalBuildDispatcher().insert( \
{ \ {type_index(typeid(ngraph::runtime::cpu::op::OP)), \
__register_##OP##_builder() \ &runtime::cpu::Builder::build<ngraph::runtime::cpu::op::OP>})
{ \
GetGlobalBuildDispatcher().insert( \
{type_index(typeid(ngraph::runtime::cpu::op::OP)), \
&runtime::cpu::Builder::build<ngraph::runtime::cpu::op::OP>}); \
} \
} __register_##OP##_builder_instance;
#define BUILDER_CF_DECL(op_name) CFbuild<op_name>(const ngraph::Node* node) #define BUILDER_CF_DECL(op_name) CFbuild<op_name>(const ngraph::Node* node)
#define REGISTER_CF_BUILDER(OP) \ #define REGISTER_CF_BUILDER(OP) \
static struct __register_##OP##_cf_builder \ GetGlobalCFDispatcherCPU().insert( \
{ \ {type_index(typeid(ngraph::op::OP)), &runtime::cpu::Builder::CFbuild<ngraph::op::OP>})
__register_##OP##_cf_builder() \
{ \
GetGlobalCFDispatcherCPU().insert({type_index(typeid(ngraph::op::OP)), \
&runtime::cpu::Builder::CFbuild<ngraph::op::OP>}); \
} \
} __register_##OP##_cf_builder_instance;
#define REGISTER_CPU_CF_BUILDER(OP) \ #define REGISTER_CPU_CF_BUILDER(OP) \
static struct __register_##OP##_cf_builder \ GetGlobalCFDispatcherCPU().insert( \
{ \ {type_index(typeid(ngraph::runtime::cpu::op::OP)), \
__register_##OP##_cf_builder() \ &runtime::cpu::Builder::CFbuild<ngraph::runtime::cpu::op::OP>})
{ \
GetGlobalCFDispatcherCPU().insert( \
{type_index(typeid(ngraph::runtime::cpu::op::OP)), \
&runtime::cpu::Builder::CFbuild<ngraph::runtime::cpu::op::OP>}); \
} \
} __register_##OP##_cf_builder_instance;
namespace ngraph namespace ngraph
{ {
......
...@@ -15,7 +15,6 @@ ...@@ -15,7 +15,6 @@
//***************************************************************************** //*****************************************************************************
#include "ngraph/runtime/cpu/cpu_builder_registry.hpp" #include "ngraph/runtime/cpu/cpu_builder_registry.hpp"
#ifdef NGRAPH_CPU_STATIC_LIB_ENABLE
namespace ngraph namespace ngraph
{ {
namespace runtime namespace runtime
...@@ -76,8 +75,8 @@ namespace ngraph ...@@ -76,8 +75,8 @@ namespace ngraph
register_builders_tile_cpp(); register_builders_tile_cpp();
register_builders_topk_cpp(); register_builders_topk_cpp();
register_builders_update_slice_cpp(); register_builders_update_slice_cpp();
register_cpu_builders();
} }
} }
} }
} }
#endif
...@@ -15,7 +15,6 @@ ...@@ -15,7 +15,6 @@
//***************************************************************************** //*****************************************************************************
#pragma once #pragma once
#ifdef NGRAPH_CPU_STATIC_LIB_ENABLE
namespace ngraph namespace ngraph
{ {
namespace runtime namespace runtime
...@@ -75,7 +74,7 @@ namespace ngraph ...@@ -75,7 +74,7 @@ namespace ngraph
void register_builders_tile_cpp(); void register_builders_tile_cpp();
void register_builders_topk_cpp(); void register_builders_topk_cpp();
void register_builders_update_slice_cpp(); void register_builders_update_slice_cpp();
void register_cpu_builders();
} }
} }
} }
#endif
This diff is collapsed.
...@@ -1374,11 +1374,6 @@ void runtime::cpu::CPU_ExternalFunction::build(ngraph::pass::PassConfig& pass_co ...@@ -1374,11 +1374,6 @@ void runtime::cpu::CPU_ExternalFunction::build(ngraph::pass::PassConfig& pass_co
"enabled due to concurrent graph execution"); "enabled due to concurrent graph execution");
} }
// reference all the builders for static library
#ifdef NGRAPH_CPU_STATIC_LIB_ENABLE
ngraph::runtime::cpu::register_builders();
#endif
// stream writer to dump the debug manifest for the DEX // stream writer to dump the debug manifest for the DEX
static const string s_debug_dir = "cpu_codegen"; static const string s_debug_dir = "cpu_codegen";
static StaticInitializers s_static_initializers(s_debug_dir); static StaticInitializers s_static_initializers(s_debug_dir);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment