Contributions welcome! Before endeavoring to provide a much appreciated change to Klein, please read this document to make the process as smooth and as pleasant as possible.
- Before embarking on a large-scale change or architectural improvement, please open an issue and explain your motivation, solution, and plan of attack.
- If you have questions about how something works or whether something is a good idea, you're welcome to join our discord to discuss things and get some quick feedback.
- Please adhere to the
git
andC++
guidelines below, and don't hesitate to ask questions if the process as outlined here is unclear. - Understand that all contributions made fall under the project's MIT license.
- A rebase workflow is the preferred method of keeping your fork/branch up to date with changes. This maintains a clean commit history with less bookkeeping needed to isolate problems introduced in the context of a linear timeline.
- Git messages should be as detailed as necessary to describe the change, with an imperatively voiced single-line commit title. Refer to this article for additional exposition.
- While a change is under review, don't squash your commits just yet until the review is finalized. That way, changes that are committed in response to feedback can be indepedently audited.
- All names are
snake_case
with the exception of macros which areUPPER_SNAKE_CASE
. - All symbols must reside in the
kln
orkln::detail
namespaces. - Implicit allocations are forbidden
- New functionality should generally be accompanied with suitable test coverage.
- If a tradeoff between speed and precision can be made, the fast version is
preferred and a
_precise
fallback can be provided in addition. - Code should abide by the "don't pay for what you don't use" mantra.
- A recent
clang-format
must be installed and working on your system so that file formatting is canonicalized. - For functions that return a value, generally
[[nodiscard]]
should be used. - All methods and functions should be marked
noexcept
as no code in Klein should need to everthrow
. - All variables that are potentially unused should be marked with the
[[maybe_unused]]
attribute. - Instructions leveraging
AVX
or a more recent instruction set must be behind a preprocessor flag namedKLN_ENABLE_ISE_*
("enable instruction set extension ..."). - All functions that accept arguments consisting of SIMD registers must be decorated
with
KLN_VEC_CALL
to enable the vector register calling convention. - API documentation is periodically generated from embedded source code comments that
follow a triple-slash (
///
) so please update documentation accordingly. - Be mindful of techniques, idioms, or dependencies that may have an adverse affect on compile times. While Klein leverages templates to a certain degree, maintaining lean compilation time is a persistent effort.