blob: b7daa4d583ac8125761f3bfca186469a7fce6acb [file] [log] [blame]
Giorgio Arena5ae8d802021-11-18 18:02:13 +00001/*
Matthew Benthamf1aeab92023-05-30 13:35:34 +00002 * Copyright (c) 2021-2023 Arm Limited.
Giorgio Arena5ae8d802021-11-18 18:02:13 +00003 *
4 * SPDX-License-Identifier: MIT
5 *
6 * Permission is hereby granted, free of charge, to any person obtaining a copy
7 * of this software and associated documentation files (the "Software"), to
8 * deal in the Software without restriction, including without limitation the
9 * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
10 * sell copies of the Software, and to permit persons to whom the Software is
11 * furnished to do so, subject to the following conditions:
12 *
13 * The above copyright notice and this permission notice shall be included in all
14 * copies or substantial portions of the Software.
15 *
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 * SOFTWARE.
23 */
24#ifndef ARM_COMPUTE_CPU_KERNEL_SELECTION_TYPES_H
25#define ARM_COMPUTE_CPU_KERNEL_SELECTION_TYPES_H
26
27#include "arm_compute/core/Types.h"
Felix Thomasmathibalanafd38f02023-09-27 17:46:17 +010028
Giorgio Arena5ae8d802021-11-18 18:02:13 +000029#include "src/common/cpuinfo/CpuIsaInfo.h"
30
31namespace arm_compute
32{
33namespace cpu
34{
35namespace kernels
36{
37// Selector data types
38struct DataTypeISASelectorData
39{
Giorgio Arenad56d94d2022-02-07 16:19:55 +000040 DataType dt;
41 cpuinfo::CpuIsaInfo isa;
Giorgio Arena5ae8d802021-11-18 18:02:13 +000042};
43
alerah01c9e519d2022-01-31 19:04:10 +020044struct DataTypeDataLayoutISASelectorData
45{
46 DataType dt;
47 DataLayout dl;
48 const cpuinfo::CpuIsaInfo &isa;
49};
50
Yair Schwarzbaum298b2c02022-02-01 08:55:56 +020051struct CastDataTypeISASelectorData
52{
53 DataType src_dt;
54 DataType dst_dt;
55 const cpuinfo::CpuIsaInfo &isa;
56};
57
Giorgio Arena5ae8d802021-11-18 18:02:13 +000058struct PoolDataTypeISASelectorData
59{
Giorgio Arenad56d94d2022-02-07 16:19:55 +000060 DataType dt;
61 DataLayout dl;
62 int pool_stride_x;
63 Size2D pool_size;
64 cpuinfo::CpuIsaInfo isa;
Giorgio Arena5ae8d802021-11-18 18:02:13 +000065};
66
Dana Zlotnik6a2df882022-01-17 09:54:26 +020067struct ElementwiseDataTypeISASelectorData
68{
69 DataType dt;
70 cpuinfo::CpuIsaInfo isa;
71 int op;
72};
Dana Zlotnikebbae942022-02-03 12:52:15 +020073struct DepthwiseConv2dNativeDataTypeISASelectorData
74{
75 DataType weights_dt;
76 DataType source_dt;
77 const cpuinfo::CpuIsaInfo &isa;
78};
Pablo Marquez Tellod75cd8a2022-05-26 14:19:39 +010079
80struct ActivationDataTypeISASelectorData
81{
Felix Thomasmathibalanafd38f02023-09-27 17:46:17 +010082 DataType dt;
83 const CPUModel &cpumodel;
84 const cpuinfo::CpuIsaInfo &isa;
85 const ActivationFunction f;
Pablo Marquez Tellod75cd8a2022-05-26 14:19:39 +010086};
87
Gunes Bayir9b921be2022-07-28 17:44:00 +010088struct CpuAddKernelDataTypeISASelectorData
89{
90 DataType dt;
91 cpuinfo::CpuIsaInfo isa;
Viet-Hoa Do40b44192022-09-22 10:24:23 +010092 bool can_use_fixedpoint;
Gunes Bayir9b921be2022-07-28 17:44:00 +010093};
94
Gunes Bayir53929b12022-08-11 12:15:39 +010095struct ScaleKernelDataTypeISASelectorData
96{
97 DataType dt;
98 cpuinfo::CpuIsaInfo isa;
99 InterpolationPolicy interpolation_policy;
100};
101
Giorgio Arena5ae8d802021-11-18 18:02:13 +0000102// Selector pointer types
Felix Thomasmathibalanafd38f02023-09-27 17:46:17 +0100103using DataTypeISASelectorPtr = std::add_pointer<bool(const DataTypeISASelectorData &data)>::type;
104using DataTypeDataLayoutSelectorPtr = std::add_pointer<bool(const DataTypeDataLayoutISASelectorData &data)>::type;
105using PoolDataTypeISASelectorPtr = std::add_pointer<bool(const PoolDataTypeISASelectorData &data)>::type;
106using ElementwiseDataTypeISASelectorPtr = std::add_pointer<bool(const ElementwiseDataTypeISASelectorData &data)>::type;
107using DepthwiseConv2dNativeDataTypeISASelectorPtr =
108 std::add_pointer<bool(const DepthwiseConv2dNativeDataTypeISASelectorData &data)>::type;
109using CastDataTypeISASelectorDataPtr = std::add_pointer<bool(const CastDataTypeISASelectorData &data)>::type;
110using ActivationDataTypeISASelectorDataPtr =
111 std::add_pointer<bool(const ActivationDataTypeISASelectorData &data)>::type;
112using CpuAddKernelDataTypeISASelectorDataPtr =
113 std::add_pointer<bool(const CpuAddKernelDataTypeISASelectorData &data)>::type;
114using ScaleKernelDataTypeISASelectorDataPtr =
115 std::add_pointer<bool(const ScaleKernelDataTypeISASelectorData &data)>::type;
Giorgio Arena5ae8d802021-11-18 18:02:13 +0000116
117} // namespace kernels
118} // namespace cpu
119} // namespace arm_compute
120
Pablo Marquez Tellod75cd8a2022-05-26 14:19:39 +0100121#endif // ARM_COMPUTE_CPU_KERNEL_SELECTION_TYPES_H