Skip to content

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

[GPU] added fused arguments to resample_pil_ref (#34600)

Michal Miotk5c4aca8f414b
diff --git a/src/plugins/intel_gpu/src/kernel_selector/cl_kernels/resample_pil_ref.cl b/src/plugins/intel_gpu/src/kernel_selector/cl_kernels/resample_pil_ref.cl
index 4e0b3726304..64b45a5f4c2 100644
--- a/src/plugins/intel_gpu/src/kernel_selector/cl_kernels/resample_pil_ref.cl
+++ b/src/plugins/intel_gpu/src/kernel_selector/cl_kernels/resample_pil_ref.cl
@@ -58,7 +58,7 @@ KERNEL (calculate_coefficients_gpu_ref)(__global float* coefficients, __global i
ww += w;
}
for (x = 0; x < xmax; x++) {
- if (ww != 0.0) {
+ if (ww != 0.0f) {
k[x] /= ww;
}
}
@@ -75,7 +75,7 @@ KERNEL (calculate_coefficients_gpu_ref)(__global float* coefficients, __global i
KERNEL (resample_horizontal_gpu_ref)( __global INPUT0_TYPE* input
, __global float* coefficients
, __global int* bounds
- , __global OUTPUT_TYPE* output
+ , __global RESAMPLE_HORIZONTAL_OUTPUT_TYPE* output
#if HAS_FUSED_OPS_DECLS
, FUSED_OPS_DECLS
#endif
@@ -97,7 +97,7 @@ KERNEL (resample_horizontal_gpu_ref)( __global INPUT0_TYPE* input
#endif
int horizontal_min, horizontal_max;
float* k;
- OUTPUT_TYPE ss = 0.f;
+ ACCUMULATOR_TYPE ss = 0.f;
#if BATCH_IS_HORIZONTAL_AXIS == 1
horizontal_min = bounds[b * 2 + 0];
horizontal_max = bounds[b * 2 + 1];
@@ -152,12 +152,21 @@ KERNEL (resample_horizontal_gpu_ref)( __global INPUT0_TYPE* input
#else
int out_idx = OUTPUT_GET_INDEX(b, f, y, x);
#endif
- output[out_idx] = ss;
+ #if HAS_FUSED_OPS
+ FUSED_OPS;
+ output[out_idx] = TO_OUTPUT_TYPE(FUSED_OPS_RESULT);
+ #else
+ #if ENABLE_VERTICAL_PASS
+ output[out_idx] = TO_INTERMEDIATE_BUF_TYPE(ACTIVATION(ss, ACTIVATION_PARAMS));
+ #else
+ output[out_idx] = TO_OUTPUT_TYPE(ACTIVATION(ss, ACTIVATION_PARAMS));
+ #endif
+ #endif
}
#else // RESAMPLE_PILLOW_STAGE == STAGE_RESAMPLE_VERTICAL
-KERNEL (resample_vertical_gpu_ref)( __global INPUT0_TYPE* input
+KERNEL (resample_vertical_gpu_ref)( __global RESAMPLE_VERTICAL_INPUT_TYPE* input
, __global float* coefficients
, __global int* bounds
, __global OUTPUT_TYPE* output
@@ -194,7 +203,7 @@ KERNEL (resample_vertical_gpu_ref)( __global INPUT0_TYPE* input
vertical_max = bounds[x * 2 + 1];
#endif
- OUTPUT_TYPE ss = 0.f;
+ ACCUMULATOR_TYPE ss = 0.f;
for (int vertical_dim = 0; vertical_dim < vertical_max; vertical_dim++) {
#if ENABLE_HORIZONTAL_PASS
@@ -243,9 +252,20 @@ KERNEL (resample_vertical_gpu_ref)( __global INPUT0_TYPE* input
#endif // ENABLE_HORIZONTAL_PASS
}
int out_idx = OUTPUT_GET_INDEX(b, f, y, x);
- output[out_idx] = ss;
+ #if HAS_FUSED_OPS
+ FUSED_OPS;
+ output[out_idx] = TO_OUTPUT_TYPE(FUSED_OPS_RESULT);
+ #else
+ output[out_idx] = TO_OUTPUT_TYPE(ACTIVATION(ss, ACTIVATION_PARAMS));
+ #endif
}
#endif
#undef PILLOW_SUPPORT
+#ifdef RESAMPLE_HORIZONTAL_OUTPUT_TYPE
+#undef RESAMPLE_HORIZONTAL_OUTPUT_TYPE
+#endif
+#ifdef RESAMPLE_VERTICAL_INPUT_TYPE
+#undef RESAMPLE_VERTICAL_INPUT_TYPE
+#endif
diff --git a/src/plugins/intel_gpu/src/kernel_selector/kernels/resample/resample_kernel_pil_ref.cpp b/src/plugins/intel_gpu/src/kernel_selector/kernels/resample/resample_kernel_pil_ref.cpp
index ea163621dcc..70a93a6d958 100644
--- a/src/plugins/intel_gpu/src/kernel_selector/kernels/resample/resample_kernel_pil_ref.cpp
+++ b/src/plugins/intel_gpu/src/kernel_selector/kernels/resample/resample_kernel_pil_ref.cpp
@@ -122,7 +122,7 @@ DataTensor GetIntermediateBufferSize(const resample_params& params) {
OPENVINO_ASSERT(channelIndex >= 0, "Invalid layout channel index");
dims[channelIndex] = ybox_last - ybox_first;
- DataTensor result{dims, output.GetDType(), layout};
+ DataTensor result{dims, Datatype::F16, layout};
return result;
}
@@ -134,6 +134,8 @@ ParamsKey ResampleKernelPilRef::GetSupportedKey() const {
k.EnableInputDataType(Datatype::F32);
k.EnableOutputDataType(Datatype::F16);
k.EnableOutputDataType(Datatype::F32);
+ k.EnableOutputDataType(Datatype::UINT8);
+ k.EnableOutputDataType(Datatype::INT8);
k.EnableDifferentTypes();
k.EnableAllInputLayout();
k.EnableAllOutputLayout();
@@ -196,7 +198,7 @@ ResampleKernelBase::DispatchData ResampleKernelPilRef::SetDefaultForKernel(Kerne
static void SetKernelArguments(const resample_params& params, ResampleKernelPilRef::KernelId kernelId,
cldnn::arguments_desc& arguments,
- std::vector<InternalBuffer>& internalBuffers) {
+ std::vector<InternalBuffer>& internalBuffers, const uint32_t fusedCount) {
/* maximum number of coeffs */
switch (kernelId) {
case ResampleKernelPilRef::eCalcHorizontalCoefficients: {
@@ -224,6 +226,9 @@ static void SetKernelArguments(const resample_params& params, ResampleKernelPilR
BytesPerElement(intermediateBufferTensor.GetDType()));
} else {
arguments.push_back({ArgumentDescriptor::Types::OUTPUT, 0}); // output
+ for (uint32_t i = 0; i < fusedCount; i++) {
+ arguments.push_back({ArgumentDescriptor::Types::INPUT_OF_FUSED_PRIMITIVE, i});
+ }
}
break;
}
@@ -258,6 +263,11 @@ static void SetKernelArguments(const resample_params& params, ResampleKernelPilR
arguments.push_back({ArgumentDescriptor::Types::INTERNAL_BUFFER, 1}); // bounds
arguments.push_back({ArgumentDescriptor::Types::OUTPUT, 0}); // output
}
+
+ for (uint32_t i = 0; i < fusedCount; i++) {
+ arguments.push_back({ArgumentDescriptor::Types::INPUT_OF_FUSED_PRIMITIVE, i});
+ }
+
break;
}
default:
@@ -276,6 +286,7 @@ JitConstants ResampleKernelPilRef::GetJitConstantsForKernel(KernelId id, const r
MakeJitConstant("STAGE_CALC_VERTICAL_COEFFICIENTS", static_cast<int>(eCalcVerticalCoefficients)),
MakeJitConstant("STAGE_RESAMPLE_VERTICAL", static_cast<int>(eResampleVertical)),
});
+ jit_constants.Merge(MakeTypeJitConstants(GetAccumulatorType(params), "ACCUMULATOR"));
switch (id) {
case eCalcHorizontalCoefficients: {
auto inputHorizontalSizeWithPadding = getInputHorizontalSize(params, true);
@@ -304,6 +315,7 @@ JitConstants ResampleKernelPilRef::GetJitConstantsForKernel(KernelId id, const r
float support = params.resampleType == ResampleType::BILINEAR_PILLOW ? 1.f : 2.f * filter_scale;
int ksize = static_cast<int>(std::ceil(support)) * 2 + 1;
auto ybox_first = GetFirstRow(params);
+ const bool needVerticalPass = NeedVerticalPass(params);
jit_constants.AddConstants({MakeJitConstant("INTERMEDIATE_BUF", GetIntermediateBufferSize(params)),
MakeJitConstant("BEGIN_PADDING_BATCH", params.pads_begin[0]),
MakeJitConstant("BEGIN_PADDING_FEATURE", params.pads_begin[1]),
@@ -317,10 +329,15 @@ JitConstants ResampleKernelPilRef::GetJitConstantsForKernel(KernelId id, const r
MakeJitConstant("FEATURE_HORIZONTAL_OFFSET", params.axes[eHorizontal] == InterpolateAxis::FEATURE ? ybox_first : 0),
MakeJitConstant("Y_HORIZONTAL_OFFSET", params.axes[eHorizontal] == InterpolateAxis::Y ? ybox_first : 0),
MakeJitConstant("X_HORIZONTAL_OFFSET", params.axes[eHorizontal] == InterpolateAxis::X ? ybox_first : 0),
- MakeJitConstant("ENABLE_VERTICAL_PASS", NeedVerticalPass(params)),
+ MakeJitConstant("ENABLE_VERTICAL_PASS", needVerticalPass),
MakeJitConstant("ENABLE_HORIZONTAL_PASS", NeedHorizontalPass(params)),
MakeJitConstant("KSIZE", ksize),
});
+ if (needVerticalPass) {
+ jit_constants.AddConstant(MakeJitConstant("RESAMPLE_HORIZONTAL_OUTPUT_TYPE", "INTERMEDIATE_BUF_TYPE"));
+ } else {
+ jit_constants.AddConstant(MakeJitConstant("RESAMPLE_HORIZONTAL_OUTPUT_TYPE", "OUTPUT_TYPE"));
+ }
break;
}
case eCalcVerticalCoefficients: {
@@ -349,6 +366,7 @@ JitConstants ResampleKernelPilRef::GetJitConstantsForKernel(KernelId id, const r
float filter_scale = std::max(1.f, scale);
float support = params.resampleType == ResampleType::BILINEAR_PILLOW ? 1.f : 2.f * filter_scale;
int ksize = static_cast<int>(std::ceil(support)) * 2 + 1;
+ const bool needHorizontalPass = NeedHorizontalPass(params);
jit_constants.AddConstants({MakeJitConstant("INTERMEDIATE_BUF", GetIntermediateBufferSize(params)),
MakeJitConstant("BEGIN_PADDING_BATCH", params.pads_begin[0]),
MakeJitConstant("BEGIN_PADDING_FEATURE", params.pads_begin[1]),
@@ -359,21 +377,44 @@ JitConstants ResampleKernelPilRef::GetJitConstantsForKernel(KernelId id, const r
MakeJitConstant("Y_IS_VERTICAL_AXIS", params.axes[eVertical] == InterpolateAxis::Y),
MakeJitConstant("X_IS_VERTICAL_AXIS", params.axes[eVertical] == InterpolateAxis::X),
MakeJitConstant("ENABLE_VERTICAL_PASS", NeedVerticalPass(params)),
- MakeJitConstant("ENABLE_HORIZONTAL_PASS", NeedHorizontalPass(params)),
+ MakeJitConstant("ENABLE_HORIZONTAL_PASS", needHorizontalPass),
MakeJitConstant("KSIZE", ksize),
- });
+ });
+ if (needHorizontalPass) {
+ jit_constants.AddConstant(MakeJitConstant("RESAMPLE_VERTICAL_INPUT_TYPE", "INTERMEDIATE_BUF_TYPE"));
+ } else {
+ jit_constants.AddConstant(MakeJitConstant("RESAMPLE_VERTICAL_INPUT_TYPE", "INPUT0_TYPE"));
+ }
+
break;
}
+
default:
throw std::invalid_argument("Kernel index is out of range. Kernel index for resample_pillow should be in range 0..3.");
}
+
+ if (!params.fused_ops.empty()) {
+ if ((id == eResampleHorizontal && !NeedVerticalPass(params)) || id == eResampleVertical){
+ std::vector<std::string> idx_order;
+ if (DataTensor::ChannelsCount(params.outputs[0].GetLayout()) == 4) {
+ idx_order = {"b", "f", "y", "x"};
+ } else if (DataTensor::ChannelsCount(params.outputs[0].GetLayout()) == 5) {
+ idx_order = {"b", "f", "z", "y", "x"};
+ } else if (DataTensor::ChannelsCount(params.outputs[0].GetLayout()) == 6) {
+ idx_order = {"b", "f", "w", "z", "y", "x"};
+ }
+ FusedOpsConfiguration conf = {"", idx_order, "ss", GetAccumulatorType(params), 1};
+ jit_constants.Merge(MakeFusedOpsJitConstants(params, {conf}));
+ }
+ }
+
return jit_constants;
}
KernelsData ResampleKernelPilRef::GetKernelsData(const Params &params) const {
const resample_params& resample_parameters = static_cast<const resample_params&>(params);
KernelData kd = KernelData::Default<resample_params>(params, GetKernelsNum(resample_parameters));
- kd.internalBufferDataType = Datatype::F32;
+ kd.internalBufferDataType = Datatype::F16;
int i = 0;
for (ResampleKernelPilRef::KernelId id = eCalcHorizontalCoefficients; id < eEnd; ++id) {
if (!NeedHorizontalPass(resample_parameters) &&
@@ -399,7 +440,9 @@ KernelsData ResampleKernelPilRef::GetKernelsData(const Params &params) const {
0,
0,
0);
- SetKernelArguments(resample_parameters, id, kernel.params.arguments, kd.internalBuffers);
+
+ const auto fusedCount = GetFusedPrimitiveInputsCount(params);
+ SetKernelArguments(resample_parameters, id, kernel.params.arguments, kd.internalBuffers, fusedCount);
}
return {kd};
}
diff --git a/src/plugins/intel_gpu/src/kernel_selector/kernels/resample/resample_kernel_pil_ref.h b/src/plugins/intel_gpu/src/kernel_selector/kernels/resample/resample_kernel_pil_ref.h
index 9c8366c4010..67f8b2b38c0 100644
--- a/src/plugins/intel_gpu/src/kernel_selector/kernels/resample/resample_kernel_pil_ref.h
+++ b/src/plugins/intel_gpu/src/kernel_selector/kernels/resample/resample_kernel_pil_ref.h
@@ -22,6 +22,11 @@ public:
KernelsData GetKernelsData(const Params& params) const override;
ParamsKey GetSupportedKey() const override;
+ std::vector<FusedOpType> GetSupportedFusedOps() const override {
+ return { FusedOpType::QUANTIZE,
+ FusedOpType::ELTWISE,
+ FusedOpType::ACTIVATION };
+ }
protected:
JitConstants GetJitConstantsForKernel(KernelId id, const resample_params& params) const;
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 6db490fc8f7..acf4acb2469 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
@@ -372,3 +372,265 @@ INSTANTIATE_TEST_SUITE_P(fusings_gpu, resample_eltwise, ::testing::ValuesIn(std:
resample_test_params{ CASE_RESAMPLE_FP16_7, RESAMPLE_QUANTIZE_CNT },
resample_test_params{ CASE_RESAMPLE_FP16_11, RESAMPLE_QUANTIZE_CNT },
}));
+
+/* ----------------------------------------------------------------------------------------------------- */
+/* -------------------------------- Resample BICUBIC_PILLOW with axes ----------------------------------- */
+/* ----------------------------------------------------------------------------------------------------- */
+
+namespace {
+struct resample_axes_test_params {
+ ov::PartialShape in_shape;
+ ov::PartialShape out_shape;
+ data_types data_type;
+ format input_format;
+ resample::InterpolateOp::InterpolateMode type;
+ data_types default_type;
+ format default_format;
+ std::vector<int64_t> axes;
+ size_t expected_fused_primitives;
+ size_t expected_not_fused_primitives;
+};
+
+class ResampleAxesPrimitiveFusingTest : public ::BaseFusingTest<resample_axes_test_params> {
+public:
+ void SetUp() override {
+ BaseFusingTest::SetUp();
+ // BICUBIC_PILLOW with partial axes requires v11 shape inference for correct output layout
+ cfg_fused.set_property(ov::intel_gpu::allow_new_shape_infer(true));
+ ov::intel_gpu::ImplementationDesc resample_target_impl = { format::bfyx, "resample_pil_ref", cldnn::impl_types::ocl};
+ cfg_fused.set_property(ov::intel_gpu::force_implementations(ov::intel_gpu::ImplForcingMap{ {"resample_prim", resample_target_impl} }));
+ cfg_not_fused.set_property(ov::intel_gpu::allow_new_shape_infer(true));
+ }
+
+ void execute(resample_axes_test_params& p) {
+ auto input_prim = get_mem(get_input_layout(p));
+ network network_not_fused(this->engine, this->topology_non_fused, cfg_not_fused);
+ network network_fused(this->engine, this->topology_fused, cfg_fused);
+ network_fused.set_input_data("input", input_prim);
+ network_not_fused.set_input_data("input", input_prim);
+ compare(network_not_fused, network_fused, p);
+ }
+
+ layout get_input_layout(resample_axes_test_params& p) {
+ return layout{ p.in_shape, p.data_type, p.input_format, padding{} };
+ }
+
+ layout get_output_layout(resample_axes_test_params& p) {
+ return layout{ p.out_shape, p.data_type, p.input_format };
+ }
+
+ layout get_per_channel_layout(resample_axes_test_params& p) {
+ ov::PartialShape shape(std::vector<ov::Dimension>(p.out_shape.size(), 1));
+ shape[1] = p.out_shape[1];
+ return layout{ shape, p.default_type, p.default_format };
+ }
+
+ std::vector<int64_t> get_sizes_for_axes(resample_axes_test_params& p) {
+ std::vector<int64_t> sizes;
+ for (auto ax : p.axes) {
+ sizes.push_back(p.out_shape[ax].get_length());
+ }
+ return sizes;
+ }
+};
+} // namespace
+
+// BICUBIC_PILLOW, spatial axes = {2,3} (downscale)
+#define CASE_RESAMPLE_BICUBIC_PILLOW_AXES_F16_1 \
+ ov::PartialShape{ 1, 15, 5, 4 }, ov::PartialShape{ 1, 15, 3, 2 }, data_types::f16, format::bfyx, \
+ resample::InterpolateOp::InterpolateMode::BICUBIC_PILLOW, data_types::f16, format::bfyx, \
+ std::vector<int64_t>{2, 3}
+
+// BICUBIC_PILLOW, spatial axes = {2,3} (upscale)
+#define CASE_RESAMPLE_BICUBIC_PILLOW_AXES_F16_2 \
+ ov::PartialShape{ 1, 16, 5, 4 }, ov::PartialShape{ 1, 16, 8, 7 }, data_types::f16, format::bfyx, \
+ resample::InterpolateOp::InterpolateMode::BICUBIC_PILLOW, data_types::f16, format::bfyx, \
+ std::vector<int64_t>{2, 3}
+
+// BICUBIC_PILLOW, spatial axes = {2,3} (downscale only horizontal - vertical axis not changed)
+#define CASE_RESAMPLE_BICUBIC_PILLOW_AXES_F16_3 \
+ ov::PartialShape{ 1, 15, 5, 4 }, ov::PartialShape{ 1, 15, 5, 2 }, data_types::f16, format::bfyx, \
+ resample::InterpolateOp::InterpolateMode::BICUBIC_PILLOW, data_types::f16, format::bfyx, \
+ std::vector<int64_t>{2, 3}
+
+// BICUBIC_PILLOW, spatial axes = {2,3} (upscale only horizontal - vertical axis not changed)
+#define CASE_RESAMPLE_BICUBIC_PILLOW_AXES_F16_4 \
+ ov::PartialShape{ 1, 16, 5, 4 }, ov::PartialShape{ 1, 16, 5, 7 }, data_types::f16, format::bfyx, \
+ resample::InterpolateOp::InterpolateMode::BICUBIC_PILLOW, data_types::f16, format::bfyx, \
+ std::vector<int64_t>{2, 3}
+
+// BICUBIC_PILLOW, spatial axes = {2,3} (downscale only vertical - horizontal axis not changed)
+#define CASE_RESAMPLE_BICUBIC_PILLOW_AXES_F16_5 \
+ ov::PartialShape{ 1, 15, 5, 4 }, ov::PartialShape{ 1, 15, 3, 4 }, data_types::f16, format::bfyx, \
+ resample::InterpolateOp::InterpolateMode::BICUBIC_PILLOW, data_types::f16, format::bfyx, \
+ std::vector<int64_t>{2, 3}
+
+// BICUBIC_PILLOW, spatial axes = {2,3} (upscale only vertical - horizontal axis not changed)
+#define CASE_RESAMPLE_BICUBIC_PILLOW_AXES_F16_6 \
+ ov::PartialShape{ 1, 16, 5, 4 }, ov::PartialShape{ 1, 16, 8, 4 }, data_types::f16, format::bfyx, \
+ resample::InterpolateOp::InterpolateMode::BICUBIC_PILLOW, data_types::f16, format::bfyx, \
+ std::vector<int64_t>{2, 3}
+
+// BICUBIC_PILLOW, spatial axes = {2,3} (downscale)
+#define CASE_RESAMPLE_BICUBIC_PILLOW_AXES_F32_1 \
+ ov::PartialShape{ 1, 15, 5, 4 }, ov::PartialShape{ 1, 15, 3, 2 }, data_types::f32, format::bfyx, \
+ resample::InterpolateOp::InterpolateMode::BICUBIC_PILLOW, data_types::f32, format::bfyx, \
+ std::vector<int64_t>{2, 3}
+
+// BICUBIC_PILLOW, spatial axes = {2,3} (upscale)
+#define CASE_RESAMPLE_BICUBIC_PILLOW_AXES_F32_2 \
+ ov::PartialShape{ 1, 16, 5, 4 }, ov::PartialShape{ 1, 16, 8, 7 }, data_types::f32, format::bfyx, \
+ resample::InterpolateOp::InterpolateMode::BICUBIC_PILLOW, data_types::f32, format::bfyx, \
+ std::vector<int64_t>{2, 3}
+
+// BICUBIC_PILLOW, spatial axes = {2,3} (downscale only horizontal - vertical axis not changed)
+#define CASE_RESAMPLE_BICUBIC_PILLOW_AXES_F32_3 \
+ ov::PartialShape{ 1, 15, 5, 4 }, ov::PartialShape{ 1, 15, 5, 2 }, data_types::f32, format::bfyx, \
+ resample::InterpolateOp::InterpolateMode::BICUBIC_PILLOW, data_types::f32, format::bfyx, \
+ std::vector<int64_t>{2, 3}
+
+// BICUBIC_PILLOW, spatial axes = {2,3} (upscale only horizontal - vertical axis not changed)
+#define CASE_RESAMPLE_BICUBIC_PILLOW_AXES_F32_4 \
+ ov::PartialShape{ 1, 16, 5, 4 }, ov::PartialShape{ 1, 16, 5, 7 }, data_types::f32, format::bfyx, \
+ resample::InterpolateOp::InterpolateMode::BICUBIC_PILLOW, data_types::f32, format::bfyx, \
+ std::vector<int64_t>{2, 3}
+
+// BICUBIC_PILLOW, spatial axes = {2,3} (downscale only vertical - horizontal axis not changed)
+#define CASE_RESAMPLE_BICUBIC_PILLOW_AXES_F32_5 \
+ ov::PartialShape{ 1, 15, 5, 4 }, ov::PartialShape{ 1, 15, 3, 4 }, data_types::f32, format::bfyx, \
+ resample::InterpolateOp::InterpolateMode::BICUBIC_PILLOW, data_types::f32, format::bfyx, \
+ std::vector<int64_t>{2, 3}
+
+// BICUBIC_PILLOW, spatial axes = {2,3} (upscale only vertical - horizontal axis not changed)
+#define CASE_RESAMPLE_BICUBIC_PILLOW_AXES_F32_6 \
+ ov::PartialShape{ 1, 16, 5, 4 }, ov::PartialShape{ 1, 16, 8, 4 }, data_types::f32, format::bfyx, \
+ resample::InterpolateOp::InterpolateMode::BICUBIC_PILLOW, data_types::f32, format::bfyx, \
+ std::vector<int64_t>{2, 3}
+
+class resample_bicubic_pillow_axes_scale_activation_eltwise : public ResampleAxesPrimitiveFusingTest {};
+TEST_P(resample_bicubic_pillow_axes_scale_activation_eltwise, basic) {
+ auto p = GetParam();
+ auto sizes = get_sizes_for_axes(p);
+ create_topologies(
+ input_layout("input", get_input_layout(p)),
+ data("scale_data", get_mem(get_per_channel_layout(p), -10, 10)),
+ data("eltwise_data", get_mem(get_output_layout(p), -10, 10)),
+ resample("resample_prim", input_info("input"), sizes, {}, p.axes, {}, {}, 0, -0.75f,
+ p.type, resample::InterpolateOp::ShapeCalcMode::SIZES),
+ eltwise("scale", { input_info("resample_prim"), input_info("scale_data") }, eltwise_mode::prod, data_types::f16),
+ activation("activation", input_info("scale"), activation_func::abs),
+ eltwise("eltwise", { input_info("activation"), input_info("eltwise_data") }, eltwise_mode::sum),
+ reorder("reorder_bfyx", input_info("eltwise"), p.default_format, data_types::f32)
+ );
+
+ tolerance = 5e-2f;
+ execute(p);
+}
+
+#define RESAMPLE_BICUBIC_PILLOW_AXES_SCALE_ACTIVATION_ELTWISE_CNT 2, 5
+INSTANTIATE_TEST_SUITE_P(fusings_gpu, resample_bicubic_pillow_axes_scale_activation_eltwise,
+ ::testing::ValuesIn(std::vector<resample_axes_test_params>{
+ resample_axes_test_params{ CASE_RESAMPLE_BICUBIC_PILLOW_AXES_F16_1, RESAMPLE_BICUBIC_PILLOW_AXES_SCALE_ACTIVATION_ELTWISE_CNT },
+ resample_axes_test_params{ CASE_RESAMPLE_BICUBIC_PILLOW_AXES_F16_2, RESAMPLE_BICUBIC_PILLOW_AXES_SCALE_ACTIVATION_ELTWISE_CNT },
+ resample_axes_test_params{ CASE_RESAMPLE_BICUBIC_PILLOW_AXES_F16_3, RESAMPLE_BICUBIC_PILLOW_AXES_SCALE_ACTIVATION_ELTWISE_CNT },
+ resample_axes_test_params{ CASE_RESAMPLE_BICUBIC_PILLOW_AXES_F16_4, RESAMPLE_BICUBIC_PILLOW_AXES_SCALE_ACTIVATION_ELTWISE_CNT },
+ resample_axes_test_params{ CASE_RESAMPLE_BICUBIC_PILLOW_AXES_F16_5, RESAMPLE_BICUBIC_PILLOW_AXES_SCALE_ACTIVATION_ELTWISE_CNT },
+ resample_axes_test_params{ CASE_RESAMPLE_BICUBIC_PILLOW_AXES_F16_6, RESAMPLE_BICUBIC_PILLOW_AXES_SCALE_ACTIVATION_ELTWISE_CNT },
+ resample_axes_test_params{ CASE_RESAMPLE_BICUBIC_PILLOW_AXES_F32_1, RESAMPLE_BICUBIC_PILLOW_AXES_SCALE_ACTIVATION_ELTWISE_CNT },
+ resample_axes_test_params{ CASE_RESAMPLE_BICUBIC_PILLOW_AXES_F32_2, RESAMPLE_BICUBIC_PILLOW_AXES_SCALE_ACTIVATION_ELTWISE_CNT },
+ resample_axes_test_params{ CASE_RESAMPLE_BICUBIC_PILLOW_AXES_F32_3, RESAMPLE_BICUBIC_PILLOW_AXES_SCALE_ACTIVATION_ELTWISE_CNT },
+ resample_axes_test_params{ CASE_RESAMPLE_BICUBIC_PILLOW_AXES_F32_4, RESAMPLE_BICUBIC_PILLOW_AXES_SCALE_ACTIVATION_ELTWISE_CNT },
+ resample_axes_test_params{ CASE_RESAMPLE_BICUBIC_PILLOW_AXES_F32_5, RESAMPLE_BICUBIC_PILLOW_AXES_SCALE_ACTIVATION_ELTWISE_CNT },
+ resample_axes_test_params{ CASE_RESAMPLE_BICUBIC_PILLOW_AXES_F32_6, RESAMPLE_BICUBIC_PILLOW_AXES_SCALE_ACTIVATION_ELTWISE_CNT },
+}));
+
+class resample_bicubic_pillow_axes_activation : public ResampleAxesPrimitiveFusingTest {};
+TEST_P(resample_bicubic_pillow_axes_activation, basic) {
+ auto p = GetParam();
+ auto sizes = get_sizes_for_axes(p);
+ create_topologies(
+ input_layout("input", get_input_layout(p)),
+ resample("resample_prim", input_info("input"), sizes, {}, p.axes, {}, {}, 0, -0.75f,
+ p.type, resample::InterpolateOp::ShapeCalcMode::SIZES),
+ activation("activation", input_info("resample_prim"), activation_func::abs),
+ reorder("reorder_bfyx", input_info("activation"), p.default_format, data_types::f32)
+ );
+
+ tolerance = 2e-2f;
+ execute(p);
+}
+
+#define RESAMPLE_BICUBIC_PILLOW_AXES_ACTIVATION_CNT 2, 3
+INSTANTIATE_TEST_SUITE_P(fusings_gpu, resample_bicubic_pillow_axes_activation,
+ ::testing::ValuesIn(std::vector<resample_axes_test_params>{
+ resample_axes_test_params{ CASE_RESAMPLE_BICUBIC_PILLOW_AXES_F16_1, RESAMPLE_BICUBIC_PILLOW_AXES_ACTIVATION_CNT },
+ resample_axes_test_params{ CASE_RESAMPLE_BICUBIC_PILLOW_AXES_F16_2, RESAMPLE_BICUBIC_PILLOW_AXES_ACTIVATION_CNT },
+ resample_axes_test_params{ CASE_RESAMPLE_BICUBIC_PILLOW_AXES_F16_3, RESAMPLE_BICUBIC_PILLOW_AXES_ACTIVATION_CNT },
+ resample_axes_test_params{ CASE_RESAMPLE_BICUBIC_PILLOW_AXES_F16_4, RESAMPLE_BICUBIC_PILLOW_AXES_ACTIVATION_CNT },
+ resample_axes_test_params{ CASE_RESAMPLE_BICUBIC_PILLOW_AXES_F16_5, RESAMPLE_BICUBIC_PILLOW_AXES_ACTIVATION_CNT },
+ resample_axes_test_params{ CASE_RESAMPLE_BICUBIC_PILLOW_AXES_F16_6, RESAMPLE_BICUBIC_PILLOW_AXES_ACTIVATION_CNT },
+ resample_axes_test_params{ CASE_RESAMPLE_BICUBIC_PILLOW_AXES_F32_1, RESAMPLE_BICUBIC_PILLOW_AXES_ACTIVATION_CNT },
+ resample_axes_test_params{ CASE_RESAMPLE_BICUBIC_PILLOW_AXES_F32_2, RESAMPLE_BICUBIC_PILLOW_AXES_ACTIVATION_CNT },
+ resample_axes_test_params{ CASE_RESAMPLE_BICUBIC_PILLOW_AXES_F32_3, RESAMPLE_BICUBIC_PILLOW_AXES_ACTIVATION_CNT },
+ resample_axes_test_params{ CASE_RESAMPLE_BICUBIC_PILLOW_AXES_F32_4, RESAMPLE_BICUBIC_PILLOW_AXES_ACTIVATION_CNT },
+ resample_axes_test_params{ CASE_RESAMPLE_BICUBIC_PILLOW_AXES_F32_5, RESAMPLE_BICUBIC_PILLOW_AXES_ACTIVATION_CNT },
+ resample_axes_test_params{ CASE_RESAMPLE_BICUBIC_PILLOW_AXES_F32_6, RESAMPLE_BICUBIC_PILLOW_AXES_ACTIVATION_CNT },
+}));
+
+class resample_bicubic_pillow_axes_quantize : public ResampleAxesPrimitiveFusingTest {};
+TEST_P(resample_bicubic_pillow_axes_quantize, basic_i8) {
+ auto p = GetParam();
+ auto sizes = get_sizes_for_axes(p);
+ create_topologies(
+ input_layout("input", get_input_layout(p)),
+ data("in_lo", get_mem(get_per_channel_layout(p), min_random, 0)),
+ data("in_hi", get_mem(get_per_channel_layout(p), 1, max_random)),
+ data("out_lo", get_mem(get_single_element_layout(p), -127)),
+ data("out_hi", get_mem(get_single_element_layout(p), 127)),
+ resample("resample_prim", input_info("input"), sizes, {}, p.axes, {}, {}, 0, -0.75f,
+ p.type, resample::InterpolateOp::ShapeCalcMode::SIZES),
+ quantize("quantize", input_info("resample_prim"), input_info("in_lo"), input_info("in_hi"),
+ input_info("out_lo"), input_info("out_hi"), 255, data_types::i8),
+ reorder("reorder_bfyx", input_info("quantize"), p.default_format, data_types::f32)
+ );
+
+ tolerance = 1;
+ execute(p);
+}
+
+TEST_P(resample_bicubic_pillow_axes_quantize, basic_u8) {
+ auto p = GetParam();
+ auto sizes = get_sizes_for_axes(p);
+ create_topologies(
+ input_layout("input", get_input_layout(p)),
+ data("in_lo", get_mem(get_per_channel_layout(p), min_random, 0)),
+ data("in_hi", get_mem(get_per_channel_layout(p), 1, max_random)),
+ data("out_lo", get_mem(get_single_element_layout(p), 0)),
+ data("out_hi", get_mem(get_single_element_layout(p), 255)),
+ resample("resample_prim", input_info("input"), sizes, {}, p.axes, {}, {}, 0, -0.75f,
+ p.type, resample::InterpolateOp::ShapeCalcMode::SIZES),
+ quantize("quantize", input_info("resample_prim"), input_info("in_lo"), input_info("in_hi"),
+ input_info("out_lo"), input_info("out_hi"), 256, data_types::u8),
+ reorder("reorder_bfyx", input_info("quantize"), p.default_format, data_types::f32)
+ );
+
+ tolerance = 1;
+ execute(p);
+}
+
+#define RESAMPLE_BICUBIC_PILLOW_AXES_QUANTIZE_CNT 2, 3
+INSTANTIATE_TEST_SUITE_P(fusings_gpu, resample_bicubic_pillow_axes_quantize,
+ ::testing::ValuesIn(std::vector<resample_axes_test_params>{
+ resample_axes_test_params{ CASE_RESAMPLE_BICUBIC_PILLOW_AXES_F16_1, RESAMPLE_BICUBIC_PILLOW_AXES_QUANTIZE_CNT },
+ resample_axes_test_params{ CASE_RESAMPLE_BICUBIC_PILLOW_AXES_F16_2, RESAMPLE_BICUBIC_PILLOW_AXES_QUANTIZE_CNT },
+ resample_axes_test_params{ CASE_RESAMPLE_BICUBIC_PILLOW_AXES_F16_3, RESAMPLE_BICUBIC_PILLOW_AXES_QUANTIZE_CNT },
+ resample_axes_test_params{ CASE_RESAMPLE_BICUBIC_PILLOW_AXES_F16_4, RESAMPLE_BICUBIC_PILLOW_AXES_QUANTIZE_CNT },
+ resample_axes_test_params{ CASE_RESAMPLE_BICUBIC_PILLOW_AXES_F16_5, RESAMPLE_BICUBIC_PILLOW_AXES_QUANTIZE_CNT },
+ resample_axes_test_params{ CASE_RESAMPLE_BICUBIC_PILLOW_AXES_F16_6, RESAMPLE_BICUBIC_PILLOW_AXES_QUANTIZE_CNT },
+ resample_axes_test_params{ CASE_RESAMPLE_BICUBIC_PILLOW_AXES_F32_1, RESAMPLE_BICUBIC_PILLOW_AXES_QUANTIZE_CNT },
+ resample_axes_test_params{ CASE_RESAMPLE_BICUBIC_PILLOW_AXES_F32_2, RESAMPLE_BICUBIC_PILLOW_AXES_QUANTIZE_CNT },
+ resample_axes_test_params{ CASE_RESAMPLE_BICUBIC_PILLOW_AXES_F32_3, RESAMPLE_BICUBIC_PILLOW_AXES_QUANTIZE_CNT },
+ resample_axes_test_params{ CASE_RESAMPLE_BICUBIC_PILLOW_AXES_F32_4, RESAMPLE_BICUBIC_PILLOW_AXES_QUANTIZE_CNT },
+ resample_axes_test_params{ CASE_RESAMPLE_BICUBIC_PILLOW_AXES_F32_5, RESAMPLE_BICUBIC_PILLOW_AXES_QUANTIZE_CNT },
+ resample_axes_test_params{ CASE_RESAMPLE_BICUBIC_PILLOW_AXES_F32_6, RESAMPLE_BICUBIC_PILLOW_AXES_QUANTIZE_CNT },
+}));