From dbdaaa93ddce2d47e77ea77929c42c33ef3de38c Mon Sep 17 00:00:00 2001 From: Vladimir Paramuzov Date: Tue, 2 Jun 2020 09:17:39 +0300 Subject: [PATCH] [IE CLDNN] Quantized deeplabv3 optimizations (#646) Enabled dilation for imad dw fsv16 kernel Added argmax and mutable_data to fsv16 white list Enabled byxf input for quantize scale_shift kernel --- .../convolution_kernel_b_fs_yx_fsv_16_32_imad_dw.cpp | 1 + .../quantize/quantize_kernel_scale_shift_opt.cpp | 1 + inference-engine/thirdparty/clDNN/src/layout_optimizer.cpp | 3 +-- inference-engine/thirdparty/clDNN/src/program.cpp | 5 ++++- .../clDNN/tests/test_cases/convolution_gpu_test.cpp | 6 +++++- 5 files changed, 12 insertions(+), 4 deletions(-) diff --git a/inference-engine/thirdparty/clDNN/kernel_selector/core/actual_kernels/convolution/convolution_kernel_b_fs_yx_fsv_16_32_imad_dw.cpp b/inference-engine/thirdparty/clDNN/kernel_selector/core/actual_kernels/convolution/convolution_kernel_b_fs_yx_fsv_16_32_imad_dw.cpp index d15c965eda7..92e1aa54ba6 100644 --- a/inference-engine/thirdparty/clDNN/kernel_selector/core/actual_kernels/convolution/convolution_kernel_b_fs_yx_fsv_16_32_imad_dw.cpp +++ b/inference-engine/thirdparty/clDNN/kernel_selector/core/actual_kernels/convolution/convolution_kernel_b_fs_yx_fsv_16_32_imad_dw.cpp @@ -66,6 +66,7 @@ ParamsKey kernel_selector::ConvolutionKernel_b_fs_yx_fsv_16_32_imad_dw::GetSuppo k.EnableQuantization(QuantizationType::ASYMMETRIC_DATA_AND_WEIGHTS); k.EnableDepthwiseSeparableOpt(); k.EnableGroupedConvolution(); + k.EnableDilation(); return k; } diff --git a/inference-engine/thirdparty/clDNN/kernel_selector/core/actual_kernels/quantize/quantize_kernel_scale_shift_opt.cpp b/inference-engine/thirdparty/clDNN/kernel_selector/core/actual_kernels/quantize/quantize_kernel_scale_shift_opt.cpp index 679d663eced..ad81b320a7a 100644 --- a/inference-engine/thirdparty/clDNN/kernel_selector/core/actual_kernels/quantize/quantize_kernel_scale_shift_opt.cpp +++ b/inference-engine/thirdparty/clDNN/kernel_selector/core/actual_kernels/quantize/quantize_kernel_scale_shift_opt.cpp @@ -33,6 +33,7 @@ ParamsKey QuantizeKernelScaleShift::GetSupportedKey() const { k.EnableOutputDataType(Datatype::INT8); k.EnableInputLayout(DataLayout::bfyx); k.EnableInputLayout(DataLayout::yxfb); + k.EnableInputLayout(DataLayout::byxf); k.EnableInputLayout(DataLayout::bfzyx); k.EnableInputLayout(DataLayout::b_fs_yx_fsv16); k.EnableInputLayout(DataLayout::b_fs_zyx_fsv16); diff --git a/inference-engine/thirdparty/clDNN/src/layout_optimizer.cpp b/inference-engine/thirdparty/clDNN/src/layout_optimizer.cpp index afbd8466036..10d13899592 100644 --- a/inference-engine/thirdparty/clDNN/src/layout_optimizer.cpp +++ b/inference-engine/thirdparty/clDNN/src/layout_optimizer.cpp @@ -367,8 +367,7 @@ bool layout_optimizer::convolution_b_fs_yx_fsv16_opt(layout const &input_layout, weights_layout.size.batch[0] >= 16 && ((conv->groups == 1 && conv->split() == 1) || conv->groups == static_cast(input_layout.size.feature[0]) || - conv->split() == static_cast(input_layout.size.feature[0])) && - conv->dilation == tensor{ 1 }) + conv->split() == static_cast(input_layout.size.feature[0]))) return true; // Check for grouped convolution else if (input_layout.size.spatial[2] == 1 && input_layout.size.batch[0] < 16 && diff --git a/inference-engine/thirdparty/clDNN/src/program.cpp b/inference-engine/thirdparty/clDNN/src/program.cpp index 2359e928ed1..14dedbe7c06 100644 --- a/inference-engine/thirdparty/clDNN/src/program.cpp +++ b/inference-engine/thirdparty/clDNN/src/program.cpp @@ -46,6 +46,7 @@ #include "deconvolution_inst.h" #include "detection_output_inst.h" #include "input_layout_inst.h" +#include "arg_max_min_inst.h" #include "lstm_inst.h" #include "lstm_elt_inst.h" #include "lstm_gemm_inst.h" @@ -1130,7 +1131,9 @@ void program_impl::set_layout_optimizer_attributes(layout_optimizer& lo) { (prim.type() != cldnn::mvn::type_id() || (prim.as().input().get_output_layout().data_type != data_types::u8 && prim.as().input().get_output_layout().data_type != data_types::i8) - || prim.as().get_primitive()->across_channels)) + || prim.as().get_primitive()->across_channels) && + prim.type() != cldnn::arg_max_min::type_id() && + 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. diff --git a/inference-engine/thirdparty/clDNN/tests/test_cases/convolution_gpu_test.cpp b/inference-engine/thirdparty/clDNN/tests/test_cases/convolution_gpu_test.cpp index 8cbbe45b7ef..734e65d6fe6 100644 --- a/inference-engine/thirdparty/clDNN/tests/test_cases/convolution_gpu_test.cpp +++ b/inference-engine/thirdparty/clDNN/tests/test_cases/convolution_gpu_test.cpp @@ -4746,7 +4746,6 @@ protected: build_options opts; opts.set_option(build_option::optimize_data(false)); - opts.set_option(build_option::graph_dumps_dir("/tmp/cldnn_dumps/")); topology topology(input_layout("input", input.get_layout()), data("weights", weights), @@ -8214,6 +8213,11 @@ struct params_generator : std::vector { b, 32, 24, { 19, 19 }, { 3, 3 }, { 1, 1 }, { -1, -1 }, { 2, 2 }, true, 1, input_format, asymm_weights, asymm_data, padded_input }); push_back(convolution_random_test_all_params{ b, 32, 24, { 19, 19 }, { 3, 3 }, { 2, 2 }, { -1, -1 }, { 2, 2 }, true, 1, input_format, asymm_weights, asymm_data, padded_input }); + // depthwise + dilation + push_back(convolution_random_test_all_params{ + b, 64, 64, { 19, 19 }, { 3, 3 }, { 1, 1 }, { -1, -1 }, { 2, 2 }, true, 64, input_format, asymm_weights, asymm_data, padded_input }); + push_back(convolution_random_test_all_params{ + b, 64, 64, { 19, 19 }, { 3, 3 }, { 2, 2 }, { -1, -1 }, { 2, 2 }, true, 64, input_format, asymm_weights, asymm_data, padded_input }); } return *this; }