Skip to content

feat(wave): SIMD kernels for wave PDE update — host + ESP32-S3 PIE + Teensy 4 DSP (refs #3073 §7) #3097

Closed

Description

@zackees

Scope from #3073 §7.

Target

The 5-point stencil inner loop in WaveSimulation2D_Real::update() is a textbook SIMD candidate. Each lane reads 5 i16s, multiplies by Q15 constants, sums, clamps, stores. Trivially parallel across cells.

Platforms

Platform ISA Width Notes
Host (test runner + WASM) SSE2 / AVX2 / NEON 8× i16 Easy first target; immediate test infrastructure benefit
ESP32-S3 PIE (Xtensa SIMD) 8× i16 (128-bit) Codebase already has PIE infra — search EE_VADDS, xt_simd
Teensy 4 (Cortex-M7) ARMv7-M DSP 2× i16 per op __SADD16, __SSAT16, __SMLAD intrinsics
ESP32-P4 RVV (RISC-V Vector) variable Future target

Implementation strategy

  • Behind #ifdef per platform; scalar fallback otherwise.
  • Build on top of the §2 / §3 / §4 (#TBD) scalar improvements — those land first, SIMD layers on the cleaner baseline.
  • One translation unit per backend (e.g. wave_simulation_real_simd_neon.cpp.hpp).
  • Selection by platform macro in the dispatcher.

Acceptance

  • Parity check: SIMD output must equal scalar output bit-for-bit on each platform. Add a parity unit test (run scalar + SIMD on the same input, FL_CHECK_EQ per cell).
  • Microbench: confirm the speedup. WaveFx is one of the heavier Fx2d effects and is regularly run at 4×/8× super-sample on ESP32-S3, so the wins should be felt at end-user frame rates.

Why this is the last item

  • Largest diff of the §1–§7 set.
  • Should land after §2/§3/§4 stabilize the scalar kernel, so the SIMD backends don't have to re-implement perf fixes.
  • Each platform backend is independent — can ship one at a time.

Refs: #3073 §7.

Activity

  1. zackees commented on Jun 15, 2026

    @zackees
    MemberAuthor

    Parent meta: #3098. Should land after the scalar-kernel improvements in #3092 / #3093 / #3094 stabilize.

  2. zackees commented on Jun 15, 2026

    @zackees
    MemberAuthor

    Closing in favor of three focused per-backend follow-up issues, each independently scoped and mergeable:

    This split matches the issue body's own "per-platform #ifdef gates" recommendation. The scalar baseline that all three SIMD paths target is now optimal — §2 (#3099), §3 (#3101), §4 (#3103), §6 (#3105) are all merged on master, and §5 (#3104) added the 9-point Laplacian opt-in. Closing this umbrella so progress on the platform-specific work is tracked per-backend.

    Parent meta: #3098 (updated to mark §7 as deferred-with-followups).

  3. moved this from Triage to Done in FastLED Trackeron Jun 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions