# Relationship to CMSIS-DSP

CMSIS-DSP is Arm's C library of signal-processing and numerical functions for Cortex-M processors, developed at [ARM-software/CMSIS-DSP](https://github.com/ARM-software/CMSIS-DSP) under the Apache-2.0 licence. heliaDSP does not contain an edited copy of it. It builds CMSIS-DSP from one commit of Ambiq's upstream-tracking fork, [AmbiqAI/CMSIS-DSP](https://github.com/AmbiqAI/CMSIS-DSP), checked out as the Git submodule `third_party/CMSIS-DSP`. The sections below describe the upstream-tracking fork, the rule a change must satisfy to enter it, the qualified CMSIS-DSP commit, and how provenance is recorded.

## Three places for three kinds of change

| Change | Where it goes | Name and contract |
| --- | --- | --- |
| A correction or improvement to Arm's source that keeps Arm's function signatures, types and documented contracts, and that could be offered to Arm | The upstream-tracking fork's `ambiq/integration` branch | Arm's `arm_*` name and contract |
| A new operation, or an implementation that needs a different contract (extra scratch, stronger padding or alignment, prepared coefficients, other layouts), or one Ambiq keeps private | heliaDSP, under `helia/` | A `helia_*` name and heliaDSP-owned types |
| Ambiq build policy: compiler defaults, board flags, packaging | heliaDSP, under `cmake/`, `nsx/` and `zephyr/` | Applied to the `CMSISDSP` target from outside; Arm's CMake files are not edited |

A contract is everything a caller must satisfy and may rely on: signature, types, buffer sizes, padding, alignment, coefficient layout, numerical behaviour.

A fourth mechanism is planned and not enabled in 2.0.0: source replacement, in which heliaDSP substitutes its own source file for one of Arm's at build time under the same `arm_*` symbols, for an improvement that keeps Arm's complete contract and cannot go to the upstream-tracking fork. A replacement must be bit-exact against Arm's output on the test vectors, or state its tolerance.

## The upstream-tracking fork

The upstream-tracking fork's `main` branch is Arm's tree without change. Its `ambiq/integration` branch carries Ambiq's patches on top of an Arm commit, each merged through a reviewed pull request. A patch enters only if:

- it keeps Arm's `arm_*` signatures, instance types and documented storage contracts, or, where it corrects a contract Arm's code already violates, the patch ledger says so;
- it is general enough to offer to Arm, which excludes Apollo-specific advice and anything Ambiq keeps private; and
- a code change carries a regression test under `Testing/Regression/` that fails on Arm's source and passes on the patched source. Documentation-only patches say so in the ledger.

The ledger, `AMBIQ_PATCHES.md` in the upstream-tracking fork, records one row per patch: the change, Arm's files it touches, its origin, its author, its regression test, the evidence, and its disposition toward Arm. The ledger was added by pull request #11 of the upstream-tracking fork and is in the qualified CMSIS-DSP commit of 2.0.0.

Arm's later commits reach the upstream-tracking fork by periodic merges from Arm into `ambiq/integration`; the patch queue stays on top.

## Submission to Arm is deferred

No patch in the upstream-tracking fork has been submitted to Arm, and submission is deferred without a date. Every ledger row carries the disposition "deferred". The patches remain public in the upstream-tracking fork. The admission test "could be offered to Arm" measures a patch's generality; it is not a commitment to submit. A carried patch is removed when Arm merges an equivalent change.

## The qualified CMSIS-DSP commit

heliaDSP builds one commit of the upstream-tracking fork, the qualified CMSIS-DSP commit, and never follows a branch. This commit is recorded in five places that must agree:

- the submodule commit (the gitlink, Git's record in the parent repository of the commit `third_party/CMSIS-DSP` is checked out at);
- `cmake/HeliaDspPin.cmake`, with a SHA-256 digest of the CMSIS-DSP files that affect the build;
- the `[cmsis_dsp_dependency]` table of [`PROVENANCE.toml`](https://github.com/AmbiqAI/helia-dsp/blob/4a7b7f054eafd96ae50c12050ad3ef3ec1ebaea1/PROVENANCE.toml);
- the identity table of [`COMPATIBILITY.md`](https://github.com/AmbiqAI/helia-dsp/blob/4a7b7f054eafd96ae50c12050ad3ef3ec1ebaea1/COMPATIBILITY.md); and
- `CMSIS_DSP_COMMIT` in `helia/python/heliadsp/__init__.py`.

Every configure step, whether direct CMake, NSX or Zephyr, recomputes the digest of the source it is about to build and stops if it differs from the qualified CMSIS-DSP commit, so a modified or different CMSIS-DSP tree is not built, with or without Git metadata. The digest covers the source, header, CMake and Zephyr module files with CRLF read as LF; line endings, other files and CMake build trees inside the dependency do not change it. The release verifier checks that the five records agree.

Changing the qualified CMSIS-DSP commit is its own heliaDSP pull request, separate from syncing Arm into the upstream-tracking fork: first the change or the sync is merged into the upstream-tracking fork and its regression tests run; then heliaDSP updates the five records together and reruns its qualification. Rolling back is reverting that pull request. The procedure is in [`RELEASING.md`](https://github.com/AmbiqAI/helia-dsp/blob/4a7b7f054eafd96ae50c12050ad3ef3ec1ebaea1/RELEASING.md).

## Provenance

`PROVENANCE.toml` records, for the dependency:

| Field | Meaning |
| --- | --- |
| `repository`, `integration_branch`, `commit` | The upstream-tracking fork, its branch, and the qualified CMSIS-DSP commit |
| `tree` | The Git tree of the qualified CMSIS-DSP commit |
| `build_input_sha256` | The digest checked at configure time |
| `upstream_repository`, `upstream_base`, `upstream_base_describe` | Arm's commit the patches are applied to, and its distance from Arm's last tag |
| `carried_patches` | The pull requests of the upstream-tracking fork between the upstream base and the qualified CMSIS-DSP commit, by number and title |

The release verifier derives the carried-patch list from the upstream-tracking fork's merge history between the upstream base and the qualified CMSIS-DSP commit and requires `PROVENANCE.toml` to match it. Other version numbers answer other questions and are listed separately in `COMPATIBILITY.md`: the CMSIS-Pack component version in Arm's pack metadata, and the versions of the `cmsisdsp` and `heliadsp` Python packages.

## Before 2.0.0

Through v1.1.0, the heliaDSP repository was a copy of Arm's tree at commit `2aa0b18a` with Ambiq's changes made in place, so every update from Arm was a merge across those edits. That history remains in the repository (`[history]` in `PROVENANCE.toml`). Most v1.1.0 changes to Arm's files are now patches in the upstream-tracking fork. The exceptions, among them the biquad instance field that changed Arm's public type and the `ARM_RFFT_FAST_INIT_F32` macro, are listed under "Breaking changes" and "Not carried" in the 2.0.0 entry of [`CHANGELOG.md`](https://github.com/AmbiqAI/helia-dsp/blob/4a7b7f054eafd96ae50c12050ad3ef3ec1ebaea1/CHANGELOG.md). Because the upstream-tracking fork is based on a later Arm commit than v1.1.0, the qualified CMSIS-DSP commit of 2.0.0 also contains 64 Arm commits that v1.1.0 did not.

## Next

- [Contributing](https://ambiqai.github.io/helia-dsp/guide/contributing/): what a change needs to enter the upstream-tracking fork or heliaDSP.
- [Releases](https://ambiqai.github.io/helia-dsp/guide/releases/)
- [Verification](https://ambiqai.github.io/helia-dsp/guide/verification/)
