Skip to content

test(parlio): #2548 convert PARLIO streaming validation from boot-time to RPC - #2562

Merged
zackees merged 1 commit into
masterfrom
perf/parlio-stream-rpc
May 30, 2026
Merged

zackees merged 1 commit into
masterfrom
perf/parlio-stream-rpc

Conversation

@zackees

@zackees zackees commented May 30, 2026 •

Copy link
Copy Markdown
Member

Summary

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).

Why

User requested: "we don't want this test at boot, we want it rpc selectable". The boot-time hook in #2561 was an interim path that worked around the broken testSimd RPC routing (#2541) on P4. RPC is the canonical pattern for autoresearch test invocation.

API

// Call
{
  "method": "parlioStreamValidate",
  "params": [{
    "numLanes":  16,   // 1..16, default 16  (16 exercises BF1+pipe4 from #2559)
    "numLeds":   256,  // 1..256, default 256
    "iterations": 5,   // 1..kMaxIterations=16, default 5
    "timeoutMs":  200  // 1..5000, default 200
  }]
}

// Response
{
  "success": true,
  "channelsOk": true,     // all PARLIO channels created cleanly
  "completed": true,      // every iteration finished within timeout
  "lanes": 16, "ledsPerLane": 256, "iterations": 5,
  "perIterUs": [23530, 16998, 17000, 16997, 17001],
  "steadyAvgUs": 16999,   // average of iters 1..N-1
  "failedIter": -1,       // index of first iter exceeding timeout, or -1
  "timeoutMs": 200
}

Changes

  • AutoResearchParlioStream.h: validateAtBoot() (esp_rom_printf-based) → validateParlioStreaming() returning a ValidateResult struct. Caller-supplied workload parameters. Static LED buffer 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 binding).
  • AutoResearchRemote.cpp: add parlioStreamValidate bind + discoverFunctions metadata entry (totalFunctions 24 → 25).

Test plan

Files

 examples/AutoResearch/AutoResearch.ino           +2 / −12
 examples/AutoResearch/AutoResearchParlioStream.h +91 / −68
 examples/AutoResearch/AutoResearchRemote.cpp     +73 / −1

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

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features

    • Validation functionality now supports configurable parameters (lanes, LEDs, iterations, timeout)
    • Validation results include detailed per-iteration timing measurements
    • New RPC endpoint for validation with optional parameters
  • Refactor

    • Validation moved from boot-time initialization to RPC-driven approach

Review Change Stack

…e to RPC

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]>
@coderabbitai

coderabbitai Bot commented May 30, 2026 •

Copy link
Copy Markdown

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 0ea41dfe-60df-4c7d-bd7c-6a229e9c3443

📥 Commits

Reviewing files that changed from the base of the PR and between 4621f23 and 70e6de9.

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

📝 Walkthrough

Walkthrough

This PR migrates PARLIO streaming validation from boot-time to RPC-driven by introducing a parameterized validateParlioStreaming() function with configurable lane/LED/iteration/timeout parameters that returns detailed timing metrics, registering a new parlioStreamValidate RPC endpoint, and removing boot-time validation invocations from the AutoResearch sketch.

Changes

PARLIO Validation RPC Migration

Layer / File(s) Summary
Validation API contract and documentation
examples/AutoResearch/AutoResearchParlioStream.h
Defines ValidateResult struct with channel/completion/timing fields, kMaxIterations constant, and validateParlioStreaming(base_tx_pin, num_lanes, num_leds, iterations, timeout_ms) function signature. Updates header documentation and includes to reflect parameterized validation approach.
ESP32 core implementation
examples/AutoResearch/AutoResearchParlioStream.h
Allocates static max-sized LED buffer, creates PARLIO channels on consecutive TX pins, runs back-to-back FastLED.show() + FastLED.wait() timing measurements via micros(), records per-iteration durations, flags timeout-exceeding iterations, and computes steady-state average over iterations 1..N-1.
Non-ESP32 stub
examples/AutoResearch/AutoResearchParlioStream.h
Provides non-ESP32 build stub that returns default-initialized ValidateResult without executing channel or timing logic.
RPC endpoint registration
examples/AutoResearch/AutoResearchRemote.cpp
Includes AutoResearchParlioStream.h, registers parlioStreamValidate RPC handler that parses config parameters, applies safety bounds, invokes validation function, and formats response JSON with per-iteration timing array and status fields. Updates help RPC to advertise the new function.
Boot-time validation removal
examples/AutoResearch/AutoResearch.ino
Removes boot-time validation call and conditional block, replacing with comment documenting that validation is now handled by parlioStreamValidate RPC. Updates include comment to reflect RPC-driven validation.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related issues

Poem

A bunny hops through timing loops,
From boot to RPC, the validation swoops! 🐰✨
Steady averages, per-iter arrays fly,
PARLIO streams tested, no boot-time sigh!
Now on-demand, when called it will try. 🎯

✨ 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 perf/parlio-stream-rpc

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.

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