Elffuss BraidHub

kikocis/kleidiai public

main · 4.9 KiBRawPermalink
1//
2// SPDX-FileCopyrightText: Copyright 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 "kai/ukernels/matmul/kai_matmul_types.h"
10
11#ifdef __cplusplus
12extern "C" {
13#endif
14
15/// For micro-kernel naming and associated packing micro-kernel that goes with it, see:
16/// * docs/microkernel_tables.md
17/// * kai/ukernels/matmul/README.md
18/// This provides information such as the data type and packing format of the buffers.
19/// Any information that is not present in the above files is documented here.
20///
21/// Documentation conventions in this file:
22/// * Only required or conditionally required configuration parameters,
23/// operands, activation arguments, and flags are documented.
24/// * See the *_types.h file for the description of those argument types.
25/// * Accumulation data type matches the output data type by default. It is
26/// documented along with the API only when the data types differ.
27/// * Any argument not listed for a micro-kernel is unused and does not need
28/// to be populated.
29///
30
31/// Single-precision floating-point matrix multiplication using SME2 MOPA instruction.
32///
33/// Required operands:
34/// * lhs, dst
35/// * rhs - rhs with per-n accumulator bias
36/// Optional arguments:
37/// * clamp - F32 output clamp values if KAI_MATMUL_UKER_FLAGS_ARGS_CLAMP flag is set.
38///
39/// Supported flags:
40/// * KAI_MATMUL_UKER_FLAGS_ARGS_CLAMP - Clamp output data.
41///
42/// @return The micro-kernel API.
43struct kai_matmul_uker_api kai_matmul_clamp_f32_f32p4vsx1_f32p4vsx1bf32_8vsx8vs_sme2_mopa(void);
44
45/// Matrix multiplication with 32-bit integer accumulation using SME2 MOPA instruction.
46///
47/// Required operands:
48/// * lhs, dst, rhs
49/// * bias
50/// * acc_bias_m, acc_bias_n
51///
52/// @return The micro-kernel API.
53struct kai_matmul_uker_api kai_matmul_i32_u8p4vsx4_u8p4vsx4_i32_i32_8vsx8vs_sme2_mopa(void);
54
55/// Matrix multiplication with 32-bit integer accumulation and FP32 output using SME2 MOPA instruction.
56///
57/// Required operands:
58/// * lhs, dst, rhs
59/// * bias
60/// * acc_bias_m, acc_bias_n, scale_bias_n
61/// * scale
62/// * acc_scale_global
63///
64/// Optional arguments:
65/// * clamp - F32 output clamp values if KAI_MATMUL_UKER_FLAGS_ARGS_CLAMP flag is set.
66///
67/// Accumulation: I32, then converted to F32 using global scaling and per column bias
68///
69/// Supported flags:
70/// * KAI_MATMUL_UKER_FLAGS_ARGS_CLAMP - Clamping output data.
71///
72/// @return The micro-kernel API.
73struct kai_matmul_uker_api kai_matmul_clamp_f32_u8p4vsx4_u8p4vsx4_i32_i32_f32_f32_8vsx8vs_sme2_mopa(void);
74
75/// Single-precision floating-point vector-matrix multiplication using SME2 MLA instruction.
76///
77/// Required operands:
78/// * dst
79/// * lhs
80/// * rhs - rhs matrix and per-n accumulator bias vector.
81///
82/// Optional arguments:
83/// * clamp - F32 output clamp values if KAI_MATMUL_UKER_FLAGS_ARGS_CLAMP flag is set.
84///
85/// Supported flags:
86/// * KAI_MATMUL_UKER_FLAGS_ARGS_CLAMP - Clamp output data.
87///
88/// @return The micro-kernel API.
89struct kai_matmul_uker_api kai_matmul_clamp_f32_f32_f32p4vsx1bf32_1x32vs_sme2_mla(void);
90
91/// Half-precision floating-point matrix multiplication using SVE2.1 FDOT instruction.
92///
93/// Required CPU features:
94/// * FEAT_SVE2p1
95///
96/// Required operands:
97/// * dst
98/// * lhs
99/// * rhs - RHS matrix with per-N bias.
100///
101/// Optional arguments:
102/// * clamp - F32 output clamp values if KAI_MATMUL_UKER_FLAGS_ARGS_CLAMP flag is set.
103///
104/// Accumulation: F32, then converted to F16.
105///
106/// Supported flags:
107/// * KAI_MATMUL_UKER_FLAGS_ARGS_CLAMP - Clamp output data
108///
109/// @return The micro-kernel API.
110struct kai_matmul_uker_api kai_matmul_clamp_f16_f16_f16p16vsx2bf16_6x16vs_sve2p1_dot(void);
111
112/// Statically quantized INT8 matrix multiplication using SME2 MOPA instruction.
113///
114/// Required CPU features:
115/// * FEAT_SME2
116///
117/// Required operands:
118/// * dst
119/// * lhs
120/// * rhs - RHS matrix with per-N bias and per-N scale.
121/// * dst_bias_global
122///
123/// Optional arguments:
124/// * clamp - INT32 output clamp values if KAI_MATMUL_UKER_FLAGS_ARGS_CLAMP flag is set.
125///
126/// Supported flags:
127/// * KAI_MATMUL_UKER_FLAGS_ARGS_CLAMP - Clamp output data.
128///
129/// @return The micro-kernel API.
130struct kai_matmul_uker_api kai_matmul_clamp_qai8_qai8p4vsx4_qsi8cxp4vsx4bi32sf32_8vsx8vs_sme2_mopa(void);
131
132/// Statically quantized INT8 vector-matrix multiplication using SME2 DOT instruction.
133///
134/// Required CPU features:
135/// * FEAT_SME2
136///
137/// Required operands:
138/// * dst
139/// * lhs
140/// * rhs - RHS matrix with per-N bias and per-N scale.
141/// * dst_bias_global
142///
143/// Optional arguments:
144/// * clamp - INT32 output clamp values if KAI_MATMUL_UKER_FLAGS_ARGS_CLAMP flag is set.
145///
146/// Supported flags:
147/// * KAI_MATMUL_UKER_FLAGS_ARGS_CLAMP - Clamp output data.
148///
149/// @return The micro-kernel API.
150struct kai_matmul_uker_api kai_matmul_clamp_qai8_qai8_qsi8cxp4vsx4bi32sf32_1x32vs_sme2_dot(void);
151
152#ifdef __cplusplus
153} // extern "C"
154#endif