Publishing R3
[platform/upstream/dldt.git] / inference-engine / thirdparty / clDNN / kernel_selector / core / actual_kernels / reorder / reorder_to_winograd_2x3_kernel.cpp
1 /*
2 // Copyright (c) 2016 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 "reorder_to_winograd_2x3_kernel.h"
18 #include "kernel_selector_utils.h"
19  
20 namespace kernel_selector 
21 {
22     ParamsKey ReorderToWinograd2x3Kernel::GetSupportedKey() const
23     {
24         ParamsKey k;
25         k.EnableInputDataType(Datatype::F16);
26         k.EnableInputDataType(Datatype::F32);
27         k.EnableOutputDataType(Datatype::F16);
28         k.EnableOutputDataType(Datatype::F32);
29         k.EnableInputLayout(DataLayout::bfyx);
30         k.EnableOutputLayout(DataLayout::winograd_2x3_s1_data);
31         k.EnableWinogradReorder();
32         k.EnableDifferentTypes();
33         k.EnableTensorOffset();
34         k.EnableTensorPitches();
35         k.EnableBatching();
36         return k;
37     }
38
39     JitConstants ReorderToWinograd2x3Kernel::GetJitConstants(const reorder_params& params) const
40     {
41         auto jit = ReorderKernelBase::GetJitConstants(params);
42
43         jit.AddConstant(MakeJitConstant("INPUT0_OFFSET_SIZE_X", params.winograd_input_offset_x));
44         jit.AddConstant(MakeJitConstant("INPUT0_OFFSET_SIZE_Y", params.winograd_input_offset_y));
45
46         return jit;
47     }
48
49     ReorderToWinograd2x3Kernel::DispatchData ReorderToWinograd2x3Kernel::SetDefault(const reorder_params& params) const
50     {
51         DispatchData kd;
52
53         const auto& input = params.inputs[0];
54         const auto& output = params.output;
55
56         kd.gws0 = static_cast<size_t>(input.Feature().v * input.Batch().v);
57         kd.gws1 = static_cast<size_t>(params.winograd_nr_tiles_x);
58         kd.gws2 = static_cast<size_t>(output.Y().v);
59
60         kd.lws0 = input.Feature().v > 32 ? 32 : static_cast<size_t>(input.Feature().v);
61         kd.lws1 = 1;
62         kd.lws2 = 1;
63
64         return kd;
65     }
66
67     KernelsData ReorderToWinograd2x3Kernel::GetKernelsData(const Params& params, const optional_params& options) const
68     {
69         const reorder_params& orgParams = static_cast<const reorder_params&>(params);
70         return GetCommonKernelsData(orgParams, options, FORCE_PRIORITY_6);
71     }
72 }