| 1 | // |
| 2 | // SPDX-FileCopyrightText: Copyright 2024-2025 Arm Limited and/or its affiliates <open-source-office@arm.com> |
| 3 | // |
| 4 | // SPDX-License-Identifier: Apache-2.0 |
| 5 | // |
| 6 | |
| 7 | #pragma once |
| 8 | |
| 9 | namespace kai::test { |
| 10 | |
| 11 | /// Returns a value indicating whether the current CPU supports FEAT_AdvSIMD. |
| 12 | bool cpu_has_advsimd(); |
| 13 | |
| 14 | /// Returns a value indicating whether the current CPU supports FEAT_DotProd. |
| 15 | bool cpu_has_dotprod(); |
| 16 | |
| 17 | /// Returns a value indicating whether the current CPU supports FEAT_DotProd and FEAT_FP16. |
| 18 | bool cpu_has_dotprod_and_fp16(); |
| 19 | |
| 20 | /// Returns a value indicating whether the current CPU supports FEAT_I8MM. |
| 21 | bool cpu_has_i8mm(); |
| 22 | |
| 23 | /// Returns a value indicating whether the current CPU supports FEAT_I8MM and FEAT_FP16. |
| 24 | bool cpu_has_i8mm_and_fp16(); |
| 25 | |
| 26 | /// Returns a value indicating whether the current CPU supports FEAT_FP16. |
| 27 | bool cpu_has_fp16(); |
| 28 | |
| 29 | /// Returns a value indicating whether the current CPU supports FEAT_BF16. |
| 30 | bool cpu_has_bf16(); |
| 31 | |
| 32 | /// Returns a value indicating whether the current CPU supports FEAT_SVE. |
| 33 | bool cpu_has_sve(); |
| 34 | |
| 35 | /// Returns a value indicating whether the current CPU supports FEAT_SVE with 256-bit vector lengths. |
| 36 | bool cpu_has_sve_vl256(); |
| 37 | |
| 38 | /// Returns a value indicating whether the current CPU supports FEAT_SVE2. |
| 39 | bool cpu_has_sve2(); |
| 40 | |
| 41 | /// Returns a value indicating whether the current CPU supports FEAT_SVE2.1. |
| 42 | bool cpu_has_sve2p1(); |
| 43 | |
| 44 | /// Returns a value indicating whether the current CPU supports FEAT_SME. |
| 45 | bool cpu_has_sme(); |
| 46 | |
| 47 | /// Returns a value indicating whether the current CPU supports FEAT_SME2. |
| 48 | bool cpu_has_sme2(); |
| 49 | |
| 50 | /// Returns a value indicating whether the current CPU supports FEAT_BF16 and FEAT_DotProd |
| 51 | bool cpu_has_dotprod_and_bf16(); |
| 52 | |
| 53 | /// Returns a value indicating whether the current CPU supports FEAT_BF16 and FEAT_I8MM |
| 54 | bool cpu_has_i8mm_and_bf16(); |
| 55 | |
| 56 | /// Returns a value indicating whether the current CPU supports a set of features |
| 57 | template <bool (*... Pred)()> |
| 58 | bool cpu_check() { |
| 59 | return (Pred() && ...); |
| 60 | } |
| 61 | |
| 62 | } // namespace kai::test |