Repository navigation
feat(simd/arm-dsp): wire scale/blend/mullo DSP ops (closes #3425 yellow) - #3427
Conversation
Completes the 🟡 ops checklist from #3425. Each promoted from scalar fallback to Cortex-M DSP-ext intrinsics, validated one-at-a-time via the device-side SIMD self-test (85/85 passing after each). - **scale_u8_16** -- UXTB16 splits the 4 bytes into two halfword pairs (0:a2,0:a0) and (0:a3,0:a1). Each pair × `scale` is a single u32 mul -- safe because each halfword product byte*scale fits in u16 (255*255 = 65025 < 65536), so lanes don't interfere. Extract the high byte of each halfword (= scale8 result) via shift + mask. 7 ops per 4-byte chunk (28 ops for u8x16) vs the 16-iter widening scalar loop. - **blend_u8_16** -- per-byte lerp via the additive identity `a + scale(pos_diff,amount) - scale(neg_diff,amount)` where pos_diff = UQSUB8(b,a) and neg_diff = UQSUB8(a,b) are always mutually exclusive per lane. Saturating add/sub composes the per-lane bytes back. Bit-exact against noop at amount=0; within ±1 LSB at mid-amount (vs noop's signed-shift two-complement rounding) -- AutoResearchSimd.h's blend test allows ±2 LSB which this satisfies. - **mullo_u16_8** -- per-halfword-pair via SMULBB+SMULTT (low/high signed 16x16 -> 32, sign-agnostic because we keep low 16 only) + PKHBT to re-pack. 3 ops per halfword pair (12 ops total) vs the 8-iter LDRH+MUL+STRH scalar loop. All four `fl_dsp_*` helpers (scale_u8x4, blend_u8x4, mullo_u16x2, plus prior UXTB16/PKHBT/PKHTB/USAT16/SEL helpers) inlined and verified to produce the expected DSP instruction sequences under `-O2 -fno-omit-frame-pointer` (Teensyduino default). Verification: `bash autoresearch teensy40 --simd --skip-lint` reports 85/85 SIMD tests passing after each individual op was added (per-op flow per #3425). Compile + lint clean. Closes #3425. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughAdds three ARMv7E-M DSP inline-assembly helpers ( ChangesARM DSP SIMD Acceleration
Estimated code review effort🎯 4 (Complex) | ⏱️ ~40 minutes Possibly related issues
Possibly related PRs
Poem
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Summary
Completes the 🟡 ops checklist from #3425 (the 🟢 portion landed in PR #3426). Each op promoted from scalar fallback to Cortex-M DSP-ext intrinsics in `src/platforms/arm/teensy/simd_arm_dsp.hpp`, validated one-at-a-time via `bash autoresearch teensy40 --simd` (85/85 passing after each).
Ops landed
Bit-exactness notes
Test plan
Closes
🤖 Generated with Claude Code
Summary by CodeRabbit