test/common/sve.cpp
| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | // | ||
| 2 | // SPDX-FileCopyrightText: Copyright 2025 Arm Limited and/or its affiliates <open-source-office@arm.com> | ||
| 3 | // | ||
| 4 | // SPDX-License-Identifier: Apache-2.0 | ||
| 5 | // | ||
| 6 | |||
| 7 | #include "test/common/sve.hpp" | ||
| 8 | |||
| 9 | #include "kai/kai_common.h" | ||
| 10 | #include "test/common/cpu_info.hpp" | ||
| 11 | |||
| 12 | namespace kai::test { | ||
| 13 | |||
| 14 | template <> | ||
| 15 | ✗ | size_t get_sve_vector_length<1>() { | |
| 16 | static size_t res = 0; | ||
| 17 | |||
| 18 | ✗ | if (res == 0) { | |
| 19 | ✗ | if (cpu_has_sve()) { | |
| 20 | ✗ | res = kai_get_sve_vector_length_u8(); | |
| 21 | ✗ | } else { | |
| 22 | ✗ | res = 1; | |
| 23 | } | ||
| 24 | ✗ | } | |
| 25 | |||
| 26 | ✗ | return res; | |
| 27 | } | ||
| 28 | |||
| 29 | template <> | ||
| 30 | ✗ | size_t get_sve_vector_length<2>() { | |
| 31 | static size_t res = 0; | ||
| 32 | |||
| 33 | ✗ | if (res == 0) { | |
| 34 | ✗ | if (cpu_has_sve()) { | |
| 35 | ✗ | res = kai_get_sve_vector_length_u16(); | |
| 36 | ✗ | } else { | |
| 37 | ✗ | res = 1; | |
| 38 | } | ||
| 39 | ✗ | } | |
| 40 | |||
| 41 | ✗ | return res; | |
| 42 | } | ||
| 43 | |||
| 44 | template <> | ||
| 45 | 36 | size_t get_sve_vector_length<4>() { | |
| 46 | static size_t res = 0; | ||
| 47 | |||
| 48 |
2/2✓ Branch 0 taken 33 times.
✓ Branch 1 taken 3 times.
|
36 | if (res == 0) { |
| 49 |
2/2✓ Branch 0 taken 2 times.
✓ Branch 1 taken 1 time.
|
3 | if (cpu_has_sve()) { |
| 50 | 2 | res = kai_get_sve_vector_length_u32(); | |
| 51 | 2 | } else { | |
| 52 | 1 | res = 1; | |
| 53 | } | ||
| 54 | 3 | } | |
| 55 | |||
| 56 | 36 | return res; | |
| 57 | } | ||
| 58 | |||
| 59 | } // namespace kai::test | ||
| 60 |