Repository navigation
Description
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:
- Remove the unconditional call from
AutoResearch.inosetup() (line 331-334). - Keep
runSimdTests()itself as a regular function (no behavior change). - The existing
testSimdRPC handler remains the canonical invocation path. - 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 asFL_BENCH_WAVE8_AT_BOOTfrom 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:
- Boot tax for users running AutoResearch as a normal tool (~50–100 ms + log noise on every boot).
- The RPC is the real validation rail; if the RPC routing breaks (see bug(esp32p4): testSimd RPC write-timeout — Serial routes to UART0 instead of USB-Serial-JTAG #2541), boot-time output is a one-way debug aid, not a validation contract.
- Consistency: with perf(wave8): byte-indexed expansion LUT (#2526) — 1.66x on ESP32-P4 #2539 merged, the example will have a mix of "runs at boot" and "RPC-only" benchmarks. Standardizing on RPC-only (with optional
#ifdefbridges) keeps the example predictable.
Touchpoints
examples/AutoResearch/AutoResearch.ino— remove the unconditional call around line 331.examples/AutoResearch/AutoResearchSimd.h::runSimdTests()— keep as-is.examples/AutoResearch/AutoResearchRemote.cpp—testSimdRPC 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
refactor(autoresearch): gate runSimdTests() behind FL_RUN_SIMD_TESTS_…