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