Skip to content

Commit

Permalink
[GPU] Fix for reorder fusing in fuse_constant_transposes pass
Browse files Browse the repository at this point in the history
  • Loading branch information
Lyamin-Roman committed Oct 23, 2023
1 parent 8d0381b commit 85744de
Showing 1 changed file with 8 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1221,6 +1221,8 @@ void prepare_primitive_fusing::fuse_constant_transposes(program& p) {
return format::find_format(new_order, fmt.block_sizes());
};

std::vector<std::pair<program_node*, program_node*>> to_replace_nodes;

auto& proc_order = p.get_processing_order();
auto itr = proc_order.begin();
while (itr != proc_order.end()) {
Expand Down Expand Up @@ -1285,9 +1287,7 @@ void prepare_primitive_fusing::fuse_constant_transposes(program& p) {

auto new_reorder = std::make_shared<reorder>(next_node->id() + "_reorder_fmt", new_const_node.id(), reorder_layout);
auto& new_reorder_node = p.get_or_create(new_reorder);
p.replace(*next_node, new_reorder_node);
new_reorder_node.recalc_output_layout(false);
itr = std::find(proc_order.begin(), proc_order.end(), &new_reorder_node);
to_replace_nodes.emplace_back(std::make_pair(next_node, &new_reorder_node));
} else {
layout reorder_layout = new_const_node.get_output_layout();
reorder_layout.format = format::bfyx;
Expand All @@ -1299,6 +1299,11 @@ void prepare_primitive_fusing::fuse_constant_transposes(program& p) {
}
}
}

for (auto& nodes : to_replace_nodes) {
p.replace(*nodes.first, *nodes.second);
nodes.second->recalc_output_layout(false);
}
}

void prepare_primitive_fusing::optimize_fused_ops(program& p) {
Expand Down

0 comments on commit 85744de

Please sign in to comment.