Elffuss BraidHub

kikocis/kleidiai public

main · 1.8 KiBRawPermalink
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#include <cstddef>
10
11#include "test/common/buffer.hpp"
12
13namespace kai::test {
14
15/// Packs the RHS buffer for static quantized GeMM.
16///
17/// The RHS matrix must be transposed.
18///
19/// This function can be used when the following conditions are met:
20/// * LHS, RHS and DST data types have the same size and are quantized.
21/// * LHS is asymmetric per-tensor, RHS is symmetric per-channel and DST is asymmetric per-tensor.
22///
23/// @tparam Data The data type of the RHS matrix.
24/// @tparam Scale The data type of the quantization scales.
25/// @tparam ZeroPoint The data type of the quantization zero points and the operator biases.
26///
27/// @param[in] data The data buffer of the RHS matrix.
28/// @param[in] scales The quantization scales of the RHS matrix.
29/// @param[in] lhs_scale The quantization scale of the LHS matrix.
30/// @param[in] dst_scale The quantization scale of the DST matrix.
31/// @param[in] biases The biases of the operator.
32/// @param[in] lhs_zero_point The quantization zero point of the LHS matrix.
33/// @param[in] n The number of columns of the non-transposed RHS matrix.
34/// @param[in] k The number of rows of the non-transposed RHS matrix.
35/// @param[in] block_height The number of rows of a data block (N dimension).
36/// @param[in] block_width The number of columns of a data block (K dimension).
37///
38/// @return The packed RHS.
39template <typename Data, typename Scale, typename ZeroPoint>
40Buffer matmul_pack_rhs_nxk_static_quantized(
41 const void* data, const void* scales, Scale lhs_scale, Scale dst_scale, const void* biases,
42 ZeroPoint lhs_zero_point, size_t n, size_t k, size_t block_height, size_t block_width);
43
44} // namespace kai::test