From e73437759067cc9f40213e07f73d2e375750268f Mon Sep 17 00:00:00 2001 From: =?utf8?q?Miko=C5=82aj=20=C5=BByczy=C5=84ski?= Date: Wed, 27 May 2020 20:19:49 +0200 Subject: [PATCH] [IE CLDNN] Grouped convolution bug fix (#572) Fixes bug in grouped convolution connected with wrong weights layout in SetDefault() method --- .../convolution/convolution_kernel_base.cpp | 30 +++++++++++----------- .../tests/test_cases/convolution_gpu_test.cpp | 6 +++-- 2 files changed, 19 insertions(+), 17 deletions(-) diff --git a/inference-engine/thirdparty/clDNN/kernel_selector/core/actual_kernels/convolution/convolution_kernel_base.cpp b/inference-engine/thirdparty/clDNN/kernel_selector/core/actual_kernels/convolution/convolution_kernel_base.cpp index b15ad49..7e16097 100644 --- a/inference-engine/thirdparty/clDNN/kernel_selector/core/actual_kernels/convolution/convolution_kernel_base.cpp +++ b/inference-engine/thirdparty/clDNN/kernel_selector/core/actual_kernels/convolution/convolution_kernel_base.cpp @@ -207,12 +207,24 @@ KernelsData ConvolutionKernelBase::GetCommonKernelsData(const Params& params, const optional_params& options, const std::string exeMode, int autoTuneIndex) const { - if (!Validate(params, options)) { + KernelData kd = KernelData::Default(params); + convolution_params& newParams = *static_cast(kd.params.get()); + + bool succeed = UpdateWeightsParams(newParams, + options, + GetPreferredWeightsLayout(newParams), + kd.weightsReorderParams, + GetSupportedKey(), + newParams.groups, + newParams.transposed); + + if (!succeed) { return {}; } - KernelData kd = KernelData::Default(params); - convolution_params& newParams = *static_cast(kd.params.get()); + if (!Validate(params, options)) { + return {}; + } if (NeedPaddedInput()) { kd.reorderInput = CovolutionUpdateInputParams(newParams); @@ -227,18 +239,6 @@ KernelsData ConvolutionKernelBase::GetCommonKernelsData(const Params& params, return {}; } - bool succeed = UpdateWeightsParams(newParams, - options, - GetPreferredWeightsLayout(newParams), - kd.weightsReorderParams, - GetSupportedKey(), - newParams.groups, - newParams.transposed); - - if (!succeed) { - return {}; - } - auto finalKernelName = GetKernelName(newParams); auto cldnnJit = GetJitConstants(newParams, runInfo); auto entryPoint = GetEntryPoint(finalKernelName, newParams.layerID, options); 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 1098cec..8cbbe45 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 @@ -7637,9 +7637,10 @@ INSTANTIATE_TEST_CASE_P(convolution_depthwise_gpu_bfyx, INSTANTIATE_TEST_CASE_P(convolution_grouped_fsv4_fsv16, convolution_grouped_gpu, ::testing::Values( - // Input X size, Input Y size, Input features, Output features, Kernel size X, Kernel size - // Y, Groups number, Stride, Output padding, Batch, Input data format + // Input X size, Input Y size, Input features, Output features, Kernel size X, Kernel size Y, + // Groups number, Stride, Output padding, Batch, Input data format // Format: b_fs_yx_fsv4 + TestParamType_grouped_convolution_gpu(4, 4, 16, 17, 3, 3, 1, 1, 1, format::b_fs_yx_fsv4), TestParamType_grouped_convolution_gpu(4, 4, 16, 16, 3, 3, 4, 1, 1, format::b_fs_yx_fsv4), TestParamType_grouped_convolution_gpu(4, 4, 8, 4, 2, 2, 2, 1, 4, format::b_fs_yx_fsv4), TestParamType_grouped_convolution_gpu(8, 8, 16, 16, 4, 4, 4, 1, 1, format::b_fs_yx_fsv4), @@ -7648,6 +7649,7 @@ INSTANTIATE_TEST_CASE_P(convolution_grouped_fsv4_fsv16, TestParamType_grouped_convolution_gpu(3, 3, 48, 96, 2, 2, 2, 8, 1, format::b_fs_yx_fsv4), TestParamType_grouped_convolution_gpu(6, 6, 8, 26, 3, 3, 2, 4, 1, format::b_fs_yx_fsv4), // Format: b_fs_yx_fsv16 + TestParamType_grouped_convolution_gpu(4, 4, 16, 17, 3, 3, 1, 1, 1, format::b_fs_yx_fsv16), TestParamType_grouped_convolution_gpu(4, 4, 16, 16, 3, 3, 4, 1, 1, format::b_fs_yx_fsv16), TestParamType_grouped_convolution_gpu(4, 4, 8, 4, 2, 2, 2, 1, 4, format::b_fs_yx_fsv16), TestParamType_grouped_convolution_gpu(8, 8, 16, 16, 4, 4, 4, 1, 1, format::b_fs_yx_fsv16), -- 2.7.4