Changesets · Branches · Tags · Compare
| Changeset | 0e8bc6f35bb3752620e67f1c6ba9cdf892c789a22fa94afffd2abee819fbdcdc |
|---|---|
| Author | Emil Ohlsson <emil.ohlsson@arm.com> · 2026-06-15 09:48 UTC |
| Committer | Emil Ohlsson <emil.ohlsson@arm.com> · 2026-06-15 09:48 UTC |
| Parents | a671e81a20cc |
1 file changed
modified kai/ukernels/matmul/README.md +39 −32
| @@ -34,22 +34,20 @@ | ||
| 34 | 34 | |
| 35 | 35 | ## Micro-kernel naming |
| 36 | 36 | |
| 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. | |
| 40 | 38 | `kai_<op>_<fused_ops>_<dst_info>_<input_0_info, input_1_info, ...>_<m_block x n_block>_<simd_engine>_<feature>_<instruction>_<uarch>` |
| 41 | 39 | |
| 42 | 40 | | Syntax | Description | Example | |
| 43 | 41 | |---------------------------------|------------------------------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| |
| 44 | 42 | | 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` | | |
| 46 | 44 | | dst_info | Description of the destination buffer | See Buffer descriptors section | |
| 47 | 45 | | input_0_info, input_1_info, ... | Description of input buffers to the micro-kernel | In `matmul` routines, the LHS precedes the RHS | |
| 48 | 46 | | 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 | |
| 49 | 47 | | 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 | | |
| 53 | 51 | |
| 54 | 52 | ## Block |
| 55 | 53 | |
| @@ -59,34 +57,30 @@ | ||
| 59 | 57 | |
| 60 | 58 | Input and output buffers can be described using the following form: |
| 61 | 59 | |
| 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 | | |
| 86 | 77 | |
| 87 | 78 | Example: `qsi4cxp` which means quantized symmetric (`qs`) signed integer 4-bit |
| 88 | 79 | data (`i4`) with per channel quantization (`cx`) that has been packed (`p`). |
| 89 | 80 | |
| 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 | + | |
| 90 | 84 | ### Packing description |
| 91 | 85 | |
| 92 | 86 | If buffers are packed they must also include information about the packing |
| @@ -97,12 +91,25 @@ | ||
| 97 | 91 | `NR` and `KR` can be written as: |
| 98 | 92 | |
| 99 | 93 | | Symbol | example | Description | |
| 100 | -| ----------------------- | --------------- | ------------------------------------------------------ | | |
| 94 | +|-------------------------|-----------------|------------------------------------------------------------------------------------------------------------------------| | |
| 101 | 95 | | _Integer literal_ | `1`, `2`, `4` | Constant value | |
| 102 | 96 | | `mr`/`nr`/`kr` | `mr` | Parametric size, given as argument to micro kernel | |
| 103 | 97 | | `<Integer literal>vl` | `1vl`, `4vl` | Accumulator _vector length_ multiple. Assuming 32-bit accumulation on a 512-bit configuration, `4vl` means 64 elements | |
| 104 | 98 | | `<Integer literal>vs` | `1vs`, `4vs` | _Vector scale_ multiplier, assuming a vector length of 128 bits. For a 512-bit configuration, `4vs` means 16 elements | |
| 105 | 99 | |
| 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 | + | |
| 106 | 113 | ## Known naming issues |
| 107 | 114 | |
| 108 | 115 | There are several micro-kernels that unfortunately use the incorrect name. For |