Publishing 2019 R1 content
[platform/upstream/dldt.git] / inference-engine / thirdparty / clDNN / kernel_selector / core / actual_kernels / reorder / reorder_kernel_byxf_f32_to_byx8_f4_i8.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_kernel_byxf_f32_to_byx8_f4_i8.h"
18 #include "kernel_selector_utils.h"
19  
20 namespace kernel_selector 
21 {
22     ParamsKey reorder_kernel_byxf_f32_to_byx8_f4_i8::GetSupportedKey() const
23     {
24         ParamsKey k;
25         k.EnableInputDataType(Datatype::F32);
26         k.EnableOutputDataType(Datatype::INT8);
27         k.EnableDifferentTypes();
28         k.EnableInputLayout(DataLayout::byxf);
29         k.EnableOutputLayout(DataLayout::byx8_f4);
30         k.EnableTensorOffset();
31         k.EnableTensorPitches();
32         k.EnableBatching();
33         return k;
34     }
35
36     bool reorder_kernel_byxf_f32_to_byx8_f4_i8::Validate(const Params& p, const optional_params& o) const
37     {
38         if (!ReorderKernelBase::Validate(p, o))
39         {
40             return false;
41         }
42
43         const reorder_params& params = static_cast<const reorder_params&>(p);
44
45         if (params.output.X().v % 16 != 0)
46             return false;
47
48         if (params.inputs[0].Feature().v != 3)
49             return false;
50
51         return true;
52     }
53
54     reorder_kernel_byxf_f32_to_byx8_f4_i8::DispatchData reorder_kernel_byxf_f32_to_byx8_f4_i8::SetDefault(const reorder_params& params) const
55     {
56         DispatchData kd;
57
58         const auto& input = params.inputs[0];
59
60         kd.gws0 = input.X().v;
61         kd.gws1 = input.Y().v;
62         kd.gws2 = input.Batch().v;
63
64         kd.lws0 = 16;
65         kd.lws1 = 1;
66         kd.lws2 = 1;
67
68         return kd;
69     }
70
71     JitConstants reorder_kernel_byxf_f32_to_byx8_f4_i8::GetJitConstants(const reorder_params& params) const
72     {
73         auto jit = ReorderKernelBase::GetJitConstants(params);
74         jit.Merge(GetTensorFriendlyWorkGroupsJit(params.inputs[0]));
75         return jit;
76     }
77
78     KernelsData reorder_kernel_byxf_f32_to_byx8_f4_i8::GetKernelsData(const Params& params, const optional_params& options) const
79     {
80         const reorder_params& orgParams = static_cast<const reorder_params&>(params);
81         return GetCommonKernelsData(orgParams, options, FORCE_PRIORITY_5);
82     }
83 }