2 // Copyright (c) 2016 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 "reorder_to_winograd_2x3_kernel.h"
18 #include "kernel_selector_utils.h"
20 namespace kernel_selector
22 ParamsKey ReorderToWinograd2x3Kernel::GetSupportedKey() const
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();
39 JitConstants ReorderToWinograd2x3Kernel::GetJitConstants(const reorder_params& params) const
41 auto jit = ReorderKernelBase::GetJitConstants(params);
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));
49 ReorderToWinograd2x3Kernel::DispatchData ReorderToWinograd2x3Kernel::SetDefault(const reorder_params& params) const
53 const auto& input = params.inputs[0];
54 const auto& output = params.output;
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);
60 kd.lws0 = input.Feature().v > 32 ? 32 : static_cast<size_t>(input.Feature().v);
67 KernelsData ReorderToWinograd2x3Kernel::GetKernelsData(const Params& params, const optional_params& options) const
69 const reorder_params& orgParams = static_cast<const reorder_params&>(params);
70 return GetCommonKernelsData(orgParams, options, FORCE_PRIORITY_6);