Skip to content

Commit

Permalink
[GPU] Fix mvn segmentation fault for multiple threads start_async (#2…
Browse files Browse the repository at this point in the history
…7654)

### Details:
- *Deep copy impl params*: deep copy primitive impl KernelData params
for different networks when running start_async() with multi-threads
(THROUGHPUT mode)

### Tickets:
 - *[CVS-155564](https://jira.devtools.intel.com/browse/CVS-155564)*

Migrated from PR #27263.

---------

Signed-off-by: yuan.xiong <[email protected]>
  • Loading branch information
yuanxion authored Nov 25, 2024
1 parent 6ffd8c1 commit c093ef5
Show file tree
Hide file tree
Showing 84 changed files with 106 additions and 84 deletions.
2 changes: 1 addition & 1 deletion src/plugins/intel_gpu/src/graph/impls/ocl/activation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ struct activation_impl : typed_primitive_impl_ocl<activation> {
DECLARE_OBJECT_TYPE_SERIALIZATION(cldnn::ocl::activation_impl)

std::unique_ptr<primitive_impl> clone() const override {
return make_unique<activation_impl>(*this);
return make_deep_copy<activation_impl, kernel_params_t>(*this);
}

void load(BinaryInputBuffer& ib) override {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ struct adaptive_pooling_impl : public typed_primitive_impl_ocl<adaptive_pooling>
DECLARE_OBJECT_TYPE_SERIALIZATION(cldnn::ocl::adaptive_pooling_impl)

std::unique_ptr<primitive_impl> clone() const override {
return make_unique<adaptive_pooling_impl>(*this);
return make_deep_copy<adaptive_pooling_impl, kernel_params_t>(*this);
}

protected:
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/intel_gpu/src/graph/impls/ocl/arg_max_min.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ struct arg_max_min_impl : typed_primitive_impl_ocl<arg_max_min> {
DECLARE_OBJECT_TYPE_SERIALIZATION(cldnn::ocl::arg_max_min_impl)

std::unique_ptr<primitive_impl> clone() const override {
return make_unique<arg_max_min_impl>(*this);
return make_deep_copy<arg_max_min_impl, kernel_params_t>(*this);
}

void load(BinaryInputBuffer& ib) override {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ struct batch_to_space_impl : typed_primitive_impl_ocl<batch_to_space> {
DECLARE_OBJECT_TYPE_SERIALIZATION(cldnn::ocl::batch_to_space_impl)

std::unique_ptr<primitive_impl> clone() const override {
return make_unique<batch_to_space_impl>(*this);
return make_deep_copy<batch_to_space_impl, kernel_params_t>(*this);
}

static kernel_params_t get_kernel_params(const kernel_impl_params& impl_param) {
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/intel_gpu/src/graph/impls/ocl/border.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ struct border_impl : typed_primitive_impl_ocl<border> {
DECLARE_OBJECT_TYPE_SERIALIZATION(cldnn::ocl::border_impl)

std::unique_ptr<primitive_impl> clone() const override {
return make_unique<border_impl>(*this);
return make_deep_copy<border_impl, kernel_params_t>(*this);
}

static kernel_params_t get_kernel_params(const kernel_impl_params& impl_param, bool is_shape_agnostic = false) {
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/intel_gpu/src/graph/impls/ocl/broadcast.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ struct broadcast_impl : typed_primitive_impl_ocl<broadcast> {
DECLARE_OBJECT_TYPE_SERIALIZATION(cldnn::ocl::broadcast_impl)

std::unique_ptr<primitive_impl> clone() const override {
return make_unique<broadcast_impl>(*this);
return make_deep_copy<broadcast_impl, kernel_params_t>(*this);
}

void load(BinaryInputBuffer& ib) override {
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/intel_gpu/src/graph/impls/ocl/bucketize.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ struct bucketize_impl : typed_primitive_impl_ocl<bucketize> {
DECLARE_OBJECT_TYPE_SERIALIZATION(cldnn::ocl::bucketize_impl)

std::unique_ptr<primitive_impl> clone() const override {
return make_unique<bucketize_impl>(*this);
return make_deep_copy<bucketize_impl, kernel_params_t>(*this);
}

static kernel_params_t get_kernel_params(const kernel_impl_params& impl_param) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ struct concatenation_impl : typed_primitive_impl_ocl<concatenation> {
DECLARE_OBJECT_TYPE_SERIALIZATION(cldnn::ocl::concatenation_impl)

std::unique_ptr<primitive_impl> clone() const override {
return make_unique<concatenation_impl>(*this);
return make_deep_copy<concatenation_impl, kernel_params_t>(*this);
}

void load(BinaryInputBuffer& ib) override {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ struct convert_color_impl : typed_primitive_impl_ocl<convert_color> {
DECLARE_OBJECT_TYPE_SERIALIZATION(cldnn::ocl::convert_color_impl)

std::unique_ptr<primitive_impl> clone() const override {
return make_unique<convert_color_impl>(*this);
return make_deep_copy<convert_color_impl, kernel_params_t>(*this);
}

protected:
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/intel_gpu/src/graph/impls/ocl/convolution.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ struct convolution_impl : typed_primitive_impl_ocl<convolution> {
DECLARE_OBJECT_TYPE_SERIALIZATION(cldnn::ocl::convolution_impl)

std::unique_ptr<primitive_impl> clone() const override {
return make_unique<convolution_impl>(*this);
return make_deep_copy<convolution_impl, kernel_params_t>(*this);
}

void load(BinaryInputBuffer& ib) override {
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/intel_gpu/src/graph/impls/ocl/crop.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ struct crop_impl : typed_primitive_impl_ocl<crop> {
DECLARE_OBJECT_TYPE_SERIALIZATION(cldnn::ocl::crop_impl)

std::unique_ptr<primitive_impl> clone() const override {
return make_unique<crop_impl>(*this);
return make_deep_copy<crop_impl, kernel_params_t>(*this);
}

void load(BinaryInputBuffer& ib) override {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ struct ctc_greedy_decoder_impl : typed_primitive_impl_ocl<ctc_greedy_decoder> {

public:
std::unique_ptr<primitive_impl> clone() const override {
return make_unique<ctc_greedy_decoder_impl>(*this);
return make_deep_copy<ctc_greedy_decoder_impl, kernel_params_t>(*this);
}

static kernel_params_t get_kernel_params(const kernel_impl_params& impl_param) {
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/intel_gpu/src/graph/impls/ocl/ctc_loss.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ struct ctc_loss_impl : typed_primitive_impl_ocl<ctc_loss> {
DECLARE_OBJECT_TYPE_SERIALIZATION(cldnn::ocl::ctc_loss_impl)

std::unique_ptr<primitive_impl> clone() const override {
return make_unique<ctc_loss_impl>(*this);
return make_deep_copy<ctc_loss_impl, kernel_params_t>(*this);
}

static kernel_params_t get_kernel_params(const kernel_impl_params& impl_param) {
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/intel_gpu/src/graph/impls/ocl/cum_sum.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ struct cum_sum_impl : typed_primitive_impl_ocl<cum_sum> {
DECLARE_OBJECT_TYPE_SERIALIZATION(cldnn::ocl::cum_sum_impl)

std::unique_ptr<primitive_impl> clone() const override {
return make_unique<cum_sum_impl>(*this);
return make_deep_copy<cum_sum_impl, kernel_params_t>(*this);
}

void load(BinaryInputBuffer& ib) override {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ struct deconvolution_impl : typed_primitive_impl_ocl<deconvolution> {
DECLARE_OBJECT_TYPE_SERIALIZATION(cldnn::ocl::deconvolution_impl)

std::unique_ptr<primitive_impl> clone() const override {
return make_unique<deconvolution_impl>(*this);
return make_deep_copy<deconvolution_impl, kernel_params_t>(*this);
}

protected:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ struct depth_to_space_impl : typed_primitive_impl_ocl<depth_to_space> {
DECLARE_OBJECT_TYPE_SERIALIZATION(cldnn::ocl::depth_to_space_impl)

std::unique_ptr<primitive_impl> clone() const override {
return make_unique<depth_to_space_impl>(*this);
return make_deep_copy<depth_to_space_impl, kernel_params_t>(*this);
}

static kernel_params_t get_kernel_params(const kernel_impl_params& impl_param) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ struct detection_output_impl : typed_primitive_impl_ocl<detection_output> {
DECLARE_OBJECT_TYPE_SERIALIZATION(cldnn::ocl::detection_output_impl)

std::unique_ptr<primitive_impl> clone() const override {
return make_unique<detection_output_impl>(*this);
return make_deep_copy<detection_output_impl, kernel_params_t>(*this);
}

public:
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/intel_gpu/src/graph/impls/ocl/dft.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ struct dft_impl : typed_primitive_impl_ocl<dft> {
DECLARE_OBJECT_TYPE_SERIALIZATION(cldnn::ocl::dft_impl)

std::unique_ptr<primitive_impl> clone() const override {
return make_unique<dft_impl>(*this);
return make_deep_copy<dft_impl, kernel_params_t>(*this);
}

static kernel_params_t get_kernel_params(const kernel_impl_params& impl_param) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ struct dynamic_quantize_impl : typed_primitive_impl_ocl<dynamic_quantize> {
DECLARE_OBJECT_TYPE_SERIALIZATION(cldnn::ocl::dynamic_quantize_impl);

std::unique_ptr<primitive_impl> clone() const override {
return make_unique<dynamic_quantize_impl>(*this);
return make_deep_copy<dynamic_quantize_impl, kernel_params_t>(*this);
}

void load(BinaryInputBuffer& ib) override {
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/intel_gpu/src/graph/impls/ocl/eltwise.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ struct eltwise_impl : typed_primitive_impl_ocl<eltwise> {
DECLARE_OBJECT_TYPE_SERIALIZATION(cldnn::ocl::eltwise_impl)

std::unique_ptr<primitive_impl> clone() const override {
return make_unique<eltwise_impl>(*this);
return make_deep_copy<eltwise_impl, kernel_params_t>(*this);
}

void load(BinaryInputBuffer& ib) override {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ struct embedding_bag_impl : typed_primitive_impl_ocl<embedding_bag> {
DECLARE_OBJECT_TYPE_SERIALIZATION(cldnn::ocl::embedding_bag_impl)

std::unique_ptr<primitive_impl> clone() const override {
return make_unique<embedding_bag_impl>(*this);
return make_deep_copy<embedding_bag_impl, kernel_params_t>(*this);
}

static kernel_params_t get_kernel_params(const kernel_impl_params& impl_param) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ struct experimental_detectron_detection_output_impl
DECLARE_OBJECT_TYPE_SERIALIZATION(cldnn::ocl::experimental_detectron_detection_output_impl)

std::unique_ptr<primitive_impl> clone() const override {
return make_unique<experimental_detectron_detection_output_impl>(*this);
return make_deep_copy<experimental_detectron_detection_output_impl, kernel_params_t>(*this);
}

protected:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ struct experimental_detectron_generate_proposals_single_image_impl
DECLARE_OBJECT_TYPE_SERIALIZATION(cldnn::ocl::experimental_detectron_generate_proposals_single_image_impl)

std::unique_ptr<primitive_impl> clone() const override {
return make_unique<experimental_detectron_generate_proposals_single_image_impl>(*this);
return make_deep_copy<experimental_detectron_generate_proposals_single_image_impl, kernel_params_t>(*this);
}

protected:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ struct experimental_detectron_prior_grid_generator_impl
DECLARE_OBJECT_TYPE_SERIALIZATION(cldnn::ocl::experimental_detectron_prior_grid_generator_impl)

std::unique_ptr<primitive_impl> clone() const override {
return make_unique<experimental_detectron_prior_grid_generator_impl>(*this);
return make_deep_copy<experimental_detectron_prior_grid_generator_impl, kernel_params_t>(*this);
}

static kernel_params_t get_kernel_params(const kernel_impl_params& impl_param) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ struct experimental_detectron_roi_feature_extractor_impl : public typed_primitiv
DECLARE_OBJECT_TYPE_SERIALIZATION(cldnn::ocl::experimental_detectron_roi_feature_extractor_impl)

std::unique_ptr<primitive_impl> clone() const override {
return make_unique<experimental_detectron_roi_feature_extractor_impl>(*this);
return make_deep_copy<experimental_detectron_roi_feature_extractor_impl, kernel_params_t>(*this);
}

event::ptr execute_impl(const std::vector<event::ptr>& events,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ struct experimental_detectron_topk_rois_impl : typed_primitive_impl_ocl<experime
DECLARE_OBJECT_TYPE_SERIALIZATION(cldnn::ocl::experimental_detectron_topk_rois_impl)

std::unique_ptr<primitive_impl> clone() const override {
return make_unique<experimental_detectron_topk_rois_impl>(*this);
return make_deep_copy<experimental_detectron_topk_rois_impl, kernel_params_t>(*this);
}

static kernel_params_t get_kernel_params(const kernel_impl_params& impl_param) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ struct extract_image_patches_impl : typed_primitive_impl_ocl<extract_image_patch
DECLARE_OBJECT_TYPE_SERIALIZATION(cldnn::ocl::extract_image_patches_impl)

std::unique_ptr<primitive_impl> clone() const override {
return make_unique<extract_image_patches_impl>(*this);
return make_deep_copy<extract_image_patches_impl, kernel_params_t>(*this);
}

static kernel_params_t get_kernel_params(const kernel_impl_params& impl_param) {
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/intel_gpu/src/graph/impls/ocl/eye.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ struct eye_impl : typed_primitive_impl_ocl<eye> {
DECLARE_OBJECT_TYPE_SERIALIZATION(cldnn::ocl::eye_impl)

std::unique_ptr<primitive_impl> clone() const override {
return make_unique<eye_impl>(*this);
return make_deep_copy<eye_impl, kernel_params_t>(*this);
}

static kernel_params_t get_kernel_params(const kernel_impl_params& impl_param) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ struct fully_connected_impl : typed_primitive_impl_ocl<fully_connected> {
}

std::unique_ptr<primitive_impl> clone() const override {
return make_unique<fully_connected_impl>(*this);
return make_deep_copy<fully_connected_impl, kernel_params_t>(*this);
}

void load(BinaryInputBuffer& ib) override {
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/intel_gpu/src/graph/impls/ocl/gather.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ struct gather_impl : typed_primitive_impl_ocl<gather> {
DECLARE_OBJECT_TYPE_SERIALIZATION(cldnn::ocl::gather_impl)

std::unique_ptr<primitive_impl> clone() const override {
return make_unique<gather_impl>(*this);
return make_deep_copy<gather_impl, kernel_params_t>(*this);
}

void load(BinaryInputBuffer& ib) override {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ struct gather_elements_impl : typed_primitive_impl_ocl<gather_elements> {
DECLARE_OBJECT_TYPE_SERIALIZATION(cldnn::ocl::gather_elements_impl)

std::unique_ptr<primitive_impl> clone() const override {
return make_unique<gather_elements_impl>(*this);
return make_deep_copy<gather_elements_impl, kernel_params_t>(*this);
}

void load(BinaryInputBuffer& ib) override {
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/intel_gpu/src/graph/impls/ocl/gather_nd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ struct gather_nd_impl : typed_primitive_impl_ocl<gather_nd> {
DECLARE_OBJECT_TYPE_SERIALIZATION(cldnn::ocl::gather_nd_impl)

std::unique_ptr<primitive_impl> clone() const override {
return make_unique<gather_nd_impl>(*this);
return make_deep_copy<gather_nd_impl, kernel_params_t>(*this);
}

void load(BinaryInputBuffer& ib) override {
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/intel_gpu/src/graph/impls/ocl/gather_tree.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ struct gather_tree_impl : typed_primitive_impl_ocl<gather_tree> {
DECLARE_OBJECT_TYPE_SERIALIZATION(cldnn::ocl::gather_tree_impl)

std::unique_ptr<primitive_impl> clone() const override {
return make_unique<gather_tree_impl>(*this);
return make_deep_copy<gather_tree_impl, kernel_params_t>(*this);
}

static kernel_params_t get_kernel_params(const kernel_impl_params& impl_param) {
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/intel_gpu/src/graph/impls/ocl/gemm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ struct gemm_impl : multi_stage_primitive<gemm> {
const uint32_t indirect_gemm = 1;

std::unique_ptr<primitive_impl> clone() const override {
return make_unique<gemm_impl>(*this);
return make_deep_copy<gemm_impl, kernel_params_t>(*this);
}

gemm_impl() = default;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ struct generate_proposals_impl
DECLARE_OBJECT_TYPE_SERIALIZATION(cldnn::ocl::generate_proposals_impl)

std::unique_ptr<primitive_impl> clone() const override {
return make_unique<generate_proposals_impl>(*this);
return make_deep_copy<generate_proposals_impl, kernel_params_t>(*this);
}

protected:
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/intel_gpu/src/graph/impls/ocl/grid_sample.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ struct grid_sample_impl : public typed_primitive_impl_ocl<grid_sample> {
DECLARE_OBJECT_TYPE_SERIALIZATION(cldnn::ocl::grid_sample_impl)

std::unique_ptr<primitive_impl> clone() const override {
return make_unique<grid_sample_impl>(*this);
return make_deep_copy<grid_sample_impl, kernel_params_t>(*this);
}

static kernel_params_t get_kernel_params(const kernel_impl_params& impl_param) {
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/intel_gpu/src/graph/impls/ocl/grn.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ struct grn_impl : typed_primitive_impl_ocl<grn> {
DECLARE_OBJECT_TYPE_SERIALIZATION(cldnn::ocl::grn_impl)

std::unique_ptr<primitive_impl> clone() const override {
return make_unique<grn_impl>(*this);
return make_deep_copy<grn_impl, kernel_params_t>(*this);
}

public:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ struct group_normalization_impl : typed_primitive_impl_ocl<group_normalization>
DECLARE_OBJECT_TYPE_SERIALIZATION(cldnn::ocl::group_normalization_impl)

std::unique_ptr<primitive_impl> clone() const override {
return make_unique<group_normalization_impl>(*this);
return make_deep_copy<group_normalization_impl, kernel_params_t>(*this);
}

void load(BinaryInputBuffer& ib) override {
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/intel_gpu/src/graph/impls/ocl/kv_cache.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ struct kv_cache_impl : multi_stage_primitive<kv_cache> {
DECLARE_OBJECT_TYPE_SERIALIZATION(cldnn::ocl::kv_cache_impl)

std::unique_ptr<primitive_impl> clone() const override {
return make_unique<kv_cache_impl>(*this);
return make_deep_copy<kv_cache_impl, kernel_params_t>(*this);
}

const size_t concat_stage = 0;
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/intel_gpu/src/graph/impls/ocl/lrn.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ struct lrn_impl : typed_primitive_impl_ocl<lrn> {
DECLARE_OBJECT_TYPE_SERIALIZATION(cldnn::ocl::lrn_impl)

std::unique_ptr<primitive_impl> clone() const override {
return make_unique<lrn_impl>(*this);
return make_deep_copy<lrn_impl, kernel_params_t>(*this);
}

static kernel_params_t get_kernel_params(const kernel_impl_params& impl_param) {
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/intel_gpu/src/graph/impls/ocl/lstm_elt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ struct lstm_elt_impl : typed_primitive_impl_ocl<lstm_elt> {
DECLARE_OBJECT_TYPE_SERIALIZATION(cldnn::ocl::lstm_elt_impl)

std::unique_ptr<primitive_impl> clone() const override {
return make_unique<lstm_elt_impl>(*this);
return make_deep_copy<lstm_elt_impl, kernel_params_t>(*this);
}

protected:
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/intel_gpu/src/graph/impls/ocl/matrix_nms.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ struct matrix_nms_impl : typed_primitive_impl_ocl<matrix_nms> {
DECLARE_OBJECT_TYPE_SERIALIZATION(cldnn::ocl::matrix_nms_impl)

std::unique_ptr<primitive_impl> clone() const override {
return make_unique<matrix_nms_impl>(*this);
return make_deep_copy<matrix_nms_impl, kernel_params_t>(*this);
}

protected:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,18 @@ struct multi_stage_primitive : public typed_primitive_impl<PType> {
return {kernels_cache.get_cached_kernel_ids(_kernels)};
}

template<typename ImplType, typename KernelParamsType>
static std::unique_ptr<primitive_impl> make_deep_copy(const ImplType& impl_ocl) {
auto prim_impl = make_unique<ImplType>(impl_ocl);
for (auto& _kernel_data : (*prim_impl)._kernels_data) {
KernelParamsType* params_ptr = dynamic_cast<KernelParamsType*>(_kernel_data.params.get());
if (params_ptr != nullptr) {
_kernel_data.params = make_unique<KernelParamsType>(*params_ptr);
}
}
return prim_impl;
}

std::vector<kernel::ptr> get_kernels() const override {
return _kernels;
}
Expand Down
Loading

0 comments on commit c093ef5

Please sign in to comment.