2 // Copyright (c) 2019 Intel Corporation
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
8 // http://www.apache.org/licenses/LICENSE-2.0
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.
17 #include "pooling_kernel_gpu_b_fs_yx_fsv4.h"
19 namespace kernel_selector
21 ParamsKey PoolingKerneGPU_b_fs_yx_fsv4::GetSupportedKey() const
24 k.EnableInputDataType(Datatype::INT8);
25 k.EnableInputDataType(Datatype::UINT8);
26 k.EnableOutputDataType(Datatype::INT8);
27 k.EnableOutputDataType(Datatype::UINT8);
28 k.EnableInputLayout(DataLayout::b_fs_yx_fsv4);
29 k.EnableOutputLayout(DataLayout::b_fs_yx_fsv4);
30 k.EnableOutputLayout(DataLayout::bfyx);
31 k.EnableTensorOffset();
32 k.EnableTensorPitches();
34 k.EnablePoolType(PoolType::MAX);
35 k.EnablePoolType(PoolType::AVG);
36 k.EnablePoolRemainder(PoolRemainder::FLOOR);
37 k.EnablePoolRemainder(PoolRemainder::CEIL);
38 k.EnablePoolKernelDividerMode(KernelDividerMode::FIXED);
39 k.EnablePoolKernelDividerMode(KernelDividerMode::DYNAMIC);
40 k.EnablePoolKernelDividerMode(KernelDividerMode::DYNAMIC_WITH_PADDING);
41 k.EnableDifferentTypes();
45 PoolingKernelBase::DispatchData PoolingKerneGPU_b_fs_yx_fsv4::SetDefault(const pooling_params& params) const
47 DispatchData runInfo = PoolingKernelBase::SetDefault(params);
49 runInfo.gws0 = params.output.X().v; // X
50 runInfo.gws1 = params.output.Y().v; // Y
51 // we got b_fs_yx_fsv4 format, we process 4 features per workitem
52 runInfo.gws2 = (params.output.Feature().v * params.output.Batch().v) / 4;
61 JitConstants PoolingKerneGPU_b_fs_yx_fsv4::GetJitConstants(const pooling_params& params, DispatchData kd) const
63 auto jit = PoolingKernelBase::GetJitConstants(params, kd);
65 const size_t in_x_pitch = 4;
66 const size_t in_y_pitch = 4 * params.inputs[0].X().LogicalDimPadded();
67 jit.AddConstant(MakeJitConstant("IN_X_PITCH", in_x_pitch));
68 jit.AddConstant(MakeJitConstant("IN_Y_PITCH", in_y_pitch));
73 KernelsData PoolingKerneGPU_b_fs_yx_fsv4::GetKernelsData(const Params& params, const optional_params& options) const
75 return GetCommonKernelsData(params, options, FORCE_PRIORITY_1);