Repository navigation
ltpf: add Arm Helium (MVE) SIMD backend - #90
Conversation
Add an M-Profile Vector Extension (MVE) backend for the LTPF pitch-detection hotspot, mirroring the existing NEON and Arm-DSP backends. `dot` / `correlate` use vmlaldavaq_s16 (8-lane int16 -> int64 multiply-accumulate); the integer sum and the (v + 32) >> 6 rounding match the scalar reference exactly, so the output is bit-exact. The header is guarded by `#if (__ARM_FEATURE_MVE & 1)` and is inert on non-MVE targets, so existing scalar / NEON / DSP builds are unchanged. Measured on-device (Cortex-M55 @197 MHz, 16 kHz mono LC3 encode): - LTPF correlate: 15105 -> 8370 cyc/frame (about -44%) - encoder output bit-exact vs the scalar path (FNV-1a checksum identical) Signed-off-by: zhangyi101 <zhangyi101@xiaomi.com>
|
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
Add host coverage for the LTPF Arm Helium (MVE) backend, mirroring the existing `test/arm` and `test/neon` suites. Previously the MVE `dot` / `correlate` paths had no automated coverage: the reference tests run the scalar path on x86, and only ARM and NEON had backend unit tests. `test/mve/mve.h` provides a small host emulation of the two intrinsics used by the backend (`vldrhq_s16`, `vmlaldavaq_s16`), matching the `test/neon/neon.h` and `test/arm/simd32.h` approach, so the backend compiles and runs on the CI host. `test/mve/ltpf_mve.c` compiles `ltpf.c` with `TEST_MVE` defined and checks `mve_dot` / `mve_correlate` against the scalar reference for bit-exactness. `ltpf_mve.h` gains a `TEST_MVE` hook (guard opt-in and the `dot` / `correlate` overrides wrapped in `#ifndef TEST_MVE`) so both the scalar and MVE versions are visible to the test, and so the MVE backend stays inert while the ARM / NEON tests build. Signed-off-by: zhangyi101 <zhangyi101@xiaomi.com>
|
Friendly ping @hchataing @zxzxwu — the CI and pypi workflow runs for this PR were created but never executed: they stayed in "waiting for approval".
To check the changes independently, I ran the same workflows on my fork at the PR head commit So the build and test status is verified for this change; what remains is maintainer approval to run CI on the PR itself. Could a maintainer approve or re-run the workflows? Happy to address any review comments in the meantime. Thanks! |
|
|
||
| #endif /* dot */ | ||
|
|
||
| /** |
There was a problem hiding this comment.
Do you need to override the implementation of correlate? The default implementation in ltpf.c has the same body.
There was a problem hiding this comment.
I Removed it and put the loop in the test.
|
The change is ok, just added a couple of questions. |
The MVE `correlate` override duplicates the default in ltpf.c: in an MVE build `dot` is already aliased to `mve_dot`, so the default `correlate` body calls the MVE kernel anyway. Drop the override and keep only the `dot` backend. Move the reference loop into test/mve/ltpf_mve.c so the host test still checks the MVE dot against the scalar path.
|
@hchataing, thanks for your review . |
|
Thanks for checking.
|
|
Get it. Added the rationale to the mve_dot doc comment:
|
Summary
Add an M-Profile Vector Extension (MVE / Arm Helium) backend for the LTPF pitch-detection hotspot, mirroring the existing NEON and Arm-DSP backends.
dot/correlateusevmlaldavaq_s16(8-lane int16 -> int64 multiply-accumulate). The integer sum and the(v + 32) >> 6rounding match the scalar reference exactly, so the output is bit-exact.The header is guarded by
#if (__ARM_FEATURE_MVE & 1)and is inert on non-MVE targets, so existing scalar / NEON / DSP builds are unchanged.Measurements
On-device (Cortex-M55 @197 MHz, 16 kHz mono LC3 encode):
correlate: 15105 -> 8370 cyc/frame (~ -44%)Testing
make testpasses locally.