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