Debian Codegraph @

kai/ukernels/matmul/pack/kai_lhs_quant_pack_qsi8d32p_f32.h

raw symbols SCIP
1 //
2 // SPDX-FileCopyrightText: Copyright 2024 Arm Limited and/or its affiliates <[email protected]>
3 //
4 // SPDX-License-Identifier: Apache-2.0
5 //
6 #pragma once
7
8 #include <stddef.h>
9 #include <stdint.h>
10
11 #ifdef __cplusplus
12 extern "C" {
13 #endif
14
15 /// Gets the m step value.
16 /// The micro-kernel can process any M values. However, the starting M index to
17 /// be processed must be a multiple of m step.
18 ///
19 /// @param[in] mr The number of M rows to interleave on the same output row.
20 ///
21 /// @return the m step value
22 size_t kai_get_m_step_lhs_quant_pack_qsi8d32p_f32(size_t mr);
23
24 /// Gets the offset in bytes for the LHS matrix (not packed)
25 ///
26 /// This function should be called before passing the pointer to the LHS matrix to the micro-kernel.
27 ///
28 /// @param[in] m_idx Row index in the LHS matrix (not packed).
29 /// @param[in] lhs_stride The number of bytes in in each row of the LHS matrix (not packed)
30 ///
31 /// @return the offset in bytes to the LHS matrix
32 size_t kai_get_lhs_offset_lhs_quant_pack_qsi8d32p_f32(size_t m_idx, size_t lhs_stride);
33
34 /// Gets the offset in bytes for the packed LHS matrix,
35 /// which contains the packed 8-bit quantized symmetric per-block (qsi8d32) values.
36 ///
37 /// This function should be called before passing the pointer to the packed LHS matrix to the micro-kernel.
38 ///
39 /// @param[in] m_idx Row index in the LHS matrix (not packed).
40 /// @param[in] k Total number of columns in the LHS matrix (not packed).
41 /// @param[in] bl The block length.
42 /// @param[in] mr The number of M rows to interleave on the same output row.
43 /// @param[in] kr The number of columns loaded in the single inner most loop of the matmul micro-kernel.
44 /// @param[in] sr The number of kr splits. It can be 1 (no splits) up to kr.
45 ///
46 /// @return the offset in bytes to the packed LHS matrix
47 size_t kai_get_lhs_packed_offset_lhs_quant_pack_qsi8d32p_f32(
48 size_t m_idx, size_t k, size_t bl, size_t mr, size_t kr, size_t sr);
49
50 /// Gets the size in bytes for the quantized and packed LHS matrix
51 ///
52 /// @param[in] m Total number of rows in the LHS matrix (not packed).
53 /// @param[in] k Total number of columns in the LHS matrix (not packed).
54 /// @param[in] bl The block length, which defines the number of K values stored in a single block. It must be a
55 /// multiple of 32.
56 /// @param[in] mr The number of M rows to interleave on the same output row.
57 /// @param[in] kr The number of columns loaded in the single inner most loop of the matmul micro-kernel.
58 /// @param[in] sr The number of kr splits. It can be 1 (no splits) up to kr.
59 ///
60 /// @return the packed LHS matrix size in bytes
61 size_t kai_get_lhs_packed_size_lhs_quant_pack_qsi8d32p_f32(
62 size_t m, size_t k, size_t bl, size_t mr, size_t kr, size_t sr);
63
64 /// Run the micro-kernel to quantize and pack the LHS matrix.
65 ///
66 /// @param[in] m The number of output rows written.
67 /// @param[in] k The number of channels. The common dimension of LHS & RHS. It must be multiple of 8.
68 /// @param[in] bl The block length, which defines the number of K values stored in a single block. It must be
69 /// a multiple of 32.
70 /// @param[in] mr The number of M rows to interleave on the same output row.
71 /// @param[in] kr The number of columns loaded in the single inner most loop of the matmul micro-kernel.
72 /// @param[in] sr The number of kr splits. It can be 1 (no splits) up to kr.
73 /// However, kr must be multiple of sr.
74 /// @param[in] m_idx_start The starting M index.
75 /// @param[in] lhs LHS matrix.
76 /// @param[in] lhs_stride Stride in bytes between two rows of LHS.
77 /// @param[out] lhs_packed The quantized and packed LHS matrix.
78 void kai_run_lhs_quant_pack_qsi8d32p_f32(
79 size_t m, size_t k, size_t bl, size_t mr, size_t kr, size_t sr, size_t m_idx_start, const float* lhs,
80 size_t lhs_stride, void* lhs_packed);
81
82 #ifdef __cplusplus
83 }
84 #endif