Skip to content

Commit

Permalink
[GPU] Fix output format not changing at runtime
Browse files Browse the repository at this point in the history
Signed-off-by: Andrew Park <[email protected]>
  • Loading branch information
andrew-k-park committed Feb 22, 2023
1 parent 7f3f576 commit d12d61e
Showing 1 changed file with 12 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,18 @@ void remove_redundant_reorders::run(program& p) {
!r_node.get_primitive()->has_surface_input();

if (remove_dep) {
// for chains like
// b_fs_yx_fsv16 -> reorder(ofmt:bfyx) -> bfyx -> reorder(ofmt:any) -> bfyx
// if output_format of current node is format::any, input format of the dependency node is propagated as it is
// b_fs_yx_fsv16 -> reorder(ofmt:any) -> b_fs_yx_fsv16
// so output format of dependency node must be stored in output_format of current node
// b_fs_yx_fsv16 -> reorder(ofmt:bfyx) -> bfyx
auto output_layout = r_dep_node.get_output_layout();
auto prim = std::const_pointer_cast<reorder>(r_node.get_primitive());
if (prim->output_format == format::any)
prim->output_format = output_layout.format;

LOG_NODE_REMOVAL(r_dep_node.id());
r_dep_node.can_be_optimized(true);
p.add_optimized_primitive_info(r_dep_node.id());
p.extract_and_remove(r_dep_node);
Expand Down

0 comments on commit d12d61e

Please sign in to comment.