Publishing 2019 R1 content
[platform/upstream/dldt.git] / inference-engine / thirdparty / clDNN / kernel_selector / core / actual_kernels / fused_conv_bn_scale / fused_conv_bn_scale_kernel_ref.cpp
1 /*
2 // Copyright (c) 2018 Intel Corporation
3 //
4 // Licensed under the Apache License, Version 2.0 (the "License");
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
7 //
8 //      http://www.apache.org/licenses/LICENSE-2.0
9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 */
16
17 #include "fused_conv_bn_scale_kernel_ref.h"
18 #include "kernel_selector_utils.h"
19
20 namespace kernel_selector {
21     
22     ParamsKey fused_conv_bn_scale_kernel_ref::GetSupportedKey() const
23     {
24         ParamsKey k;
25         k.EnableInputDataType(Datatype::F32);
26         k.EnableOutputDataType(Datatype::F32);
27         k.EnableInputWeightsType(WeightsType::F32);
28         k.EnableInputLayout(DataLayout::bfyx);
29         k.EnableOutputLayout(DataLayout::bfyx);
30         k.EnableTensorOffset();
31         k.EnableTensorPitches();
32         k.EnableBiasPerFeature();
33         k.EnableNonBiasTerm();
34         k.EnableSplitSupport();
35         k.EnableBatching();
36         k.DisableTuning();
37         return k;
38     }
39
40     fused_conv_bn_scale_kernel_base::DispatchData fused_conv_bn_scale_kernel_ref::SetDefault(const fused_conv_bn_scale_params& arg) const
41     {
42         DispatchData runInfo = fused_conv_bn_scale_kernel_base::SetDefault(arg);
43
44         runInfo.effiency = DONT_USE_IF_HAVE_SOMETHING_ELSE;
45
46         runInfo.gws0 = arg.output.Batch().v;
47         runInfo.gws1 = arg.output.Feature().v; 
48         runInfo.gws2 = 1;
49
50         runInfo.lws0 = std::min(std::max(runInfo.gws0, static_cast<size_t>(1)), static_cast<size_t>(32));
51         while (runInfo.gws0 % runInfo.lws0 != 0)
52         {
53             --runInfo.lws0;
54         }
55         runInfo.lws1 = 1;
56         runInfo.lws2 = 1;
57
58         return runInfo;
59     }
60
61     JitConstants fused_conv_bn_scale_kernel_ref::GetJitConstants(const fused_conv_bn_scale_params& params, const DispatchData& runInfo) const
62     {
63         auto jit = Parent::GetJitConstants(params, runInfo);
64
65         return jit;
66     }
67
68     KernelsData fused_conv_bn_scale_kernel_ref::GetKernelsData(const Params& params, const optional_params& options) const
69     {
70         KernelsData kd = GetCommonKernelsData(params, options, DONT_USE_IF_HAVE_SOMETHING_ELSE);
71  
72         return kd;
73     }
74 }