Compute Library
 22.08
CpuModel.h
Go to the documentation of this file.
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 
31 
32 namespace arm_compute
33 {
34 namespace cpuinfo
35 {
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  *
58  * @param[in] model Model to check for allowlisted capabilities
59  */
60 bool model_supports_fp16(CpuModel model);
61 
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  *
66  * @param[in] model Model to check for allowlisted capabilities
67  */
68 bool model_supports_dot(CpuModel model);
69 } // namespace cpuinfo
70 } // namespace arm_compute
71 #endif /* SRC_COMMON_CPUINFO_CPUMODEL_H */
CPUModel
CPU models types.
Definition: CPPTypes.h:58
Copyright (c) 2017-2022 Arm Limited.
bool model_supports_fp16(CpuModel model)
Check if a model supports half-precision floating point arithmetic.
Definition: CpuModel.cpp:46
bool model_supports_dot(CpuModel model)
Check if a model supports dot product.
Definition: CpuModel.cpp:63
std::string cpu_model_to_string(CpuModel model)
Convert a CPU model value to a string.
Definition: CpuModel.cpp:30
CpuModel midr_to_model(uint32_t midr)
Extract the model type from the MIDR value.
Definition: CpuModel.cpp:78