Publishing 2019 R1 content
[platform/upstream/dldt.git] / inference-engine / thirdparty / clDNN / kernel_selector / core / actual_kernels / lstm / lstm_gemv_gpu_subgroup1x64_bfyx_hh_SIMD16.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 "lstm_gemv_gpu_subgroup1x64_bfyx_hh_SIMD16.h"
18 #include "kernel_selector_utils.h"
19
20 namespace kernel_selector {
21
22     ParamsKey LSTMGemvKernel_subgroup1x64_bfyx_hh_SIMD16::GetSupportedKey() const
23     {
24         ParamsKey k;
25         k.EnableInputDataType(Datatype::F16);
26         k.EnableOutputDataType(Datatype::F16);
27         k.EnableDifferentTypes();
28         k.EnableInputLayout(DataLayout::bfyx); 
29         k.EnableOutputLayout(DataLayout::bfyx);
30         k.EnableTensorOffset();
31         k.EnableTensorPitches();
32         k.EnableBatching();
33         k.EnableLSTMGEMMBias();
34         k.EnableLSTMGEMMHidden();
35         k.EnableSubGroup();
36         return k;
37     }
38
39     KernelsData LSTMGemvKernel_subgroup1x64_bfyx_hh_SIMD16::GetKernelsData(const Params& params, const optional_params& options) const
40     {
41         KernelsData kernelsData = GetCommonKernelsData(params, options);
42         auto &kernel = kernelsData[0].kernels[0];
43
44         // This kernel is good if 
45         // 1) Batch size is 1
46         // 2) The input size y-x size is 64x1
47         const lstm_gemm_params& orgParams = static_cast<const lstm_gemm_params&>(params);
48         const auto& input = orgParams.inputs[0];
49
50         if (   (input.Batch().v == 1) 
51             && (input.X().v >= 64) 
52             && (input.Y().v == 1)) 
53         {    
54             auto out = orgParams.output;
55
56             kernel.workGroups.global = { 16, out.X().v, out.Batch().v };
57             kernelsData[0].estimatedTime = FORCE_PRIORITY_1;
58         }
59
60         return kernelsData;
61     }
62 }