Elffuss BraidHub

kikocis/kleidiai public

docs: Split kernel naming

This change splits the kernel naming into buffer description, and
packing description.

Signed-off-by: Emil Ohlsson <emil.ohlsson@arm.com>

Approved-by: John McLoughlin <john.mcloughlin@arm.com>
Approved-by: Viet-Hoa Do <viet-hoa.do@arm.com>
Changeset0e8bc6f35bb3752620e67f1c6ba9cdf892c789a22fa94afffd2abee819fbdcdc
AuthorEmil Ohlsson <emil.ohlsson@arm.com> · 2026-06-15 09:48 UTC
CommitterEmil Ohlsson <emil.ohlsson@arm.com> · 2026-06-15 09:48 UTC
Parentsa671e81a20cc

Browse the files at this changeset

1 file changed

modified kai/ukernels/matmul/README.md +39 −32
@@ -34,22 +34,20 @@
3434
3535 ## Micro-kernel naming
3636
37-The naming of micro-kernels must follow the convention below. Unless explicitly
38-specified, arguments are mandatory.
39-
37+The naming of micro-kernels must follow the convention below.
4038 `kai_<op>_<fused_ops>_<dst_info>_<input_0_info, input_1_info, ...>_<m_block x n_block>_<simd_engine>_<feature>_<instruction>_<uarch>`
4139
4240 | Syntax | Description | Example |
4341 |---------------------------------|------------------------------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
4442 | op | The primary operation of the micro-kernel | `matmul`, `imatmul ` |
45-| fused_ops | (Optional) Information on applied fused operations, e.g., activation functions | `clamp` |
43+| fused_ops | Information on applied fused operations, e.g., activation functions | `clamp` |
4644 | dst_info | Description of the destination buffer | See Buffer descriptors section |
4745 | input_0_info, input_1_info, ... | Description of input buffers to the micro-kernel | In `matmul` routines, the LHS precedes the RHS |
4846 | m_block x n_block | Primary tile size computed by the micro-kernel. | `6x32` where the tile size is 6 rows by 32 columns; `2vlx2vl` where the tile size is equivalent to twice the hardware-defined vector length in the row and column dimensions |
4947 | simd_engine | SIMD engine used to drive the computation | `neon`, `sve`, `sve2`, `sme`, `sme2` |
50-| feature | (Optional) Further information about the Arm architecture feature used, often referred to as `FEAT_<feature>` in the specification | `dotprod`, `i8mm ` |
51-| instruction | (Optional) Predominant SIMD instruction used in the micro-kernel | `mla`, `mmla`, `mopa`, `dot` |
52-| uarch | (Optional) Microarchitecture for which the micro-kernel has been optimized for | `cortexa55` to represent the Arm® Cortex®-A55 processor |
48+| feature | Further information about the Arm architecture feature used, often referred to as `FEAT_<feature>` in the specification | `dotprod`, `i8mm ` |
49+| instruction | Predominant SIMD instruction used in the micro-kernel | `mla`, `mmla`, `mopa`, `dot` |
50+| uarch | Microarchitecture for which the micro-kernel has been optimized for | `cortexa55` to represent the Arm® Cortex®-A55 processor |
5351
5452 ## Block
5553
@@ -59,34 +57,30 @@
5957
6058 Input and output buffers can be described using the following form:
6159
62-| Syntax | Description |
63-|----------|---------------------------------------------------------------------------------------------------|
64-| f32 | Single-precision floating-point |
65-| f16 | Half-precision floating-point |
66-| bf16 | Brain floating-point |
67-| x | Data type agnostic. Usually used when describing moving data around like in packing micro-kernels |
68-| qs | Quantized symmetric |
69-| qa | Quantized asymmetric |
70-| i | Signed integer |
71-| u | Unsigned integer |
72-| 4 | 4-bit quantized |
73-| 8 | 8-bit quantized |
74-| dx | Per dimension quantized |
75-| cx | Per channel quantized |
76-| d32 | Per-dimension block quantization, with block length multiple of 32 |
77-| c32 | Per block quantization, with block length multiple of 32 |
78-| scalef16 | **Deprecated** Scale factors stored as floating-point 16-bit |
79-| p | Indicates data is packed |
80-| s16s0 | Packing order of data is interleaved |
81-| s4s0 | Packing order of data is interleaved with nibble distance of 4 |
82-| s1s0 | Packing order of data is sequential |
83-| s<type> | Scale factors of type `<type>` are packed into buffer |
84-| b<type> | Bias values of type `<type>` are packed into buffer |
85-| biasf32 | **Deprecated** Bias values are packed into buffer as `f32` |
60+| Syntax | Description |
61+|-----------------------|---------------------------------------------------------------------------------------------------|
62+| f32 | Single-precision floating-point |
63+| f16 | Half-precision floating-point |
64+| bf16 | Brain floating-point |
65+| x | Data type agnostic. Usually used when describing moving data around like in packing micro-kernels |
66+| qs | Quantized symmetric |
67+| qa | Quantized asymmetric |
68+| i | Signed integer |
69+| u | Unsigned integer |
70+| 4 | 4-bit quantized |
71+| 8 | 8-bit quantized |
72+| dx | Per dimension quantized |
73+| cx | Per channel quantized |
74+| d32 | Per-dimension block quantization, with block length multiple of 32 |
75+| c32 | Per block quantization, with block length multiple of 32 |
76+| p\[<width>x<height>\] | Indicates data is packed, see _Packing description_ for details |
8677
8778 Example: `qsi4cxp` which means quantized symmetric (`qs`) signed integer 4-bit
8879 data (`i4`) with per channel quantization (`cx`) that has been packed (`p`).
8980
81+For high level naming, the above is sufficient. This is used to name
82+directories. For the specific files the packing format must also be specified.
83+
9084 ### Packing description
9185
9286 If buffers are packed they must also include information about the packing
@@ -97,12 +91,25 @@
9791 `NR` and `KR` can be written as:
9892
9993 | Symbol | example | Description |
100-| ----------------------- | --------------- | ------------------------------------------------------ |
94+|-------------------------|-----------------|------------------------------------------------------------------------------------------------------------------------|
10195 | _Integer literal_ | `1`, `2`, `4` | Constant value |
10296 | `mr`/`nr`/`kr` | `mr` | Parametric size, given as argument to micro kernel |
10397 | `<Integer literal>vl` | `1vl`, `4vl` | Accumulator _vector length_ multiple. Assuming 32-bit accumulation on a 512-bit configuration, `4vl` means 64 elements |
10498 | `<Integer literal>vs` | `1vs`, `4vs` | _Vector scale_ multiplier, assuming a vector length of 128 bits. For a 512-bit configuration, `4vs` means 16 elements |
10599
100+In addition to the packing width and height there is additional information that
101+is encoded in the extended pack
102+
103+| Syntax | Description |
104+|----------|----------------------------------------------------------------|
105+| s16s0 | Packing order of data is interleaved |
106+| s4s0 | Packing order of data is interleaved with nibble distance of 4 |
107+| s1s0 | Packing order of data is sequential |
108+| s<type> | Scale factors of type `<type>` are packed into buffer |
109+| b<type> | Bias values of type `<type>` are packed into buffer |
110+| scalef16 | **Deprecated** Scale factors stored as floating-point 16-bit |
111+| biasf32 | **Deprecated** Bias values are packed into buffer as `f32` |
112+
106113 ## Known naming issues
107114
108115 There are several micro-kernels that unfortunately use the incorrect name. For