Giorgio Arena | 5ae8d80 | 2021-11-18 18:02:13 +0000 | [diff] [blame] | 1 | /* |
Matthew Bentham | f1aeab9 | 2023-05-30 13:35:34 +0000 | [diff] [blame] | 2 | * Copyright (c) 2021-2023 Arm Limited. |
Giorgio Arena | 5ae8d80 | 2021-11-18 18:02:13 +0000 | [diff] [blame] | 3 | * |
| 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 Thomasmathibalan | afd38f0 | 2023-09-27 17:46:17 +0100 | [diff] [blame] | 28 | |
Giorgio Arena | 5ae8d80 | 2021-11-18 18:02:13 +0000 | [diff] [blame] | 29 | #include "src/common/cpuinfo/CpuIsaInfo.h" |
| 30 | |
| 31 | namespace arm_compute |
| 32 | { |
| 33 | namespace cpu |
| 34 | { |
| 35 | namespace kernels |
| 36 | { |
| 37 | // Selector data types |
| 38 | struct DataTypeISASelectorData |
| 39 | { |
Giorgio Arena | d56d94d | 2022-02-07 16:19:55 +0000 | [diff] [blame] | 40 | DataType dt; |
| 41 | cpuinfo::CpuIsaInfo isa; |
Giorgio Arena | 5ae8d80 | 2021-11-18 18:02:13 +0000 | [diff] [blame] | 42 | }; |
| 43 | |
alerah01 | c9e519d | 2022-01-31 19:04:10 +0200 | [diff] [blame] | 44 | struct DataTypeDataLayoutISASelectorData |
| 45 | { |
| 46 | DataType dt; |
| 47 | DataLayout dl; |
| 48 | const cpuinfo::CpuIsaInfo &isa; |
| 49 | }; |
| 50 | |
Yair Schwarzbaum | 298b2c0 | 2022-02-01 08:55:56 +0200 | [diff] [blame] | 51 | struct CastDataTypeISASelectorData |
| 52 | { |
| 53 | DataType src_dt; |
| 54 | DataType dst_dt; |
| 55 | const cpuinfo::CpuIsaInfo &isa; |
| 56 | }; |
| 57 | |
Giorgio Arena | 5ae8d80 | 2021-11-18 18:02:13 +0000 | [diff] [blame] | 58 | struct PoolDataTypeISASelectorData |
| 59 | { |
Giorgio Arena | d56d94d | 2022-02-07 16:19:55 +0000 | [diff] [blame] | 60 | DataType dt; |
| 61 | DataLayout dl; |
| 62 | int pool_stride_x; |
| 63 | Size2D pool_size; |
| 64 | cpuinfo::CpuIsaInfo isa; |
Giorgio Arena | 5ae8d80 | 2021-11-18 18:02:13 +0000 | [diff] [blame] | 65 | }; |
| 66 | |
Dana Zlotnik | 6a2df88 | 2022-01-17 09:54:26 +0200 | [diff] [blame] | 67 | struct ElementwiseDataTypeISASelectorData |
| 68 | { |
| 69 | DataType dt; |
| 70 | cpuinfo::CpuIsaInfo isa; |
| 71 | int op; |
| 72 | }; |
Dana Zlotnik | ebbae94 | 2022-02-03 12:52:15 +0200 | [diff] [blame] | 73 | struct DepthwiseConv2dNativeDataTypeISASelectorData |
| 74 | { |
| 75 | DataType weights_dt; |
| 76 | DataType source_dt; |
| 77 | const cpuinfo::CpuIsaInfo &isa; |
| 78 | }; |
Pablo Marquez Tello | d75cd8a | 2022-05-26 14:19:39 +0100 | [diff] [blame] | 79 | |
| 80 | struct ActivationDataTypeISASelectorData |
| 81 | { |
Felix Thomasmathibalan | afd38f0 | 2023-09-27 17:46:17 +0100 | [diff] [blame] | 82 | DataType dt; |
| 83 | const CPUModel &cpumodel; |
| 84 | const cpuinfo::CpuIsaInfo &isa; |
| 85 | const ActivationFunction f; |
Pablo Marquez Tello | d75cd8a | 2022-05-26 14:19:39 +0100 | [diff] [blame] | 86 | }; |
| 87 | |
Gunes Bayir | 9b921be | 2022-07-28 17:44:00 +0100 | [diff] [blame] | 88 | struct CpuAddKernelDataTypeISASelectorData |
| 89 | { |
| 90 | DataType dt; |
| 91 | cpuinfo::CpuIsaInfo isa; |
Viet-Hoa Do | 40b4419 | 2022-09-22 10:24:23 +0100 | [diff] [blame] | 92 | bool can_use_fixedpoint; |
Gunes Bayir | 9b921be | 2022-07-28 17:44:00 +0100 | [diff] [blame] | 93 | }; |
| 94 | |
Gunes Bayir | 53929b1 | 2022-08-11 12:15:39 +0100 | [diff] [blame] | 95 | struct ScaleKernelDataTypeISASelectorData |
| 96 | { |
| 97 | DataType dt; |
| 98 | cpuinfo::CpuIsaInfo isa; |
| 99 | InterpolationPolicy interpolation_policy; |
| 100 | }; |
| 101 | |
Giorgio Arena | 5ae8d80 | 2021-11-18 18:02:13 +0000 | [diff] [blame] | 102 | // Selector pointer types |
Felix Thomasmathibalan | afd38f0 | 2023-09-27 17:46:17 +0100 | [diff] [blame] | 103 | using DataTypeISASelectorPtr = std::add_pointer<bool(const DataTypeISASelectorData &data)>::type; |
| 104 | using DataTypeDataLayoutSelectorPtr = std::add_pointer<bool(const DataTypeDataLayoutISASelectorData &data)>::type; |
| 105 | using PoolDataTypeISASelectorPtr = std::add_pointer<bool(const PoolDataTypeISASelectorData &data)>::type; |
| 106 | using ElementwiseDataTypeISASelectorPtr = std::add_pointer<bool(const ElementwiseDataTypeISASelectorData &data)>::type; |
| 107 | using DepthwiseConv2dNativeDataTypeISASelectorPtr = |
| 108 | std::add_pointer<bool(const DepthwiseConv2dNativeDataTypeISASelectorData &data)>::type; |
| 109 | using CastDataTypeISASelectorDataPtr = std::add_pointer<bool(const CastDataTypeISASelectorData &data)>::type; |
| 110 | using ActivationDataTypeISASelectorDataPtr = |
| 111 | std::add_pointer<bool(const ActivationDataTypeISASelectorData &data)>::type; |
| 112 | using CpuAddKernelDataTypeISASelectorDataPtr = |
| 113 | std::add_pointer<bool(const CpuAddKernelDataTypeISASelectorData &data)>::type; |
| 114 | using ScaleKernelDataTypeISASelectorDataPtr = |
| 115 | std::add_pointer<bool(const ScaleKernelDataTypeISASelectorData &data)>::type; |
Giorgio Arena | 5ae8d80 | 2021-11-18 18:02:13 +0000 | [diff] [blame] | 116 | |
| 117 | } // namespace kernels |
| 118 | } // namespace cpu |
| 119 | } // namespace arm_compute |
| 120 | |
Pablo Marquez Tello | d75cd8a | 2022-05-26 14:19:39 +0100 | [diff] [blame] | 121 | #endif // ARM_COMPUTE_CPU_KERNEL_SELECTION_TYPES_H |