[IE CLDNN] Grouped convolution bug fix (#572)
authorMikołaj Życzyński <mikolaj.zyczynski@intel.com>
Wed, 27 May 2020 18:19:49 +0000 (20:19 +0200)
committerGitHub <noreply@github.com>
Wed, 27 May 2020 18:19:49 +0000 (21:19 +0300)
Fixes bug in grouped convolution connected with wrong weights layout in SetDefault() method

inference-engine/thirdparty/clDNN/kernel_selector/core/actual_kernels/convolution/convolution_kernel_base.cpp
inference-engine/thirdparty/clDNN/tests/test_cases/convolution_gpu_test.cpp

index b15ad49..7e16097 100644 (file)
@@ -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<convolution_params>(params);
+    convolution_params& newParams = *static_cast<convolution_params*>(kd.params.get());
+
+    bool succeed = UpdateWeightsParams(newParams,
+                                       options,
+                                       GetPreferredWeightsLayout(newParams),
+                                       kd.weightsReorderParams,
+                                       GetSupportedKey(),
+                                       newParams.groups,
+                                       newParams.transposed);
+
+    if (!succeed) {
         return {};
     }
 
-    KernelData kd = KernelData::Default<convolution_params>(params);
-    convolution_params& newParams = *static_cast<convolution_params*>(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);
index 1098cec..8cbbe45 100644 (file)
@@ -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),