Skip to content

Commit

Permalink
[GPU] Fix the issue missing data padding info in update_shape (openvi…
Browse files Browse the repository at this point in the history
…notoolkit#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*
  • Loading branch information
ahnyoung-paul authored Aug 29, 2024
1 parent 55723af commit 46d1a4d
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions src/plugins/intel_gpu/src/graph/primitive_inst.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<reshape>() || (!_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
Expand Down

0 comments on commit 46d1a4d

Please sign in to comment.