Skip to content

Commit fb59806

Browse files
Add condition to check if it is aligned
1 parent 87c4196 commit fb59806

File tree

1 file changed

+17
-7
lines changed

1 file changed

+17
-7
lines changed

src/plugins/intel_gpu/src/graph/graph_optimizer/basic_memory_dependencies.cpp

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -61,13 +61,23 @@ void basic_memory_dependencies::run(program& p) {
6161
}
6262

6363
// onednn concatenation doesn't support non-zero padding which can occur for unaligned feature.
64-
if (node->is_type<concatenation>() && format::is_blocked(node->get_output_layout().format)) {
65-
node->can_share_buffer(false);
66-
for (auto& dep : node->get_dependencies()) {
67-
dep.first->can_share_buffer(false);
68-
for (auto& user : node->get_users()) {
69-
add_memory_dependency(user, dep.first);
70-
add_memory_dependency(user, node);
64+
if (node->is_type<concatenation>()) {
65+
auto is_feature_aligned = [](const cldnn::layout& l) {
66+
if (!format::is_blocked(l.format)) {
67+
return true;
68+
}
69+
const auto bs = format::block_sizes(l.format).begin()->second;
70+
return (bs <= 1) || (l.feature() % bs) == 0;
71+
};
72+
73+
if (node->is_dynamic() || (!node->is_dynamic() && !is_feature_aligned(node->get_output_layout()))) {
74+
node->can_share_buffer(false);
75+
for (auto& dep : node->get_dependencies()) {
76+
dep.first->can_share_buffer(false);
77+
for (auto& user : node->get_users()) {
78+
add_memory_dependency(user, dep.first);
79+
add_memory_dependency(user, node);
80+
}
7181
}
7282
}
7383
}

0 commit comments

Comments
 (0)