Skip to content

refactor(autoresearch): move runSimdTests() out of setup() — RPC-only invocation #2542

Closed

Description

@zackees

Problem

autoresearch::simd_check::runSimdTests() is currently called unconditionally at boot from examples/AutoResearch/AutoResearch.ino:331:

int simd_failures = autoresearch::simd_check::runSimdTests();
if (simd_failures > 0) {
    FL_ERROR("SIMD autoresearch failed - " << simd_failures << " test(s) failed");
}

This runs ~85 SIMD tests on every boot of the AutoResearch example on every ESP32 variant — taking ~50–100 ms of CPU and producing a long log dump that anyone using AutoResearch as the actual LED autoresearch tool has to sit through. It's the same anti-pattern that PR #2539 just fixed for the wave8 expansion bench: validation/measurement code in a production example's boot path.

There's already a working testSimd RPC handler (AutoResearchRemote.cpp:1578) that invokes the same tests on demand. So the suite is already RPC-callable — the boot-time invocation is just redundant work.

Proposal

Apply the same pattern as PR #2539's wave8ExpandBenchmark:

  1. Remove the unconditional call from AutoResearch.ino setup() (line 331-334).
  2. Keep runSimdTests() itself as a regular function (no behavior change).
  3. The existing testSimd RPC handler remains the canonical invocation path.
  4. If a boot-time bridge is desired (until bug(esp32p4): testSimd RPC write-timeout — Serial routes to UART0 instead of USB-Serial-JTAG #2541 routing is fixed), gate it behind #ifdef FL_RUN_SIMD_TESTS_AT_BOOT (off by default) — same shape as FL_BENCH_WAVE8_AT_BOOT from perf(wave8): byte-indexed expansion LUT (#2526) — 1.66x on ESP32-P4 #2539.

Rationale (per @zackees on PR #2539)

"this should be function that's invoked via the rpc but otherwise not computed"

Same reasoning applies here:

Touchpoints

  • examples/AutoResearch/AutoResearch.ino — remove the unconditional call around line 331.
  • examples/AutoResearch/AutoResearchSimd.h::runSimdTests() — keep as-is.
  • examples/AutoResearch/AutoResearchRemote.cpp — testSimd RPC handler stays.

Refs PR #2539 (the precedent + pattern), #2541 (RPC routing fix that makes RPC-only fully usable on P4), #2540 (FL_PRINT migration).

Activity

  1. added a commit that references this issue on May 31, 2026
    fe8120c
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

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions