From 46d1a4db6ffe9af45d940802296375cb36804dcd Mon Sep 17 00:00:00 2001 From: Paul Youngsoo Ahn Date: Thu, 29 Aug 2024 10:17:19 +0900 Subject: [PATCH] [GPU] Fix the issue missing data padding info in update_shape (#26276) ### Details: - *Do not set shape_changed to true when shape is not changed.* - *Fix output layout does not have updated data_padding which is calculated by calc_output_layouts in update_shape* ### Tickets: - *149773* --- .../intel_gpu/src/graph/primitive_inst.cpp | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/src/plugins/intel_gpu/src/graph/primitive_inst.cpp b/src/plugins/intel_gpu/src/graph/primitive_inst.cpp index 9d741e6c177393..362aa651f8c251 100644 --- a/src/plugins/intel_gpu/src/graph/primitive_inst.cpp +++ b/src/plugins/intel_gpu/src/graph/primitive_inst.cpp @@ -425,13 +425,23 @@ void primitive_inst::update_shape() { _impl_params->memory_deps = memory_deps; + auto new_layouts = _node->type()->calc_output_layouts(*_node, *_impl_params); - for (size_t i = 0; i != _impl_params->output_layouts.size(); ++i) { - set_shape_change(); - _impl_params->output_layouts[i].set_partial_shape(new_layouts[i].get_partial_shape()); + for (size_t idx = 0; idx != new_layouts.size(); ++idx) { + auto& new_layout = new_layouts[idx]; if (!_node->is_type() || (!_node->get_input_layout(0).has_dynamic_pad() && !_node->can_be_optimized())) { - _impl_params->output_layouts[i].data_padding = padding::max(_impl_params->output_layouts[i].data_padding, new_layouts[i].data_padding); + auto data_padding = padding::max(_impl_params->get_output_layout(idx).data_padding, new_layout.data_padding); + new_layout.data_padding = padding::max(_node->get_primitive()->get_output_padding(idx), data_padding); + } + + if (_impl_params->get_output_layout(idx) != new_layout) { + GPU_DEBUG_TRACE_DETAIL << id() << ": update shape: was: " << _impl_params->get_output_layout(idx).to_short_string() + << " now: " << new_layout.to_short_string() << std::endl; + set_shape_change(); } + + _impl_params->output_layouts[idx].data_padding = new_layout.data_padding; + _impl_params->output_layouts[idx].set_partial_shape(new_layouts[idx].get_partial_shape()); } // Update descriptors of fused operations and set output_layout's shape to all fused ops