| 1 | <!-- |
| 2 | SPDX-FileCopyrightText: Copyright 2024, 2026 Arm Limited and/or its affiliates <open-source-office@arm.com> |
| 3 | |
| 4 | SPDX-License-Identifier: Apache-2.0 |
| 5 | --> |
| 6 | |
| 7 | # Contribution Guidelines |
| 8 | |
| 9 | This purpose of this document is to describe how to contribute to Arm® KleidiAI™ and |
| 10 | define what is expected from a contribution. It does not cover every corner case; |
| 11 | the policy will evolve over time. |
| 12 | |
| 13 | # Before you start |
| 14 | |
| 15 | Before starting non-trivial work, please read: |
| 16 | |
| 17 | - [README.md](README.md) for project scope, supported instructions, build |
| 18 | requirements, and support expectations. |
| 19 | - [docs/README.md](docs/README.md) for the documentation hub, examples, and |
| 20 | repository layout. |
| 21 | - [kai/ukernels/matmul/README.md](kai/ukernels/matmul/README.md) for matmul |
| 22 | micro-kernel naming and layout rules. |
| 23 | - [docs/microkernel_testing.md](docs/microkernel_testing.md) for adding a |
| 24 | micro-kernel to the NextGen test suite. |
| 25 | - [benchmark/README.md](benchmark/README.md) for benchmark build and usage. |
| 26 | |
| 27 | Reach out to the maintainers by creating a new issue on the official [KleidiAI |
| 28 | GitLab](https://gitlab.arm.com/kleidi/kleidiai) before investing significant |
| 29 | time in: |
| 30 | |
| 31 | - New micro-kernels. |
| 32 | - New public APIs. |
| 33 | - Large rewrites, broad refactors, or changes that alter established |
| 34 | micro-kernel behavior. |
| 35 | |
| 36 | ## Accepted contributions |
| 37 | |
| 38 | The following areas are generally suitable for external contributions: |
| 39 | |
| 40 | - New micro-kernels |
| 41 | - Bug fixes |
| 42 | - Example improvements and new examples that demonstrate supported usage. |
| 43 | - Build-system fixes for supported build systems. |
| 44 | - Test and benchmark improvements that follow the existing framework. |
| 45 | |
| 46 | ## Rejected contributions |
| 47 | |
| 48 | The following directories are not open to external contributions and |
| 49 | contributions will be rejected without prior maintainer agreement: |
| 50 | |
| 51 | - `experimental` |
| 52 | |
| 53 | KleidiAI does not accept contributions that add support for: |
| 54 | |
| 55 | - Non-Arm CPU architectures. |
| 56 | - AArch32 execution state. |
| 57 | - Unsupported operating systems, compiler families, or build systems unless |
| 58 | maintainers have agreed to expand the support policy. |
| 59 | - Breaking changes to the public API. |
| 60 | |
| 61 | # General contribution requirements |
| 62 | |
| 63 | All contributions must: |
| 64 | |
| 65 | - Use one of the project licenses in the [LICENSES](./LICENSES/) sub-directory. |
| 66 | - Include a Developer Certificate of Origin sign-off. |
| 67 | - Preserve or add correct copyright and license metadata. |
| 68 | - Follow the [Coding standard and convention](docs/coding_conventions.md). |
| 69 | - Build with all relevant supported build systems. |
| 70 | - Include appropriate tests cases. |
| 71 | - Update relevant documentation. |
| 72 | - Include appropriate updates to `CHANGELOG.md`. |
| 73 | |
| 74 | For contributions, a Developer Certificate of Origin (DCO) is required to |
| 75 | certify origin. The process is managed by |
| 76 | [DCO v1.1](https://developercertificate.org/). |
| 77 | |
| 78 | The agreement to the DCO is indicated by a `Signed-off-by` line in the commit |
| 79 | message using your real name and email address: |
| 80 | |
| 81 | ```text |
| 82 | Signed-off-by: Name <name@example.com> |
| 83 | ``` |
| 84 | |
| 85 | Contributors are responsible for ensuring their copyright notices are correct. |
| 86 | Third party contributors should add their own copyright notice applicable to |
| 87 | their own modifications in existing files. For new files, if they include any |
| 88 | code copied from existing files, preserve the existing copyright as is (do |
| 89 | not modify it in any way - for example changing the year) and amend as required |
| 90 | with third party copyright notice. If the file is entirely new and does not |
| 91 | contain Arm copyrightable content, there is typically no need to include Arm |
| 92 | copyright. |
| 93 | |
| 94 | Do not contribute code with unclear provenance and do not include code copied |
| 95 | from licenses that are incompatible with KleidiAI distribution. Disclose |
| 96 | third-party sources in the merge request. |
| 97 | |
| 98 | # Micro-kernel contributions |
| 99 | |
| 100 | Discuss new micro-kernels with maintainers before implementation. The discussion |
| 101 | should cover: |
| 102 | |
| 103 | - The operation and data formats. |
| 104 | - The target architecture feature or microarchitecture. |
| 105 | - Expected integration use case. |
| 106 | - Expected performance benefit. |
| 107 | - Whether the micro-kernel needs to expand the public API. |
| 108 | - Required packing micro-kernels. |
| 109 | - Test, benchmark, and documentation requirements. |
| 110 | |
| 111 | New micro-kernels must: |
| 112 | |
| 113 | - Follow the established naming convention or explicitly justify an extension to |
| 114 | it. |
| 115 | - Use the [current micro-kernel API](kai/ukernels/matmul/kai_matmul.h) style |
| 116 | unless maintainers explicitly agree to a different interface. |
| 117 | - Provide matching interface headers where required. |
| 118 | - Preserve public symbol naming consistency. |
| 119 | - Use ACLE feature test macros for CPU-feature-dependent code where applicable. |
| 120 | - Maintain the advertised behavior, including clamp behavior and partial-output |
| 121 | behavior. |
| 122 | - Include unit tests. Must use the NextGen test framework which is described in |
| 123 | [docs/microkernel_testing.md](docs/microkernel_testing.md). |
| 124 | - Include benchmark test. |
| 125 | - Be added to the micro-kernel tables in [docs/microkernel_tables.md](docs/microkernel_tables.md). |
| 126 | |
| 127 | # Getting access and submitting a merge request |
| 128 | |
| 129 | Contributions are submitted as GitLab merge requests (MR). The process to submit a MR is: |
| 130 | |
| 131 | 1. Create an account on the [Arm hosted GitLab instance](https://gitlab.arm.com/). |
| 132 | 1. Request project fork permission. See |
| 133 | [Arm GitLab contribution documentation](https://gitlab.arm.com/documentation/contributions). |
| 134 | 1. Fork the KleidiAI repository. |
| 135 | 1. Make the smallest coherent change that solves the problem. |
| 136 | 1. Run the relevant tests locally and fix any issues. |
| 137 | 1. Push the patch-set to your forked repository. |
| 138 | 1. Submit a MR on the official KleidiAI GitLab repository with a clear description. |
| 139 | |
| 140 | The description of a MR must contain: |
| 141 | |
| 142 | - Prefix the first line with type of contribution: major, feat, fix, docs or chore |
| 143 | - What changed. |
| 144 | - Why the change is needed. |
| 145 | - How it was tested. |
| 146 | - Any remaining limitations or follow-up work. |
| 147 | |
| 148 | # Testing requirements |
| 149 | |
| 150 | Never skip tests unless there is a clear unavoidable reason. |
| 151 | |
| 152 | For normal validation, run one of: |
| 153 | |
| 154 | ```sh |
| 155 | cmake -S . -B build |
| 156 | cmake --build build |
| 157 | build/kleidiai_test |
| 158 | ``` |
| 159 | |
| 160 | ```sh |
| 161 | bazelisk test //test:kleidiai_test |
| 162 | ``` |
| 163 | |
| 164 | The NextGen test framework uses deterministic seeds by default. For new |
| 165 | micro-kernels, run with several explicit seeds to cover more generated |
| 166 | shapes and values. |
| 167 | |
| 168 | # Benchmarking and performance evidence |
| 169 | |
| 170 | Performance-sensitive contributions must include benchmark evidence. Build and |
| 171 | run the benchmark tool as described in |
| 172 | [benchmark/README.md](benchmark/README.md). |
| 173 | |
| 174 | Performance evidence should include: |
| 175 | |
| 176 | - The exact hardware platform. |
| 177 | - Operating system and toolchain version. |
| 178 | - Build system and build flags. |
| 179 | - Benchmark command lines. |
| 180 | - Shape set used for testing. |
| 181 | - Baseline commit or baseline micro-kernel. |
| 182 | - Results for the changed implementation and the baseline. |
| 183 | |
| 184 | Use shapes that represent the intended integration use case. When possible, |
| 185 | choose shapes from existing model workloads rather than synthetic shapes only. |
| 186 | |
| 187 | # Examples and documentation |
| 188 | |
| 189 | Add a new, or update one of the existing, standalone C++ example application(s) |
| 190 | in the [examples](examples/) sub-directory when a change introduces a new |
| 191 | concept users of the micro-kernel must understand in order to use the |
| 192 | micro-kernel. Examples of when this is needed is when the contribution adds: |
| 193 | |
| 194 | - A new integration pattern. |
| 195 | - A new operator flow not covered by existing examples. |
| 196 | - A new public API that is not self-explanatory from existing documentation. |
| 197 | |
| 198 | Before adding new explanatory text, check whether existing documentation can be |
| 199 | referenced instead: |
| 200 | |
| 201 | - [docs/README.md](docs/README.md) for the documentation hub and example list. |
| 202 | - [kai/ukernels/matmul/pack/README.md](kai/ukernels/matmul/pack/README.md) for |
| 203 | matmul packing. |
| 204 | - [kai/ukernels/matmul/README.md](kai/ukernels/matmul/README.md) for matmul |
| 205 | naming and layout. |
| 206 | - [docs/microkernel_testing.md](docs/microkernel_testing.md) for NextGen |
| 207 | testing. |
| 208 | - [benchmark/README.md](benchmark/README.md) for benchmark usage. |
| 209 | |
| 210 | # Pre-commit checks |
| 211 | |
| 212 | Install and run the configured pre-commit hooks before submitting a merge |
| 213 | request: |
| 214 | |
| 215 | ```sh |
| 216 | pre-commit install |
| 217 | pre-commit run --all-files |
| 218 | ``` |
| 219 | |
| 220 | The hook configuration is in `.pre-commit-config.yaml`. |
| 221 | |
| 222 | If a hook fails, fix the underlying issue rather than bypassing the hook. If a |
| 223 | hook is not applicable to a specific change, explain that in the merge request. |
| 224 | |
| 225 | # Supported environments |
| 226 | |
| 227 | KleidiAI support is intentionally bounded. Contributions must preserve support |
| 228 | for the environments targeted by the project. |
| 229 | |
| 230 | Library C sources must remain C99-compatible, with ACLE and assembly extensions |
| 231 | where required for Arm architecture features. C++ code in tests and tooling must |
| 232 | remain C++17-compatible unless maintainers agree otherwise. |
| 233 | |
| 234 | The project supports CMake 3.16 and Bazel 6.5 or later. Contributions that add |
| 235 | files or change build behavior must keep both build systems up to date. |
| 236 | |
| 237 | | OS / environment | Supported versions | Compiler / toolchain | Supported versions / policy | |
| 238 | |---|---|---|---| |
| 239 | | Ubuntu | Current LTS versions | GCC | Default GCC installation versions and all more recent supported releases on gcc.gnu.org | |
| 240 | | Ubuntu | Current LTS versions | Clang | Default Clang installation versions and latest upstream Clang release | |
| 241 | | Ubuntu | Supported Ubuntu versions where available | Arm Compiler for Linux | All ACfL releases from the previous 13 months | |
| 242 | | Windows® | Windows releases marked (E) or (W) in Active Support: Windows 11 26H1 E/W, 25H2 E/W, 24H2 E/W, 23H2 E | MSVC / Visual Studio® | Visual Studio Stable Channel | |
| 243 | | macOS® operating system software | macOS 26, 15, 14 | Xcode® developer software | Most recent minor release of the most recent major Xcode release | |
| 244 | | Android™ | | Android NDK | Current Android NDK LTS | |
| 245 | |
| 246 | > macOS and Xcode are trademarks of Apple Inc., registered in the U.S. and other countries and regions.<br> |
| 247 | > Android is a trademark of Google LLC.<br> |
| 248 | > Visual Studio and Windows are trademarks of the Microsoft group of companies. |
| 249 | |
| 250 | # Review and acceptance process |
| 251 | |
| 252 | Once a MR is uploaded, the KleidiAI maintainers will review it and trigger the |
| 253 | CI pipeline. Maintainers review merge requests for: |
| 254 | |
| 255 | - Project fit. |
| 256 | - Code maintainability. |
| 257 | - Correctness and API behavior. |
| 258 | - Test coverage. |
| 259 | - Benchmark and performance evidence where relevant. |
| 260 | - Build-system coverage. |
| 261 | - Coding convention compliance. |
| 262 | - Documentation quality. |
| 263 | - Licensing and provenance. |
| 264 | |
| 265 | Maintainers may ask for additional explanation or rewriting when the code |
| 266 | is hard to review, inconsistent with project conventions, or has unclear |
| 267 | origin. |
| 268 | |
| 269 | Review comments must be addressed before merge. Keep updates focused and avoid |
| 270 | unrelated refactoring while responding to review. |
| 271 | |
| 272 | Acceptance of a contribution does not imply acceptance of follow-up work, new |
| 273 | support scope, or future micro-kernels in the same area. Discuss major follow-up |
| 274 | work with the maintainers. |