Skip to content

perf(wave8): byte-indexed expansion LUT (#2526) — 1.66x on ESP32-P4 - #2539

Merged
zackees merged 2 commits into
masterfrom
feat/wave8-byte-lut
May 29, 2026
Merged

zackees merged 2 commits into
masterfrom
feat/wave8-byte-lut

Conversation

@zackees

@zackees zackees commented May 29, 2026 •

Copy link
Copy Markdown
Member

Summary

Implements the byte-indexed expansion LUT proposed in #2526 — the "wider lookups, fewer stores" strategy from the deep-dive comment. Replaces the two nibble lookups in the hot PARLIO encode path with a single indexed 8-byte copy, same bit-exact output, ~half the per-byte index work.

Why this works

Expansion runs 16 lanes × 768 byte-positions = 12,288×/frame and was dominated by index arithmetic + issue width on the in-order RV32 core, not memory bandwidth. Cutting the per-byte instruction count from ~11 to ~6 (no >>4/mask, no second index, single 8-byte load/store pair) is the right shape for that bottleneck — same independent-ops lesson that made the spread-LUT transpose win on this core.

Changes

  • Wave8ByteExpansionLut (256×8 = 2 KB) + buildWave8ByteExpansionLUT(nibble) builder.
  • detail::wave8_expand_byte() — single indexed 8-byte copy, FORCE_INLINE FL_IRAM.
  • Byte-LUT overloads of wave8Transpose_{2,4,8,16}; PARLIO engine holds mWave8ByteLut alongside mWave8Lut and routes all 5 hot expansion call sites through it (single-lane + 2/4/8/16-lane multi-lane).
  • Host equivalence test: buildWave8ByteExpansionLUT_matches_nibble_path checks all 256 input bytes are bit-identical to the nibble path.
  • Boot-time micro-bench in AutoResearch (AutoResearchWave8Expand.h) prints via esp_rom_printf → USB-Serial-JTAG console so results are capturable on COM25 without the broken testSimd RPC (see feat(esp32-p4): add PIE (xesppie) SIMD backend to fl::simd #2536/feat(esp32-p4): PIE (xesppie) SIMD backend Tier-1 ops (#2536) #2538).

Measured on real ESP32-P4 (revision v1.3)

iters=30000  nibble_us=350170 byte_us=210419 batched_us=198682
frame_equiv_us  nibble=8964 byte=5386 batched=5086
speedup_x100    byte_vs_nibble=166  batched_vs_nibble=176
  • Byte-LUT: 1.66× (40% time reduction)
  • Batched byte-LUT: 1.76× (43% time reduction)

At expansion ~55% of encode, this predicts ~1.28× full encode_us — matching the prediction posted on #2526.

Test plan

  • Host: bash test wave8 --cpp (all wave8 tests including new equivalence test pass)
  • Host: bash test parlio_driver --cpp (parlio path still passes)
  • Lint: bash lint --cpp clean (incl. the strict NativePlatformDefinesChecker / UsingNamespaceFlInExamplesChecker)
  • Device: builds + flashes + boots on ESP32-P4 via PlatformIO (bash autoresearch esp32p4 --simd --no-fbuild)
  • Device: BENCH_EXPAND numbers captured on COM25 boot (1.66×/1.76× as above)

Refs #2526, #2524 (umbrella), #2533 (spread-LUT transpose precedent), #2538 (P4 PIE backend / serial-routing context for the bench output workaround)

Summary by CodeRabbit

  • New Features

    • Added an on-device Wave8 performance benchmark for ESP32, accessible at boot (optional) and via a new remote RPC, reporting multiple expansion/transpose timings.
  • Refactor

    • Introduced a byte-indexed expansion path and precomputed lookup to speed up Wave8 encoding; runtime engine now uses the faster path for clockless output.
  • Tests

    • Added unit tests validating byte-indexed expansion matches the previous nibble-based output.

Review Change Stack

Adds a 256x8 byte-indexed expansion LUT (Wave8ByteExpansionLut, 2 KB) and a
single-lookup expansion primitive (wave8_expand_byte) that replaces the two
nibble lookups in the hot PARLIO encode path. Same bit-exact output, ~half the
per-byte index work — which is the bottleneck because expansion is
instruction-issue-bound on the in-order RV32 core, not memory-bandwidth-bound.

Integration:
- New Wave8ByteExpansionLut type and buildWave8ByteExpansionLUT(nibble) builder.
- detail::wave8_expand_byte(b, byteLut, *out): one indexed 8-byte copy.
- Byte-LUT overloads of wave8Transpose_2/4/8/16; the PARLIO engine now holds
  mWave8ByteLut alongside mWave8Lut and routes all 5 hot expansion call sites
  through it (single-lane + 2/4/8/16-lane multi-lane).
- Host test buildWave8ByteExpansionLUT_matches_nibble_path verifies bit-exact
  equivalence across all 256 input bytes.

Measured on a real ESP32-P4 (revision v1.3) via a boot-time micro-bench in
AutoResearch.ino (output via esp_rom_printf -> USB-Serial-JTAG console to
sidestep the testSimd RPC's UART0 routing block; see #2536/#2538):

  iters=30000 (= 480,000 expansions per measurement)
  nibble_us=350170  byte_us=210419  batched_us=198682
  frame_equiv (768 byte-positions): nibble=8964us byte=5386us batched=5086us
  speedup vs nibble: byte=1.66x  batched=1.76x

At expansion ~55% of encode, the 1.66x expansion speedup predicts ~1.28x on
full encode_us — matching the prediction posted on #2526.

Co-Authored-By: Claude Opus 4.7 <[email protected]>
@coderabbitai

coderabbitai Bot commented May 29, 2026 •

Copy link
Copy Markdown
📝 Walkthrough

Walkthrough

This PR introduces a byte-indexed Wave8 expansion lookup table optimization for faster LED timing waveform encoding on ESP32. It adds a new Wave8ByteExpansionLut type, a builder function, a direct-lookup expansion helper, updates transpose functions to use the byte path, integrates into the Parlio engine, and includes validation testing and benchmarking infrastructure.

Changes

Wave8 Byte Expansion Path

Layer / File(s) Summary
Byte-indexed LUT type and builder contract
src/fl/channels/wave8.h
Introduces Wave8ByteExpansionLut struct mapping all 256 byte values directly to their 8-symbol waveforms, and declares buildWave8ByteExpansionLUT builder function to derive this from the existing nibble-based LUT.
Builder and expansion helper implementation
src/fl/channels/wave8.cpp.hpp, src/fl/channels/detail/wave8.hpp
Implements buildWave8ByteExpansionLUT by combining high/low-nibble entries into byte-indexed LUT slots, and adds wave8_expand_byte helper for efficient single-byte expansion using direct lookup and ISR-optimized 32-bit memcpy.
Transpose functions refactored for byte-indexed LUT
src/fl/channels/wave8.h, src/fl/channels/wave8.cpp.hpp
Updates wave8Transpose_2/4/8/16 signatures to accept Wave8ByteExpansionLut and uses wave8_expand_byte for per-lane byte expansion before calling existing transpose helpers.
Parlio engine byte-LUT integration
src/platforms/esp/32/drivers/parlio/parlio_engine.h, src/platforms/esp/32/drivers/parlio/parlio_engine.cpp.hpp
Adds private mWave8ByteLut member, builds it during initialization from mWave8Lut, and updates single-lane and multi-lane Wave8 clockless encode paths to use the byte-indexed LUT.
Correctness test for byte vs. nibble paths
tests/fl/channels/wave8.cpp
Adds test validating all 256 input bytes produce bit-identical symbol output via byte-indexed LUT compared to the nibble-based reference path.
Wave8 expand micro-benchmark & example RPC
examples/AutoResearch/AutoResearchWave8Expand.h, examples/AutoResearch/AutoResearch.ino, examples/AutoResearch/AutoResearchRemote.cpp
Implements ESP32-only benchmark measuring three expansion variants and two transpose variants, prints ROM output, adds boot-time conditional run in the example, and exposes wave8ExpandBenchmark RPC with optional iterations.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related issues

  • FastLED/FastLED#2526: Directly implements the byte-indexed Wave8 expansion optimization path described in this optimization tracking issue.
  • FastLED/FastLED#2524: The PR's wave8_expand_byte and byte-indexed LUT address the LUT expansion optimization objective outlined here.
  • FastLED/FastLED#2525: Related as the PR introduces byte-indexed LUT expansion and updates the same transpose code paths that are discussed as optimization candidates.

Poem

🐰 A nibble walks into a bar,
A byte says "I'm twice as far!"
With LUTs prebuilt and lookups clean,
Wave8 shines brighter than it's been.
— The FastLED Hare 🌊✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 43.48% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely summarizes the main change: introducing a byte-indexed expansion LUT for Wave8 that achieves a 1.66x performance improvement on ESP32-P4, which is the core objective of the changeset.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/wave8-byte-lut

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (2)
examples/AutoResearch/AutoResearch.ino (1)

334-335: ⚡ Quick win

Gate the boot-time benchmark behind an opt-in flag.

This now runs on every AutoResearch boot before the harness reports ready. That adds avoidable startup time and extra benchmark output to normal validation runs, even when nobody is collecting perf numbers.

Suggested change
-    // `#2526` expansion micro-bench: prints via esp_rom_printf -> USB-JTAG console.
-    autoresearch::wave8_bench::runWave8ExpandBenchmark();
+    // `#2526` expansion micro-bench: enable only for explicit perf captures.
+    `#if` defined(FASTLED_RUN_WAVE8_EXPAND_BENCH)
+    autoresearch::wave8_bench::runWave8ExpandBenchmark();
+    `#endif`
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@examples/AutoResearch/AutoResearch.ino` around lines 334 - 335, Wrap the
boot-time benchmark call autoresearch::wave8_bench::runWave8ExpandBenchmark()
behind an opt-in flag so it does not run on every boot; add a configurable check
(e.g., a bool config flag or compile-time define like enable_wave8_bench) and
only invoke runWave8ExpandBenchmark() when that flag is true (check the flag in
AutoResearch.ino before calling the function), thereby preserving current
startup behavior unless explicitly enabled.
tests/fl/channels/wave8.cpp (1)

81-101: ⚡ Quick win

Add coverage for the new byte-LUT transpose overloads.

This only validates the helper-level expansion equivalence. It does not exercise the new public wave8Transpose_{2,4,8,16}(..., const Wave8ByteExpansionLut&, ...) overloads that the hot PARLIO path now calls, so a bad overload wiring or lane-order regression would still slip through.

Suggested follow-up
+FL_TEST_CASE("wave8 byte-LUT transpose overloads match nibble-LUT overloads") {
+    ChipsetTiming timing;
+    timing.T1 = 250;
+    timing.T2 = 500;
+    timing.T3 = 250;
+
+    Wave8BitExpansionLut nibble = buildWave8ExpansionLUT(timing);
+    Wave8ByteExpansionLut byte_lut = buildWave8ByteExpansionLUT(nibble);
+
+    {
+        uint8_t lanes[2] = {0x3C, 0xA5};
+        uint8_t exp[2 * sizeof(Wave8Byte)];
+        uint8_t got[2 * sizeof(Wave8Byte)];
+        wave8Transpose_2(lanes, nibble, exp);
+        wave8Transpose_2(lanes, byte_lut, got);
+        for (int i = 0; i < static_cast<int>(sizeof(exp)); ++i) FL_REQUIRE(got[i] == exp[i]);
+    }
+
+    // Repeat the same pattern for 4/8/16 lanes with mixed lane values.
+}
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@tests/fl/channels/wave8.cpp` around lines 81 - 101, The test only checks
helper-level expansion equivalence but doesn't exercise the public overloads
wave8Transpose_2/4/8/16 that accept a const Wave8ByteExpansionLut&, so add test
coverage that calls each public transpose overload with the byteLut you already
build (Wave8ByteExpansionLut byteLut = buildWave8ByteExpansionLUT(nibble)) and
validate outputs against the nibble-based path; for each b in 0..255, produce
the expected transposed output by using the existing nibble expansion helpers
(detail::wave8_convert_byte_to_wave8byte / detail::wave8_expand_byte or the
public nibble-based transpose overloads) and then call wave8Transpose_2(...,
byteLut, ...), wave8Transpose_4(..., byteLut, ...), wave8Transpose_8(...,
byteLut, ...), wave8Transpose_16(..., byteLut, ...) comparing
returned/transposed buffers element-wise to ensure lane-order and wiring match.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@examples/AutoResearch/AutoResearch.ino`:
- Around line 334-335: Wrap the boot-time benchmark call
autoresearch::wave8_bench::runWave8ExpandBenchmark() behind an opt-in flag so it
does not run on every boot; add a configurable check (e.g., a bool config flag
or compile-time define like enable_wave8_bench) and only invoke
runWave8ExpandBenchmark() when that flag is true (check the flag in
AutoResearch.ino before calling the function), thereby preserving current
startup behavior unless explicitly enabled.

In `@tests/fl/channels/wave8.cpp`:
- Around line 81-101: The test only checks helper-level expansion equivalence
but doesn't exercise the public overloads wave8Transpose_2/4/8/16 that accept a
const Wave8ByteExpansionLut&, so add test coverage that calls each public
transpose overload with the byteLut you already build (Wave8ByteExpansionLut
byteLut = buildWave8ByteExpansionLUT(nibble)) and validate outputs against the
nibble-based path; for each b in 0..255, produce the expected transposed output
by using the existing nibble expansion helpers
(detail::wave8_convert_byte_to_wave8byte / detail::wave8_expand_byte or the
public nibble-based transpose overloads) and then call wave8Transpose_2(...,
byteLut, ...), wave8Transpose_4(..., byteLut, ...), wave8Transpose_8(...,
byteLut, ...), wave8Transpose_16(..., byteLut, ...) comparing
returned/transposed buffers element-wise to ensure lane-order and wiring match.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: c5ae5c0a-f4bc-4378-b161-8311cec306fb

📥 Commits

Reviewing files that changed from the base of the PR and between 1211c98 and 2efcdf1.

📒 Files selected for processing (8)
  • examples/AutoResearch/AutoResearch.ino
  • examples/AutoResearch/AutoResearchWave8Expand.h
  • src/fl/channels/detail/wave8.hpp
  • src/fl/channels/wave8.cpp.hpp
  • src/fl/channels/wave8.h
  • src/platforms/esp/32/drivers/parlio/parlio_engine.cpp.hpp
  • src/platforms/esp/32/drivers/parlio/parlio_engine.h
  • tests/fl/channels/wave8.cpp

…anspose16 timing

Addresses review feedback on PR #2539:
- Boot-time call removed by default; behind -DFL_BENCH_WAVE8_AT_BOOT=1 only.
- Registers wave8ExpandBenchmark RPC handler (returns JSON via the RPC server).
- Split into a pure measureWave8Expand() compute function + an optional
  esp_rom_printf print helper; the RPC path serializes the struct directly.
- Adds full per-byte-position production timing (wave8Transpose_16 with both
  LUTs), not just isolated expansion — this is what the engine actually pays
  in the hot loop x 768 byte-positions/frame.

Measured on ESP32-P4 v1.3 (boot-time bridge until #2541 routing fix):
  expand_only_us         nibble=350142  byte=210155  batched=206528
  transpose16_us         nibble=530115  byte=344128
  frame_equiv_us (768)   expand_nibble=8963  expand_byte=5379
                         t16_nibble=13570    t16_byte=8809
  speedup_x100           expand=166  batched=169  transpose16=154

So the **production per-byte-position hot loop is 1.54x faster** with the
byte-LUT (4761 us/frame saved), and **isolated expansion is 1.66x faster**.
Real encode-side measurement, not the prior 1.28x extrapolation.

Follow-ups filed: #2540 (FL_PRINT vs esp_rom_printf), #2541 (testSimd RPC
routing root cause).

Co-Authored-By: Claude Opus 4.7 <[email protected]>
@zackees

zackees commented May 29, 2026

Copy link
Copy Markdown
Member Author

Review-driven update (latest commit 645b947ac6)

1. Bench is now RPC-driven, no boot computation by default

2. Now measuring the real production hot path, not just isolated expansion

Added a wave8Transpose_16(lanes, lut, output) timing for both LUTs — that's exactly what the PARLIO engine calls 768×/frame for mDataWidth==16.

Measured on ESP32-P4 v1.3:

metric nibble byte-LUT speedup
expand-only (480k expansions) 350,142 µs 210,155 µs 1.66×
wave8Transpose_16 (prod hot path) 530,115 µs 344,128 µs 1.54×
frame equiv (×768 byte-positions) 13,570 µs 8,809 µs −4,761 µs/frame

So the production per-byte-position cost is 1.54× faster — directly measured, not extrapolated. Full encode_us (which adds DMA/ring/ISR overhead) is bounded above by 1.54× and needs measureParlio (blocked by #2541) to nail down end-to-end.

3. Follow-ups filed

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (2)
examples/AutoResearch/AutoResearch.ino (1)

334-343: 💤 Low value

Consider conventional variable naming.

The variable _w8r uses a leading underscore, which is unconventional in C++ (though legal in local scope). Standard practice avoids leading underscores to prevent potential reserved-name conflicts.

♻️ Suggested refactor
 `#ifdef` FL_BENCH_WAVE8_AT_BOOT
     {
-        auto _w8r = autoresearch::wave8_bench::measureWave8Expand();
-        autoresearch::wave8_bench::printWave8ExpandResultRom(_w8r);
+        auto w8r = autoresearch::wave8_bench::measureWave8Expand();
+        autoresearch::wave8_bench::printWave8ExpandResultRom(w8r);
     }
 `#endif`
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@examples/AutoResearch/AutoResearch.ino` around lines 334 - 343, The local
variable name `_w8r` uses a leading underscore which is non-idiomatic and may
risk reserved-name conflicts; rename it to a conventional local identifier
(e.g., `w8r` or `wave8Result`) where it is assigned from
`autoresearch::wave8_bench::measureWave8Expand()` and then passed into
`autoresearch::wave8_bench::printWave8ExpandResultRom()` so both uses are
updated consistently.
examples/AutoResearch/AutoResearchWave8Expand.h (1)

24-29: 💤 Low value

Consider consolidating duplicate platform guards.

The same #if defined(ARDUINO_ARCH_ESP32) || defined(ESP_PLATFORM) guard is used twice consecutively. Consolidating into a single block improves readability:

♻️ Suggested refactor
-#if defined(ARDUINO_ARCH_ESP32) || defined(ESP_PLATFORM)
-#include <Arduino.h> // micros()
-#endif
-#if defined(ARDUINO_ARCH_ESP32) || defined(ESP_PLATFORM)
-#include <esp_rom_sys.h> // esp_rom_printf -> USB-Serial-JTAG console (`#2540`)
-#endif
+#if defined(ARDUINO_ARCH_ESP32) || defined(ESP_PLATFORM)
+#include <Arduino.h>        // micros()
+#include <esp_rom_sys.h>    // esp_rom_printf -> USB-Serial-JTAG console (`#2540`)
+#endif
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@examples/AutoResearch/AutoResearchWave8Expand.h` around lines 24 - 29, Two
consecutive platform guards repeat the same condition; consolidate them by
merging both includes into a single `#if` defined(ARDUINO_ARCH_ESP32) ||
defined(ESP_PLATFORM) block so both <Arduino.h> and <esp_rom_sys.h> are included
together. Locate the duplicate guards around the includes for Arduino.h and
esp_rom_sys.h in AutoResearchWave8Expand.h and move both `#include` lines inside
one combined preprocessor conditional (keeping the original macros
ARDUINO_ARCH_ESP32 and ESP_PLATFORM and preserving the comment about
esp_rom_printf).
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@examples/AutoResearch/AutoResearch.ino`:
- Around line 334-343: The local variable name `_w8r` uses a leading underscore
which is non-idiomatic and may risk reserved-name conflicts; rename it to a
conventional local identifier (e.g., `w8r` or `wave8Result`) where it is
assigned from `autoresearch::wave8_bench::measureWave8Expand()` and then passed
into `autoresearch::wave8_bench::printWave8ExpandResultRom()` so both uses are
updated consistently.

In `@examples/AutoResearch/AutoResearchWave8Expand.h`:
- Around line 24-29: Two consecutive platform guards repeat the same condition;
consolidate them by merging both includes into a single `#if`
defined(ARDUINO_ARCH_ESP32) || defined(ESP_PLATFORM) block so both <Arduino.h>
and <esp_rom_sys.h> are included together. Locate the duplicate guards around
the includes for Arduino.h and esp_rom_sys.h in AutoResearchWave8Expand.h and
move both `#include` lines inside one combined preprocessor conditional (keeping
the original macros ARDUINO_ARCH_ESP32 and ESP_PLATFORM and preserving the
comment about esp_rom_printf).

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 6d846260-5ec8-45f4-979b-c319556ab418

📥 Commits

Reviewing files that changed from the base of the PR and between 2efcdf1 and 645b947.

📒 Files selected for processing (3)
  • examples/AutoResearch/AutoResearch.ino
  • examples/AutoResearch/AutoResearchRemote.cpp
  • examples/AutoResearch/AutoResearchWave8Expand.h

@zackees
zackees merged commit 1150f2e into master May 29, 2026
6 of 7 checks passed
@zackees
zackees deleted the feat/wave8-byte-lut branch May 29, 2026 21:59
zackees added a commit that referenced this pull request May 30, 2026
…e to RPC (#2562)

Removes the `FL_PARLIO_STREAM_VALIDATE_AT_BOOT` boot-time hook landed in
#2561 and re-exposes the same functional test as a JSON-RPC handler
`parlioStreamValidate`, matching the convention of the other autoresearch
utility benches (`wave8ExpandBenchmark` #2539, `parlioEncodeBenchmark` #2547).

### Changes

- `AutoResearchParlioStream.h`:
  - `validateAtBoot()` (esp_rom_printf-based) → `validateParlioStreaming()`
    returning a `ValidateResult` struct (channels_ok, completed, per_iter_us[],
    steady_avg_us, failed_iter, etc.).
  - Caller-supplied `num_lanes`, `num_leds`, `iterations`, `timeout_ms` so the
    RPC can drive different workloads.
  - Static LED buffer sized for the canonical worst case (16 × 256) to avoid
    repeated allocation across RPC calls.

- `AutoResearch.ino`:
  - Drop the `#ifdef FL_PARLIO_STREAM_VALIDATE_AT_BOOT` boot-time hook.
  - Keep the header include for the RPC handler in AutoResearchRemote.cpp.

- `AutoResearchRemote.cpp`:
  - Add `parlioStreamValidate` bind: parses optional `numLanes`/`numLeds`/
    `iterations`/`timeoutMs` from args, calls `validateParlioStreaming()`,
    returns full result as JSON (`channelsOk`, `completed`, `lanes`,
    `ledsPerLane`, `iterations`, `perIterUs:[…]`, `steadyAvgUs`, `failedIter`,
    `timeoutMs`).
  - Register in `discoverFunctions` metadata (totalFunctions 24 → 25, Phase 4
    Utility, full args + returns docstring).

### Validation

- `bash lint --cpp` clean
- Build + flash on ESP32-P4 v1.3 (`bash autoresearch esp32p4 --simd --no-fbuild`)
  succeeds; handler is registered.
- On-device RPC invocation is blocked on P4 by the pre-existing
  #2541 (testSimd RPC over UART0 fails because the host connects via COM25
  USB-Serial-JTAG, different physical path). Same blocker that already affects
  `testSimd`, `wave8ExpandBenchmark`, and `parlioEncodeBenchmark`. The
  handler will be invokable from CI / other platforms once that infra
  issue is resolved.
- Functional correctness was previously demonstrated end-to-end via the
  boot-time variant in #2561: 5 back-to-back show()+wait() iterations,
  16-lane × 256-LED WS2812B, all completed within timeout (steady-state
  ~17 ms/frame, 0 hangs).

Refs #2548, #2541. Supersedes the boot-time hook from #2561.

Co-authored-by: Claude Opus 4.7 <[email protected]>
zackees added a commit that referenced this pull request May 30, 2026
)

Two back-to-back #if defined(ARDUINO_ARCH_ESP32) || defined(ESP_PLATFORM)
blocks at lines 24-29 are merged into one. Pure readability cleanup.

Addresses CodeRabbit finding C4 from meta #2580 (originally #2539).
zackees added a commit that referenced this pull request May 30, 2026
…#2584)

CodeRabbit nitpick on PR #2539. Function-scope leading underscores
aren't technically reserved but the project convention is to avoid
them.

Addresses CodeRabbit finding C3 from meta #2580.
zackees added a commit that referenced this pull request May 31, 2026
…AT_BOOT (#2618)

Stop running the 85-test SIMD validation suite unconditionally on every
boot of the AutoResearch example. The testSimd RPC handler in
AutoResearchRemote.cpp is the canonical invocation path; the boot-time
call was a redundant ~50-100 ms tax plus log noise for anyone using
AutoResearch as the regular LED autoresearch tool.

Mirrors the FL_BENCH_WAVE8_AT_BOOT / FL_BENCH_PARLIO_AT_BOOT pattern from
PR #2539: keep the function callable, gate the boot-time invocation
behind an opt-in macro for use as a bridge until the testSimd RPC
routing on P4 is fixed (#2541).

Closes #2542

Co-authored-by: Claude Opus 4.7 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant