KleidiAI Coverage Report


Directory: ./
File: test/common/matmul_test_common.cpp
Date: 2025-10-20 13:18:31
Coverage Exec Excl Total
Lines: 93.1% 27 0 29
Functions: 80.0% 4 0 5
Branches: 56.2% 9 0 16

Line Branch Exec Source
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 #include "matmul_test_common.hpp"
8
9 #include <sstream>
10
11 namespace kai::test {
12
13 std::ostream& operator<<(std::ostream& os, const MatMulShape& shape) {
14 return os << "[m=" << shape.m << ", n=" << shape.n << ", k=" << shape.k << "]";
15 }
16
17 4392 void PrintTo(const MatMulTestParams& param, std::ostream* os) {
18 17568 const auto& [method, shape, portion] = param;
19
20 8784 *os << method.name << "__";
21 4392 PrintTo(shape, os);
22 4392 *os << "__";
23 4392 PrintTo(portion, os);
24 4392 }
25
26 137904 void PrintTo(const MatMulShape& shape, std::ostream* os) {
27 137904 *os << "M_" << shape.m << "__N_" << shape.n << "__K_" << shape.k;
28 137904 }
29
30 147108 void PrintTo(const MatrixPortion& portion, std::ostream* os) {
31 147108 *os << "Portion__R_" << static_cast<int>(portion.start_row() * 1000) //
32 147108 << "__C_" << static_cast<int>(portion.start_col() * 1000) //
33 147108 << "__H_" << static_cast<int>(portion.height() * 1000) //
34 147108 << "__W_" << static_cast<int>(portion.width() * 1000);
35 147108 }
36
37 11250 std::string test_description(
38 const std::string_view& name, const MatMulShape& shape, const MatrixPortion& portion, bool bias) {
39 11250 std::ostringstream os;
40
41
2/4
✓ Branch 0 taken 11250 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 11250 times.
✗ Branch 3 not taken.
11250 os << name << "__";
42
1/2
✓ Branch 0 taken 11250 times.
✗ Branch 1 not taken.
11250 PrintTo(shape, &os);
43
1/2
✓ Branch 0 taken 11250 times.
✗ Branch 1 not taken.
11250 os << "__";
44
1/2
✓ Branch 0 taken 11250 times.
✗ Branch 1 not taken.
11250 PrintTo(portion, &os);
45
2/2
✓ Branch 0 taken 9962 times.
✓ Branch 1 taken 1288 times.
11250 if (bias) {
46
1/2
✓ Branch 0 taken 9962 times.
✗ Branch 1 not taken.
9962 os << "__Bias";
47 9962 }
48
49
1/2
✓ Branch 0 taken 11250 times.
✗ Branch 1 not taken.
11250 return os.str();
50 11250 }
51
52 } // namespace kai::test
53