Georgios Pinitas | 08302c1 | 2021-06-09 10:08:27 +0100 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2021 Arm Limited. |
| 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 SRC_COMMON_CPUINFO_CPUMODEL_H |
| 25 | #define SRC_COMMON_CPUINFO_CPUMODEL_H |
| 26 | |
| 27 | #include <cstdint> |
| 28 | #include <string> |
| 29 | |
| 30 | #include "arm_compute/core/CPP/CPPTypes.h" |
| 31 | |
| 32 | namespace arm_compute |
| 33 | { |
| 34 | namespace cpuinfo |
| 35 | { |
| 36 | using CpuModel = arm_compute::CPUModel; |
| 37 | |
| 38 | /** Convert a CPU model value to a string |
| 39 | * |
| 40 | * @param model CpuModel value to be converted |
| 41 | * |
| 42 | * @return String representing the corresponding CpuModel |
| 43 | */ |
| 44 | std::string cpu_model_to_string(CpuModel model); |
| 45 | |
| 46 | /** Extract the model type from the MIDR value |
| 47 | * |
| 48 | * @param[in] midr MIDR information |
| 49 | * |
| 50 | * @return CpuModel a mapped CPU model |
| 51 | */ |
| 52 | CpuModel midr_to_model(uint32_t midr); |
| 53 | |
| 54 | /** Check if a model supports half-precision floating point arithmetic |
| 55 | * |
| 56 | * @note This is used in case of old kernel configurations where some capabilities are not exposed. |
| 57 | * |
ramelg01 | b2eba7f | 2021-12-23 08:32:08 +0000 | [diff] [blame] | 58 | * @param[in] model Model to check for allowlisted capabilities |
Georgios Pinitas | 08302c1 | 2021-06-09 10:08:27 +0100 | [diff] [blame] | 59 | */ |
| 60 | bool model_supports_fp16(CpuModel model); |
| 61 | |
Georgios Pinitas | 08302c1 | 2021-06-09 10:08:27 +0100 | [diff] [blame] | 62 | /** Check if a model supports dot product |
| 63 | * |
| 64 | * @note This is used in case of old kernel configurations where some capabilities are not exposed. |
| 65 | * |
ramelg01 | b2eba7f | 2021-12-23 08:32:08 +0000 | [diff] [blame] | 66 | * @param[in] model Model to check for allowlisted capabilities |
Georgios Pinitas | 08302c1 | 2021-06-09 10:08:27 +0100 | [diff] [blame] | 67 | */ |
| 68 | bool model_supports_dot(CpuModel model); |
| 69 | } // namespace cpuinfo |
| 70 | } // namespace arm_compute |
| 71 | #endif /* SRC_COMMON_CPUINFO_CPUMODEL_H */ |