Skip to content

bloat gate: local ESP32-S3 Blink total_flash reads 4 KB higher than CI for the same commit #4468

Closed

Description

@zackees

Observed

For master 01caa0a89f, uv run python tests/test_esp32s3_bloat_regression.py gives different totals:

total_flash (report.json) fbuild image flash: ELF size
CI (bloat regression run on master) 383,120 B → PASS 473,588 B 9.84 MB
local (NixOS, fbuild 2.5.24) 387,217 B → FAIL by 4,059 B 473,524 B 10.3 MB

The flash images agree to within 64 B, but the symbol-sum total the gate reads is 4 KB apart. A local run therefore can't reproduce the gate: it fails on a commit CI passes. Any local delta is only meaningful against another local build.

Ruled out

  • A stale build dir: removed .build/fbuild/esp32s3 and rebuilt; same 387,217.
  • The nm path: build_info_Blink.json's aliases.nm points at a stale ~/.fbuild/dev toolchain (20251107) while the compile uses ~/.fbuild/prod (20260121). That comes from _gnu_toolchain_bin_for_target in ci/compiler/build_config.py, which globs ~/.fbuild/*/… sorted, so dev wins over prod. It's a separate small bug worth fixing, but repointing it at the prod nm still gives 387,217, so it isn't the cause here.

Next steps

  • Upload .build/symbols/esp32s3/report.json as an artifact from the bloat workflow, so a local report can be diffed against CI's by symbol rather than guessed at.
  • Make _gnu_toolchain_bin_for_target prefer the toolchain the compile actually used (it is in the compile command's include paths).

Found while measuring #4455.

🤖 Generated with Claude Code

Activity

  1. zackees commented on Sep 19, 2026

    @zackees
    MemberAuthor

    The stale-binutils part is fixed in #4469. The 4 KB total_flash gap is still open: next, the bloat workflow uploads its report.json so the two can be diffed by symbol.

  2. zackees commented on Sep 19, 2026

    @zackees
    MemberAuthor

    Diffed by symbol: this is attribution, not code

    CI's report is now available (#4470, artifact esp32s3-bloat-report). I compared it against a local report of the same master code:

    total_flash symbols nm rows map-derived rows
    CI 383,120 4,886 3,860 1,026
    local 387,217 4,202 3,926 276
    • Most of the gap is one symbol. Locally _stext is sized 10,912 B. In CI it has no row at all. _stext is the linker-script label at the start of .flash.text (0x42000020). The 10,912 B after it are the .literal.* input sections of main_34d2.cpp.o, the literal pool, which the local run credits to _stext.
    • Local map attribution is much thinner. The local run derives only 276 rows from the map, against 1,026 in CI. For example, .text.startup.* / .text.unlikely.* pieces such as fl::ChannelEvents::ChannelEvents() get their own rows in CI and none locally.
    • Some archive totals really differ. libxtensa is +2.9 KB and FrameworkArduino −1.7 KB. That points at the locally cached framework objects differing from CI's fresh build, even though the images agree to within 64 B.

    So the gate's total_flash is a sum of attributed symbol sizes, and how that sum comes out depends on the environment. It is not the image size, so local and CI totals can't be compared directly. Deltas within one environment remain meaningful.

    The attribution is done inside fbuild symbols (map parsing plus sizing of unsized nm symbols), so the remaining fix belongs in FastLED/fbuild. Next step: compare the two map parses, which needs the CI firmware.map as well as the report.

  3. zackees commented on Sep 23, 2026

    @zackees
    MemberAuthor

    Filed the upstream parser/report-contract fix as FastLED/fbuild#1456. Reproduced with fbuild 2.5.26 on a clean base worktree: local total_flash=387,289 B versus pinned 383,214 B, image flash 473,588 B, _stext=10,912 B, and only 276 map-derived rows. The response-LUT feature worktree is 387,363 B locally (+74 B), so the ~4 KB local gate failure is already present without that feature. The upstream issue includes a RED→GREEN fixture and a stable image-metric acceptance criterion; this FastLED issue remains the downstream gate tracker.

  4. zackees commented on Sep 26, 2026

    @zackees
    MemberAuthor

    Status check (2026-09-26, master fb86eb26e9): both downstream next steps from this issue have landed — CI uploads report.json (#4470), and _gnu_toolchain_bin_for_target in ci/compiler/build_config.py now prefers the toolchain root found in the compile command's paths (#4469). The remaining false ~4 KB local delta is the _stext linker-marker attribution inside fbuild symbols; report.json still exposes only the attributed-symbol total_flash (no image-flash metric). This stays open, blocked on FastLED/fbuild#1456; once an fbuild release ships a stable image metric, bump the pin and switch the gate to it.

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