2 // Copyright (c) 2018 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 "convolution_kernel_bfyx_depthwise_weights_lwg.h"
19 namespace kernel_selector
21 ParamsKey ConvolutionKernel_bfyx_depthwise_weights_lwg::GetSupportedKey() const
24 k.EnableInputDataType(Datatype::F32);
25 k.EnableInputDataType(Datatype::F16);
26 k.EnableInputWeightsType(WeightsType::F16);
27 k.EnableInputWeightsType(WeightsType::F32);
28 k.EnableOutputDataType(Datatype::F32);
29 k.EnableOutputDataType(Datatype::F16);
30 k.EnableInputLayout(DataLayout::bfyx);
31 k.EnableOutputLayout(DataLayout::bfyx);
32 k.EnableTensorOffset();
33 k.EnableTensorPitches();
34 k.EnableBiasPerFeature();
35 k.EnableNonBiasTerm();
37 k.EnableSplitSupport();
39 k.EnableSubGroupShort();
40 k.EnableDepthwiseSeparableOpt();
45 bool ConvolutionKernel_bfyx_depthwise_weights_lwg::Validate(const Params& p, const optional_params& o) const
47 if (!ConvolutionKernelBase::Validate(p, o) ||
48 !CovolutionCheckInput(p, o))
53 const convolution_params& cp = static_cast<const convolution_params&>(p);
54 if (!cp.depthwise_separable_opt)
56 if ((cp.filterSize.x > 4) ||
57 (cp.filterSize.y > 4) ||
58 ((cp.inputs[0].Feature().v != cp.split) && (cp.inputs[0].Feature().v != cp.groups)))
66 ConvolutionKernelBase::DispatchData ConvolutionKernel_bfyx_depthwise_weights_lwg::SetDefault(const convolution_params& params, int) const
68 DispatchData runInfo = Parent::SetDefault(params);
69 const auto& out = params.output;
71 std::vector<size_t> global = { out.X().v * out.Y().v, out.Feature().v, out.Batch().v };
73 runInfo.gws0 = Align(global[0], 16);
74 runInfo.gws1 = global[1];
75 runInfo.gws2 = global[2];
80 runInfo.effiency = FORCE_PRIORITY_6;
85 JitConstants ConvolutionKernel_bfyx_depthwise_weights_lwg::GetJitConstants(const convolution_params& params, const DispatchData& kd) const
87 auto mem_consts = ConvolutionKernelBase::GetJitConstants(params, kd);
89 if(params.padding.x != 0 || params.padding.y != 0)
90 mem_consts.AddConstant(MakeJitConstant("BOUNDARY_CHECK", 1));
95 KernelsData ConvolutionKernel_bfyx_depthwise_weights_lwg::GetKernelsData(const Params& params, const optional_params& options) const
97 return GetTunedKernelsDataByIndex(params, options);