Skip to content

Commit

Permalink
[GPU] Extend the cases where layouts are compatible
Browse files Browse the repository at this point in the history
  • Loading branch information
Lyamin-Roman committed Dec 18, 2024
1 parent afdb0e6 commit 6a9d6aa
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions src/plugins/intel_gpu/src/runtime/layout.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -446,8 +446,8 @@ bool layout::compatible(const layout& other) const {
if (l1.is_dynamic() || l2.is_dynamic())
return false;

auto l1_size = l1.get_tensor();
auto l2_size = l2.get_tensor();
auto l1_size = l1.get_shape();
auto l2_size = l2.get_shape();
if (l1 == l2)
return true;
if (check_redundant_1d_along_feature(l1, l2))
Expand Down Expand Up @@ -505,6 +505,16 @@ bool layout::compatible(const layout& other) const {
auto l1_pitch = l1.get_pitches();
auto l2_pitch = l2.get_pitches();

// Ignore pitches which will never be used (for dims with size == 1)
for (size_t i = 0; i < l1_size.size(); ++i) {
if (l1_size[i] == 1) {
l1_pitch[i] = 0;
}
if (l2_size[i] == 1) {
l2_pitch[i] = 0;
}
}

auto l1_offset = l1.get_linear_offset();
auto l2_offset = l2.get_linear_offset();
if (l1_pitch == l2_pitch && l1_offset == l2_offset)
Expand Down

0 comments on commit 6a9d6aa

Please sign in to comment.