File dp_simd.h¶
Go to the source code of this file
doppler's own composite SIMD reductions, layered over jm_simd.h .More...
#include <stddef.h>#include "jm_simd.h"
Macros¶
| Type | Name |
|---|---|
| define | DP_SUMSQ_F32 (dst, ptr, n) /* multi line expression */Sum of squares: dst = Σ ptr[i]² for i in [0, n). |
Detailed Description¶
just-makeit ships the TIER primitives — JM_VEC_F32, JM_LOAD_F32, JM_FMA_F32, JM_HSUM_F32, JM_SIMD_WIDTH_F32 — one set per ISA (AVX-512 / AVX2 / NEON / scalar). Anything doppler builds ON those belongs here, in a header doppler owns.
That distinction is the whole reason this file exists. DP_SUMSQ_F32 lived in native/inc/jm_simd.h from bda43475 (the log-domain AGC) until it was lost, and the way it was lost is worth recording: jm's headers are create-only, so jm apply never rewrites them — which is exactly what let a local addition survive there for months, and exactly why nothing warned when the create-only migration (delete, re-apply, pick up the newer upstream file) discarded it. A local extension inside a vendored file is protected by nothing but the tool's reluctance to touch it.
It also carried the wrong namespace. JM_ belongs to just-makeit, and a future release is free to define JM_SUMSQ_F32 itself with different semantics or arity; this is doppler's primitive, so it is DP_.
Macro Definition Documentation¶
define DP_SUMSQ_F32¶
Sum of squares: dst = Σ ptr[i]² for i in [0, n).
The bulk runs JM_SIMD_WIDTH_F32-wide via FMA accumulation; the trailing n % JM_SIMD_WIDTH_F32 elements are summed scalar. When n is a multiple of the SIMD width the remainder loop has zero trips and folds away, leaving a pure vector reduction.
A macro rather than a function, and single-pointer rather than a dot product against itself: jm_dot_f32(a, a, n) would be undefined behaviour, because both of its parameters are JM_RESTRICT and passing one pointer to two restrict-qualified parameters tells the compiler the buffers do not overlap when they are the same buffer.
Parameters:
dstlvalue of type float — receives the sum.ptrconst float * — base of the contiguous input.nelement count (size_t-convertible).
The documentation for this class was generated from the following file native/inc/dp_simd.h