Add dot_row_reversed: the symmetric-table kernel (+ SMLALDX Q15 path) - #6
Merged
Conversation
y = sum_t hist[t] * row[taps-1-t] with the history walked forward — the kernel a linear-phase polyphase table halved by symmetry needs: branch p of a symmetric prototype is branch L-1-p read in reverse, so mirrored branches dot the STORED row backward and the halving costs storage only (RatioTap M7 campaign, lever 3; lands here first per the family's substrate discipline). Bit-exactness contract, pinned by the new typed parity test: identical bits to dot_row against the materialized mirrored row for every sample type — the t-th product and the ascending-t accumulation order are the same, float's fixed double accumulation included. On DSP-extension Arm cores (M33/M4/M7 class) the Q15 path uses the swapped-lane dual MAC (SMLALDX): the row pair loaded at taps-2-t packs the two coefficients in cross order, and each 16x16 product is exact in int32 with associative int64 accumulation, so pairing changes no output bit. Compile-smoked for cortex-m33 (intrinsic path) and cortex-m55 (MVE gate off). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Ldeq57sBySx2nFTQsGcQB6
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
One new kernel in
tap/dsp/fir_kernels.h:history walked forward, coefficient row read tap-reversed. This is the kernel a linear-phase polyphase table halved by symmetry needs: branch
pof a symmetric prototype is branchL−1−pread in reverse, so the mirrored branches dot the stored row backward and the halving costs storage only. It lands here first per the substrate discipline — the consumer is RatioTap's M7 campaign, lever 3 (polyphase symmetry storage halving), and SampleRateTap can adopt the same structure later if it wants the bytes.Bit-exactness contract
Pinned by the new typed parity test (
ReversedMatchesMaterializedMirrorBitExact, float/Q15/Q31 × taps ∈ {44, 48, 33, 1, 2}): identical bits todot_rowagainst the materialized mirrored row — the t-th product and the ascending-t accumulation order are the same, float's fixed double accumulation included, single finalize.On DSP-extension Arm cores (M33/M4/M7 class, same gate as
dot_row's SMLALD path) the Q15 loop uses the swapped-lane dual MAC (SMLALDX): one 32-bit load per pair on each side — the row load attaps−2−tpacks the two coefficients in cross order, and SMLALDX's lo×hi + hi×lo pairing is exactly the reversed walk. Each 16×16 product is exact in int32 and the int64 accumulation is associative, so pairing changes no output bit.Verification
-Werror -Wconversionbuild also clean).-mcpu=cortex-m33, intrinsic path active) and cortex-m55 (MVE gate correctly disables the intrinsic).🤖 Generated with Claude Code
https://claude.ai/code/session_01Ldeq57sBySx2nFTQsGcQB6
Generated by Claude Code