blob: 071efc4b3f11c0a2c8fee9c306abd35aad15f9ff [file] [log] [blame]
Georgios Pinitas08302c12021-06-09 10:08:27 +01001/*
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
32namespace arm_compute
33{
34namespace cpuinfo
35{
36using 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 */
44std::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 */
52CpuModel 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 *
58 * @param[in] model Model to check for whitelisted capabilities
59 */
60bool model_supports_fp16(CpuModel model);
61
62/** Check if a model supports SVE
63 *
64 * @note This is used in case of old kernel configurations where some capabilities are not exposed.
65 *
66 * @param[in] model Model to check for whitelisted capabilities
67 */
68bool model_supports_sve(CpuModel model);
69
70/** Check if a model supports dot product
71 *
72 * @note This is used in case of old kernel configurations where some capabilities are not exposed.
73 *
74 * @param[in] model Model to check for whitelisted capabilities
75 */
76bool model_supports_dot(CpuModel model);
77} // namespace cpuinfo
78} // namespace arm_compute
79#endif /* SRC_COMMON_CPUINFO_CPUMODEL_H */