[GPU] program_helpers::are_layouts_identical fix (#10109)

This commit is contained in:
Roman Lyamin authored and GitHub committed 2022-02-09 09:27:15 +03:00
1 parent 8f0e974ee6
commit 0d64afc2c8
1 file changed
+7 -6
@@ -121,12 +121,6 @@ std::pair<bool, bool> program_helpers::are_layouts_identical(layout const& l1, l
auto offset_last_element_l2 = l2.get_linear_offset(l2.size - tensor{1});
if (l1 == l2)
return {true, true};
// If data is actually 1d along f and dense, the layouts are identical
if (l1.data_type == l2.data_type && l1.size == l2.size && !l1_pad && !l2_pad && l1.size.batch[0] == 1 &&
((l1.format.spatial_num() == 2 && l1.size.spatial[0] == 1 && l1.size.spatial[1] == 1) ||
((l1.format.spatial_num() == 3 && l1.size.spatial[0] == 1 && l1.size.spatial[1] == 1 && l1.size.spatial[2] == 1))) &&
(offset_last_element_l1 + 1 == l1.size.feature[0] && offset_last_element_l2 + 1 == l2.size.feature[0]))
return {false, true};
if (l1.data_type != l2.data_type)
return {false, false};
// Reorders between bfyx, bfzyx, bfwzyx can pe reinterpeted as reshape when
@@ -160,6 +154,13 @@ std::pair<bool, bool> program_helpers::are_layouts_identical(layout const& l1, l
check_format(format::bs_fs_zyx_bsv16_fsv16))
return {false, false};
// If data is actually 1d along f and dense, the layouts are identical
if (l1.data_type == l2.data_type && l1.size == l2.size && !l1_pad && !l2_pad && l1.size.batch[0] == 1 &&
((l1.format.spatial_num() == 2 && l1.size.spatial[0] == 1 && l1.size.spatial[1] == 1) ||
((l1.format.spatial_num() == 3 && l1.size.spatial[0] == 1 && l1.size.spatial[1] == 1 && l1.size.spatial[2] == 1))) &&
(offset_last_element_l1 + 1 == l1.size.feature[0] && offset_last_element_l2 + 1 == l2.size.feature[0]))
return {false, true};
auto l1_pitch = l1.get_pitches();
auto l2_pitch = l2.get_pitches();