Skip to content

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

[GPU] bug fix for the calculating input index with shrink (#32773)

Sungeun Kim521c2fc45e9a
diff --git a/src/plugins/intel_gpu/src/graph/graph_optimizer/add_required_reorders.cpp b/src/plugins/intel_gpu/src/graph/graph_optimizer/add_required_reorders.cpp
index 184b32e2489..3cc5fde19ad 100644
--- a/src/plugins/intel_gpu/src/graph/graph_optimizer/add_required_reorders.cpp
+++ b/src/plugins/intel_gpu/src/graph/graph_optimizer/add_required_reorders.cpp
@@ -148,7 +148,7 @@ bool add_required_reorders::test_format(cldnn::program_node& node, format reques
auto current_format = dep->get_output_layout(false, dep_with_port.second).format;
- if (format::is_weights_format(current_format))
+ if (dep->is_constant() || format::is_weights_format(current_format))
continue;
if (dep->is_type<reorder>()) {
diff --git a/src/plugins/intel_gpu/src/kernel_selector/cl_kernels/strided_slice_ref.cl b/src/plugins/intel_gpu/src/kernel_selector/cl_kernels/strided_slice_ref.cl
index f0676d541cb..84938e5f631 100644
--- a/src/plugins/intel_gpu/src/kernel_selector/cl_kernels/strided_slice_ref.cl
+++ b/src/plugins/intel_gpu/src/kernel_selector/cl_kernels/strided_slice_ref.cl
@@ -29,10 +29,10 @@ inline void FUNC(get_slice_step)(OPTIONAL_SHAPE_INFO_ARG
*step_batch = batch_index < STRIDE_DIMS ? stride[batch_index] : 1;
*step_feature = feature_index < STRIDE_DIMS ? stride[feature_index] : 1;
#ifdef OUTPUT_LAYOUT_BFYX
- *step_w = 0;
- *step_z = 0;
+ *step_w = 1;
+ *step_z = 1;
#elif OUTPUT_LAYOUT_BFZYX
- *step_w = 0;
+ *step_w = 1;
*step_z = z_index < STRIDE_DIMS ? stride[z_index] : 1;
#elif OUTPUT_LAYOUT_BFWZYX
*step_w = w_index < STRIDE_DIMS ? stride[w_index] : 1;
@@ -202,9 +202,9 @@ KERNEL(strided_slice_ref)(OPTIONAL_SHAPE_INFO_ARG
{
const uint batch = get_global_id(0);
const uint feature = get_global_id(1);
- int step_batch, step_feature, step_w, step_z, step_y, step_x;
- int begin_batch, begin_feature, begin_w, begin_z, begin_y, begin_x;
- int end_batch, end_feature, end_w, end_z, end_y, end_x;
+ int step_batch = 0, step_feature = 0, step_w = 0, step_z = 0, step_y = 0, step_x = 0;
+ int begin_batch = 0, begin_feature = 0, begin_w = 0, begin_z = 0, begin_y = 0, begin_x = 0;
+ int end_batch = 0, end_feature = 0, end_w = 0, end_z = 0, end_y = 0, end_x = 0;
#ifdef STRIDE_TYPE
FUNC_CALL(get_slice_step)(OPTIONAL_SHAPE_INFO_TENSOR stride, &step_batch, &step_feature, &step_w, &step_z, &step_y, &step_x);
diff --git a/src/plugins/intel_gpu/tests/functional/single_layer_tests/dynamic/strided_slice.cpp b/src/plugins/intel_gpu/tests/functional/single_layer_tests/dynamic/strided_slice.cpp
index 3064c20eb12..509a306744d 100644
--- a/src/plugins/intel_gpu/tests/functional/single_layer_tests/dynamic/strided_slice.cpp
+++ b/src/plugins/intel_gpu/tests/functional/single_layer_tests/dynamic/strided_slice.cpp
@@ -416,6 +416,22 @@ INSTANTIATE_TEST_SUITE_P(smoke_CompareWithRefs_Common_Dynamic_5D, StridedSliceLa
::testing::ValuesIn(rest_input_types)),
StridedSliceLayerGPUTest::getTestCaseName);
+const std::vector<StridedSliceParams> testCasesCommon5D_shrink = {
+ StridedSliceParams{ { 1 }, { 2 }, { 1 }, { 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0 }, { 1, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0 } },
+};
+
+const std::vector<InputShape> inputShapesDynamic5D_shrink = {
+ {{-1, -1, -1, -1, 4},
+ {{2, 1, 3, 4, 4}}},
+};
+
+INSTANTIATE_TEST_SUITE_P(smoke_CompareWithRefs_Common_Dynamic_5D_shrink, StridedSliceLayerGPUTest,
+ ::testing::Combine(
+ ::testing::ValuesIn(inputShapesDynamic5D_shrink),
+ ::testing::ValuesIn(testCasesCommon5D_shrink),
+ ::testing::ValuesIn(model_types),
+ ::testing::ValuesIn(rest_input_types)),
+ StridedSliceLayerGPUTest::getTestCaseName);
const std::vector<StridedSliceParams> testCasesCommon6D = {
StridedSliceParams{ { 0, 2, 5, 4 }, { 1, 4, 28, 27 }, { 1, 1, 1, 1 }, { 0, 0, 0, 0 }, { 0, 0, 0, 0 }, { }, { }, { } },