Skip to content

test(autoresearch): on-device verification of fl::ieee754_string codec (refs #3022, #3038) #3039

Closed

Description

@zackees

Context

PR #3038 (closed phase 2 of #3022) landed the integer-only IEEE 754 codec in src/fl/stl/ieee754_string.{h,cpp.hpp} — fl::ieee754_parse_decimal(...) and fl::ieee754_format_decimal(...). The codec is verified on host x86 by tests/fl/stl/ieee754_string.cpp (10 doctest cases, all green incl. ASAN/LSAN/UBSAN), but the whole point of the codec is to behave correctly on no-FPU embedded targets (LPC845, Cortex-M0+) where libgcc soft-FP would otherwise be reachable. That side of the contract is currently unverified at runtime — we have a link-symbol check for criterion #6 of #3022, but no on-device assertion that the parser / serializer actually produce the right bit patterns under the platform's integer ABI.

The natural home is the AutoResearch harness (examples/AutoResearch/AutoResearch.ino plus its sibling AutoResearch*.h modules — Simd, Parlio, Wave8Expand, etc.). Per CLAUDE.md:

On-device / hardware tests go through examples/AutoResearch/AutoResearch.ino — prefer reusing or augmenting its existing test harness (e.g. AutoResearchSimd.h, run via bash autoresearch <board> --simd/--parlio/etc.) rather than creating a new .ino in examples/.

So this is purely additive inside examples/AutoResearch/, no new .ino.

Proposal

  1. Add examples/AutoResearch/AutoResearchIeee754.h following the pattern of AutoResearchSimd.h / AutoResearchWave8Expand.h:
    • Static test vectors with (input_text, expected_bits) pairs covering: 0, -0, 1, -1, 0.5, 2.5, pi-ish (3.14159), e-ish (2.71828), 100, 1000, very-large (1e30), very-small (1e-30), denormal threshold (1e-40 clamps to 0), 1e40 clamps to +inf, -1e40 clamps to -inf, NaN parse rejection.
    • Round-trip table: feed each u32 bit pattern through ieee754_format_decimal then back through ieee754_parse_decimal, assert ±1 ULP.
    • For the ±1 ULP reference, embed a known-good host-strtof'd table as static constexpr u32 kReferenceBits[] — the device never needs to run strtof.
  2. Wire a --ieee754 flag into AutoResearch.ino mirroring the existing --parlio / --simd / --lpuart dispatch.
  3. Results return through the existing AutoResearch RPC / JSON plumbing so bash autoresearch <board> --ieee754 reports pass/fail counts + first-failing test name in structured JSON.
  4. Add the link-symbol check to the harness's reporting path: after the on-device test passes, the build script (or a follow-up CI step) greps the resulting ELF for __aeabi_d* / __aeabi_f* and asserts empty output. This mechanizes acceptance criterion WS2801 Timing issue - Calling FastLED.show() too quickly does not update the LEDs. #6 from fl::json: custom 64-bit packed tagged-number type (replaces variant<i64, float, double> in #3002) #3022.
  5. Update agents/docs/hardware-autoresearch.md with the new flag.

Acceptance criteria

  • examples/AutoResearch/AutoResearchIeee754.h exists and is included from AutoResearch.ino under a #ifdef FL_AUTORESEARCH_IEEE754 (or analogous) gate consistent with the other modules.
  • bash autoresearch lpc845brk --ieee754 runs on LPC845-BRK hardware and reports all test vectors passing.
  • The harness emits the result through the existing JSON RPC channel — result.tests_run, result.tests_failed, result.first_failure keys (or whatever the project's existing schema is).
  • At least one no-FPU board (LPC845-BRK) and one FPU board (Teensy 4.x or ESP32-S3) covered, so the codec is exercised on both ABIs.
  • CI (or the harness's own reporting) asserts arm-none-eabi-nm -C firmware.elf | grep -E '(aeabi_d|aeabi_f|f2iz|d2iz|__l2f|__floatdisf)' is empty when --ieee754 is the active workload.
  • agents/docs/hardware-autoresearch.md lists --ieee754 alongside the other research workloads.

Decisions

  • Priority: P2. Codec is already shipping (PR feat(json): integer-only IEEE 754 codec replaces soft-FP cascade (refs #3022) #3038 merged); host tests guard correctness for the dominant CI path. On-device coverage closes a real gap but doesn't block shipping work. Upgrade if a real LPC845 bug appears.
  • Flag name --ieee754. Matches the --parlio / --simd / --lpuart lower-kebab convention; tracks the module name directly. Triage can rename to --codec-float if a broader codec workload is planned.
  • File AutoResearchIeee754.h (header-only). Mirrors AutoResearchSimd.h / AutoResearchWave8Expand.h. Keeps test vectors inline so the build pulls them in via the existing .ino translation unit without a new .cpp file.
  • ±1 ULP tolerance. Same target as the host test (tests/fl/stl/ieee754_string.cpp). Embedded-grade precision was the chosen contract for fl::json: custom 64-bit packed tagged-number type (replaces variant<i64, float, double> in #3002) #3022 phase 2; tightening to bit-exact would require the Eisel-Lemire / Ryu upgrade tracked separately.
  • Reference vector source: host strtof. Generated offline by a helper script (similar to ci/tools/gen_pow10_table.py) and committed as a header. The device never runs strtof, so the soft-FP-free property is preserved.
  • No new .ino. Project policy (CLAUDE.md → "Examples Policy") plus the protect_example_ino.py PreToolUse hook block new .ino. The hook can be overridden but should not be here — augmenting AutoResearch.ino is the right pattern.
  • Boards: LPC845-BRK + one of (Teensy 4.x, ESP32-S3). LPC845 is the canonical no-FPU target this codec was built for; one FPU board confirms the codec doesn't accidentally rely on absent soft-FP helpers on richer targets.

Related

Activity

  1. zackees commented on Jun 18, 2026

    @zackees
    MemberAuthor

    Fixed by merged PR #3213.

    Validation run on LPC845-BRK:

    • bash autoresearch lpc845brk --ieee754 --upload-port COM10 --skip-lint --skip-schema
    • Result: success=true, tests_run=35, tests_failed=0, first_failure=""
    • Dedicated IEEE754 firmware size: 59.36 KB / 64 KB flash, 8.52 KB / 16 KB RAM
    • Default LPC AutoResearch build still passes at 62.47 KB / 64 KB flash

    Upgrade guidance: use FastLED at or after merge commit 9684ad8 from PR #3213, or the next FastLED release containing it. No sketch/API migration is required. To run the new coverage locally, use bash autoresearch lpc845brk --ieee754.

    Note: this closes the on-device codec verification gap. The broader soft-FP symbol burn-down remains tracked by #3002 / #3022.

  2. moved this from Triage to Done in FastLED Trackeron Jun 18, 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

    No labels
    No labels

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions