Elffuss BraidHub

kikocis/kleidiai public

main · 10.5 KiBRenderedRawPermalink
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
9This purpose of this document is to describe how to contribute to Arm® KleidiAI™ and
10define what is expected from a contribution. It does not cover every corner case;
11the policy will evolve over time.
12
13# Before you start
14
15Before 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
27Reach out to the maintainers by creating a new issue on the official [KleidiAI
28GitLab](https://gitlab.arm.com/kleidi/kleidiai) before investing significant
29time 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
38The 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
48The following directories are not open to external contributions and
49contributions will be rejected without prior maintainer agreement:
50
51- `experimental`
52
53KleidiAI 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
63All 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
74For contributions, a Developer Certificate of Origin (DCO) is required to
75certify origin. The process is managed by
76[DCO v1.1](https://developercertificate.org/).
77
78The agreement to the DCO is indicated by a `Signed-off-by` line in the commit
79message using your real name and email address:
80
81```text
82Signed-off-by: Name <name@example.com>
83```
84
85Contributors are responsible for ensuring their copyright notices are correct.
86Third party contributors should add their own copyright notice applicable to
87their own modifications in existing files. For new files, if they include any
88code copied from existing files, preserve the existing copyright as is (do
89not modify it in any way - for example changing the year) and amend as required
90with third party copyright notice. If the file is entirely new and does not
91contain Arm copyrightable content, there is typically no need to include Arm
92copyright.
93
94Do not contribute code with unclear provenance and do not include code copied
95from licenses that are incompatible with KleidiAI distribution. Disclose
96third-party sources in the merge request.
97
98# Micro-kernel contributions
99
100Discuss new micro-kernels with maintainers before implementation. The discussion
101should 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
111New 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
129Contributions are submitted as GitLab merge requests (MR). The process to submit a MR is:
130
1311. Create an account on the [Arm hosted GitLab instance](https://gitlab.arm.com/).
1321. Request project fork permission. See
133 [Arm GitLab contribution documentation](https://gitlab.arm.com/documentation/contributions).
1341. Fork the KleidiAI repository.
1351. Make the smallest coherent change that solves the problem.
1361. Run the relevant tests locally and fix any issues.
1371. Push the patch-set to your forked repository.
1381. Submit a MR on the official KleidiAI GitLab repository with a clear description.
139
140The 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
150Never skip tests unless there is a clear unavoidable reason.
151
152For normal validation, run one of:
153
154```sh
155cmake -S . -B build
156cmake --build build
157build/kleidiai_test
158```
159
160```sh
161bazelisk test //test:kleidiai_test
162```
163
164The NextGen test framework uses deterministic seeds by default. For new
165micro-kernels, run with several explicit seeds to cover more generated
166shapes and values.
167
168# Benchmarking and performance evidence
169
170Performance-sensitive contributions must include benchmark evidence. Build and
171run the benchmark tool as described in
172[benchmark/README.md](benchmark/README.md).
173
174Performance 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
184Use shapes that represent the intended integration use case. When possible,
185choose shapes from existing model workloads rather than synthetic shapes only.
186
187# Examples and documentation
188
189Add a new, or update one of the existing, standalone C++ example application(s)
190in the [examples](examples/) sub-directory when a change introduces a new
191concept users of the micro-kernel must understand in order to use the
192micro-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
198Before adding new explanatory text, check whether existing documentation can be
199referenced 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
212Install and run the configured pre-commit hooks before submitting a merge
213request:
214
215```sh
216pre-commit install
217pre-commit run --all-files
218```
219
220The hook configuration is in `.pre-commit-config.yaml`.
221
222If a hook fails, fix the underlying issue rather than bypassing the hook. If a
223hook is not applicable to a specific change, explain that in the merge request.
224
225# Supported environments
226
227KleidiAI support is intentionally bounded. Contributions must preserve support
228for the environments targeted by the project.
229
230Library C sources must remain C99-compatible, with ACLE and assembly extensions
231where required for Arm architecture features. C++ code in tests and tooling must
232remain C++17-compatible unless maintainers agree otherwise.
233
234The project supports CMake 3.16 and Bazel 6.5 or later. Contributions that add
235files 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
252Once a MR is uploaded, the KleidiAI maintainers will review it and trigger the
253CI 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
265Maintainers may ask for additional explanation or rewriting when the code
266is hard to review, inconsistent with project conventions, or has unclear
267origin.
268
269Review comments must be addressed before merge. Keep updates focused and avoid
270unrelated refactoring while responding to review.
271
272Acceptance of a contribution does not imply acceptance of follow-up work, new
273support scope, or future micro-kernels in the same area. Discuss major follow-up
274work with the maintainers.