Skip to content

feat(power): bound mixed managed frames with a shared Q16 prepass - #4542

Merged
zackees merged 13 commits into
masterfrom
feat/4499-shared-power-prepass
Sep 23, 2026
Merged

zackees merged 13 commits into
masterfrom
feat/4499-shared-power-prepass

Conversation

@zackees

@zackees zackees commented Sep 23, 2026 •

Copy link
Copy Markdown
Member

Tracks #4499 and #4156 R3/R4.

Implements a stable shared frame-power snapshot and Q16 scalar for mixed legacy RGB and managed RGB/RGBW/RGBWW output. Candidate demand follows solved emitter response, output quantization, dither reserve, and native current fields; allocation failure fails closed. The public estimated-power and isPowerLimited reports reflect the managed Q16 decision. Includes focused tests, contract documentation, a host prepass profile, and a capture-only AutoResearch mixed-channel show benchmark RPC.

Validation on head 98e7252:

  • Focused power-prepass quick and sanitizer tests, power-management and power-estimation tests, and C++ lint pass locally.
  • CI ESP32-S3 bloat gate passes at 383,134 B. Compared with the master artifact, unbound Blink flash is 383,139 -> 383,134 B (-5 B) and RAM is 40,819 -> 40,819 B (unchanged). No managed-power symbol links into Blink. The pinned baseline was not raised.
  • Host benchmark: 32/256/1000 pixels per channel, full show/prepass/encode measured with in-memory capture; see PR comment.
  • Attached ESP32-C6 RPC smoke passed. Capture-only show benchmarks at 32/64/128 pixels per channel measured limited 8,231/13,860/24,376 us per frame versus unlimited 2,525/4,713/9,094 us per frame; see PR comment. No LED strip was connected to the default GPIO1 output, and the capture driver does not transmit LED frames. These are CPU measurements, not optical measurements.
  • Broad CI matrix is still running; the single ESP32-C3 BlinkParallel QEMU boot timeout is being rerun on the same SHA.

Pay-for-what-you-use boundary: an unbound Blink sketch has no added flash or RAM. A sketch that binds a color profile without a power limiter still links the profile-side histogram callbacks; that advisory cost is not claimed as zero.

Draft until the remaining CI checks pass and the QEMU timeout is resolved. P10 measured photometry is a separate instrument gate: datasheet intensity/current figures are not used as a substitute for light-output measurements.

@coderabbitai

coderabbitai Bot commented Sep 23, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

Note

Currently processing new changes in this PR. This may take a few minutes, please wait...

⚙️ Run configuration

Configuration used: Repository: FastLED/FastLED/.coderabbit.yaml

Review profile: CHILL

Plan: Advanced

Run ID: e0507dbb-7a3f-49c0-805d-be812bbbf3ee

📥 Commits

Reviewing files that changed from the base of the PR and between a57b77d and 98e7252.

📒 Files selected for processing (16)
  • docs/color-pipeline-contracts.md
  • examples/AutoResearch/AutoResearchRemoteBenchmarkMethods.cpp
  • examples/AutoResearch/AutoResearchRemotePinMethods.cpp
  • src/FastLED.cpp.hpp
  • src/FastLED.h
  • src/fl/channels/color_managed_source.cpp.hpp
  • src/fl/channels/color_managed_source.h
  • src/fl/channels/pipeline_binding.cpp.hpp
  • src/fl/channels/pipeline_binding.h
  • src/fl/channels/power_prepass.h
  • src/fl/gfx/pipeline.cpp.hpp
  • src/fl/gfx/pipeline.h
  • src/fl/gfx/white_allocation.cpp.hpp
  • src/power_mgt.cpp.hpp
  • tests/fl/channels/power_prepass.cpp
  • tests/profile/power_prepass_bench.cpp
 _______________________________________
< Goodbye, code review procrastination. >
 ---------------------------------------
  \
   \   \
        \ /\
        ( )
      .( o ).
✨ Finishing Touches
📝 Generate docstrings
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR

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.

@zackees

zackees commented Sep 23, 2026

Copy link
Copy Markdown
Member Author

CI bloat gate found a real unused-path regression: ESP32-S3 Blink linked symbol flash 389,909 B vs the pinned 383,140 B baseline (+6,769 B). The linked symbols include framePowerAtFluxMilliwatts (1,352 B), so this is not being waived as local accounting noise. I am moving the managed Q16 prepass behind a link-elided dispatch before requesting merge. See the bloat job.

@zackees

zackees commented Sep 23, 2026

Copy link
Copy Markdown
Member Author

A second pre-fix CI blocker is Windows fl_channels_power_prepass: 310/311 unit targets passed, but the focused managed-frame test used the old byte estimator (2,481 vs Q16 plan 2,457 mW) and exceeded the HD budget (1,581 > 1,000 mW). The likely cause is comparing a power-function address across Windows DLL/import thunks to decide whether to run the new plan. The dispatch fix in progress removes function-address equality entirely; the next Windows CI run will be the decisive check. Failing test job.

@zackees
zackees force-pushed the feat/4499-shared-power-prepass branch from c89c0df to 2e7c261 Compare September 23, 2026 08:31
@zackees

zackees commented Sep 23, 2026

Copy link
Copy Markdown
Member Author

Host prepass-plus-encode benchmark (in-memory capture driver, no LED output or wire time) is now committed in 2e7c261. Three profile runs on this host gave median FastLED.show() CPU time per frame, with three channels (legacy RGB + managed RGBW + managed RGBWW):

Pixels/channel Limited Unlimited Ratio
32 28.3 µs 12.4 µs 2.28×
256 177.5 µs 95.0 µs 1.87×
1000 691.5 µs 363.0 µs 1.91×

These are host-tier CPU measurements only, not MCU timing, physical light, or wire time. The C6 benchmark is still pending wiring confirmation because generic AutoResearch firmware performs a boot-time GPIO probe. The latest prior-revision ESP32-S3 Blink bloat result was 383,216 B (+76 B) with no managed solver symbols linked; the branch has been rebased onto current master and a new CI run is pending.

@zackees

zackees commented Sep 23, 2026

Copy link
Copy Markdown
Member Author

CI size evidence for 98e7252: the ESP32-S3 bloat gate passed at 383,134 B (pinned baseline 383,140 B). I compared its uploaded report with the master run at a57b77d: flash 383,139 -> 383,134 B (-5 B), RAM 40,819 -> 40,819 B (unchanged). No FramePower / managed-show / histogram symbols appear in the unbound Blink image. Focused power-prepass quick + debug tests and C++ lint passed locally. The broader CI matrix is still running. A profile-bound sketch without a power limit still links the profile-side histogram callbacks; that narrower pay-for-what-you-use boundary is the remaining advisory size tradeoff, not hidden by the Blink result. Device throughput remains unverified until the attached ESP32-C6 output wiring is confirmed safe; no light was emitted by these tests.

@zackees

zackees commented Sep 23, 2026

Copy link
Copy Markdown
Member Author

ESP32-C6 device throughput (attached board, AutoResearch RPC smoke PASS; user confirmed no strip on default GPIO1): mixedPowerShowPerf uses an in-memory capture driver and emitted no LED frame to physical output. Three channels (legacy RGB + managed RGBW + managed RGBWW), four FastLED.show() frames per sample, ABBA/BAAB medians, 2,500 mW model budget. 32 pixels/channel: limited 32,923 us / 4 = 8,231 us/frame; unlimited 10,100 us / 4 = 2,525 us/frame. 64 pixels/channel: 55,440 / 4 = 13,860 vs 18,850 / 4 = 4,713 us/frame. 128 pixels/channel: 97,502 / 4 = 24,376 vs 36,375 / 4 = 9,094 us/frame. All RPC results reported success=true, all three encoded captures present, and limited modeled demand was 2,499 / 2,498 / 2,431 mW respectively. These are prepass+encode CPU measurements, excluding wire time and photometric output. They do not replace P10 instrument measurements.

@zackees
zackees marked this pull request as ready for review September 23, 2026 09:18
@zackees
zackees merged commit ab9e867 into master Sep 23, 2026
25 of 26 checks passed
@fastled-project-sync fastled-project-sync Bot moved this from In Progress to Triage in FastLED Tracker Sep 23, 2026
@fastled-project-sync fastled-project-sync Bot moved this from Triage to Done in FastLED Tracker Sep 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

1 participant