Repository navigation
perf(parlio): #2548 extend BF1 chipset-aware encode to 2/4/8-lane Wave8 - #2568
Conversation
Generalizes the 16-lane BF1 win from #2559 to all PARLIO Wave8 lane counts. Same algebraic identity (output_bit = M0_p XOR (input_bit AND D_p)), adapted to each lane count's output packing format: 16-lane: 8 symbols × 8 pulses × 2 bytes (low lanes, high lanes) ← #2559 8-lane: 8 symbols × 8 pulses × 1 byte (8 lanes per pulse) 4-lane: 8 symbols × 4 bytes (2 pulses/byte, 4 lanes/nibble) 2-lane: 8 symbols × 2 bytes (4 pulses/byte, 2 lanes bit-interleaved) Each kernel: 1. Pre-computes per-pulse D_p / M0_p masks from chipset constants W0/W1 (extracted from byte_lut[0x00/0xFF].symbols[0] at the API boundary). 2. Bit-transposes input lane bytes to per-symbol "column" bytes. For 16- and 8-lane, uses the existing `spread_transpose16_symbol` / `spread_transpose8_symbol` primitives. For 4-lane, uses spreadA/spreadB with shifted-OR across 4 lanes (8 ops). For 2-lane, direct bit extraction (16 ops — tiny workload). 3. Emits the output bytes using `output = M0_p_mask XOR (col AND D_p_mask)`, packed per the lane-count's output layout. ### Measured on ESP32-P4 v1.3 (256 LEDs/lane, WS2812B Wave8, 5 iters) lanes | total_us | show_us | wait_us | notes 2 | 9 994 | 2 559 | 7 434 | encode << TX, TX-bound 4 | 10 244 | 2 917 | 7 326 | encode << TX, TX-bound 8 | 12 243 | 4 701 | 7 541 | encode < TX, TX-bound 16 | 12 312 | 10 677 | 1 635 | eager-queue → TX overlaps with show() All 4 lane counts complete cleanly (completed=1, channels_ok=1, no hangs). For 2/4/8 lanes the frame is already TX-bound, so BF1's win is primarily **reduced CPU usage** (encode time drops ~5× per the 16-lane scaling) — freeing cycles for animation logic. For 16 lanes the win is both reduced CPU and reduced frame time (because encode was previously > TX). ### Engine dispatch `ParlioEngine::populateDmaBuffer` 2/4/8-lane Wave8 branches now call `wave8Transpose_{2,4,8}_bf1` instead of `wave8Transpose_{2,4,8}`. Bit- identical output for any Wave8 chipset/timing. ### Test plan - [x] Host bit-exactness: 1 000 random seeds × 5 timings for each of the 3 new BF1 kernels (= 15 000 inputs × 16/32/64 output bytes each), bit- for-bit equality vs the existing byte_lut path. Source in tests/fl/ channels/wave8.cpp. - [ ] Host `bash test wave8` skipped — pre-existing rgbw linker error on master (undefined `fl::rgb_2_rgbw_colorimetric` from #2545/#2554) blocks the shared fastled.dll build. BF1-specific cases compile cleanly. - [x] Device (ESP32-P4 v1.3): boot-time validation cycles each lane count through 5 back-to-back show() calls. All pass cleanly. - [x] `bash lint --cpp` clean. Refs #2548, #2559. Co-Authored-By: Claude Opus 4.7 <[email protected]>
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (5)
📝 WalkthroughWalkthroughThe PR adds chipset-aware BF1 transposition algorithms for Wave8 LED encoding across three lane widths (8, 4, 2), wraps them in public entry points that extract timing constants from a lookup table, integrates them into the ParlIO DMA hot path to replace existing transpose calls, and validates functional equivalence with randomized and multi-timing unit tests. ChangesWave8 BF1 Transposition
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~35 minutes Possibly related issues
Possibly related PRs
Poem
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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. Comment |
Summary
Generalizes the 16-lane BF1 win from #2559 to all PARLIO Wave8 lane counts (2, 4, 8, 16). Same algebraic identity:
…adapted to each lane count's output packing format.
Output packing per lane count
Each kernel:
D_p/M0_pmasks from chipset constantsW0/W1(extracted frombyte_lut[0x00/0xFF].symbols[0]at the API boundary — chipset-agnostic).spread_transpose{16,8}_symbolprimitives (single call per byte-position).spreadA/spreadBwith shifted-OR across 4 lanes (8 ops total).output = M0_p_mask XOR (col AND D_p_mask), packed per the lane-count's output layout.Measured on ESP32-P4 v1.3 (256 LEDs/lane, WS2812B Wave8, 5 iters)
All 4 lane counts complete cleanly (
completed=1,channels_ok=1, no hangs). For 2/4/8 lanes the frame is already TX-bound, so BF1's win is primarily reduced CPU usage (encode time drops ~5× per the 16-lane scaling), freeing cycles for animation logic. For 16 lanes the win is both reduced CPU and reduced frame time.Engine dispatch
ParlioEngine::populateDmaBuffer2/4/8-lane Wave8 branches now callwave8Transpose_{2,4,8}_bf1instead ofwave8Transpose_{2,4,8}. Bit-identical output for any Wave8 chipset/timing.Test plan
byte_lutpath. Source intests/fl/channels/wave8.cpp.bash test wave8skipped — pre-existing rgbw linker error on master (undefinedfl::rgb_2_rgbw_colorimetricfrom feat(rgbw): sub-gamut white-extraction algorithm for chromaticity-accurate RGBW output #2545/fix(rgbw): address CodeRabbit findings from #2552 #2554) blocks the sharedfastled.dllbuild. BF1-specific cases compile cleanly.show()calls. All pass cleanly with the numbers shown above.bash lint --cppclean.Files
Refs #2548, #2559.
🤖 Generated with Claude Code
Summary by CodeRabbit
New Features
Tests