Skip to content

OpenVINO™ is an open source toolkit for optimizing and deploying AI inference

[GPU] Fix invalid input format of fused ops for resample opt (#32654)

Min, Byungil94b8f85a88a2
diff --git a/src/plugins/intel_gpu/src/graph/include/resample_inst.h b/src/plugins/intel_gpu/src/graph/include/resample_inst.h
index 014f44674f6..23bc7f6aa92 100644
--- a/src/plugins/intel_gpu/src/graph/include/resample_inst.h
+++ b/src/plugins/intel_gpu/src/graph/include/resample_inst.h
@@ -22,7 +22,14 @@ public:
program_node& input() const { return get_dependency(0); }
- std::vector<size_t> get_shape_infer_dependencies() const override { return {1, 2}; }
+ std::vector<size_t> get_shape_infer_dependencies() const override {
+ // if vector of sizes or scales exists, resample in CreateInterpolateOp generates no dependency for inputs of sizes and scales
+ if (typed_desc()->sizes.size() != 0 && typed_desc()->scales.size() != 0) {
+ return {};
+ } else {
+ return {1, 2};
+ }
+ }
};
using resample_node = typed_program_node<resample>;
diff --git a/src/plugins/intel_gpu/src/kernel_selector/kernels/resample/resample_kernel_opt.cpp b/src/plugins/intel_gpu/src/kernel_selector/kernels/resample/resample_kernel_opt.cpp
index 954854ca4b9..c925bcee367 100644
--- a/src/plugins/intel_gpu/src/kernel_selector/kernels/resample/resample_kernel_opt.cpp
+++ b/src/plugins/intel_gpu/src/kernel_selector/kernels/resample/resample_kernel_opt.cpp
@@ -162,6 +162,13 @@ bool ResampleKernelOpt::Validate(const Params& p) const {
if (input.Dimentions() == 5 && params.resampleType != ResampleType::NEAREST_NEIGHBOR)
DO_NOT_USE_THIS_KERNEL(p.layerID);
+ if (!params.fused_ops.empty()) {
+ for (auto& fused_op : params.fused_ops) {
+ if (SimpleLayout(fused_op.tensors[0].GetLayout()))
+ DO_NOT_USE_THIS_KERNEL(p.layerID);
+ }
+ }
+
return true;
}
diff --git a/src/plugins/intel_gpu/tests/unit/fusions/fusion_validity_test.cpp b/src/plugins/intel_gpu/tests/unit/fusions/fusion_validity_test.cpp
index 12b861c5b3e..ccb6bc2fab4 100644
--- a/src/plugins/intel_gpu/tests/unit/fusions/fusion_validity_test.cpp
+++ b/src/plugins/intel_gpu/tests/unit/fusions/fusion_validity_test.cpp
@@ -116,8 +116,6 @@ TEST_P(format_mismatch_multiple_fusing, multiple_fused_node) {
reorder("reorder_bfyx", input_info("eltwise"), p.default_format, data_types::f32)
);
- ov::intel_gpu::ImplementationDesc resample_impl = { p.input_format, "resample_opt" };
- cfg_fused.set_property(ov::intel_gpu::force_implementations(ov::intel_gpu::ImplForcingMap{ { "resample_prim", resample_impl } }));
ov::intel_gpu::ImplementationDesc ref_resample_impl = { p.input_format, "resample_ref" };
cfg_not_fused.set_property(ov::intel_gpu::force_implementations(ov::intel_gpu::ImplForcingMap{ { "resample_prim", ref_resample_impl } }));
ov::intel_gpu::ImplementationDesc ref_eltwise = { p.input_format, "" };
@@ -128,8 +126,8 @@ TEST_P(format_mismatch_multiple_fusing, multiple_fused_node) {
}
INSTANTIATE_TEST_SUITE_P(validate_fusings_gpu, format_mismatch_multiple_fusing, ::testing::ValuesIn(std::vector<fusing_test_params>{
- fusing_test_params{ CASE_RESAMPLE_FSV16_1, 3, 4 },
- fusing_test_params{ CASE_RESAMPLE_FSV16_2, 3, 4 }
+ fusing_test_params{ CASE_RESAMPLE_FSV16_1, 4, 4 },
+ fusing_test_params{ CASE_RESAMPLE_FSV16_2, 4, 4 }
}));
#define CASE_RESAMPLE_ONNX_4D_FSV16_1 { 1, 16, 64, 64 }, { 1, 16, 128, 128 }, data_types::f16, format::b_fs_yx_fsv16, format::bfyx, resample::InterpolateOp::InterpolateMode::LINEAR_ONNX, data_types::f16, format::bfyx
diff --git a/src/plugins/intel_gpu/tests/unit/fusions/resample_fusion_test.cpp b/src/plugins/intel_gpu/tests/unit/fusions/resample_fusion_test.cpp
index 4faa2f2c88f..2d3a7353286 100644
--- a/src/plugins/intel_gpu/tests/unit/fusions/resample_fusion_test.cpp
+++ b/src/plugins/intel_gpu/tests/unit/fusions/resample_fusion_test.cpp
@@ -348,3 +348,27 @@ INSTANTIATE_TEST_SUITE_P(fusings_gpu, resample_eltwise_fusing_through_not_allowe
resample_test_params{ CASE_RESAMPLE_FP16_1, RESAMPLE_ELTWISE_FUSING_THROUGH_CNT },
}));
+
+class resample_eltwise : public ResamplePrimitiveFusingTest {};
+TEST_P(resample_eltwise, opt_kernel) {
+ auto p = GetParam();
+ create_topologies(
+ input_layout("input", get_input_layout(p)),
+ data("scale_data", get_mem(get_per_channel_layout(p), -10, 10)),
+ reorder("reorder_datat", input_info("scale_data"), p.default_format, p.data_type),
+ resample("resample_prim", input_info("input"), p.out_shape, p.in_shape.feature[0], p.type),
+ eltwise("eltwise",{ input_info("resample_prim"), input_info("reorder_datat") }, eltwise_mode::sum, p.data_type),
+ reorder("out", input_info("eltwise"), p.input_format, data_types::f32)
+ );
+
+ tolerance = 1.f;
+ execute(p);
+}
+
+#define RESAMPLE_QUANTIZE_CNT 2, 3
+INSTANTIATE_TEST_SUITE_P(fusings_gpu, resample_eltwise, ::testing::ValuesIn(std::vector<resample_test_params>{
+ resample_test_params{ CASE_RESAMPLE_FP16_1, RESAMPLE_QUANTIZE_CNT },
+ resample_test_params{ CASE_RESAMPLE_FP16_4, RESAMPLE_QUANTIZE_CNT },
+ resample_test_params{ CASE_RESAMPLE_FP16_7, RESAMPLE_QUANTIZE_CNT },
+ resample_test_params{ CASE_RESAMPLE_FP16_11, RESAMPLE_QUANTIZE_CNT },
+}));