Skip to content

v16.6 — Every Arm SIMD backend now runs in CI

Choose a tag to compare

@danmcleran danmcleran released this 07 Nov 22:56
· 56 commits to master since this release
7ec4fdb

v16.6 — Every Arm SIMD backend now runs in CI

Until this release, six of tinymind's Arm SIMD backends (NEON, NEON dot product, NEON fp16, SVE, Helium MVE-I and MVE-F) had never executed anywhere: no CI host could run them, so they were compiled at most. Every one of them now runs on every pull request, as a required check, against the scalar reference. Doing that turned up one backend that did not compile and one that no build could ever select.

Library changes

  • SVE is now selectable (#243). The SVE gate requires the NEON gate, and the dispatcher tested NEON first, so no build could ever reach the SVE backend. SVE now heads the Arm order: SVE > NEON_DOTPROD > NEON > HELIUM_MVE_I > ARM_DSP > scalar. Behaviour change: a build that sets both TINYMIND_ENABLE_SIMD_NEON and TINYMIND_ENABLE_SIMD_SVE now dispatches to sve where it used to get neon or neon_dotprod, and activeBackendName() reports it. Results are unchanged: every integer backend is bit-exact with the scalar reference.
  • The Helium MVE-F backend compiles (#245). simd_helium_mve_f.hpp reduced its accumulator with vaddvq_f32, which does not exist (MVE has no floating-point add-across-vector instruction), so any build with TINYMIND_ENABLE_SIMD_HELIUM_MVE_F=1 failed under both GCC and Clang. It now sums the four lanes in a fixed order, (l0 + l1) + (l2 + l3).

Verification

  • Arm A-profile backends on an arm64 runner (#241, #243). New required CI job "Arm SIMD backends (aarch64)" (make check-simd-arm) on GitHub's Neoverse N2 runner. The int8 suites and the golden-output examples run under ASan+UBSan with layers dispatched to NEON, to NEON dot product and to SVE; the dot-product configuration is also built with Clang. Every compiled-in backend is also called directly against the scalar reference at every lane (45.7 million calls each) and at every length 0–300 from every buffer offset 0–15; NEON fp16 is checked against a model of its own arithmetic. SVE additionally runs under qemu-aarch64 at 128-, 256-, 512- and 2048-bit vectors, including the whole quantization suite, because vector-length-agnostic code has to be right at lengths the hardware does not have. All backends were correct.
  • Helium backends on an emulated Cortex-M55 (#245). New required CI job "Helium backends on emulated Cortex-M55" (make -C unit_test/embedded helium_qemu) on QEMU's mps3-an547. MVE-I is bit-exact with the scalar reference for every (x, w, zero point) in each lane of a 16-lane vector, every length 0–80 at every misalignment, and through QPointwiseConv2D, QConv2DPerChannel and QDense end to end: 268.6 million cases, 0 mismatches. MVE-F is bit-exact against a model of its lane arithmetic. GCC and Clang images, plus a UBSan trap-mode image of each. The SMLAD test it shares moved from unit_test/embedded/arm_dsp/ to qemu_m/.
  • Each new gate was shown to fail. Planted defects were each reported: NEON switched off, a dropped tail element in neon_dotprod, an SVE stride fixed at 16 bytes (passes at 128 bits, caught at 256), the old SVE dispatch order, an unpredicated MVE-I or MVE-F tail, a flipped MVE-I zero-point sign, a different MVE-F lane reduction order (1 ULP, caught only by the lane model), and the Helium dispatch branch disabled.
  • CBMC equivalence proof of the SMLAD dot product (#240, opt-in). make -C unit_test/formal/arm_dsp_dot proves arm_dsp::int8DotWithZeroPoint equals the scalar reference for every input at lengths 0–8, with misaligned buffers and a big-endian memory model, and the absence of out-of-bounds access, signed overflow and undefined shifts. Four planted defects must each be caught. Needs Bitwuzla, so it is not part of CI.

Examples

  • Weight initialisation is seeded explicitly (#236). Eleven examples built their network at namespace scope, so its initial weights were drawn before main() called srand(), from glibc's default seed. Each now seeds the weights explicitly (WEIGHT_INIT_SEED = 1) before building the network, then seeds everything else as before. Every output is byte-identical.
  • Initial weights stay in range at 8- and 16-bit storage (#239). Thirteen examples cast rand() to the storage type before taking the modulo, which at Q8.8 put initial weights as low as -322 against an intended minimum of -128. The cast now applies to the finished value. Every shipped configuration that uses these weights is Q16.16, where the old cast was harmless, so outputs are unchanged; if you copied one of these generators into an 8- or 16-bit build, apply the same fix. Found by the tinymind-rs port.
  • kan_xor --dense no longer reports a false failure (#236). It classified 1597 of 1600 grid points correctly but failed an MSE threshold that a step-shaped target makes unreachable. Dense mode is now judged by classification.
  • Stale sample output and run instructions refreshed (#237).

Project

  • SECURITY.md added and GitHub private vulnerability reporting enabled; CodeQL's write permission is scoped to its own job (#238). OpenSSF Scorecard 7.9 → 8.6.

Documentation, architecture guides, and example gallery: https://danmcleran.github.io/tinymind/

Full changelog: v16.5...v16.6