Skip to content

Commit

Permalink
[IE CLDNN] Adjustment of layouts to choose optimal deconvolution (ope…
Browse files Browse the repository at this point in the history
  • Loading branch information
alex-chaiko authored and Rom committed Aug 28, 2020
1 parent 951a054 commit f032221
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
9 changes: 8 additions & 1 deletion inference-engine/thirdparty/clDNN/src/layout_optimizer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -753,7 +753,14 @@ layout layout_optimizer::get_expected_layout(layout const& current_layout,
} else if (_optimization_attributes.b_fs_yx_fsv16_network &&
deconvolution_b_fs_yx_fsv16_opt(current_layout, output_or_weights_layout, prim)) {
expected_tensor = current_layout.size;
expected_format = cldnn::format::b_fs_yx_fsv16;
auto input_tensor = node.get_dependency(0).get_output_layout().size;
int input_features = input_tensor.feature[0];
int output_features = expected_tensor.feature[0];
float r = float(input_features * output_features) / (align_to(input_features, 16) * align_to(output_features, 16));
if (r > 0.5f)
expected_format = cldnn::format::b_fs_yx_fsv16;
else
expected_format = cldnn::format::bfyx;
}
return layout(expected_data_type, expected_format, expected_tensor);
}
Expand Down
7 changes: 4 additions & 3 deletions inference-engine/thirdparty/clDNN/src/program.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1164,11 +1164,12 @@ void program_impl::set_layout_optimizer_attributes(layout_optimizer& lo) {
prim.type() != cldnn::mutable_data::type_id())
can_use_fsv16 = false;

// WA to keep bfyx_f16 layout disabled for some topologies where it leads to regressions.
// Detects if given crop layer is located in the very beginning of the graph.
// WA to keep fsv16 layout disabled for some topologies where it leads to regressions.
// For reshape bfy*x is preferred, as fsv16 introduces extra reorders
if (prim.type() == cldnn::crop::type_id()) {
if (!prim.get_dependencies()[0]->is_type<reorder>() || !prim.get_dependencies()[0]->get_dependencies()[0]->is_input())
if (prim.get_dependencies()[0]->is_type<reshape>() || prim.get_dependencies()[0]->is_type<concatenation>()) {
can_use_fsv16 = false;
}
}

if (prim.is_in_data_flow() &&
Expand Down

0 comments on commit f032221

Please sign in to comment.