Skip to content
heliaDSP
User guide
HELIA HUB

Contributing

A change to heliaDSP enters in one of two repositories, depending on whose contract it keeps. The same requirements apply whether the change was written by hand or with a coding agent; AGENTS.md states the repository’s conventions in the form agents read.

A contract is everything a caller must satisfy and may rely on: signature, types, buffer sizes, padding, alignment, coefficient layout, which buffers may overlap or are modified, and numerical behaviour. CMSIS-DSP is Arm’s C library that heliaDSP builds from one commit of Ambiq’s upstream-tracking fork AmbiqAI/CMSIS-DSP, the qualified CMSIS-DSP commit.

Change Repository and branch
A correction or improvement to one of Arm’s files that keeps Arm’s arm_* signatures, types and documented contracts and could be offered to Arm The upstream-tracking fork, a pull request against ambiq/integration; it reaches heliaDSP when the qualified CMSIS-DSP commit changes
A new operation, or an implementation with a different contract, or one Ambiq keeps private heliaDSP, under helia/, with a helia_* name
Build integration, compiler policy, packaging, tests, release tooling, documentation heliaDSP, under cmake/, nsx/, zephyr/, tools/, tests/ or docs/

No file under third_party/CMSIS-DSP is edited in heliaDSP. The rule for each place, and why submission to Arm is deferred, is in Relationship to CMSIS-DSP.

A pull request to the upstream-tracking fork contains:

  • the change to Arm’s files, with Arm’s signatures and types unchanged;
  • a regression test under Testing/Regression/ that fails on Arm’s unmodified source and passes on the patched source, run where the defect shows: for an access outside a buffer, on the Corstone-300 simulator with a memory-protection guard directly after or before the buffer; a documentation-only patch says that it has no test;
  • the evidence: the cases run, the compiler and its version, the optimization level, and the result on both sources; and
  • a row for the upstream-tracking fork’s patch ledger, AMBIQ_PATCHES.md: change, Arm’s files touched, origin, author, regression test, evidence, and disposition toward Arm.

A compiler defect is worked around in the upstream-tracking fork, as its patch ledger’s “Compiler workarounds” section requires: by one source shim in the compiler-workarounds block of Include/arm_math_types.h, gated on a closed compiler version range, with a canary under Testing/Regression/. heliaDSP’s CMake carries no per-file compile option for such a defect. Pull request #55 of the upstream-tracking fork, the GCC 15.0 to 15.2 __QSUB/__QADD shim, is the example.

A patch that changes what a caller must provide, even to correct a contract Arm’s code already violates, says so in its ledger row and in its description, with the measurement that shows the violation. Pull request #9 of the upstream-tracking fork, which changes the Helium FIR state length, is the example.

The change reaches heliaDSP through a separate heliaDSP pull request that changes the qualified CMSIS-DSP commit, updating the submodule, cmake/HeliaDspPin.cmake, PROVENANCE.toml, COMPATIBILITY.md and helia/python/heliadsp/__init__.py together (RELEASING.md, “Changing the CMSIS-DSP pin”).

A new helia_* operation, or a new implementation of one, is admitted with:

  • A named workload, existing or anticipated: the use that needs the operation, and the sizes, types and layouts it is tested and measured at. An anticipated workload names its source, such as a widely used library or codec whose usage fixes those sizes; an existing Ambiq caller raises an operation’s priority but is not required. Before adding an operation, check whether the qualified CMSIS-DSP commit already provides it, and record what exists.
  • A reference implementation: portable C, written for the reader rather than for speed, that defines the operation’s correct output. It is the test oracle, not necessarily the implementation that runs where an optimized one cannot; helia/REFERENCE_POLICY.md states the rules for it. An optimized implementation is bit-exact against the reference on the test vectors, or states its tolerance and the measurement behind it before admission.
  • The contract, at the declaration: supported sizes, directions and types; data layout, packing and normalization; the size of every caller-owned buffer, with alignment, readable padding and permitted overlap; which buffers are modified; stack use; numerical domain and error; behaviour on invalid input. Storage is caller-owned; nothing allocates memory. helia/CONTRACTS.md lists the seven fields a family’s header states, from the provider-requirements table in helia-dsp issue #25; helia/include/helia/helia_dwt.h and Discrete wavelet transform state each of them for the wavelet transform.
  • Selection before the build: each variant is a named entry point, and no process or initialize function chooses among variants at run time. A run-time choice keeps every variant it can reach in the image; the generic real-FFT initializer’s 87.6 KB against 9.3 KB for one length is the measured cost of that pattern (see Measurements).
  • Tests: edge and tail sizes, state carried across calls, in-place use where the contract allows it, on the host and on the Corstone-300 simulator with guards around the buffers, with each supported compiler.
  • Silicon numbers: cycles, flash, RAM and stack on an Apollo510 EVB, each with its configuration (compiler and version, optimization level, clock mode, memory placement), against the CMSIS-DSP function or configuration a user would otherwise choose. Where a number is missing, the pull request says what was not measured.

Public headers are in helia/include/helia/ and sources in helia/src/. cmake/HeliaDspSources.cmake lists the sources and their compile options for both the CMake build (helia/CMakeLists.txt) and the Zephyr module (zephyr/CMakeLists.txt); the wavelet transform (helia/src/dwt/, reference) is the first operation and an example of the layout. Its named consumers are compressionKIT’s PPG codec (Coif5, 320 samples, six levels) and ECG codec (bior4.4, 512 samples, six levels).

A reviewer checks, for every pull request:

  • Each statement about speed, size or accuracy names its measurement and configuration. A statement such as “numerically unstable” or “faster” without a number is either measured or removed.
  • A new public build option or macro is documented with the other options.
  • The change is in the repository its contract belongs to.
  • Every header-affecting definition is a usage requirement of the library compiled with it, so that CMake applies it to every target that links the library.
  • The compiler used for each number is within the toolchain policy; a cycle count of the Helium FFT taken with GCC 15.2.Rel1 against a CMSIS-DSP commit without the write-back gather workaround measures miscompiled code.

From the repository root of a Git checkout with the submodule initialized:

Terminal window
python tools/qualification/build.py --toolchain host
python -m unittest discover -s tests/release -v

The first ends with 100% tests passed out of 3, the second with OK (see Verification). Changes to compiler policy or to code built for Cortex-M55 also need a cross build with --toolchain atfe or --toolchain gcc and --cmsis-core <CMSIS_6>/CMSIS/Core, where <CMSIS_6> is a checkout of ARM-software/CMSIS_6 at v6.2.0.