# heliaDSP

heliaDSP is Ambiq's integrated distribution of Arm CMSIS-DSP for signal-processing development and deployment on Apollo and Atomiq SoCs.

## Where it fits

Ambiq's software for AI on its chips includes heliaCORE, which supplies the neural-network layer kernels that models run on; heliaML, a C runtime and offline exporter for classical machine-learning models; and compressionKIT, which supplies codecs for physiological signals. heliaDSP supplies the signal processing around the model. It does not replace heliaCORE or heliaML, and it does not claim ownership of the CMSIS-DSP algorithms it carries unchanged from Arm. [Why heliaDSP](https://ambiqai.github.io/helia-dsp/guide/why/) gives the problems it addresses and the measurement behind each.

## For a firmware developer

A project adds heliaDSP once and links one CMake target, `helia_dsp`. The project then includes Arm's header `arm_math.h` and calls CMSIS-DSP's `arm_*` functions as before, and will call `helia_*` functions where heliaDSP adds an operation. heliaDSP builds CMSIS-DSP from one commit of Ambiq's upstream-tracking fork [AmbiqAI/CMSIS-DSP](https://github.com/AmbiqAI/CMSIS-DSP), called the qualified CMSIS-DSP commit, and stops the build if the CMSIS-DSP source on disk is a different one. [Getting started](https://ambiqai.github.io/helia-dsp/getting-started/) covers CMake, neuralSPOT-X and Zephyr builds.

Version 2.0.0 contains:

- CMSIS-DSP from the upstream-tracking fork at the qualified CMSIS-DSP commit, as the Git submodule `third_party/CMSIS-DSP`. The upstream-tracking fork's patches are listed in [`PROVENANCE.toml`](https://github.com/AmbiqAI/helia-dsp/blob/4a7b7f054eafd96ae50c12050ad3ef3ec1ebaea1/PROVENANCE.toml).
- Build integration for direct CMake, the neuralSPOT-X (NSX) module system and Zephyr.
- Ambiq build policy. On NSX boards whose CPU has Helium, the handwritten Helium kernels are the default. The policy also sets compiler defaults (see [Toolchains](https://ambiqai.github.io/helia-dsp/guide/toolchains/)).
- Qualification tests and release tooling: host and simulator tests, a release verifier, and source archives that build without Git or network access.
- The `heliadsp` Python package skeleton, for host prototyping.

Helium is Arm's name for the M-profile Vector Extension (MVE) of the Armv8.1-M architecture, implemented by the Cortex-M55 in Apollo510. CMSIS-DSP contains handwritten Helium kernels for many functions, and portable C kernels for all of them.

2.0.0 adds no operation of its own. 2.1.0 adds the first, the discrete wavelet transform (`helia_dwt_*`, see [Discrete wavelet transform](https://ambiqai.github.io/helia-dsp/reference/dwt/)), in `helia/include/helia/` and `helia/src/`.

## heliaDSP's own operations

Each heliaDSP operation has its own `helia_*` name, types and contract, stated in its public header in `helia/include/helia/`. Each has a reference implementation in portable C, written for review, whose output defines correct output for the operation's other implementations, and each implementation is admitted with a correctness check against the reference and measurements on Ambiq hardware ([`helia/REFERENCE_POLICY.md`](https://github.com/AmbiqAI/helia-dsp/blob/4a7b7f054eafd96ae50c12050ad3ef3ec1ebaea1/helia/REFERENCE_POLICY.md), [Contributing](https://ambiqai.github.io/helia-dsp/guide/contributing/)). The reference is the test oracle, not necessarily the implementation that runs where an optimized one cannot.

- Discrete wavelet transform, `helia/helia_dwt.h` ([Discrete wavelet transform](https://ambiqai.github.io/helia-dsp/reference/dwt/)): each direction has a general entry point, which runs the Helium implementation on targets with floating-point MVE unless `AUTOVECTORIZE=ON` and the optimized scalar implementation otherwise, chosen when the library is compiled; an optimized scalar entry point; and a reference entry point.
- Window statistics, `helia/helia_window_stats.h` ([Window statistics](https://ambiqai.github.io/helia-dsp/reference/window_stats/)): the count, sum, sum of squares, minimum and maximum of an f32 window in one traversal, and inline helpers that derive the mean, the variances and the RMS from them. The entry points follow the wavelet transform's convention: general (Helium or optimized scalar, chosen when the library is compiled), optimized scalar and reference.

Not present: source replacement. A heliaDSP implementation that keeps an Arm function's complete contract may replace Arm's source file at build time under the same `arm_*` name. No replacement is enabled.

## Terms

These pages use the following terms with one meaning each.

| Term | Meaning |
| --- | --- |
| Contract | Everything a caller must satisfy and may rely on for a function: its signature, its types, buffer sizes, coefficient order and padding, alignment, which buffers may overlap or are overwritten, and its numerical behaviour. |
| Upstream-tracking fork | The public repository [AmbiqAI/CMSIS-DSP](https://github.com/AmbiqAI/CMSIS-DSP). Its `ambiq/integration` branch holds Ambiq's patches on top of an Arm commit. |
| Qualified CMSIS-DSP commit | The one commit of the upstream-tracking fork heliaDSP builds and is qualified against. It is recorded in `PROVENANCE.toml`, `COMPATIBILITY.md`, `cmake/HeliaDspPin.cmake` and the submodule. |
| NSX | neuralSPOT-X, Ambiq's module system for bare-metal firmware. A module is a directory with an `nsx-module.yaml` and CMake files. |
| Provider | The CMake target `CMSISDSP` that builds CMSIS-DSP. heliaDSP allows one per build. |

## Pages

- [Why heliaDSP](https://ambiqai.github.io/helia-dsp/guide/why/): the problems it addresses and the measurement behind each.
- [Getting started](https://ambiqai.github.io/helia-dsp/getting-started/): choosing an integration path.
  - [Direct CMake](https://ambiqai.github.io/helia-dsp/getting-started/cmake/)
  - [neuralSPOT-X](https://ambiqai.github.io/helia-dsp/getting-started/neuralspot-x/)
  - [Zephyr](https://ambiqai.github.io/helia-dsp/getting-started/zephyr/)
- Guides
  - [Relationship to CMSIS-DSP](https://ambiqai.github.io/helia-dsp/guide/cmsis-dsp-relationship/): the upstream-tracking fork, its patch queue and the qualified CMSIS-DSP commit.
  - [Toolchains](https://ambiqai.github.io/helia-dsp/guide/toolchains/): which compilers build which kernels.
  - [Contracts](https://ambiqai.github.io/helia-dsp/guide/contracts/): caller obligations that depend on the build configuration.
  - [Verification](https://ambiqai.github.io/helia-dsp/guide/verification/): what is tested, where, and what is not.
  - [Measurements](https://ambiqai.github.io/helia-dsp/guide/measurements/): cycles, flash and accuracy on Apollo510.
  - [Releases](https://ambiqai.github.io/helia-dsp/guide/releases/): version numbers, archives and provenance.
- [API reference](https://ambiqai.github.io/helia-dsp/reference/): where the C API is documented.
- [Contributing](https://ambiqai.github.io/helia-dsp/guide/contributing/): how a change enters the upstream-tracking fork or heliaDSP.
- [Changelog](https://github.com/AmbiqAI/helia-dsp/blob/4a7b7f054eafd96ae50c12050ad3ef3ec1ebaea1/CHANGELOG.md) and [compatibility matrix](https://github.com/AmbiqAI/helia-dsp/blob/4a7b7f054eafd96ae50c12050ad3ef3ec1ebaea1/COMPATIBILITY.md).
