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.
19 #include "weight_bias_kernel_base.h"
20 #include "fully_connected_params.h"
22 namespace kernel_selector
24 ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
25 // FullyConnectedKernelBase
26 ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
27 class FullyConnectedKernelBase : public WeightBiasKernelBase
30 using WeightBiasKernelBase::WeightBiasKernelBase;
31 virtual ~FullyConnectedKernelBase() {}
33 struct DispatchData : public CommonDispatchData
35 uint32_t unit_byte_size;
36 const char* chunk_type;
37 uint32_t chunk_byte_size;
38 uint32_t units_per_chunk;
39 uint32_t bytes_per_sg_read;
40 uint32_t units_per_sg_read;
41 uint32_t responses_per_sg_exec;
42 uint32_t in_chunk_prefetch_size;
43 uint32_t filter_chunk_prefetch_size;
45 uint32_t last_rg_size;
49 std::string GetAutoTuneOptions(int autoTuneIndex) const;
50 std::vector<std::string> autoTuneOptions = { DEFAULT, NO_PRERA_SCH, AGE_BASED };
51 virtual KernelsData GetTunedKernelsDataByIndex(const Params& params, const optional_params& options, DataLayout dl, std::vector<WeightsLayout> wl, float estimated_time = DONT_USE_IF_HAVE_SOMETHING_ELSE, int autoTuneIndex = -1) const ;
54 virtual JitConstants GetJitConstants(const fully_connected_params& params, const DispatchData& kd) const;
55 virtual DispatchData SetDefault(const fully_connected_params& params, int autoTuneIndex = -1) const;
56 KernelsData GetCommonKernelsData(const Params& params, const optional_params& optParams, DataLayout dl, std::vector<WeightsLayout> wl, float estimated_time = DONT_USE_IF_HAVE_SOMETHING_ELSE, const std::string exeMode = DEFAULT, int autoTuneIndex = -1) const;
58 bool Validate(const Params& p, const optional_params&) const override
60 if (p.GetType() != KernelType::FULLY_CONNECTED)