[GPU] Graph serialization for GPU (#13801)

* gpu graph serialization

* fix to rebase

* onednn_gpu.patch for serialization

* git apply --verbode to --quiet

* functional tests

* removed referece of mas_unpooling.hpp

* git apply --verbose

* add no args ctor for proposal_impl

* changed kernel_cache save/load error messages

* gpu model cacning control env. variable

* fixed nonnull warning

* impl_params are added to save and load

* changed a way to use kernel_impl_params in save and load

* get_arguments_by_idx is added

* setenv is disabled in windows

* added missed part for onednn

* code refactoring based on code review

* fixed to use get_node_output_layout()

* OV_GPU_MODEL_CACHING is changed to OV_GPU_CACHE_MODEL

* reference to node and primitive are removed

* fixed hash of enum class

* restored CanShareContextWith

* serialization of intermediate memory

* fix to rebase

* multiclass_nms serialization

* caching_properties added
This commit is contained in:
Eddy Kim
2022-11-14 09:39:45 +09:00
committed by GitHub
parent e4b21aa1ff
commit f488e6cc49
234 changed files with 3943 additions and 110 deletions

View File

@@ -12,6 +12,7 @@
#include "intel_gpu/runtime/event.hpp"
#include "intel_gpu/runtime/stream.hpp"
#include "intel_gpu/runtime/lru_cache.hpp"
#include "serialization/binary_buffer.hpp"
#include <map>
#include <vector>
@@ -79,8 +80,11 @@ public:
network(program::ptr program, stream::ptr stream, uint16_t stream_id);
network(cldnn::BinaryInputBuffer& ifs, stream::ptr stream, engine& engine, uint16_t stream_id = 0);
~network();
void save(cldnn::BinaryOutputBuffer& ob);
static ptr build_network(engine& engine,
const topology& topology,

View File

@@ -25,7 +25,10 @@ public:
typedef std::shared_ptr<CompiledModel> Ptr;
CompiledModel(InferenceEngine::CNNNetwork &network, std::shared_ptr<InferenceEngine::RemoteContext> context, Config config);
CompiledModel(std::istream& networkModel, std::shared_ptr<InferenceEngine::RemoteContext> context, Config config);
void Export(std::ostream& networkModel) override;
bool isSerializable();
std::shared_ptr<ngraph::Function> GetExecGraphInfo() override;
InferenceEngine::IInferRequestInternal::Ptr CreateInferRequest() override;
InferenceEngine::IInferRequestInternal::Ptr CreateInferRequestImpl(InferenceEngine::InputsDataMap networkInputs,

View File

@@ -41,7 +41,9 @@ public:
using variable_states_map = std::map<std::string, std::vector<cldnn::network::VariableState::Ptr>>;
Graph(InferenceEngine::CNNNetwork& network, InferenceEngine::gpu::ClContext::Ptr context, Config config, uint16_t stream_id = 0);
Graph(cldnn::BinaryInputBuffer& ib, InferenceEngine::gpu::ClContext::Ptr context, Config config, uint16_t stream_id = 0);
explicit Graph(std::shared_ptr<Graph> graph, uint16_t stream_id = 0);
void Export(cldnn::BinaryOutputBuffer &ob);
std::shared_ptr<ngraph::Function> GetExecGraphInfo();
bool IsLoaded() const;

View File

@@ -23,6 +23,7 @@ class Plugin : public InferenceEngine::IInferencePlugin,
std::shared_ptr<impl> _impl;
bool streamsSet = false;
bool throttlingSet = false;
bool isModelCachingEnabled = false;
// key: device_id, value: cldnn device
std::map<std::string, cldnn::device::ptr> device_map;
@@ -58,6 +59,8 @@ public:
InferenceEngine::Parameter GetMetric(const std::string& name, const std::map<std::string, InferenceEngine::Parameter>& options) const override;
InferenceEngine::QueryNetworkResult QueryNetwork(const InferenceEngine::CNNNetwork& network,
const std::map<std::string, std::string>& config) const override;
InferenceEngine::IExecutableNetworkInternal::Ptr ImportNetwork(std::istream& networkModel,
const std::map<std::string, std::string>& config) override;
std::shared_ptr<InferenceEngine::RemoteContext> CreateContext(const InferenceEngine::ParamMap& params) override;
std::shared_ptr<InferenceEngine::RemoteContext> GetDefaultContext(const InferenceEngine::ParamMap& params) override;

View File

@@ -114,6 +114,61 @@ struct kernel_arguments_data {
const scalars_desc* scalars = nullptr;
};
struct kernel_arguments_data_idx {
std::vector<int32_t> inputs;
int32_t weights;
int32_t recurrent;
int32_t hidden;
int32_t cell;
int32_t bias;
int32_t weights_zero_points;
int32_t activations_zero_points;
int32_t compensation;
int32_t lookup_table;
int32_t scale_table;
int32_t slope;
std::vector<int32_t> fused_op_inputs;
int32_t split = 0;
scalars_desc scalars;
template <typename BufferType>
void save(BufferType& ob) const {
ob << inputs;
ob << weights;
ob << recurrent;
ob << hidden;
ob << cell;
ob << bias;
ob << weights_zero_points;
ob << activations_zero_points;
ob << compensation;
ob << lookup_table;
ob << scale_table;
ob << slope;
ob << fused_op_inputs;
ob << split;
}
template <typename BufferType>
void load(BufferType& ib) {
ib >> inputs;
ib >> weights;
ib >> recurrent;
ib >> hidden;
ib >> cell;
ib >> bias;
ib >> weights_zero_points;
ib >> activations_zero_points;
ib >> compensation;
ib >> lookup_table;
ib >> scale_table;
ib >> slope;
ib >> fused_op_inputs;
ib >> split;
}
};
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// KernelString
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

View File

@@ -371,6 +371,12 @@ struct layout {
layout(const layout& other) = default;
layout()
: data_type(cldnn::data_types::bin)
, format(cldnn::format::any)
, data_padding(padding())
, size(ov::PartialShape()) { }
layout& operator=(const layout& other) {
if (this == &other)
return *this;

View File

@@ -90,7 +90,7 @@ struct padded_pool_comparer {
class memory_pool {
memory_pool();
memory_ptr alloc_memory(const layout& layout, allocation_type type);
memory_ptr alloc_memory(const layout& layout, allocation_type type, bool reset = true);
static bool has_conflict(const memory_set&, const std::set<primitive_id>&, uint32_t network_id);
std::multimap<uint64_t, memory_record> _non_padded_pool;
@@ -107,7 +107,7 @@ public:
const std::set<primitive_id>& restrictions,
allocation_type type,
bool reusable = true); // get from pool or create memory allocation
memory_ptr get_memory(const layout& layout, allocation_type type);
memory_ptr get_memory(const layout& layout, allocation_type type, bool reset = true);
memory_ptr get_from_non_padded_pool(const layout& layout,
const primitive_id& id,
uint32_t network_id,

View File

@@ -585,4 +585,20 @@ convolution_inst::typed_primitive_inst(network& network, convolution_node const&
"Weights/ifm mismatch");
}
}
void convolution_inst::save(cldnn::BinaryOutputBuffer& ob) const {
parent::save(ob);
ob << _groups;
ob << _split;
ob << _deform_conv_dep_offset;
}
void convolution_inst::load(cldnn::BinaryInputBuffer& ib) {
parent::load(ib);
ib >> _groups;
ib >> _split;
ib >> _deform_conv_dep_offset;
}
} // namespace cldnn

View File

@@ -244,7 +244,7 @@ crop_inst::typed_primitive_inst(network& network, crop_node const& node) : paren
}
void crop_inst::on_execute() {
if (!node->can_be_optimized())
if (!can_be_optimized())
return;
if (_outputs[0] && _network.get_engine().is_the_same_buffer(output_memory(), input_memory()))
@@ -254,17 +254,18 @@ void crop_inst::on_execute() {
}
void crop_inst::reuse_input() {
_outputs[0] = _network.get_engine().reinterpret_buffer(input_memory(), node->get_output_layout());
update_output_memory();
}
void crop_inst::update_output_memory() {
if (!node->can_be_optimized())
if (!can_be_optimized())
return;
if (_outputs[0] && _network.get_engine().is_the_same_buffer(output_memory(), input_memory()))
return;
_outputs[0] = _network.get_engine().reinterpret_buffer(input_memory(), node->get_output_layout());
_outputs[0] = _network.get_engine().reinterpret_buffer(input_memory(), _impl_params->output_layout);
_mem_allocated = false;
}
} // namespace cldnn

View File

@@ -141,7 +141,9 @@ std::string deconvolution_inst::to_string(deconvolution_node const& node) {
}
deconvolution_inst::typed_primitive_inst(network& network, deconvolution_node const& node)
: parent(network, node) {
: parent(network, node),
_groups(node.get_groups()),
_split(node.get_split()) {
auto stride = argument->stride;
auto pad = argument->pad;
@@ -220,4 +222,18 @@ deconvolution_inst::typed_primitive_inst(network& network, deconvolution_node co
"Weights/ifm mismatch");
}
}
void deconvolution_inst::save(cldnn::BinaryOutputBuffer& ob) const {
parent::save(ob);
ob << _groups;
ob << _split;
}
void deconvolution_inst::load(cldnn::BinaryInputBuffer& ib) {
parent::load(ib);
ib >> _groups;
ib >> _split;
}
} // namespace cldnn

View File

@@ -7,6 +7,7 @@
#include "intel_gpu/runtime/error_handler.hpp"
#include "json_object.h"
#include <string>
#include "serialization/string_serializer.hpp"
namespace cldnn {
primitive_type_id detection_output::type_id() {
@@ -180,4 +181,91 @@ detection_output_inst::typed_primitive_inst(network& network, detection_output_n
"Detection output layer doesn't support input padding in Prior-Box input");
}
void detection_output_inst::save(cldnn::BinaryOutputBuffer& ob) const {
parent::save(ob);
// argument (struct detection_output)
ob << argument->id;
ob << argument->input[0];
ob << argument->input[1];
ob << argument->input[2];
ob << cldnn::make_data(&argument->output_padding, sizeof(argument->output_padding));
ob << argument->num_classes;
ob << argument->keep_top_k;
ob << argument->share_location;
ob << argument->background_label_id;
ob << argument->nms_threshold;
ob << argument->top_k;
ob << argument->eta;
ob << cldnn::make_data(&argument->code_type, sizeof(argument->code_type));
ob << argument->variance_encoded_in_target;
ob << argument->confidence_threshold;
ob << argument->prior_info_size;
ob << argument->prior_coordinates_offset;
ob << argument->prior_is_normalized;
ob << argument->input_width;
ob << argument->input_height;
ob << argument->decrease_label_id;
ob << argument->clip_before_nms;
ob << argument->clip_after_nms;
}
void detection_output_inst::load(cldnn::BinaryInputBuffer& ib) {
parent::load(ib);
primitive_id id;
primitive_id input_location;
primitive_id input_confidence;
primitive_id input_prior_box;
uint32_t num_classes;
uint32_t keep_top_k;
bool share_location;
int background_label_id;
float nms_threshold;
int top_k;
float eta;
prior_box_code_type code_type;
bool variance_encoded_in_target;
float confidence_threshold;
int32_t prior_info_size;
int32_t prior_coordinates_offset;
bool prior_is_normalized;
int32_t input_width;
int32_t input_height;
bool decrease_label_id;
bool clip_before_nms;
bool clip_after_nms;
// primitive_id ext_prim_id;
padding output_padding;
ib >> id;
ib >> input_location;
ib >> input_confidence;
ib >> input_prior_box;
ib >> cldnn::make_data(&output_padding, sizeof(output_padding));
ib >> num_classes;
ib >> keep_top_k;
ib >> share_location;
ib >> background_label_id;
ib >> nms_threshold;
ib >> top_k;
ib >> eta;
ib >> cldnn::make_data(&code_type, sizeof(code_type));
ib >> variance_encoded_in_target;
ib >> confidence_threshold;
ib >> prior_info_size;
ib >> prior_coordinates_offset;
ib >> prior_is_normalized;
ib >> input_width;
ib >> input_height;
ib >> decrease_label_id;
ib >> clip_before_nms;
ib >> clip_after_nms;
argument = std::make_shared<detection_output>(id, input_location, input_confidence, input_prior_box,
num_classes, keep_top_k, share_location, background_label_id, nms_threshold, top_k, eta, code_type,
variance_encoded_in_target, confidence_threshold, prior_info_size, prior_coordinates_offset,
prior_is_normalized, input_width, input_height, decrease_label_id, clip_before_nms, clip_after_nms,
output_padding);
}
} // namespace cldnn

View File

@@ -0,0 +1,198 @@
// Copyright (C) 2018-2022 Intel Corporation
// SPDX-License-Identifier: Apache-2.0
//
///////////////////////////////////////////////////////////////////////////////////////////////////
#include "primitive_inst.h"
#include "generic_layer.hpp"
#include "intel_gpu/primitives/activation.hpp"
#include "intel_gpu/primitives/adaptive_pooling.hpp"
#include "intel_gpu/primitives/arg_max_min.hpp"
#include "intel_gpu/primitives/assign.hpp"
#include "intel_gpu/primitives/average_unpooling.hpp"
#include "intel_gpu/primitives/batch_to_space.hpp"
#include "intel_gpu/primitives/binary_convolution.hpp"
#include "intel_gpu/primitives/border.hpp"
#include "intel_gpu/primitives/broadcast.hpp"
#include "intel_gpu/primitives/bucketize.hpp"
#include "intel_gpu/primitives/concatenation.hpp"
#include "intel_gpu/primitives/condition.hpp"
#include "intel_gpu/primitives/convert_color.hpp"
#include "intel_gpu/primitives/convolution.hpp"
#include "intel_gpu/primitives/crop.hpp"
#include "intel_gpu/primitives/ctc_greedy_decoder.hpp"
#include "intel_gpu/primitives/ctc_loss.hpp"
#include "intel_gpu/primitives/cum_sum.hpp"
#include "intel_gpu/primitives/custom_gpu_primitive.hpp"
#include "intel_gpu/primitives/data.hpp"
#include "intel_gpu/primitives/deconvolution.hpp"
#include "intel_gpu/primitives/depth_to_space.hpp"
#include "intel_gpu/primitives/detection_output.hpp"
#include "intel_gpu/primitives/dft.hpp"
#include "intel_gpu/primitives/eltwise.hpp"
#include "intel_gpu/primitives/embedding_bag.hpp"
#include "intel_gpu/primitives/experimental_detectron_detection_output.hpp"
#include "intel_gpu/primitives/experimental_detectron_generate_proposals_single_image.hpp"
#include "intel_gpu/primitives/experimental_detectron_prior_grid_generator.hpp"
#include "intel_gpu/primitives/experimental_detectron_roi_feature_extractor.hpp"
#include "intel_gpu/primitives/experimental_detectron_topk_rois.hpp"
#include "intel_gpu/primitives/extract_image_patches.hpp"
#include "intel_gpu/primitives/eye.hpp"
#include "intel_gpu/primitives/fully_connected.hpp"
#include "intel_gpu/primitives/gather_elements.hpp"
#include "intel_gpu/primitives/gather_nd.hpp"
#include "intel_gpu/primitives/gather_tree.hpp"
#include "intel_gpu/primitives/gather.hpp"
#include "intel_gpu/primitives/gemm.hpp"
#include "intel_gpu/primitives/generate_proposals.hpp"
#include "intel_gpu/primitives/grn.hpp"
#include "intel_gpu/primitives/grn.hpp"
#include "intel_gpu/primitives/input_layout.hpp"
#include "intel_gpu/primitives/loop.hpp"
#include "intel_gpu/primitives/lrn.hpp"
#include "intel_gpu/primitives/lstm_dynamic_input.hpp"
#include "intel_gpu/primitives/lstm_dynamic_timeloop.hpp"
#include "intel_gpu/primitives/lstm_dynamic.hpp"
#include "intel_gpu/primitives/lstm.hpp"
#include "intel_gpu/primitives/multiclass_nms.hpp"
#include "intel_gpu/primitives/mutable_data.hpp"
#include "intel_gpu/primitives/mvn.hpp"
#include "intel_gpu/primitives/non_max_suppression.hpp"
#include "intel_gpu/primitives/non_zero.hpp"
#include "intel_gpu/primitives/normalize.hpp"
#include "intel_gpu/primitives/one_hot.hpp"
#include "intel_gpu/primitives/permute.hpp"
#include "intel_gpu/primitives/pooling.hpp"
#include "intel_gpu/primitives/prior_box.hpp"
#include "intel_gpu/primitives/proposal.hpp"
#include "intel_gpu/primitives/pyramid_roi_align.hpp"
#include "intel_gpu/primitives/quantize.hpp"
#include "intel_gpu/primitives/random_uniform.hpp"
#include "intel_gpu/primitives/range.hpp"
#include "intel_gpu/primitives/read_value.hpp"
#include "intel_gpu/primitives/reduce.hpp"
#include "intel_gpu/primitives/region_yolo.hpp"
#include "intel_gpu/primitives/reorder.hpp"
#include "intel_gpu/primitives/reorg_yolo.hpp"
#include "intel_gpu/primitives/resample.hpp"
#include "intel_gpu/primitives/reshape.hpp"
#include "intel_gpu/primitives/reverse_sequence.hpp"
#include "intel_gpu/primitives/reverse.hpp"
#include "intel_gpu/primitives/roi_align.hpp"
#include "intel_gpu/primitives/roi_pooling.hpp"
#include "intel_gpu/primitives/roll.hpp"
#include "intel_gpu/primitives/scatter_elements_update.hpp"
#include "intel_gpu/primitives/scatter_nd_update.hpp"
#include "intel_gpu/primitives/scatter_update.hpp"
#include "intel_gpu/primitives/select.hpp"
#include "intel_gpu/primitives/shape_of.hpp"
#include "intel_gpu/primitives/shuffle_channels.hpp"
#include "intel_gpu/primitives/slice.hpp"
#include "intel_gpu/primitives/softmax.hpp"
#include "intel_gpu/primitives/space_to_batch.hpp"
#include "intel_gpu/primitives/space_to_depth.hpp"
#include "intel_gpu/primitives/split.hpp"
#include "intel_gpu/primitives/strided_slice.hpp"
#include "intel_gpu/primitives/tile.hpp"
cldnn::primitive_type_id cldnn::get_type_id(std::string type_str) {
static std::unordered_map<std::string, primitive_type_id> primitive_inst_types = {
{"activation", cldnn::activation::type_id()},
{"adaptive_pooling", cldnn::adaptive_pooling::type_id()},
{"arg_max_min", cldnn::arg_max_min::type_id()},
{"assign", cldnn::assign::type_id()},
{"average_unpooling", cldnn::average_unpooling::type_id()},
{"binary_convolution", cldnn::binary_convolution::type_id()},
{"border", cldnn::border::type_id()},
{"broadcast", cldnn::broadcast::type_id()},
{"bucketize", cldnn::bucketize::type_id()},
{"batch_to_space", cldnn::batch_to_space::type_id()},
{"space_to_batch", cldnn::space_to_batch::type_id()},
{"concatenation", cldnn::concatenation::type_id()},
{"condition", cldnn::condition::type_id()},
{"convert_color", cldnn::convert_color::type_id()},
{"convolution", cldnn::convolution::type_id()},
{"count_nonzero", cldnn::count_nonzero::type_id()},
{"crop", cldnn::crop::type_id()},
{"ctc_greedy_decoder", cldnn::ctc_greedy_decoder::type_id()},
{"ctc_loss", cldnn::ctc_loss::type_id()},
{"cum_sum", cldnn::cum_sum::type_id()},
{"custom_gpu_primitive", cldnn::custom_gpu_primitive::type_id()},
{"data", cldnn::data::type_id()},
{"deconvolution", cldnn::deconvolution::type_id()},
{"deformable_conv", cldnn::deformable_conv::type_id()},
{"deformable_interp", cldnn::deformable_interp::type_id()},
{"depth_to_space", cldnn::depth_to_space::type_id()},
{"detection_output", cldnn::detection_output::type_id()},
{"dft", cldnn::dft::type_id()},
{"eltwise", cldnn::eltwise::type_id()},
{"embedding_bag", cldnn::embedding_bag::type_id()},
{"experimental_detectron_detection_output", cldnn::experimental_detectron_detection_output::type_id()},
{"experimental_detectron_generate_proposals_single_image", cldnn::experimental_detectron_generate_proposals_single_image::type_id()},
{"experimental_detectron_prior_grid_generator", cldnn::experimental_detectron_prior_grid_generator::type_id()},
{"experimental_detectron_roi_feature_extractor", cldnn::experimental_detectron_roi_feature_extractor::type_id()},
{"experimental_detectron_topk_rois", cldnn::experimental_detectron_topk_rois::type_id()},
{"extract_image_patches", cldnn::extract_image_patches::type_id()},
{"eye", cldnn::eye::type_id()},
{"fully_connected", cldnn::fully_connected::type_id()},
{"gather", cldnn::gather::type_id()},
{"gather_elements", cldnn::gather_elements::type_id()},
{"gather_nd", cldnn::gather_nd::type_id()},
{"gather_nonzero", cldnn::gather_nonzero::type_id()},
{"gather_tree", cldnn::gather_tree::type_id()},
{"gemm", cldnn::gemm::type_id()},
{"generate_proposals", cldnn::generate_proposals::type_id()},
{"generic_layer", cldnn::generic_layer::type_id()},
{"grn", cldnn::grn::type_id()},
{"input_layout", cldnn::input_layout::type_id()},
{"loop", cldnn::loop::type_id()},
{"lrn", cldnn::lrn::type_id()},
{"lstm", cldnn::lstm::type_id()},
{"lstm_dynamic", cldnn::lstm_dynamic::type_id()},
{"lstm_dynamic_input", cldnn::lstm_dynamic_input::type_id()},
{"lstm_dynamic_timeloop", cldnn::lstm_dynamic_timeloop::type_id()},
{"lstm_elt", cldnn::lstm_elt::type_id()},
{"lstm_gemm", cldnn::lstm_gemm::type_id()},
{"multiclass_nms", cldnn::multiclass_nms::type_id()},
{"mutable_data", cldnn::mutable_data::type_id()},
{"mvn", cldnn::mvn::type_id()},
{"non_max_suppression", cldnn::non_max_suppression::type_id()},
{"normalize", cldnn::normalize::type_id()},
{"one_hot", cldnn::one_hot::type_id()},
{"permute", cldnn::permute::type_id()},
{"pooling", cldnn::pooling::type_id()},
{"prior_box", cldnn::prior_box::type_id()},
{"proposal", cldnn::proposal::type_id()},
{"pyramid_roi_align", cldnn::pyramid_roi_align::type_id()},
{"quantize", cldnn::quantize::type_id()},
{"random_uniform", cldnn::random_uniform::type_id()},
{"range", cldnn::range::type_id()},
{"read_value", cldnn::read_value::type_id()},
{"reduce", cldnn::reduce::type_id()},
{"region_yolo", cldnn::region_yolo::type_id()},
{"reorder", cldnn::reorder::type_id()},
{"reorg_yolo", cldnn::reorg_yolo::type_id()},
{"resample", cldnn::resample::type_id()},
{"reshape", cldnn::reshape::type_id()},
{"reverse", cldnn::reverse::type_id()},
{"reverse_sequence", cldnn::reverse_sequence::type_id()},
{"roi_align", cldnn::roi_align::type_id()},
{"roi_pooling", cldnn::roi_pooling::type_id()},
{"roll", cldnn::roll::type_id()},
{"scatter_elements_update", cldnn::scatter_elements_update::type_id()},
{"scatter_nd_update", cldnn::scatter_nd_update::type_id()},
{"scatter_update", cldnn::scatter_update::type_id()},
{"select", cldnn::select::type_id()},
{"shape_of", cldnn::shape_of::type_id()},
{"shuffle_channels", cldnn::shuffle_channels::type_id()},
{"slice", cldnn::slice::type_id()},
{"softmax", cldnn::softmax::type_id()},
{"space_to_depth", cldnn::space_to_depth::type_id()},
{"split", cldnn::split::type_id()},
{"strided_slice", cldnn::strided_slice::type_id()},
{"tile", cldnn::tile::type_id()},
};
return primitive_inst_types[type_str];
}

View File

@@ -8,22 +8,34 @@
#include "input_layout_inst.h"
#include "impls/implementation_map.hpp"
#include "register.hpp"
#include "serialization/binary_buffer.hpp"
#include <vector>
namespace cldnn {
namespace common {
class wait_for_events_impl : public primitive_impl {
using primitive_impl::primitive_impl;
public:
explicit wait_for_events_impl(const program_node& /*node*/)
: primitive_impl(kernel_selector::weights_reorder_params{}, "wait_for_events") { }
wait_for_events_impl() : primitive_impl() {}
DECLARE_OBJECT_TYPE_SERIALIZATION
std::unique_ptr<primitive_impl> clone() const override {
return make_unique<wait_for_events_impl>(*this);
}
void init_kernels(const kernels_cache&) override {}
void set_arguments(primitive_inst& /*instance*/) override {}
void set_arguments(kernel_arguments_data_idx& /*instance*/) override {}
kernel_arguments_data get_arguments(const primitive_inst& /*instance*/) const override {
kernel_arguments_data args;
return args;
}
std::vector<layout> get_internal_buffer_layouts() const override { return {}; }
event::ptr execute(const std::vector<event::ptr>& events, primitive_inst& instance) override {
@@ -62,3 +74,5 @@ attach_prior_box_common::attach_prior_box_common() {
} // namespace detail
} // namespace common
} // namespace cldnn
BIND_BINARY_BUFFER_WITH_TYPE(cldnn::common::wait_for_events_impl, cldnn::object_type::WAIT_FOR_EVENTS_IMPL)

View File

@@ -10,6 +10,8 @@ namespace cldnn {
namespace cpu {
struct assign_impl : public typed_primitive_impl<assign> {
DECLARE_OBJECT_TYPE_SERIALIZATION
std::unique_ptr<primitive_impl> clone() const override {
return make_unique<assign_impl>(*this);
}
@@ -53,3 +55,5 @@ attach_assign_impl::attach_assign_impl() {
} // namespace detail
} // namespace cpu
} // namespace cldnn
BIND_BINARY_BUFFER_WITH_TYPE(cldnn::cpu::assign_impl, cldnn::object_type::ASSIGN_IMPL)

View File

@@ -43,12 +43,21 @@ bool comp_score_descend<std::pair<int, int>>(const std::pair<float, std::pair<in
/************************ Detection Output CPU ************************/
struct detection_output_impl : typed_primitive_impl<detection_output> {
using parent = typed_primitive_impl<detection_output>;
using parent::parent;
public:
enum NMSType {CAFFE, MXNET};
NMSType nms_type;
DECLARE_OBJECT_TYPE_SERIALIZATION
std::unique_ptr<primitive_impl> clone() const override {
return make_unique<detection_output_impl>(*this);
}
detection_output_impl() : parent() {}
explicit detection_output_impl(const detection_output_node& outer) {
set_node_params(outer);
}
@@ -59,6 +68,14 @@ struct detection_output_impl : typed_primitive_impl<detection_output> {
nms_type = (node.get_primitive()->decrease_label_id ? NMSType::MXNET : NMSType::CAFFE);
}
void save(BinaryOutputBuffer& ob) const override {
ob << make_data(&nms_type, sizeof(NMSType));
}
void load(BinaryInputBuffer& ib) override {
ib >> make_data(&nms_type, sizeof(NMSType));
}
static inline void intersect_bbox(const bounding_box& bbox1,
const bounding_box& bbox2,
bounding_box& intersect_bbox) {
@@ -854,3 +871,5 @@ attach_detection_output_impl::attach_detection_output_impl() {
} // namespace cpu
} // namespace cldnn
BIND_BINARY_BUFFER_WITH_TYPE(cldnn::cpu::detection_output_impl, cldnn::object_type::DETECTION_OUTPUT_IMPL_CPU)

View File

@@ -383,6 +383,8 @@ void run(non_max_suppression_inst& instance) {
struct non_max_suppression_impl : typed_primitive_impl<non_max_suppression> {
using parent = typed_primitive_impl<non_max_suppression>;
DECLARE_OBJECT_TYPE_SERIALIZATION
std::unique_ptr<primitive_impl> clone() const override {
return make_unique<non_max_suppression_impl>(*this);
}
@@ -421,3 +423,5 @@ attach_non_max_suppression_impl::attach_non_max_suppression_impl() {
} // namespace detail
} // namespace cpu
} // namespace cldnn
BIND_BINARY_BUFFER_WITH_TYPE(cldnn::cpu::non_max_suppression_impl, cldnn::object_type::NON_MAX_SUPPRESSION_IMPL_CPU)

View File

@@ -188,8 +188,15 @@ struct im_info_t {
};
struct proposal_impl : typed_primitive_impl<proposal> {
using parent = typed_primitive_impl<proposal>;
using parent::parent;
proposal_impl() : parent() {}
explicit proposal_impl(const proposal_node& arg) {}
DECLARE_OBJECT_TYPE_SERIALIZATION
std::unique_ptr<primitive_impl> clone() const override {
return make_unique<proposal_impl>(*this);
}
@@ -453,3 +460,5 @@ attach_proposal_impl::attach_proposal_impl() {
} // namespace detail
} // namespace cpu
} // namespace cldnn
BIND_BINARY_BUFFER_WITH_TYPE(cldnn::cpu::proposal_impl, cldnn::object_type::PROPOSAL_IMPL_CPU)

View File

@@ -10,6 +10,8 @@ namespace cldnn {
namespace cpu {
struct read_value_impl : public typed_primitive_impl<read_value> {
DECLARE_OBJECT_TYPE_SERIALIZATION
std::unique_ptr<primitive_impl> clone() const override {
return make_unique<read_value_impl>(*this);
}
@@ -53,3 +55,5 @@ attach_read_value_impl::attach_read_value_impl() {
} // namespace detail
} // namespace cpu
} // namespace cldnn
BIND_BINARY_BUFFER_WITH_TYPE(cldnn::cpu::read_value_impl, cldnn::object_type::READ_VALUE_IMPL)

View File

@@ -17,10 +17,14 @@ struct activation_impl : typed_primitive_impl_ocl<activation> {
using parent = typed_primitive_impl_ocl<activation>;
using parent::parent;
DECLARE_OBJECT_TYPE_SERIALIZATION
std::unique_ptr<primitive_impl> clone() const override {
return make_unique<activation_impl>(*this);
}
activation_impl() : parent() {}
explicit activation_impl(const activation_impl& other) : parent(other),
_is_parameterized(other._is_parameterized) {}
@@ -34,7 +38,7 @@ struct activation_impl : typed_primitive_impl_ocl<activation> {
_is_parameterized = node.is_parameterized();
}
kernel_arguments_data get_arguments(typed_primitive_inst<activation>& instance, int32_t split) const override {
kernel_arguments_data get_arguments(const typed_primitive_inst<activation>& instance, int32_t split) const override {
kernel_arguments_data args = parent::get_arguments(instance, split);
if (_is_parameterized) {
@@ -43,6 +47,17 @@ struct activation_impl : typed_primitive_impl_ocl<activation> {
return args;
}
void save(BinaryOutputBuffer& ob) const override {
parent::save(ob);
ob << _is_parameterized;
}
void load(BinaryInputBuffer& ib) override {
parent::load(ib);
ib >> _is_parameterized;
}
static primitive_impl* create(const activation_node& arg, const kernel_impl_params& impl_param) {
const auto& prim = arg.get_primitive();
auto activation_params = get_default_params<kernel_selector::activation_params>(impl_param);
@@ -153,3 +168,5 @@ attach_activation_impl::attach_activation_impl() {
} // namespace detail
} // namespace ocl
} // namespace cldnn
BIND_BINARY_BUFFER_WITH_TYPE(cldnn::ocl::activation_impl, cldnn::object_type::ACTIVATION_IMPL)

View File

@@ -17,12 +17,14 @@ struct adaptive_pooling_impl : public typed_primitive_impl_ocl<adaptive_pooling>
using parent = typed_primitive_impl_ocl<adaptive_pooling>;
using parent::parent;
DECLARE_OBJECT_TYPE_SERIALIZATION
std::unique_ptr<primitive_impl> clone() const override {
return make_unique<adaptive_pooling_impl>(*this);
}
protected:
kernel_arguments_data get_arguments(typed_primitive_inst<adaptive_pooling>& instance, int32_t) const override {
kernel_arguments_data get_arguments(const typed_primitive_inst<adaptive_pooling>& instance, int32_t) const override {
kernel_arguments_data args;
const auto num_inputs = instance.inputs_memory_count();
for (size_t i = 0; i < num_inputs; ++i) {
@@ -96,3 +98,5 @@ attach_adaptive_pooling_impl::attach_adaptive_pooling_impl() {
} // namespace detail
} // namespace ocl
} // namespace cldnn
BIND_BINARY_BUFFER_WITH_TYPE(cldnn::ocl::adaptive_pooling_impl, cldnn::object_type::ADAPTIVE_POOLING_IMPL)

View File

@@ -40,12 +40,14 @@ struct arg_max_min_impl : typed_primitive_impl_ocl<arg_max_min> {
using parent = typed_primitive_impl_ocl<arg_max_min>;
using parent::parent;
DECLARE_OBJECT_TYPE_SERIALIZATION
std::unique_ptr<primitive_impl> clone() const override {
return make_unique<arg_max_min_impl>(*this);
}
protected:
kernel_arguments_data get_arguments(typed_primitive_inst<arg_max_min>& instance, int32_t) const override {
kernel_arguments_data get_arguments(const typed_primitive_inst<arg_max_min>& instance, int32_t) const override {
kernel_arguments_data args = parent::get_arguments(instance, 0);
if (instance.node->has_second_output()) {
@@ -129,3 +131,5 @@ attach_arg_max_min_impl::attach_arg_max_min_impl() {
} // namespace detail
} // namespace ocl
} // namespace cldnn
BIND_BINARY_BUFFER_WITH_TYPE(cldnn::ocl::arg_max_min_impl, cldnn::object_type::ARG_MAX_MIN_IMPL)

View File

@@ -17,12 +17,14 @@ struct average_unpooling_impl : typed_primitive_impl_ocl<average_unpooling> {
using parent = typed_primitive_impl_ocl<average_unpooling>;
using parent::parent;
DECLARE_OBJECT_TYPE_SERIALIZATION
std::unique_ptr<primitive_impl> clone() const override {
return make_unique<average_unpooling_impl>(*this);
}
protected:
kernel_arguments_data get_arguments(typed_primitive_inst<average_unpooling>& instance, int32_t split) const override {
kernel_arguments_data get_arguments(const typed_primitive_inst<average_unpooling>& instance, int32_t split) const override {
kernel_arguments_data args = parent::get_arguments(instance, split);
return args;
}
@@ -77,3 +79,5 @@ attach_average_unpooling_impl::attach_average_unpooling_impl() {
} // namespace detail
} // namespace ocl
} // namespace cldnn
BIND_BINARY_BUFFER_WITH_TYPE(cldnn::ocl::average_unpooling_impl, cldnn::object_type::AVERAGE_UNPOOLING_IMPL)

View File

@@ -20,6 +20,8 @@ struct batch_to_space_impl : typed_primitive_impl_ocl<batch_to_space> {
using parent = typed_primitive_impl_ocl<batch_to_space>;
using parent::parent;
DECLARE_OBJECT_TYPE_SERIALIZATION
std::unique_ptr<primitive_impl> clone() const override {
return make_unique<batch_to_space_impl>(*this);
}
@@ -75,3 +77,5 @@ attach_batch_to_space_impl::attach_batch_to_space_impl() {
} // namespace detail
} // namespace ocl
} // namespace cldnn
BIND_BINARY_BUFFER_WITH_TYPE(cldnn::ocl::batch_to_space_impl, cldnn::object_type::BATCH_TO_SPACE_IMPL)

View File

@@ -21,10 +21,14 @@ struct binary_convolution_impl : typed_primitive_impl_ocl<binary_convolution> {
using parent = typed_primitive_impl_ocl<binary_convolution>;
using parent::parent;
DECLARE_OBJECT_TYPE_SERIALIZATION
std::unique_ptr<primitive_impl> clone() const override {
return make_unique<binary_convolution_impl>(*this);
}
binary_convolution_impl() : parent() {}
explicit binary_convolution_impl(const binary_convolution_impl& other) : parent(other),
_split(other._split) {}
@@ -61,7 +65,7 @@ protected:
return res;
}
kernel_arguments_data get_arguments(typed_primitive_inst<binary_convolution>& instance, int32_t split) const override {
kernel_arguments_data get_arguments(const typed_primitive_inst<binary_convolution>& instance, int32_t split) const override {
kernel_arguments_data args = parent::get_arguments(instance, split);
args.weights = instance.weights_memory(split);
@@ -71,6 +75,16 @@ protected:
int32_t get_split() const override { return _split; }
public:
void save(BinaryOutputBuffer& ob) const override {
parent::save(ob);
ob << _split;
}
void load(BinaryInputBuffer& ib) override {
parent::load(ib);
ib >> _split;
}
static primitive_impl* create(const binary_convolution_node& arg, const kernel_impl_params& impl_param) {
const auto& primitive = arg.get_primitive();
const auto& weights_layout = (*impl_param.weights_layout).convert_to_weights_layout(false);
@@ -154,3 +168,5 @@ attach_binary_convolution_impl::attach_binary_convolution_impl() {
} // namespace detail
} // namespace ocl
} // namespace cldnn
BIND_BINARY_BUFFER_WITH_TYPE(cldnn::ocl::binary_convolution_impl, cldnn::object_type::BINARY_CONVOLUTION_IMPL)

View File

@@ -18,6 +18,8 @@ struct border_impl : typed_primitive_impl_ocl<border> {
using parent = typed_primitive_impl_ocl<border>;
using parent::parent;
DECLARE_OBJECT_TYPE_SERIALIZATION
std::unique_ptr<primitive_impl> clone() const override {
return make_unique<border_impl>(*this);
}
@@ -173,3 +175,5 @@ attach_border_impl::attach_border_impl() {
} // namespace detail
} // namespace ocl
} // namespace cldnn
BIND_BINARY_BUFFER_WITH_TYPE(cldnn::ocl::border_impl, cldnn::object_type::BORDER_IMPL)

View File

@@ -18,6 +18,8 @@ struct broadcast_impl : typed_primitive_impl_ocl<broadcast> {
using parent = typed_primitive_impl_ocl<broadcast>;
using parent::parent;
DECLARE_OBJECT_TYPE_SERIALIZATION
std::unique_ptr<primitive_impl> clone() const override {
return make_unique<broadcast_impl>(*this);
}
@@ -172,3 +174,5 @@ attach_broadcast_impl::attach_broadcast_impl() {
} // namespace detail
} // namespace ocl
} // namespace cldnn
BIND_BINARY_BUFFER_WITH_TYPE(cldnn::ocl::broadcast_impl, cldnn::object_type::BROADCAST_IMPL)

View File

@@ -15,6 +15,8 @@ struct bucketize_impl : typed_primitive_impl_ocl<bucketize> {
using parent = typed_primitive_impl_ocl<bucketize>;
using parent::parent;
DECLARE_OBJECT_TYPE_SERIALIZATION
std::unique_ptr<primitive_impl> clone() const override {
return make_unique<bucketize_impl>(*this);
}
@@ -74,3 +76,5 @@ attach_bucketize_impl::attach_bucketize_impl() {
} // namespace ocl
} // namespace cldnn
BIND_BINARY_BUFFER_WITH_TYPE(cldnn::ocl::bucketize_impl, cldnn::object_type::BUCKETIZE_IMPL)

View File

@@ -47,11 +47,16 @@ kernel_selector::concat_axis convert_axis(int64_t axis, size_t rank) {
struct concatenation_impl : typed_primitive_impl_ocl<concatenation> {
using parent = typed_primitive_impl_ocl<concatenation>;
using parent::parent;
DECLARE_OBJECT_TYPE_SERIALIZATION
std::unique_ptr<primitive_impl> clone() const override {
return make_unique<concatenation_impl>(*this);
}
concatenation_impl() : parent() {}
explicit concatenation_impl(const concatenation_impl& other) : parent(other),
_can_be_optimized(other._can_be_optimized) {}
@@ -80,6 +85,16 @@ protected:
}
public:
void save(BinaryOutputBuffer& ob) const override {
parent::save(ob);
ob << _can_be_optimized;
}
void load(BinaryInputBuffer& ib) override {
parent::load(ib);
ib >> _can_be_optimized;
}
static primitive_impl* create(const concatenation_node& arg, const kernel_impl_params& impl_param) {
if (arg.can_be_optimized()) {
return new concatenation_impl(arg, {});
@@ -194,3 +209,5 @@ attach_concatenation_impl::attach_concatenation_impl() {
} // namespace detail
} // namespace ocl
} // namespace cldnn
BIND_BINARY_BUFFER_WITH_TYPE(cldnn::ocl::concatenation_impl, cldnn::object_type::CONCATENATION_IMPL)

View File

@@ -20,12 +20,14 @@ struct convert_color_impl : typed_primitive_impl_ocl<convert_color> {
using parent = typed_primitive_impl_ocl<convert_color>;
using parent::parent;
DECLARE_OBJECT_TYPE_SERIALIZATION
std::unique_ptr<primitive_impl> clone() const override {
return make_unique<convert_color_impl>(*this);
}
protected:
kernel_arguments_data get_arguments(typed_primitive_inst<convert_color>& instance, int32_t split) const override {
kernel_arguments_data get_arguments(const typed_primitive_inst<convert_color>& instance, int32_t split) const override {
kernel_arguments_data args = parent::get_arguments(instance, split);
return args;
}
@@ -76,3 +78,5 @@ attach_convert_color_impl::attach_convert_color_impl() {
} // namespace detail
} // namespace ocl
} // namespace cldnn
BIND_BINARY_BUFFER_WITH_TYPE(cldnn::ocl::convert_color_impl, cldnn::object_type::CONVERT_COLOR_IMPL)

View File

@@ -21,10 +21,14 @@ struct convolution_impl : typed_primitive_impl_ocl<convolution> {
using parent = typed_primitive_impl_ocl<convolution>;
using parent::parent;
DECLARE_OBJECT_TYPE_SERIALIZATION
std::unique_ptr<primitive_impl> clone() const override {
return make_unique<convolution_impl>(*this);
}
convolution_impl() : parent() {}
explicit convolution_impl(const convolution_impl& other) : parent(other),
_split(other._split),
_groups(other._groups),
@@ -59,7 +63,7 @@ protected:
return res;
}
kernel_arguments_data get_arguments(typed_primitive_inst<convolution>& instance, int32_t split) const override {
kernel_arguments_data get_arguments(const typed_primitive_inst<convolution>& instance, int32_t split) const override {
kernel_arguments_data args = parent::get_arguments(instance, split);
args.weights = instance.weights_memory(split);
@@ -76,6 +80,20 @@ protected:
bool get_depthwise_sep_opt() const override { return _depthwise_sep_opt; }
public:
void save(BinaryOutputBuffer& ob) const override {
parent::save(ob);
ob << _split;
ob << _groups;
ob << _depthwise_sep_opt;
}
void load(BinaryInputBuffer& ib) override {
parent::load(ib);
ib >> _split;
ib >> _groups;
ib >> _depthwise_sep_opt;
}
static primitive_impl* create(const convolution_node& arg, const kernel_impl_params& impl_param) {
const auto& primitive = arg.get_primitive();
@@ -266,3 +284,5 @@ attach_convolution_impl::attach_convolution_impl() {
} // namespace detail
} // namespace ocl
} // namespace cldnn
BIND_BINARY_BUFFER_WITH_TYPE(cldnn::ocl::convolution_impl, cldnn::object_type::CONVOLUTION_IMPL)

View File

@@ -17,10 +17,14 @@ struct crop_impl : typed_primitive_impl_ocl<crop> {
using parent = typed_primitive_impl_ocl<crop>;
using parent::parent;
DECLARE_OBJECT_TYPE_SERIALIZATION
std::unique_ptr<primitive_impl> clone() const override {
return make_unique<crop_impl>(*this);
}
crop_impl() : parent() {}
explicit crop_impl(const crop_impl& other) : parent(other),
_can_be_optimized(other._can_be_optimized) {}
@@ -40,6 +44,16 @@ protected:
}
public:
void save(BinaryOutputBuffer& ob) const override {
parent::save(ob);
ob << _can_be_optimized;
}
void load(BinaryInputBuffer& ib) override {
parent::load(ib);
ib >> _can_be_optimized;
}
static primitive_impl* create(const crop_node& arg, const kernel_impl_params& impl_param) {
auto ew_params = get_default_params<kernel_selector::eltwise_params>(impl_param, 1);
auto ew_optional_params = get_default_optional_params<kernel_selector::eltwise_optional_params>(arg.get_program());
@@ -151,3 +165,5 @@ attach_crop_impl::attach_crop_impl() {
} // namespace detail
} // namespace ocl
} // namespace cldnn
BIND_BINARY_BUFFER_WITH_TYPE(cldnn::ocl::crop_impl, cldnn::object_type::CROP_IMPL)

View File

@@ -21,6 +21,8 @@ struct ctc_greedy_decoder_impl : typed_primitive_impl_ocl<ctc_greedy_decoder> {
using parent = typed_primitive_impl_ocl<ctc_greedy_decoder>;
using parent::parent;
DECLARE_OBJECT_TYPE_SERIALIZATION
std::unique_ptr<primitive_impl> clone() const override {
return make_unique<ctc_greedy_decoder_impl>(*this);
}
@@ -71,3 +73,5 @@ attach_ctc_greedy_decoder_impl::attach_ctc_greedy_decoder_impl() {
} // namespace detail
} // namespace ocl
} // namespace cldnn
BIND_BINARY_BUFFER_WITH_TYPE(cldnn::ocl::ctc_greedy_decoder_impl, cldnn::object_type::CTC_GREEDY_DECODER_IMPL)

View File

@@ -15,6 +15,8 @@ struct ctc_loss_impl : typed_primitive_impl_ocl<ctc_loss> {
using parent = typed_primitive_impl_ocl<ctc_loss>;
using parent::parent;
DECLARE_OBJECT_TYPE_SERIALIZATION
std::unique_ptr<primitive_impl> clone() const override {
return make_unique<ctc_loss_impl>(*this);
}
@@ -62,3 +64,5 @@ attach_ctc_loss_impl::attach_ctc_loss_impl() {
} // namespace detail
} // namespace ocl
} // namespace cldnn
BIND_BINARY_BUFFER_WITH_TYPE(cldnn::ocl::ctc_loss_impl, cldnn::object_type::CTC_LOSS_IMPL)

View File

@@ -51,6 +51,8 @@ struct cum_sum_impl : typed_primitive_impl_ocl<cum_sum> {
using parent = typed_primitive_impl_ocl<cum_sum>;
using parent::parent;
DECLARE_OBJECT_TYPE_SERIALIZATION
std::unique_ptr<primitive_impl> clone() const override {
return make_unique<cum_sum_impl>(*this);
}
@@ -104,3 +106,5 @@ attach_cum_sum_impl::attach_cum_sum_impl() {
} // namespace detail
} // namespace ocl
} // namespace cldnn
BIND_BINARY_BUFFER_WITH_TYPE(cldnn::ocl::cum_sum_impl, cldnn::object_type::CUM_SUM_IMPL)

View File

@@ -24,6 +24,11 @@ namespace cldnn {
namespace ocl {
struct custom_gpu_primitive_impl : typed_primitive_impl<custom_gpu_primitive> {
using parent = typed_primitive_impl<custom_gpu_primitive>;
using parent::parent;
DECLARE_OBJECT_TYPE_SERIALIZATION
std::shared_ptr<kernel_selector::cl_kernel_data> cl_kernel;
std::vector<kernel::ptr> _kernels;
kernel_id _kernel_id;
@@ -32,6 +37,9 @@ struct custom_gpu_primitive_impl : typed_primitive_impl<custom_gpu_primitive> {
return make_unique<custom_gpu_primitive_impl>(*this);
}
custom_gpu_primitive_impl()
: _kernels() {}
custom_gpu_primitive_impl(const custom_gpu_primitive_impl& other)
: cl_kernel(other.cl_kernel)
, _kernels({})
@@ -76,6 +84,17 @@ struct custom_gpu_primitive_impl : typed_primitive_impl<custom_gpu_primitive> {
std::vector<std::string> get_kernel_ids() override {
return {_kernel_id};
}
void save(BinaryOutputBuffer& ob) const override {
ob << *cl_kernel;
ob << _kernel_id;
}
void load(BinaryInputBuffer& ib) override {
cl_kernel = std::make_shared<kernel_selector::cl_kernel_data>();
ib >> *cl_kernel;
ib >> _kernel_id;
}
};
static kernel_selector::kernel_argument_element get_arg(custom_gpu_primitive::arg_desc arg) {
@@ -238,3 +257,5 @@ attach_custom_gpu_primitive_impl::attach_custom_gpu_primitive_impl() {
} // namespace detail
} // namespace ocl
} // namespace cldnn
BIND_BINARY_BUFFER_WITH_TYPE(cldnn::ocl::custom_gpu_primitive_impl, cldnn::object_type::CUSTOM_GPU_PRIMITIVE_IMPL)

View File

@@ -18,10 +18,14 @@ struct deconvolution_impl : typed_primitive_impl_ocl<deconvolution> {
using parent = typed_primitive_impl_ocl<deconvolution>;
using parent::parent;
DECLARE_OBJECT_TYPE_SERIALIZATION
std::unique_ptr<primitive_impl> clone() const override {
return make_unique<deconvolution_impl>(*this);
}
deconvolution_impl() : parent() {}
explicit deconvolution_impl(const deconvolution_impl& other) : parent(other),
_split(other._split),
_groups(other._groups) {}
@@ -37,6 +41,18 @@ struct deconvolution_impl : typed_primitive_impl_ocl<deconvolution> {
_groups = node.get_groups();
}
void save(BinaryOutputBuffer& ob) const override {
parent::save(ob);
ob << _split;
ob << _groups;
}
void load(BinaryInputBuffer& ib) override {
parent::load(ib);
ib >> _split;
ib >> _groups;
}
protected:
// TODO: share it with convolution and fully connected
bool validate_impl(const typed_primitive_inst<deconvolution>& instance) const override {
@@ -52,7 +68,7 @@ protected:
return res;
}
kernel_arguments_data get_arguments(typed_primitive_inst<deconvolution>& instance, int32_t split) const override {
kernel_arguments_data get_arguments(const typed_primitive_inst<deconvolution>& instance, int32_t split) const override {
kernel_arguments_data args = parent::get_arguments(instance, split);
args.weights = instance.weights_memory(split);
@@ -158,3 +174,5 @@ attach_deconvolution_impl::attach_deconvolution_impl() {
} // namespace detail
} // namespace ocl
} // namespace cldnn
BIND_BINARY_BUFFER_WITH_TYPE(cldnn::ocl::deconvolution_impl, cldnn::object_type::DECONVOLUTION_IMPL)

View File

@@ -19,10 +19,14 @@ struct deformable_conv_impl : typed_primitive_impl_ocl<deformable_conv> {
using parent = typed_primitive_impl_ocl<deformable_conv>;
using parent::parent;
DECLARE_OBJECT_TYPE_SERIALIZATION
std::unique_ptr<primitive_impl> clone() const override {
return make_unique<deformable_conv_impl>(*this);
}
deformable_conv_impl() : parent() {}
explicit deformable_conv_impl(const deformable_conv_impl& other) : parent(other),
_split(other._split),
_groups(other._groups) {}
@@ -38,8 +42,20 @@ struct deformable_conv_impl : typed_primitive_impl_ocl<deformable_conv> {
_groups = node.get_groups();
}
void save(BinaryOutputBuffer& ob) const override {
parent::save(ob);
ob << _split;
ob << _groups;
}
void load(BinaryInputBuffer& ib) override {
parent::load(ib);
ib >> _split;
ib >> _groups;
}
protected:
kernel_arguments_data get_arguments(typed_primitive_inst<deformable_conv>& instance, int32_t split) const override {
kernel_arguments_data get_arguments(const typed_primitive_inst<deformable_conv>& instance, int32_t split) const override {
kernel_arguments_data args = parent::get_arguments(instance, split);
args.weights = instance.weights_memory(split);
@@ -101,6 +117,8 @@ struct deformable_interp_impl : typed_primitive_impl_ocl<deformable_interp> {
using parent = typed_primitive_impl_ocl<deformable_interp>;
using parent::parent;
DECLARE_OBJECT_TYPE_SERIALIZATION
std::unique_ptr<primitive_impl> clone() const override {
return make_unique<deformable_interp_impl>(*this);
}
@@ -193,3 +211,6 @@ attach_deformable_interp_impl::attach_deformable_interp_impl() {
} // namespace detail
} // namespace ocl
} // namespace cldnn
BIND_BINARY_BUFFER_WITH_TYPE(cldnn::ocl::deformable_conv_impl, cldnn::object_type::DEFORMABLE_CONV_IMPL)
BIND_BINARY_BUFFER_WITH_TYPE(cldnn::ocl::deformable_interp_impl, cldnn::object_type::DEFORMABLE_INTERP_IMPL)

View File

@@ -19,6 +19,8 @@ struct depth_to_space_impl : typed_primitive_impl_ocl<depth_to_space> {
using parent = typed_primitive_impl_ocl<depth_to_space>;
using parent::parent;
DECLARE_OBJECT_TYPE_SERIALIZATION
std::unique_ptr<primitive_impl> clone() const override {
return make_unique<depth_to_space_impl>(*this);
}
@@ -73,3 +75,5 @@ attach_depth_to_space_impl::attach_depth_to_space_impl() {
} // namespace detail
} // namespace ocl
} // namespace cldnn
BIND_BINARY_BUFFER_WITH_TYPE(cldnn::ocl::depth_to_space_impl, cldnn::object_type::DEPTH_TO_SPACE_IMPL)

View File

@@ -18,6 +18,8 @@ struct detection_output_impl : typed_primitive_impl_ocl<detection_output> {
using parent = typed_primitive_impl_ocl<detection_output>;
using parent::parent;
DECLARE_OBJECT_TYPE_SERIALIZATION
std::unique_ptr<primitive_impl> clone() const override {
return make_unique<detection_output_impl>(*this);
}
@@ -101,3 +103,5 @@ attach_detection_output_impl::attach_detection_output_impl() {
} // namespace detail
} // namespace ocl
} // namespace cldnn
BIND_BINARY_BUFFER_WITH_TYPE(cldnn::ocl::detection_output_impl, cldnn::object_type::DETECTION_OUTPUT_IMPL_OCL)

View File

@@ -18,6 +18,8 @@ namespace ocl {
struct dft_impl : typed_primitive_impl_ocl<dft> {
using typed_primitive_impl_ocl::typed_primitive_impl_ocl;
DECLARE_OBJECT_TYPE_SERIALIZATION
std::unique_ptr<primitive_impl> clone() const override {
return make_unique<dft_impl>(*this);
}
@@ -109,3 +111,5 @@ attach_dft_impl::attach_dft_impl() {
} // namespace detail
} // namespace ocl
} // namespace cldnn
BIND_BINARY_BUFFER_WITH_TYPE(cldnn::ocl::dft_impl, cldnn::object_type::DFT_IMPL)

View File

@@ -18,12 +18,14 @@ struct eltwise_impl : typed_primitive_impl_ocl<eltwise> {
using parent = typed_primitive_impl_ocl<eltwise>;
using parent::parent;
DECLARE_OBJECT_TYPE_SERIALIZATION
std::unique_ptr<primitive_impl> clone() const override {
return make_unique<eltwise_impl>(*this);
}
protected:
kernel_arguments_data get_arguments(typed_primitive_inst<eltwise>& instance, int32_t split) const override {
kernel_arguments_data get_arguments(const typed_primitive_inst<eltwise>& instance, int32_t split) const override {
kernel_arguments_data args = parent::get_arguments(instance, split);
return args;
}
@@ -285,3 +287,5 @@ attach_eltwise_impl::attach_eltwise_impl() {
} // namespace detail
} // namespace ocl
} // namespace cldnn
BIND_BINARY_BUFFER_WITH_TYPE(cldnn::ocl::eltwise_impl, cldnn::object_type::ELTWISE_IMPL)

View File

@@ -19,6 +19,8 @@ struct embedding_bag_impl : typed_primitive_impl_ocl<embedding_bag> {
using parent = typed_primitive_impl_ocl<embedding_bag>;
using parent::parent;
DECLARE_OBJECT_TYPE_SERIALIZATION
std::unique_ptr<primitive_impl> clone() const override {
return make_unique<embedding_bag_impl>(*this);
}
@@ -77,3 +79,5 @@ attach_embedding_bag_impl::attach_embedding_bag_impl() {
} // namespace detail
} // namespace ocl
} // namespace cldnn
BIND_BINARY_BUFFER_WITH_TYPE(cldnn::ocl::embedding_bag_impl, cldnn::object_type::EMBEDDING_BAG_IMPL)

View File

@@ -16,12 +16,14 @@ struct experimental_detectron_detection_output_impl
using parent = typed_primitive_impl_ocl<experimental_detectron_detection_output>;
using parent::parent;
DECLARE_OBJECT_TYPE_SERIALIZATION
std::unique_ptr<primitive_impl> clone() const override {
return make_unique<experimental_detectron_detection_output_impl>(*this);
}
protected:
kernel_arguments_data get_arguments(typed_primitive_inst<experimental_detectron_detection_output>& instance,
kernel_arguments_data get_arguments(const typed_primitive_inst<experimental_detectron_detection_output>& instance,
int32_t unused) const override {
kernel_arguments_data args = parent::get_arguments(instance, unused);
args.inputs.push_back(instance.output_classes_memory());
@@ -85,3 +87,6 @@ attach_experimental_detectron_detection_output_impl::attach_experimental_detectr
} // namespace detail
} // namespace ocl
} // namespace cldnn
BIND_BINARY_BUFFER_WITH_TYPE(cldnn::ocl::experimental_detectron_detection_output_impl,
cldnn::object_type::ACTIVATION_IMPL)

View File

@@ -17,12 +17,14 @@ struct experimental_detectron_generate_proposals_single_image_impl
using parent = typed_primitive_impl_ocl<experimental_detectron_generate_proposals_single_image>;
using parent::parent;
DECLARE_OBJECT_TYPE_SERIALIZATION
std::unique_ptr<primitive_impl> clone() const override {
return make_unique<experimental_detectron_generate_proposals_single_image_impl>(*this);
}
protected:
kernel_arguments_data get_arguments(typed_primitive_inst<experimental_detectron_generate_proposals_single_image>& instance, int32_t) const override {
kernel_arguments_data get_arguments(const typed_primitive_inst<experimental_detectron_generate_proposals_single_image>& instance, int32_t) const override {
kernel_arguments_data args;
const auto num_inputs = instance.inputs_memory_count();
for (size_t i = 0; i < num_inputs; ++i) {
@@ -86,3 +88,6 @@ attach_experimental_detectron_generate_proposals_single_image_impl::attach_exper
} // namespace detail
} // namespace ocl
} // namespace cldnn
BIND_BINARY_BUFFER_WITH_TYPE(cldnn::ocl::experimental_detectron_generate_proposals_single_image_impl,
cldnn::object_type::EXPERIMENTAL_DETECTRON_GENERATE_PROPOSALS_SINGLE_IMAGE_IMPL)

View File

@@ -22,6 +22,8 @@ struct experimental_detectron_prior_grid_generator_impl
using parent = typed_primitive_impl_ocl<experimental_detectron_prior_grid_generator>;
using parent::parent;
DECLARE_OBJECT_TYPE_SERIALIZATION
std::unique_ptr<primitive_impl> clone() const override {
return make_unique<experimental_detectron_prior_grid_generator_impl>(*this);
}
@@ -68,3 +70,6 @@ attach_experimental_detectron_prior_grid_generator_impl::attach_experimental_det
} // namespace detail
} // namespace ocl
} // namespace cldnn
BIND_BINARY_BUFFER_WITH_TYPE(cldnn::ocl::experimental_detectron_prior_grid_generator_impl,
cldnn::object_type::EXPERIMENTAL_DETECTRON_PRIOR_GRID_GENERATOR_IMPL)

View File

@@ -16,12 +16,14 @@ struct experimental_detectron_roi_feature_extractor_impl : public typed_primitiv
using parent = typed_primitive_impl_ocl<experimental_detectron_roi_feature_extractor>;
using parent::parent;
DECLARE_OBJECT_TYPE_SERIALIZATION
std::unique_ptr<primitive_impl> clone() const override {
return make_unique<experimental_detectron_roi_feature_extractor_impl>(*this);
}
protected:
kernel_arguments_data get_arguments(experimental_detectron_roi_feature_extractor_inst& instance, int32_t) const override {
kernel_arguments_data get_arguments(const experimental_detectron_roi_feature_extractor_inst& instance, int32_t) const override {
kernel_arguments_data args;
for (std::size_t i = 0; i < instance.inputs_memory_count(); i++) {
@@ -85,3 +87,6 @@ attach_experimental_detectron_roi_feature_extractor_impl::attach_experimental_de
} // namespace detail
} // namespace ocl
} // namespace cldnn
BIND_BINARY_BUFFER_WITH_TYPE(cldnn::ocl::experimental_detectron_roi_feature_extractor_impl,
cldnn::object_type::EXPERIMENTAL_DETECTRON_ROI_FEATURE_EXTRACTOR_IMPL)

View File

@@ -17,6 +17,8 @@ struct experimental_detectron_topk_rois_impl : typed_primitive_impl_ocl<experime
using parent = typed_primitive_impl_ocl<experimental_detectron_topk_rois>;
using parent::parent;
DECLARE_OBJECT_TYPE_SERIALIZATION
std::unique_ptr<primitive_impl> clone() const override {
return make_unique<experimental_detectron_topk_rois_impl>(*this);
}
@@ -58,3 +60,6 @@ attach_experimental_detectron_topk_rois_impl::attach_experimental_detectron_topk
} // namespace ocl
} // namespace cldnn
BIND_BINARY_BUFFER_WITH_TYPE(cldnn::ocl::experimental_detectron_topk_rois_impl,
cldnn::object_type::EXPERIMENTAL_DETECTRON_TOPK_ROIS_IMPL)

View File

@@ -18,6 +18,8 @@ struct extract_image_patches_impl : typed_primitive_impl_ocl<extract_image_patch
using parent = typed_primitive_impl_ocl<extract_image_patches>;
using parent::parent;
DECLARE_OBJECT_TYPE_SERIALIZATION
std::unique_ptr<primitive_impl> clone() const override {
return make_unique<extract_image_patches_impl>(*this);
}
@@ -64,3 +66,5 @@ attach_extract_image_patches_impl::attach_extract_image_patches_impl() {
} // namespace detail
} // namespace ocl
} // namespace cldnn
BIND_BINARY_BUFFER_WITH_TYPE(cldnn::ocl::extract_image_patches_impl, cldnn::object_type::EXTRACT_IMAGE_PATCHES_IMPL)

View File

@@ -22,6 +22,8 @@ struct eye_impl : typed_primitive_impl_ocl<eye> {
using parent = typed_primitive_impl_ocl<eye>;
using parent::parent;
DECLARE_OBJECT_TYPE_SERIALIZATION
std::unique_ptr<primitive_impl> clone() const override {
return make_unique<eye_impl>(*this);
}
@@ -77,3 +79,5 @@ attach_eye_impl::attach_eye_impl() {
} // namespace ocl
} // namespace cldnn
BIND_BINARY_BUFFER_WITH_TYPE(cldnn::ocl::eye_impl, cldnn::object_type::EYE_IMPL)

View File

@@ -26,12 +26,14 @@ struct fully_connected_impl : typed_primitive_impl_ocl<fully_connected> {
using parent = typed_primitive_impl_ocl<fully_connected>;
using parent::parent;
DECLARE_OBJECT_TYPE_SERIALIZATION
std::unique_ptr<primitive_impl> clone() const override {
return make_unique<fully_connected_impl>(*this);
}
protected:
kernel_arguments_data get_arguments(typed_primitive_inst<fully_connected>& instance, int32_t split) const override {
kernel_arguments_data get_arguments(const typed_primitive_inst<fully_connected>& instance, int32_t split) const override {
kernel_arguments_data args = parent::get_arguments(instance, split);
args.weights = instance.weights_memory();
@@ -159,3 +161,5 @@ attach_fully_connected_impl::attach_fully_connected_impl() {
} // namespace detail
} // namespace ocl
} // namespace cldnn
BIND_BINARY_BUFFER_WITH_TYPE(cldnn::ocl::fully_connected_impl, cldnn::object_type::FULLY_CONNECTED_IMPL)

View File

@@ -63,6 +63,8 @@ struct gather_impl : typed_primitive_impl_ocl<gather> {
using parent = typed_primitive_impl_ocl<gather>;
using parent::parent;
DECLARE_OBJECT_TYPE_SERIALIZATION
std::unique_ptr<primitive_impl> clone() const override {
return make_unique<gather_impl>(*this);
}
@@ -218,3 +220,5 @@ attach_gather_impl::attach_gather_impl() {
} // namespace detail
} // namespace ocl
} // namespace cldnn
BIND_BINARY_BUFFER_WITH_TYPE(cldnn::ocl::gather_impl, cldnn::object_type::GATHER_IMPL)

View File

@@ -50,6 +50,8 @@ struct gather_elements_impl : typed_primitive_impl_ocl<gather_elements> {
using parent = typed_primitive_impl_ocl<gather_elements>;
using parent::parent;
DECLARE_OBJECT_TYPE_SERIALIZATION
std::unique_ptr<primitive_impl> clone() const override {
return make_unique<gather_elements_impl>(*this);
}
@@ -101,3 +103,5 @@ attach_gather_elements_impl::attach_gather_elements_impl() {
} // namespace detail
} // namespace ocl
} // namespace cldnn
BIND_BINARY_BUFFER_WITH_TYPE(cldnn::ocl::gather_elements_impl, cldnn::object_type::GATHER_ELEMENTS_IMPL)

View File

@@ -18,6 +18,8 @@ struct gather_nd_impl : typed_primitive_impl_ocl<gather_nd> {
using parent = typed_primitive_impl_ocl<gather_nd>;
using parent::parent;
DECLARE_OBJECT_TYPE_SERIALIZATION
std::unique_ptr<primitive_impl> clone() const override {
return make_unique<gather_nd_impl>(*this);
}
@@ -67,3 +69,5 @@ attach_gather_nd_impl::attach_gather_nd_impl() {
} // namespace detail
} // namespace ocl
} // namespace cldnn
BIND_BINARY_BUFFER_WITH_TYPE(cldnn::ocl::gather_nd_impl, cldnn::object_type::GATHER_ND_IMPL)

View File

@@ -18,6 +18,8 @@ struct gather_tree_impl : typed_primitive_impl_ocl<gather_tree> {
using parent = typed_primitive_impl_ocl<gather_tree>;
using parent::parent;
DECLARE_OBJECT_TYPE_SERIALIZATION
std::unique_ptr<primitive_impl> clone() const override {
return make_unique<gather_tree_impl>(*this);
}
@@ -66,3 +68,5 @@ attach_gather_tree_impl::attach_gather_tree_impl() {
} // namespace detail
} // namespace ocl
} // namespace cldnn
BIND_BINARY_BUFFER_WITH_TYPE(cldnn::ocl::gather_tree_impl, cldnn::object_type::GATHER_TREE_IMPL)

View File

@@ -18,6 +18,8 @@ struct gemm_impl : typed_primitive_impl_ocl<gemm> {
using parent = typed_primitive_impl_ocl<gemm>;
using parent::parent;
DECLARE_OBJECT_TYPE_SERIALIZATION
std::unique_ptr<primitive_impl> clone() const override {
return make_unique<gemm_impl>(*this);
}
@@ -170,3 +172,5 @@ attach_gemm_impl::attach_gemm_impl() {
} // namespace detail
} // namespace ocl
} // namespace cldnn
BIND_BINARY_BUFFER_WITH_TYPE(cldnn::ocl::gemm_impl, cldnn::object_type::GEMM_IMPL)

View File

@@ -18,12 +18,14 @@ struct generate_proposals_impl
using parent = typed_primitive_impl_ocl<generate_proposals>;
using parent::parent;
DECLARE_OBJECT_TYPE_SERIALIZATION
std::unique_ptr<primitive_impl> clone() const override {
return make_unique<generate_proposals_impl>(*this);
}
protected:
kernel_arguments_data get_arguments(typed_primitive_inst<generate_proposals>& instance, int32_t) const override {
kernel_arguments_data get_arguments(const typed_primitive_inst<generate_proposals>& instance, int32_t) const override {
auto args = parent::get_arguments(instance, 0);
args.inputs.push_back(instance.output_rois_scores_memory());
args.inputs.push_back(instance.output_rois_nums_memory());
@@ -87,3 +89,5 @@ namespace detail {
} // namespace detail
} // namespace ocl
} // namespace cldnn
BIND_BINARY_BUFFER_WITH_TYPE(cldnn::ocl::generate_proposals_impl, cldnn::object_type::GENERATE_PROPOSALS_IMPL)

View File

@@ -13,14 +13,21 @@ namespace cldnn {
namespace ocl {
struct generic_layer_impl : typed_primitive_impl<generic_layer> {
const kernel_selector::cl_kernel_data& _cl_kernel_data;
using parent = typed_primitive_impl<generic_layer>;
using parent::parent;
kernel_selector::cl_kernel_data _cl_kernel_data;
std::vector<kernel::ptr> _kernels;
kernel_id _kernel_id;
DECLARE_OBJECT_TYPE_SERIALIZATION
std::unique_ptr<primitive_impl> clone() const override {
return make_unique<generic_layer_impl>(*this);
}
generic_layer_impl() : parent() {}
generic_layer_impl(const generic_layer_impl& other)
: _cl_kernel_data(other._cl_kernel_data)
, _kernels({})
@@ -28,7 +35,7 @@ struct generic_layer_impl : typed_primitive_impl<generic_layer> {
if (other._kernels.empty()) {
throw std::runtime_error("Can't copy generic_layer_impl node: kernels vector is empty");
}
_kernels.push_back(other._kernels.front()->clone());
_kernels.push_back(std::move(other._kernels.front()->clone()));
}
generic_layer_impl(const generic_layer_node& arg)
@@ -37,8 +44,18 @@ struct generic_layer_impl : typed_primitive_impl<generic_layer> {
_kernel_id = arg.get_program().add_kernel(arg.get_primitive()->generic_params.clKernel->code.kernelString);
}
void save(BinaryOutputBuffer& ob) const override {
ob <<_cl_kernel_data;
ob << _kernel_id;
}
void load(BinaryInputBuffer& ib) override {
ib >> _cl_kernel_data;
ib >> _kernel_id;
}
void init_kernels(const kernels_cache& kernels_cache) override {
_kernels.push_back(kernels_cache.get_kernel(_kernel_id));
_kernels.push_back(std::move(kernels_cache.get_kernel(_kernel_id)));
}
void set_arguments_impl(generic_layer_inst& instance) override {
@@ -118,3 +135,5 @@ attach_generic_layer_impl::attach_generic_layer_impl() {
} // namespace detail
} // namespace ocl
} // namespace cldnn
BIND_BINARY_BUFFER_WITH_TYPE(cldnn::ocl::generic_layer_impl, cldnn::object_type::GENERIC_LAYER_IMPL)

View File

@@ -43,6 +43,8 @@ struct grid_sample_impl : public typed_primitive_impl_ocl<grid_sample> {
using parent = typed_primitive_impl_ocl<grid_sample>;
using parent::parent;
DECLARE_OBJECT_TYPE_SERIALIZATION
std::unique_ptr<primitive_impl> clone() const override {
return make_unique<grid_sample_impl>(*this);
}
@@ -90,3 +92,5 @@ attach_grid_sample_impl::attach_grid_sample_impl() {
} // namespace detail
} // namespace ocl
} // namespace cldnn
BIND_BINARY_BUFFER_WITH_TYPE(cldnn::ocl::grid_sample_impl, cldnn::object_type::GRID_SAMPLE_IMPL)

View File

@@ -21,6 +21,8 @@ struct grn_impl : typed_primitive_impl_ocl<grn> {
using parent = typed_primitive_impl_ocl<grn>;
using parent::parent;
DECLARE_OBJECT_TYPE_SERIALIZATION
std::unique_ptr<primitive_impl> clone() const override {
return make_unique<grn_impl>(*this);
}
@@ -59,3 +61,5 @@ attach_grn_impl::attach_grn_impl() {
} // namespace detail
} // namespace ocl
} // namespace cldnn
BIND_BINARY_BUFFER_WITH_TYPE(cldnn::ocl::grn_impl, cldnn::object_type::GRN_IMPL)

View File

@@ -17,6 +17,8 @@ struct lrn_impl : typed_primitive_impl_ocl<lrn> {
using parent = typed_primitive_impl_ocl<lrn>;
using parent::parent;
DECLARE_OBJECT_TYPE_SERIALIZATION
std::unique_ptr<primitive_impl> clone() const override {
return make_unique<lrn_impl>(*this);
}
@@ -98,3 +100,5 @@ attach_lrn_impl::attach_lrn_impl() {
} // namespace detail
} // namespace ocl
} // namespace cldnn
BIND_BINARY_BUFFER_WITH_TYPE(cldnn::ocl::lrn_impl, cldnn::object_type::LRN_IMPL)

View File

@@ -19,12 +19,14 @@ struct lstm_dynamic_input_impl : typed_primitive_impl_ocl<lstm_dynamic_input> {
using parent = typed_primitive_impl_ocl<lstm_dynamic_input>;
using parent::parent;
DECLARE_OBJECT_TYPE_SERIALIZATION
std::unique_ptr<primitive_impl> clone() const override {
return make_unique<lstm_dynamic_input_impl>(*this);
}
protected:
kernel_arguments_data get_arguments(typed_primitive_inst<lstm_dynamic_input>& instance, int32_t) const override {
kernel_arguments_data get_arguments(const typed_primitive_inst<lstm_dynamic_input>& instance, int32_t) const override {
kernel_arguments_data args;
args.inputs = { instance.input_memory_ptr(), instance.dyn_length_memory()};
args.outputs = { instance.output_memory_ptr() };
@@ -85,3 +87,5 @@ attach_lstm_dynamic_input_impl::attach_lstm_dynamic_input_impl() {
} // namespace detail
} // namespace ocl
} // namespace cldnn
BIND_BINARY_BUFFER_WITH_TYPE(cldnn::ocl::lstm_dynamic_input_impl, cldnn::object_type::LSTM_DYNAMIC_INPUT_IMPL)

View File

@@ -19,12 +19,14 @@ struct lstm_dynamic_timeloop_impl : typed_primitive_impl_ocl<lstm_dynamic_timelo
using parent = typed_primitive_impl_ocl<lstm_dynamic_timeloop>;
using parent::parent;
DECLARE_OBJECT_TYPE_SERIALIZATION
std::unique_ptr<primitive_impl> clone() const override {
return make_unique<lstm_dynamic_timeloop_impl>(*this);
}
protected:
kernel_arguments_data get_arguments(typed_primitive_inst<lstm_dynamic_timeloop>& instance, int32_t) const override {
kernel_arguments_data get_arguments(const typed_primitive_inst<lstm_dynamic_timeloop>& instance, int32_t) const override {
kernel_arguments_data args;
args.inputs = {instance.input_memory_ptr(), instance.dyn_length_memory()};
if (instance.last_hidden_output_term())
@@ -102,3 +104,5 @@ attach_lstm_dynamic_timeloop_impl::attach_lstm_dynamic_timeloop_impl() {
} // namespace detail
} // namespace ocl
} // namespace cldnn
BIND_BINARY_BUFFER_WITH_TYPE(cldnn::ocl::lstm_dynamic_timeloop_impl, cldnn::object_type::LSTM_DYNAMIC_TIMELOOP_IMPL)

View File

@@ -19,12 +19,14 @@ struct lstm_elt_impl : typed_primitive_impl_ocl<lstm_elt> {
using parent = typed_primitive_impl_ocl<lstm_elt>;
using parent::parent;
DECLARE_OBJECT_TYPE_SERIALIZATION
std::unique_ptr<primitive_impl> clone() const override {
return make_unique<lstm_elt_impl>(*this);
}
protected:
kernel_arguments_data get_arguments(typed_primitive_inst<lstm_elt>& instance, int32_t) const override {
kernel_arguments_data get_arguments(const typed_primitive_inst<lstm_elt>& instance, int32_t) const override {
kernel_arguments_data args = parent::get_arguments(instance, 0);
args.cell = instance.cell_term() ? instance.cell_memory() : nullptr;
@@ -105,3 +107,5 @@ attach_lstm_elt_impl::attach_lstm_elt_impl() {
} // namespace detail
} // namespace ocl
} // namespace cldnn
BIND_BINARY_BUFFER_WITH_TYPE(cldnn::ocl::lstm_elt_impl, cldnn::object_type::LSTM_ELT_IMPL)

View File

@@ -19,12 +19,14 @@ struct lstm_gemm_impl : typed_primitive_impl_ocl<lstm_gemm> {
using parent = typed_primitive_impl_ocl<lstm_gemm>;
using parent::parent;
DECLARE_OBJECT_TYPE_SERIALIZATION
std::unique_ptr<primitive_impl> clone() const override {
return make_unique<lstm_gemm_impl>(*this);
}
protected:
kernel_arguments_data get_arguments(typed_primitive_inst<lstm_gemm>& instance, int32_t) const override {
kernel_arguments_data get_arguments(const typed_primitive_inst<lstm_gemm>& instance, int32_t) const override {
kernel_arguments_data args = parent::get_arguments(instance, 0);
args.outputs = { instance.output_memory_ptr() };
@@ -106,3 +108,5 @@ attach_lstm_gemm_impl::attach_lstm_gemm_impl() {
} // namespace detail
} // namespace ocl
} // namespace cldnn
BIND_BINARY_BUFFER_WITH_TYPE(cldnn::ocl::lstm_gemm_impl, cldnn::object_type::LSTM_GEMM_IMPL)

View File

@@ -46,7 +46,7 @@ struct matrix_nms_impl : typed_primitive_impl_ocl<matrix_nms> {
}
protected:
kernel_arguments_data get_arguments(matrix_nms_inst& instance, int32_t) const override {
kernel_arguments_data get_arguments(const matrix_nms_inst& instance, int32_t) const override {
kernel_arguments_data args;
args.inputs = {instance.input_boxes_mem(),
instance.input_scores_mem(),

View File

@@ -51,12 +51,14 @@ struct multiclass_nms_impl : public typed_primitive_impl_ocl<multiclass_nms> {
using parent = typed_primitive_impl_ocl<multiclass_nms>;
using parent::parent;
DECLARE_OBJECT_TYPE_SERIALIZATION
std::unique_ptr<primitive_impl> clone() const override {
return make_unique<multiclass_nms_impl>(*this);
}
protected:
kernel_arguments_data get_arguments(typed_primitive_inst<multiclass_nms>& instance, int32_t unused) const override {
kernel_arguments_data get_arguments(const typed_primitive_inst<multiclass_nms>& instance, int32_t unused) const override {
kernel_arguments_data args = parent::get_arguments(instance, unused);
args.inputs.push_back(instance.output_indices_memory());
args.inputs.push_back(instance.output_num_memory());
@@ -122,3 +124,5 @@ attach_multiclass_nms_impl::attach_multiclass_nms_impl() {
} // namespace detail
} // namespace ocl
} // namespace cldnn
BIND_BINARY_BUFFER_WITH_TYPE(cldnn::ocl::multiclass_nms_impl, cldnn::object_type::MULTICLASS_NMS_IMPL)

View File

@@ -13,6 +13,8 @@ struct mutable_data_impl : public typed_primitive_impl_ocl<mutable_data> {
using parent = typed_primitive_impl_ocl<mutable_data>;
using parent::parent;
DECLARE_OBJECT_TYPE_SERIALIZATION
std::unique_ptr<primitive_impl> clone() const override {
return make_unique<mutable_data_impl>(*this);
}
@@ -30,3 +32,5 @@ attach_mutable_data_impl::attach_mutable_data_impl() {
} // namespace detail
} // namespace ocl
} // namespace cldnn
BIND_BINARY_BUFFER_WITH_TYPE(cldnn::ocl::mutable_data_impl, cldnn::object_type::MUTABLE_DATA_IMPL)

View File

@@ -21,6 +21,8 @@ struct mvn_impl : typed_primitive_impl_ocl<mvn> {
using parent = typed_primitive_impl_ocl<mvn>;
using parent::parent;
DECLARE_OBJECT_TYPE_SERIALIZATION
std::unique_ptr<primitive_impl> clone() const override {
return make_unique<mvn_impl>(*this);
}
@@ -107,3 +109,5 @@ attach_mvn_impl::attach_mvn_impl() {
} // namespace detail
} // namespace ocl
} // namespace cldnn
BIND_BINARY_BUFFER_WITH_TYPE(cldnn::ocl::mvn_impl, cldnn::object_type::MVN_IMPL)

View File

@@ -16,12 +16,14 @@ struct non_max_suppression_impl : typed_primitive_impl_ocl<non_max_suppression>
using parent = typed_primitive_impl_ocl<non_max_suppression>;
using parent::parent;
DECLARE_OBJECT_TYPE_SERIALIZATION
std::unique_ptr<primitive_impl> clone() const override {
return make_unique<non_max_suppression_impl>(*this);
}
protected:
kernel_arguments_data get_arguments(typed_primitive_inst<non_max_suppression>& instance, int32_t) const override {
kernel_arguments_data get_arguments(const typed_primitive_inst<non_max_suppression>& instance, int32_t) const override {
kernel_arguments_data args;
for (size_t i = 0; i < instance.inputs_memory_count(); i++) {
args.inputs.push_back(instance.input_memory_ptr(i));
@@ -205,3 +207,5 @@ attach_non_max_suppression_impl::attach_non_max_suppression_impl() {
} // namespace detail
} // namespace ocl
} // namespace cldnn
BIND_BINARY_BUFFER_WITH_TYPE(cldnn::ocl::non_max_suppression_impl, cldnn::object_type::NON_MAX_SUPPRESSION_IMPL_OCL)

View File

@@ -21,6 +21,8 @@ struct count_nonzero_impl : typed_primitive_impl_ocl<count_nonzero> {
using parent = typed_primitive_impl_ocl<count_nonzero>;
using parent::parent;
DECLARE_OBJECT_TYPE_SERIALIZATION
std::unique_ptr<primitive_impl> clone() const override {
return make_unique<count_nonzero_impl>(*this);
}
@@ -45,6 +47,8 @@ struct gather_nonzero_impl : typed_primitive_impl_ocl<gather_nonzero> {
using parent = typed_primitive_impl_ocl<gather_nonzero>;
using parent::parent;
DECLARE_OBJECT_TYPE_SERIALIZATION
std::unique_ptr<primitive_impl> clone() const override {
return make_unique<gather_nonzero_impl>(*this);
}
@@ -118,3 +122,6 @@ attach_gather_nonzero_impl::attach_gather_nonzero_impl() {
} // namespace detail
} // namespace ocl
} // namespace cldnn
BIND_BINARY_BUFFER_WITH_TYPE(cldnn::ocl::count_nonzero_impl, cldnn::object_type::COUNT_NONZERO_IMPL)
BIND_BINARY_BUFFER_WITH_TYPE(cldnn::ocl::gather_nonzero_impl, cldnn::object_type::GATHER_NONZERO_IMPL)

View File

@@ -21,12 +21,14 @@ struct normalize_impl : typed_primitive_impl_ocl<normalize> {
using parent = typed_primitive_impl_ocl<normalize>;
using parent::parent;
DECLARE_OBJECT_TYPE_SERIALIZATION
std::unique_ptr<primitive_impl> clone() const override {
return make_unique<normalize_impl>(*this);
}
protected:
kernel_arguments_data get_arguments(typed_primitive_inst<normalize>& instance, int32_t split) const override {
kernel_arguments_data get_arguments(const typed_primitive_inst<normalize>& instance, int32_t split) const override {
kernel_arguments_data args = parent::get_arguments(instance, split);
args.scale_table = instance.scale_memory();
return args;
@@ -84,3 +86,5 @@ attach_normalize_impl::attach_normalize_impl() {
} // namespace detail
} // namespace ocl
} // namespace cldnn
BIND_BINARY_BUFFER_WITH_TYPE(cldnn::ocl::normalize_impl, cldnn::object_type::NORMALIZE_IMPL)

View File

@@ -19,6 +19,8 @@ struct one_hot_impl : typed_primitive_impl_ocl<one_hot> {
using parent = typed_primitive_impl_ocl<one_hot>;
using parent::parent;
DECLARE_OBJECT_TYPE_SERIALIZATION
std::unique_ptr<primitive_impl> clone() const override {
return make_unique<one_hot_impl>(*this);
}
@@ -71,3 +73,5 @@ attach_one_hot_impl::attach_one_hot_impl() {
} // namespace detail
} // namespace ocl
} // namespace cldnn
BIND_BINARY_BUFFER_WITH_TYPE(cldnn::ocl::one_hot_impl, cldnn::object_type::ONE_HOT_IMPL)

View File

@@ -46,6 +46,8 @@ struct permute_impl : typed_primitive_impl_ocl<permute> {
using parent = typed_primitive_impl_ocl<permute>;
using parent::parent;
DECLARE_OBJECT_TYPE_SERIALIZATION
std::unique_ptr<primitive_impl> clone() const override {
return make_unique<permute_impl>(*this);
}
@@ -82,3 +84,5 @@ attach_permute_impl::attach_permute_impl() {
} // namespace detail
} // namespace ocl
} // namespace cldnn
BIND_BINARY_BUFFER_WITH_TYPE(cldnn::ocl::permute_impl, cldnn::object_type::PERMUTE_IMPL)

View File

@@ -59,12 +59,14 @@ struct pooling_impl : typed_primitive_impl_ocl<pooling> {
using parent = typed_primitive_impl_ocl<pooling>;
using parent::parent;
DECLARE_OBJECT_TYPE_SERIALIZATION
std::unique_ptr<primitive_impl> clone() const override {
return make_unique<pooling_impl>(*this);
}
protected:
kernel_arguments_data get_arguments(typed_primitive_inst<pooling>& instance, int32_t split) const override {
kernel_arguments_data get_arguments(const typed_primitive_inst<pooling>& instance, int32_t split) const override {
kernel_arguments_data args = parent::get_arguments(instance, split);
return args;
}
@@ -223,3 +225,5 @@ attach_pooling_impl::attach_pooling_impl() {
} // namespace detail
} // namespace ocl
} // namespace cldnn
BIND_BINARY_BUFFER_WITH_TYPE(cldnn::ocl::pooling_impl, cldnn::object_type::POOLING_IMPL)

View File

@@ -11,6 +11,12 @@
#include "intel_gpu/runtime/error_handler.hpp"
#include "kernel_selector_helper.h"
#include "intel_gpu/graph/network.hpp"
#include "serialization/binary_buffer.hpp"
#include "serialization/cl_kernel_data_serializer.hpp"
#include "serialization/helpers.hpp"
#include "serialization/set_serializer.hpp"
#include "serialization/string_serializer.hpp"
#include "serialization/vector_serializer.hpp"
#include "register.hpp"
#include <vector>
#include <list>
@@ -25,10 +31,17 @@ For example, all gpu convolution implementations should derive from typed_primit
*/
template <class PType>
struct typed_primitive_impl_ocl : public typed_primitive_impl<PType> {
const primitive_id& _node_id;
primitive_id _node_id;
kernel_selector::kernel_data _kernel_data;
std::vector<kernel_id> _kernel_ids;
std::vector<kernel::ptr> _kernels;
kernel_arguments_data_idx _kernel_args;
typed_primitive_impl_ocl() : _node_id(""), _kernel_data({}), _kernel_ids({}), _kernels({}) {
_kernel_data.weightsReorderParams.engine = kernel_selector::generic_kernel_params::Engine::NONE;
_kernel_data.weightsReorderParams.cpuKernel = nullptr;
_kernel_data.weightsReorderParams.clKernel = nullptr;
}
typed_primitive_impl_ocl(const typed_primitive_impl_ocl<PType>& other)
: typed_primitive_impl<PType>(other._weights_reorder_params, other._kernel_name)
@@ -54,10 +67,26 @@ struct typed_primitive_impl_ocl : public typed_primitive_impl<PType> {
bool is_cpu() const override { return false; }
void save(BinaryOutputBuffer& ob) const override {
ob << make_data(&_kernel_data.internalBufferDataType, sizeof(kernel_selector::Datatype));
ob << _kernel_data.internalBufferSizes;
ob << _kernel_data.kernels;
ob << _kernel_ids;
ob << _kernel_args;
}
void load(BinaryInputBuffer& ib) override {
ib >> make_data(&_kernel_data.internalBufferDataType, sizeof(kernel_selector::Datatype));
ib >> _kernel_data.internalBufferSizes;
ib >> _kernel_data.kernels;
ib >> _kernel_ids;
ib >> _kernel_args;
}
protected:
virtual bool optimized_out(typed_primitive_inst<PType>&) const { return false; }
virtual kernel_arguments_data get_arguments(typed_primitive_inst<PType>& instance, int32_t /*split*/) const {
virtual kernel_arguments_data get_arguments(const typed_primitive_inst<PType>& instance, int32_t /*split*/) const {
kernel_arguments_data args;
for (size_t i = 0; i < instance.inputs_memory_count(); i++) {
@@ -78,6 +107,36 @@ protected:
return args;
}
kernel_arguments_data get_arguments_by_idx(const typed_primitive_inst<PType>& instance, int32_t /*split*/) const {
kernel_arguments_data args;
for (uint32_t i = 0; i < _kernel_args.inputs.size(); i++) {
args.inputs.push_back(instance.dep_memory_ptr(_kernel_args.inputs[i]));
}
args.weights = (_kernel_args.weights >= 0) ? instance.dep_memory_ptr(_kernel_args.weights) : args.weights;
args.recurrent = (_kernel_args.recurrent >= 0) ? instance.dep_memory_ptr(_kernel_args.recurrent) : args.recurrent;
args.hidden = (_kernel_args.hidden >= 0) ? instance.dep_memory_ptr(_kernel_args.hidden) : args.hidden;
args.cell = (_kernel_args.cell >= 0) ? instance.dep_memory_ptr(_kernel_args.cell) : args.cell;
args.bias = (_kernel_args.bias >= 0) ? instance.dep_memory_ptr(_kernel_args.bias) : args.bias;
args.weights_zero_points = (_kernel_args.weights_zero_points >= 0) ?
instance.dep_memory_ptr(_kernel_args.weights_zero_points) : args.weights_zero_points;
args.activations_zero_points = (_kernel_args.activations_zero_points >= 0) ?
instance.dep_memory_ptr(_kernel_args.activations_zero_points) : args.activations_zero_points;
args.compensation = (_kernel_args.compensation >= 0) ? instance.dep_memory_ptr(_kernel_args.compensation) : args.compensation;
args.lookup_table = (_kernel_args.lookup_table >= 0) ? instance.dep_memory_ptr(_kernel_args.lookup_table) : args.lookup_table;
args.scale_table = (_kernel_args.scale_table >= 0) ? instance.dep_memory_ptr(_kernel_args.scale_table) : args.scale_table;
args.slope = (_kernel_args.slope >= 0) ? instance.dep_memory_ptr(_kernel_args.slope) : args.slope;
for (size_t i = 0; i < _kernel_args.fused_op_inputs.size(); i++) {
args.fused_op_inputs.push_back(instance.dep_memory_ptr(_kernel_args.fused_op_inputs[i]));
}
args.outputs.push_back(instance.output_memory_ptr());
return args;
}
virtual int32_t get_split() const { return 1; }
virtual uint32_t get_groups() const { return 1; }
virtual bool get_depthwise_sep_opt() const { return false; }
@@ -132,6 +191,36 @@ protected:
stream& stream = instance.get_network().get_stream();
// we iterate over split first in order to be able parallelism with OOOQ mechanism.
for (size_t k = 0; k < _kernels.size(); ++k) {
for (decltype(split) i = 0; i < split; i++) {
kernel_arguments_data args;
if (_kernel_args.inputs.size() > 0) {
args = get_arguments_by_idx(instance, i);
} else {
args = get_arguments(instance, i);
}
for (const auto& m : instance.get_intermediates_memories()) {
args.intermediates.push_back(m);
}
args.scalars = &_kernel_data.kernels[k].params.scalars;
args.split = i;
stream.set_arguments(*_kernels[k], _kernel_data.kernels[k].params, args);
}
}
}
void set_arguments_impl(kernel_arguments_data_idx& args_idx) override {
this->_kernel_args = args_idx;
}
kernel_arguments_data get_arguments_impl(const typed_primitive_inst<PType>& instance) const override {
auto split = get_split();
// we iterate over split first in order to be able parallelism with OOOQ mechanism.
for (size_t k = 0; k < _kernels.size(); ++k) {
for (decltype(split) i = 0; i < split; i++) {
@@ -143,10 +232,12 @@ protected:
args.intermediates.push_back(m);
}
stream.set_arguments(*_kernels[k], _kernel_data.kernels[k].params, args);
return args;
}
}
kernel_arguments_data args;
return args;
}
event::ptr execute_impl(const std::vector<event::ptr>& events,
@@ -167,17 +258,29 @@ protected:
std::vector<event::ptr> new_events;
for (decltype(split) i = 0; i < split; i++) {
// is any user of the prim's users is an detecion output, set prim as a output event (event won't be nullptr)
auto users = instance.node->get_users();
bool is_output_event = is_any_user_cpu(users) || instance.node->is_output();
bool is_output_event;
if (instance.node != nullptr) {
auto users = instance.node->get_users();
is_output_event = is_any_user_cpu(users) || instance.node->is_output();
} else {
is_output_event = instance.is_output();
}
kernel_arguments_data args;
if (_kernel_args.inputs.size() > 0) {
args = get_arguments_by_idx(instance, i);
} else {
args = get_arguments(instance, i);
for (const auto& m : instance.get_intermediates_memories()) {
args.intermediates.push_back(m);
}
}
auto args = get_arguments(instance, i);
args.scalars = &_kernel_data.kernels[k].params.scalars;
args.split = i;
for (const auto& m : instance.get_intermediates_memories()) {
args.intermediates.push_back(m);
}
auto ev = stream.enqueue_kernel(*_kernels[k], _kernel_data.kernels[k].params, args, tmp_events, is_output_event);
new_events.push_back(ev);
all_events.push_back(ev);

View File

@@ -19,6 +19,8 @@ struct prior_box_impl : typed_primitive_impl_ocl<prior_box> {
using parent = typed_primitive_impl_ocl<prior_box>;
using parent::parent;
DECLARE_OBJECT_TYPE_SERIALIZATION
std::unique_ptr<primitive_impl> clone() const override {
return make_unique<prior_box_impl>(*this);
}
@@ -100,3 +102,5 @@ attach_prior_box_impl::attach_prior_box_impl() {
} // namespace ocl
} // namespace cldnn
BIND_BINARY_BUFFER_WITH_TYPE(cldnn::ocl::prior_box_impl, cldnn::object_type::PRIOR_BOX_IMPL)

View File

@@ -19,6 +19,8 @@ struct pyramid_roi_align_impl : typed_primitive_impl_ocl<pyramid_roi_align> {
using parent = typed_primitive_impl_ocl<pyramid_roi_align>;
using parent::parent;
DECLARE_OBJECT_TYPE_SERIALIZATION
std::unique_ptr<primitive_impl> clone() const override {
return make_unique<pyramid_roi_align_impl>(*this);
}
@@ -77,3 +79,5 @@ attach_pyramid_roi_align_impl::attach_pyramid_roi_align_impl() {
} // namespace detail
} // namespace ocl
} // namespace cldnn
BIND_BINARY_BUFFER_WITH_TYPE(cldnn::ocl::pyramid_roi_align_impl, cldnn::object_type::PYRAMID_ROI_ALIGN_IMPL)

View File

@@ -19,12 +19,14 @@ struct quantize_impl : typed_primitive_impl_ocl<quantize> {
using parent = typed_primitive_impl_ocl<quantize>;
using parent::parent;
DECLARE_OBJECT_TYPE_SERIALIZATION
std::unique_ptr<primitive_impl> clone() const override {
return make_unique<quantize_impl>(*this);
}
protected:
kernel_arguments_data get_arguments(typed_primitive_inst<quantize>& instance, int32_t) const override {
kernel_arguments_data get_arguments(const typed_primitive_inst<quantize>& instance, int32_t) const override {
kernel_arguments_data args;
for (size_t i = 0; i < instance.inputs_memory_count(); i++) {
@@ -205,3 +207,5 @@ attach_quantize_impl::attach_quantize_impl() {
} // namespace detail
} // namespace ocl
} // namespace cldnn
BIND_BINARY_BUFFER_WITH_TYPE(cldnn::ocl::quantize_impl, cldnn::object_type::QUANTIZE_IMPL)

View File

@@ -17,6 +17,8 @@ struct random_uniform_impl : typed_primitive_impl_ocl<random_uniform> {
using parent = typed_primitive_impl_ocl<random_uniform>;
using parent::parent;
DECLARE_OBJECT_TYPE_SERIALIZATION
std::unique_ptr<primitive_impl> clone() const override {
return make_unique<random_uniform_impl>(*this);
}
@@ -63,3 +65,5 @@ attach_random_uniform_impl::attach_random_uniform_impl() {
} // namespace ocl
} // namespace cldnn
BIND_BINARY_BUFFER_WITH_TYPE(cldnn::ocl::random_uniform_impl, cldnn::object_type::RANDOM_UNIFORM_IMPL)

View File

@@ -16,6 +16,8 @@ namespace ocl {
struct range_impl : typed_primitive_impl_ocl<range> {
using typed_primitive_impl_ocl::typed_primitive_impl_ocl;
DECLARE_OBJECT_TYPE_SERIALIZATION
std::unique_ptr<primitive_impl> clone() const override {
return make_unique<range_impl>(*this);
}
@@ -58,3 +60,5 @@ attach_range_impl::attach_range_impl() {
} // namespace detail
} // namespace ocl
} // namespace cldnn
BIND_BINARY_BUFFER_WITH_TYPE(cldnn::ocl::range_impl, cldnn::object_type::RANGE_IMPL)

View File

@@ -70,6 +70,8 @@ struct reduce_impl : typed_primitive_impl_ocl<reduce> {
using parent = typed_primitive_impl_ocl<reduce>;
using parent::parent;
DECLARE_OBJECT_TYPE_SERIALIZATION
std::unique_ptr<primitive_impl> clone() const override {
return make_unique<reduce_impl>(*this);
}
@@ -141,3 +143,5 @@ attach_reduce_impl::attach_reduce_impl() {
} // namespace detail
} // namespace ocl
} // namespace cldnn
BIND_BINARY_BUFFER_WITH_TYPE(cldnn::ocl::reduce_impl, cldnn::object_type::REDUCE_IMPL)

View File

@@ -17,6 +17,8 @@ struct region_yolo_impl : typed_primitive_impl_ocl<region_yolo> {
using parent = typed_primitive_impl_ocl<region_yolo>;
using parent::parent;
DECLARE_OBJECT_TYPE_SERIALIZATION
std::unique_ptr<primitive_impl> clone() const override {
return make_unique<region_yolo_impl>(*this);
}
@@ -65,3 +67,5 @@ attach_region_yolo_impl::attach_region_yolo_impl() {
} // namespace detail
} // namespace ocl
} // namespace cldnn
BIND_BINARY_BUFFER_WITH_TYPE(cldnn::ocl::region_yolo_impl, cldnn::object_type::REGION_YOLO_IMPL)

View File

@@ -17,10 +17,14 @@ struct reorder_impl : typed_primitive_impl_ocl<reorder> {
using parent = typed_primitive_impl_ocl<reorder>;
using parent::parent;
DECLARE_OBJECT_TYPE_SERIALIZATION
std::unique_ptr<primitive_impl> clone() const override {
return make_unique<reorder_impl>(*this);
}
reorder_impl() : parent() {}
explicit reorder_impl(const reorder_impl& other) : parent(other),
_can_be_optimized(other._can_be_optimized),
_has_mean(other._has_mean) {}
@@ -36,12 +40,24 @@ struct reorder_impl : typed_primitive_impl_ocl<reorder> {
_has_mean = node.has_mean();
}
void save(BinaryOutputBuffer& ob) const override {
parent::save(ob);
ob << _can_be_optimized;
ob << _has_mean;
}
void load(BinaryInputBuffer& ib) override {
parent::load(ib);
ib >> _can_be_optimized;
ib >> _has_mean;
}
protected:
bool optimized_out(reorder_inst& instance) const override {
return parent::optimized_out(instance) || _can_be_optimized;
}
kernel_arguments_data get_arguments(reorder_inst& instance, int32_t split) const override {
kernel_arguments_data get_arguments(const reorder_inst& instance, int32_t split) const override {
kernel_arguments_data args = parent::get_arguments(instance, split);
auto input = &instance.input_memory();
auto input_layout = input->get_layout();
@@ -142,3 +158,5 @@ attach_reorder_impl::attach_reorder_impl() {
} // namespace detail
} // namespace ocl
} // namespace cldnn
BIND_BINARY_BUFFER_WITH_TYPE(cldnn::ocl::reorder_impl, cldnn::object_type::REORDER_IMPL)

View File

@@ -17,6 +17,8 @@ struct reorg_yolo_impl : typed_primitive_impl_ocl<reorg_yolo> {
using parent = typed_primitive_impl_ocl<reorg_yolo>;
using parent::parent;
DECLARE_OBJECT_TYPE_SERIALIZATION
std::unique_ptr<primitive_impl> clone() const override {
return make_unique<reorg_yolo_impl>(*this);
}
@@ -64,3 +66,5 @@ attach_reorg_yolo_impl::attach_reorg_yolo_impl() {
} // namespace detail
} // namespace ocl
} // namespace cldnn
BIND_BINARY_BUFFER_WITH_TYPE(cldnn::ocl::reorg_yolo_impl, cldnn::object_type::REORG_YOLO_IMPL)

View File

@@ -129,6 +129,8 @@ struct resample_impl : typed_primitive_impl_ocl<resample> {
using parent = typed_primitive_impl_ocl<resample>;
using parent::parent;
DECLARE_OBJECT_TYPE_SERIALIZATION
std::unique_ptr<primitive_impl> clone() const override {
return make_unique<resample_impl>(*this);
}
@@ -214,3 +216,5 @@ attach_resample_impl::attach_resample_impl() {
} // namespace detail
} // namespace ocl
} // namespace cldnn
BIND_BINARY_BUFFER_WITH_TYPE(cldnn::ocl::resample_impl, cldnn::object_type::RESAMPLE_IMPL)

View File

@@ -17,6 +17,8 @@ struct reshape_impl : public typed_primitive_impl_ocl<reshape> {
using parent = typed_primitive_impl_ocl<reshape>;
using parent::parent;
DECLARE_OBJECT_TYPE_SERIALIZATION
std::unique_ptr<primitive_impl> clone() const override {
return make_unique<reshape_impl>(*this);
}
@@ -53,3 +55,5 @@ attach_reshape_impl::attach_reshape_impl() {
} // namespace detail
} // namespace ocl
} // namespace cldnn
BIND_BINARY_BUFFER_WITH_TYPE(cldnn::ocl::reshape_impl, cldnn::object_type::RESHAPE_IMPL)

View File

@@ -19,6 +19,8 @@ struct reverse_impl : typed_primitive_impl_ocl<reverse> {
using parent = typed_primitive_impl_ocl<reverse>;
using parent::parent;
DECLARE_OBJECT_TYPE_SERIALIZATION
std::unique_ptr<primitive_impl> clone() const override {
return make_unique<reverse_impl>(*this);
}
@@ -82,3 +84,5 @@ attach_reverse_impl::attach_reverse_impl() {
} // namespace detail
} // namespace ocl
} // namespace cldnn
BIND_BINARY_BUFFER_WITH_TYPE(cldnn::ocl::reverse_impl, cldnn::object_type::REVERSE_IMPL)

View File

@@ -18,6 +18,8 @@ struct reverse_sequence_impl : typed_primitive_impl_ocl<reverse_sequence> {
using parent = typed_primitive_impl_ocl<reverse_sequence>;
using parent::parent;
DECLARE_OBJECT_TYPE_SERIALIZATION
std::unique_ptr<primitive_impl> clone() const override {
return make_unique<reverse_sequence_impl>(*this);
}
@@ -63,3 +65,5 @@ attach_reverse_sequence_impl::attach_reverse_sequence_impl() {
} // namespace detail
} // namespace ocl
} // namespace cldnn
BIND_BINARY_BUFFER_WITH_TYPE(cldnn::ocl::reverse_sequence_impl, cldnn::object_type::REVERSE_SEQUENCE_IMPL)

View File

@@ -41,12 +41,14 @@ struct roi_align_impl : typed_primitive_impl_ocl<roi_align> {
using parent = typed_primitive_impl_ocl<roi_align>;
using parent::parent;
DECLARE_OBJECT_TYPE_SERIALIZATION
std::unique_ptr<primitive_impl> clone() const override {
return make_unique<roi_align_impl>(*this);
}
protected:
kernel_arguments_data get_arguments(typed_primitive_inst<roi_align>& instance, int32_t) const override {
kernel_arguments_data get_arguments(const typed_primitive_inst<roi_align>& instance, int32_t) const override {
kernel_arguments_data args;
args.inputs = {instance.input_memory_ptr(), instance.rois_memory(), instance.batches_memory()};
args.outputs = {instance.output_memory_ptr()};
@@ -118,3 +120,5 @@ attach_roi_align_impl::attach_roi_align_impl() {
} // namespace detail
} // namespace ocl
} // namespace cldnn
BIND_BINARY_BUFFER_WITH_TYPE(cldnn::ocl::roi_align_impl, cldnn::object_type::ROI_ALIGN_IMPL)

View File

@@ -37,12 +37,14 @@ struct roi_pooling_impl : typed_primitive_impl_ocl<roi_pooling> {
using parent = typed_primitive_impl_ocl<roi_pooling>;
using parent::parent;
DECLARE_OBJECT_TYPE_SERIALIZATION
std::unique_ptr<primitive_impl> clone() const override {
return make_unique<roi_pooling_impl>(*this);
}
protected:
kernel_arguments_data get_arguments(typed_primitive_inst<roi_pooling>& instance, int32_t) const override {
kernel_arguments_data get_arguments(const typed_primitive_inst<roi_pooling>& instance, int32_t) const override {
kernel_arguments_data args;
if (instance.argument->mode == pooling_mode::deformable_bilinear && !instance.argument->no_trans)
@@ -129,3 +131,5 @@ attach_roi_pooling_impl::attach_roi_pooling_impl() {
} // namespace detail
} // namespace ocl
} // namespace cldnn
BIND_BINARY_BUFFER_WITH_TYPE(cldnn::ocl::roi_pooling_impl, cldnn::object_type::ROI_POOLING_IMPL)

View File

@@ -14,6 +14,8 @@ struct roll_impl : typed_primitive_impl_ocl<roll> {
using parent = typed_primitive_impl_ocl<roll>;
using parent::parent;
DECLARE_OBJECT_TYPE_SERIALIZATION
std::unique_ptr<primitive_impl> clone() const override {
return make_unique<roll_impl>(*this);
}
@@ -73,3 +75,5 @@ attach_roll_impl::attach_roll_impl() {
} // namespace ocl
} // namespace cldnn
BIND_BINARY_BUFFER_WITH_TYPE(cldnn::ocl::roll_impl, cldnn::object_type::ROLL_IMPL)

View File

@@ -46,6 +46,8 @@ struct scatter_elements_update_impl : typed_primitive_impl_ocl<scatter_elements_
using parent = typed_primitive_impl_ocl<scatter_elements_update>;
using parent::parent;
DECLARE_OBJECT_TYPE_SERIALIZATION
std::unique_ptr<primitive_impl> clone() const override {
return make_unique<scatter_elements_update_impl>(*this);
}
@@ -104,3 +106,6 @@ attach_scatter_elements_update_impl::attach_scatter_elements_update_impl() {
} // namespace detail
} // namespace ocl
} // namespace cldnn
BIND_BINARY_BUFFER_WITH_TYPE(cldnn::ocl::scatter_elements_update_impl,
cldnn::object_type::SCATTER_ELEMENTS_UPDATE_IMPL)

View File

@@ -19,6 +19,8 @@ struct scatter_nd_update_impl : typed_primitive_impl_ocl<scatter_nd_update> {
using parent = typed_primitive_impl_ocl<scatter_nd_update>;
using parent::parent;
DECLARE_OBJECT_TYPE_SERIALIZATION
std::unique_ptr<primitive_impl> clone() const override {
return make_unique<scatter_nd_update_impl>(*this);
}
@@ -147,3 +149,5 @@ attach_scatter_nd_update_impl::attach_scatter_nd_update_impl() {
} // namespace detail
} // namespace ocl
} // namespace cldnn
BIND_BINARY_BUFFER_WITH_TYPE(cldnn::ocl::scatter_nd_update_impl, cldnn::object_type::SCATTER_ND_UPDATE_IMPL)

View File

@@ -45,6 +45,8 @@ struct scatter_update_impl : typed_primitive_impl_ocl<scatter_update> {
using parent = typed_primitive_impl_ocl<scatter_update>;
using parent::parent;
DECLARE_OBJECT_TYPE_SERIALIZATION
std::unique_ptr<primitive_impl> clone() const override {
return make_unique<scatter_update_impl>(*this);
}
@@ -101,3 +103,5 @@ attach_scatter_update_impl::attach_scatter_update_impl() {
} // namespace detail
} // namespace ocl
} // namespace cldnn
BIND_BINARY_BUFFER_WITH_TYPE(cldnn::ocl::scatter_update_impl, cldnn::object_type::SCATTER_UPDATE_IMPL)

View File

@@ -17,6 +17,8 @@ struct select_impl : typed_primitive_impl_ocl<select> {
using parent = typed_primitive_impl_ocl<select>;
using parent::parent;
DECLARE_OBJECT_TYPE_SERIALIZATION
std::unique_ptr<primitive_impl> clone() const override {
return make_unique<select_impl>(*this);
}
@@ -94,3 +96,5 @@ attach_select_impl::attach_select_impl() {
} // namespace detail
} // namespace ocl
} // namespace cldnn
BIND_BINARY_BUFFER_WITH_TYPE(cldnn::ocl::select_impl, cldnn::object_type::SELECT_IMPL)

View File

@@ -17,6 +17,8 @@ struct shape_of_impl : typed_primitive_impl_ocl<shape_of> {
using parent = typed_primitive_impl_ocl<shape_of>;
using parent::parent;
DECLARE_OBJECT_TYPE_SERIALIZATION
std::unique_ptr<primitive_impl> clone() const override {
return make_unique<shape_of_impl>(*this);
}
@@ -52,3 +54,5 @@ attach_shape_of_impl::attach_shape_of_impl() {
} // namespace detail
} // namespace ocl
} // namespace cldnn
BIND_BINARY_BUFFER_WITH_TYPE(cldnn::ocl::shape_of_impl, cldnn::object_type::SHAPE_OF_IMPL)

View File

@@ -19,6 +19,8 @@ struct shuffle_channels_impl : typed_primitive_impl_ocl<shuffle_channels> {
using parent = typed_primitive_impl_ocl<shuffle_channels>;
using parent::parent;
DECLARE_OBJECT_TYPE_SERIALIZATION
std::unique_ptr<primitive_impl> clone() const override {
return make_unique<shuffle_channels_impl>(*this);
}
@@ -81,3 +83,5 @@ attach_shuffle_channels_impl::attach_shuffle_channels_impl() {
} // namespace detail
} // namespace ocl
} // namespace cldnn
BIND_BINARY_BUFFER_WITH_TYPE(cldnn::ocl::shuffle_channels_impl, cldnn::object_type::SHUFFLE_CHANNELS_IMPL)

View File

@@ -68,6 +68,8 @@ struct slice_impl : typed_primitive_impl_ocl<slice> {
kInputsNum
};
DECLARE_OBJECT_TYPE_SERIALIZATION
std::unique_ptr<primitive_impl> clone() const override {
return make_unique<slice_impl>(*this);
}
@@ -135,3 +137,5 @@ attach_slice_impl::attach_slice_impl() {
} // namespace ocl
} // namespace cldnn
BIND_BINARY_BUFFER_WITH_TYPE(cldnn::ocl::slice_impl, cldnn::object_type::SLICE_IMPL)

View File

@@ -39,6 +39,8 @@ struct softmax_impl : typed_primitive_impl_ocl<softmax> {
using parent = typed_primitive_impl_ocl<softmax>;
using parent::parent;
DECLARE_OBJECT_TYPE_SERIALIZATION
std::unique_ptr<primitive_impl> clone() const override {
return make_unique<softmax_impl>(*this);
}
@@ -83,3 +85,5 @@ attach_softmax_impl::attach_softmax_impl() {
} // namespace detail
} // namespace ocl
} // namespace cldnn
BIND_BINARY_BUFFER_WITH_TYPE(cldnn::ocl::softmax_impl, cldnn::object_type::SOFTMAX_IMPL)

View File

@@ -20,6 +20,8 @@ struct space_to_batch_impl : typed_primitive_impl_ocl<space_to_batch> {
using parent = typed_primitive_impl_ocl<space_to_batch>;
using parent::parent;
DECLARE_OBJECT_TYPE_SERIALIZATION
std::unique_ptr<primitive_impl> clone() const override {
return make_unique<space_to_batch_impl>(*this);
}
@@ -75,3 +77,5 @@ attach_space_to_batch_impl::attach_space_to_batch_impl() {
} // namespace detail
} // namespace ocl
} // namespace cldnn
BIND_BINARY_BUFFER_WITH_TYPE(cldnn::ocl::space_to_batch_impl, cldnn::object_type::SPACE_TO_BATCH_IMPL)

Some files were not shown because too many files have changed in this diff Show More