Skip to content

feat(wave): host SIMD backend for 2D wave PDE update kernel — SSE2/AVX2/NEON (split from #3097) #3106

Open

Description

@zackees

Split from the now-closed §7 umbrella (#3097). Sub-task of meta #3098.

Target

Host build (test runner + WASM). Implement a SIMD path for the inner loop of WaveSimulation2D_Real::update() using:

  • SSE2 for x86-64 (universally available).
  • AVX2 for newer x86-64 (__AVX2__ guard).
  • NEON for arm64 (__ARM_NEON).

Lane width: 8× i16 per iteration (128-bit SSE2/NEON), 16× i16 for AVX2.

Approach

  • New TU: src/fl/math/wave/wave_simulation_real_simd_host.cpp.hpp (included only when a host SIMD target is detected).
  • Add a WaveSimulation2D_Real::updateSIMD() private path; update() dispatches to it when available.
  • Parity test in tests/fl/math/wave/wave_simulation_real.cpp: run scalar + SIMD on the same grid, FL_CHECK_EQ per cell.
  • Microbench: cycle counts on a 64×64 grid before/after.

Acceptance

  • SIMD output bit-equal to scalar output on the host build.
  • Existing test suite continues to pass.
  • Microbench shows measurable speedup (target: 4–8× on AVX2).

Parent meta: #3098
History: split from #3097

Activity

  1. zackees commented on Jun 15, 2026

    @zackees
    MemberAuthor

    Hold this work until #3111 lands.

    #3111 is researching whether super-sample (the primary motivator for SIMD throughput on this kernel) should be replaced wholesale by an algorithmic alternative (screen-space anti-aliasing + higher-order stencils, spectral methods, LBM, procedural waves, etc.). If the research lands on a 10×+ algorithmic win, we'd be writing SIMD for the wrong kernel.

    Resume here once #3111 has produced its recommendation document and the FastLED-3098-family scalar kernel is confirmed as the long-term path.

  2. zackees commented on Jun 15, 2026

    @zackees
    MemberAuthor

    Now tracked under parent meta #3113 (Wave2D perf pipeline). The hold for this SIMD sub-issue stays in place — the meta gates SIMD on first landing the perf benchmark (#3113 Task 1) and the algorithmic candidates from the #3112 research doc.

  3. zackees commented on Aug 20, 2026

    @zackees
    MemberAuthor

    Burn-down disposition: DEFER ? this remains intentionally gated work, not a ready implementation issue.

    Current evidence:

    Restart criteria:

    1. Capture and commit trusted --perf-wave2d baselines, including host scalar FivePoint/NinePoint results and the target embedded platforms from [meta] Wave2D perf pipeline — autoresearch benchmark + sanity calibration + PSRAM storage + algorithmic follow-ups #3113.
    2. Land/evaluate at least the compact O(h?) and one other top algorithmic candidate, then explicitly retain the scalar PDE kernel as a long-term hot path.
    3. Add a host microbenchmark that can report scalar vs SSE2 vs AVX2/NEON on identical 64?64 inputs.
    4. Implement through fl::simd, with scalar fallback and bit-for-bit parity across saturation/boundary/stencil cases.
    5. Require a reproducible material speedup on each enabled ISA; otherwise close as not worthwhile rather than carrying dispatch complexity.

    This preserves the parent meta's sequencing decision and prevents premature optimization of a potentially superseded kernel.

  4. added
    deferred
    on Aug 20, 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

    deferred

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions