diff --git a/src/plugins/intel_gpu/src/graph/impls/cpu/resample.cpp b/src/plugins/intel_gpu/src/graph/impls/cpu/resample.cpp index 58aa959aabf850..8ecd1c98f26f9e 100644 --- a/src/plugins/intel_gpu/src/graph/impls/cpu/resample.cpp +++ b/src/plugins/intel_gpu/src/graph/impls/cpu/resample.cpp @@ -106,34 +106,32 @@ struct resample_impl : public typed_primitive_impl { auto input_mem_ptr = instance.input_memory_ptr(); cldnn::mem_lock input_lock(input_mem_ptr, stream); + auto input_rank = params->input_layouts[0].get_rank(); for (size_t i = 0; i < params->input_layouts.size(); i++) { auto input_tensor = make_tensor(params->input_layouts[0], input_lock.data()); input_host_tensors.push_back(input_tensor); } + if (scales.size() < input_rank) + scales.insert(scales.begin(), input_rank - scales.size(), 1.f); + + for(size_t i = (input_rank - axes.size()); i > 0; i--) + axes.insert(axes.begin(), 1, (i - 1)); + if (input_host_tensors.size() == 1) { auto target_shape_sizes = params->output_layouts[0].get_tensor().sizes(); std::vector target_shape_ps; - for (size_t i = 0; i < axes.size(); i++) + for (size_t i = 0; i < input_rank; i++) target_shape_ps.push_back(target_shape_sizes[i]); auto target_shape_tensor = ov::Tensor(ov::element::i32, {target_shape_ps.size()}, target_shape_ps.data()); input_host_tensors.push_back(target_shape_tensor); - if (shape_calc_mode == ov::op::util::InterpolateBase::ShapeCalcMode::SIZES) { - auto new_scales = scales; - auto input_shape_sizes = params->input_layouts[0].get_tensor().sizes(); - for (size_t i = 0; i < sizes.size(); i++) - new_scales[i] = sizes[i] / input_shape_sizes[i]; - - auto scales_tensor = ov::Tensor(ov::element::f32, {new_scales.size()}, new_scales.data()); - input_host_tensors.push_back(scales_tensor); - shape_calc_mode = ov::op::util::InterpolateBase::ShapeCalcMode::SCALES; - } else if (shape_calc_mode == ov::op::util::InterpolateBase::ShapeCalcMode::SCALES) { + if (shape_calc_mode == ov::op::util::InterpolateBase::ShapeCalcMode::SCALES) { auto scales_tensor = ov::Tensor(ov::element::f32, {scales.size()}, scales.data()); input_host_tensors.push_back(scales_tensor); } else { - OPENVINO_ASSERT(false, "[GPU] Not supported Interpolate ShapeCalcMode", instance.id()); + OPENVINO_ASSERT(false, "[GPU] Not supported Interpolate ShapeCalcMode of CPU impl", instance.id()); } auto axes_tensor = ov::Tensor(ov::element::i64, {axes.size()}, axes.data()); @@ -189,19 +187,6 @@ struct resample_impl : public typed_primitive_impl { namespace detail { attach_resample_impl::attach_resample_impl() { - // auto formats = { - // format::bfyx, - // }; - - // auto types = { - // data_types::f32, - // }; - - // implementation_map::add(impl_types::cpu, shape_types::static_shape, resample_impl::create, types, formats); - // implementation_map::add(impl_types::cpu, shape_types::dynamic_shape, resample_impl::create, types, formats); - - //std::set::key_type> keys; - const auto types = {data_types::f32, data_types::i32}; const auto formats = { format::bfyx, @@ -219,13 +204,6 @@ attach_resample_impl::attach_resample_impl() { format::bs_fs_zyx_bsv32_fsv32, format::bs_fs_zyx_bsv32_fsv16, }; - // for (const auto type : types) { - // for (const auto format : formats) { - // keys.emplace(type, format); - // } - // } - - // keys.emplace(data_types::f32, format::yxfb); implementation_map::add(impl_types::cpu, shape_types::static_shape, resample_impl::create, types, formats); implementation_map::add(impl_types::cpu, shape_types::dynamic_shape, resample_impl::create, types, formats); diff --git a/src/plugins/intel_gpu/src/graph/impls/ocl/register.cpp b/src/plugins/intel_gpu/src/graph/impls/ocl/register.cpp index fec54625d81a5e..fb7bf0a98c176e 100644 --- a/src/plugins/intel_gpu/src/graph/impls/ocl/register.cpp +++ b/src/plugins/intel_gpu/src/graph/impls/ocl/register.cpp @@ -72,7 +72,6 @@ void register_implementations() { REGISTER_OCL(swiglu); REGISTER_OCL(tile); REGISTER_OCL(gather_tree); - //REGISTER_OCL(resample); REGISTER_OCL(grn); REGISTER_OCL(ctc_greedy_decoder); REGISTER_OCL(ctc_loss); diff --git a/src/plugins/intel_gpu/src/graph/impls/ocl/register.hpp b/src/plugins/intel_gpu/src/graph/impls/ocl/register.hpp index 19873bb0a6d539..f78e539db671f5 100644 --- a/src/plugins/intel_gpu/src/graph/impls/ocl/register.hpp +++ b/src/plugins/intel_gpu/src/graph/impls/ocl/register.hpp @@ -47,7 +47,6 @@ #include "intel_gpu/primitives/reduce.hpp" #include "intel_gpu/primitives/region_yolo.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/rms.hpp" diff --git a/src/plugins/intel_gpu/src/graph/impls/ocl/resample.cpp b/src/plugins/intel_gpu/src/graph/impls/ocl/resample.cpp index 2ca31874469707..a480617c1b690e 100644 --- a/src/plugins/intel_gpu/src/graph/impls/ocl/resample.cpp +++ b/src/plugins/intel_gpu/src/graph/impls/ocl/resample.cpp @@ -175,42 +175,6 @@ struct resample_impl : typed_primitive_impl_ocl { } }; -// namespace detail { - -// attach_resample_impl::attach_resample_impl() { -// std::set::key_type> keys; - -// const auto types = {data_types::f16, data_types::f32, data_types::i8, data_types::u8, data_types::i32}; -// const auto formats = { -// format::bfyx, -// format::b_fs_yx_fsv16, -// format::b_fs_yx_fsv32, -// format::bs_fs_yx_bsv16_fsv16, -// format::bs_fs_yx_bsv32_fsv16, -// format::bs_fs_yx_bsv32_fsv32, - -// format::bfzyx, -// format::b_fs_zyx_fsv16, -// format::b_fs_zyx_fsv32, -// format::bs_fs_zyx_bsv16_fsv32, -// format::bs_fs_zyx_bsv16_fsv16, -// format::bs_fs_zyx_bsv32_fsv32, -// format::bs_fs_zyx_bsv32_fsv16, -// }; -// for (const auto type : types) { -// for (const auto format : formats) { -// keys.emplace(type, format); -// } -// } - -// keys.emplace(data_types::f32, format::yxfb); -// keys.emplace(data_types::f16, format::yxfb); -// keys.emplace(data_types::f16, format::fs_b_yx_fsv32); - -// implementation_map::add(impl_types::ocl, typed_primitive_impl_ocl::create, keys); -// } - -// } // namespace detail std::unique_ptr ResampleImplementationManager::create_impl(const program_node& node, const kernel_impl_params& params) const { assert(node.is_type()); return typed_primitive_impl_ocl::create(static_cast(node), params); diff --git a/src/plugins/intel_gpu/src/graph/impls/ocl/resample.hpp b/src/plugins/intel_gpu/src/graph/impls/ocl/resample.hpp index f0a75a06b448b6..9bb50a2271e41c 100644 --- a/src/plugins/intel_gpu/src/graph/impls/ocl/resample.hpp +++ b/src/plugins/intel_gpu/src/graph/impls/ocl/resample.hpp @@ -4,7 +4,7 @@ #include "impls/registry/implementation_manager.hpp" #include "program_node.h" -//#include "intel_gpu/primitives/resample.hpp" +#include "resample_inst.h" #include namespace cldnn { @@ -15,16 +15,6 @@ struct ResampleImplementationManager : public ImplementationManager { ResampleImplementationManager(shape_types shape_type, ValidateFunc vf = nullptr) : ImplementationManager(impl_types::ocl, shape_type, vf) {} std::unique_ptr create_impl(const program_node& node, const kernel_impl_params& params) const override; bool validate_impl(const program_node& node) const override { - // auto prim = node.as().get_primitive(); - // const auto& in0_layout = node.get_input_layout(0); - - // if (in0_layout.data_type == ov::element::f32 && - // prim->operation_type == ov::op::util::InterpolateBase::InterpolateMode::LINEAR_ONNX && - // prim->coord_trans_mode == ov::op::util::InterpolateBase::CoordinateTransformMode::ALIGN_CORNERS && - // prim->shape_calc_mode == ov::op::util::InterpolateBase::ShapeCalcMode::SCALES) { - // return false; - // } - return true; } }; diff --git a/src/plugins/intel_gpu/src/graph/impls/registry/registry.hpp b/src/plugins/intel_gpu/src/graph/impls/registry/registry.hpp index b86ef442c6e735..c015ca043b91b6 100644 --- a/src/plugins/intel_gpu/src/graph/impls/registry/registry.hpp +++ b/src/plugins/intel_gpu/src/graph/impls/registry/registry.hpp @@ -201,7 +201,6 @@ REGISTER_DEFAULT_IMPLS(space_to_batch, OCL_S); REGISTER_DEFAULT_IMPLS(space_to_depth, OCL_S); REGISTER_DEFAULT_IMPLS(swiglu, OCL_S, OCL_D); REGISTER_DEFAULT_IMPLS(gather_tree, OCL_S); -//REGISTER_DEFAULT_IMPLS(resample, CPU_S, OCL_S); REGISTER_DEFAULT_IMPLS(grn, OCL_S); REGISTER_DEFAULT_IMPLS(ctc_greedy_decoder, OCL_S); REGISTER_DEFAULT_IMPLS(ctc_loss, OCL_S); diff --git a/src/plugins/intel_gpu/src/graph/impls/registry/resample_impls.cpp b/src/plugins/intel_gpu/src/graph/impls/registry/resample_impls.cpp index 737fd636d82a90..a2f8f54d4dedc9 100644 --- a/src/plugins/intel_gpu/src/graph/impls/registry/resample_impls.cpp +++ b/src/plugins/intel_gpu/src/graph/impls/registry/resample_impls.cpp @@ -33,19 +33,10 @@ const std::vector>& Registry shapeParams4D_LargeShape = { ShapeParams{ ov::op::v4::Interpolate::ShapeCalcMode::SCALES, - //InputShape{{-1, {2, 100}, -1, -1}, {{1, 64, 148, 148}}}, - InputShape{{-1, -1, -1, -1}, {{1, 3, 48, 48}}}, // min shape for failure + InputShape{{-1, {2, 100}, -1, -1}, {{1, 64, 148, 148}}}, ov::test::utils::InputLayerType::CONSTANT, ov::test::utils::InputLayerType::CONSTANT, {{1.f, 1.f, 2.f, 2.f}}, defaultAxes4D.front() }, + ShapeParams{ + ov::op::v4::Interpolate::ShapeCalcMode::SCALES, + InputShape{{-1, -1, -1, -1}, {{1, 3, 48, 48}}}, + ov::test::utils::InputLayerType::CONSTANT, + ov::test::utils::InputLayerType::CONSTANT, + {{2.f, 2.f}}, + reducedAxes4D.front() + }, ShapeParams{ ov::op::v4::Interpolate::ShapeCalcMode::SIZES, InputShape{{-1, -1, -1, -1}, {{1, 3, 48, 48}}},