Elffuss BraidHub

kikocis/kleidiai public

main · 1.6 KiBRawPermalink
1//
2// SPDX-FileCopyrightText: Copyright 2025-2026 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#include <cstddef>
10#include <functional>
11#include <ostream>
12
13#include "test/common/compare.hpp"
14#include "test/common/data_type.hpp"
15#include "test/nextgen/common/shape.hpp"
16
17namespace kai::test {
18
19/// Compares two data buffers.
20///
21/// The data inside the tile of interests of the two buffers are compared.
22/// The data in the buffer under test that is outside the tile of intersts must be 0.
23///
24/// @param[in] shape The size of the multidimensional data.
25/// @param[in] tile_coords The starting coordinate of the tile to be compared.
26/// @param[in] tile_shape The size of the tile to be compared.
27/// @param[in] imp_buffer The data buffer under test.
28/// @param[in] ref_buffer The reference data buffer.
29/// @param[in] report_fn The function to report the mismatch location.
30/// @param[in] handler The mismatch handler.
31///
32/// @return The number of elements being checked.
33using CompareFn = size_t (*)(
34 Shape shape, Span<const size_t> tile_coords, Shape tile_shape, Span<const std::byte> imp_buffer,
35 Span<const std::byte> ref_buffer, const std::function<void(std::ostream& os, Span<const size_t> coords)>& report_fn,
36 MismatchHandler& handler);
37
38/// Gets the function to compare two plain 2D data buffers for the specified data type.
39///
40/// @param[in] dtype The data type.
41///
42/// @return The function pointer.
43[[nodiscard]] CompareFn make_compare_plain_2d(DataType dtype);
44
45} // namespace kai::test