Skip to content

Commit

Permalink
[GPU] Disabled adding reorders for runtime weights in reorder_inputs …
Browse files Browse the repository at this point in the history
…pass
  • Loading branch information
Lyamin-Roman committed Jul 30, 2024
1 parent c67dce1 commit 1993a1a
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/plugins/intel_gpu/src/graph/graph_optimizer/reorder_inputs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -545,6 +545,15 @@ const char *dir_msg(direction_e dir) {
return "backward";
}

static bool is_weights_dependency(program_node* predecessor, program_node* successor) {
bool is_weights_dep = false;
if (successor->is_type<convolution>() || successor->is_type<deconvolution>() || successor->is_type<fully_connected>()) {
size_t dep_idx = successor->get_dependency_index(*predecessor);
is_weights_dep = dep_idx == successor->get_primitive()->input_size();
}
return is_weights_dep;
}

// If there is layout mismatch between two layers, add reorder
template <direction_e dir>
void insert_reorders_in_dir(program& p, const std::map<program_node*, format::type>& fmt_map, reorder_factory& rf, layout_optimizer& lo, program_node* node) {
Expand All @@ -558,6 +567,9 @@ void insert_reorders_in_dir(program& p, const std::map<program_node*, format::ty
if (fmt_map.count(next) > 0 && fmt_map.at(next) == fmt)
continue;

if (is_weights_dependency(node, next))
continue;

// We have three (potentially) conflicting information here for format
// node->get_output_layout().format : It is not up-to-date at this moment. It is just the default format (bfyx)
// fmt_map.at(node).format : It is queried with get_preferred_layout. However, it has only output format.
Expand Down Expand Up @@ -609,6 +621,9 @@ void insert_reorders_in_dir<direction_e::backwards>(program& p, const std::map<p
if (fmt_map.count(next.first) > 0 && fmt_map.at(next.first) == fmt)
continue;

if (is_weights_dependency(next.first, node))
continue;

// We have three (potentially) conflicting information here for format
// node->get_output_layout().format : It is not up-to-date at this moment. It is just the default format (bfyx)
// fmt_map.at(node).format : It is queried with get_preferred_layout. However, it has only output format.
Expand Down

0 comments on commit 1993a1a

Please sign in to comment.