Skip to content

ci(avr): check drawPolygon scene hashes on the avr8js Uno against host - #5340

Merged
zackees merged 1 commit into
masterfrom
pilot/5324-avr-polygon-hashes
Nov 21, 2026
Merged

zackees merged 1 commit into
masterfrom
pilot/5324-avr-polygon-hashes

Conversation

@zackees

@zackees zackees commented Nov 21, 2026 •

Copy link
Copy Markdown
Member

Fixes #5324 (first slice: drawPolygon scene and kernel hashes on AVR vs host).

What

  • examples/Test/PolygonHashes.h: 8 scenes with exact Q16.16 vertices, rendered with both kernels (Exact and ABuffer) at the AVR tier (MAXN 8, CHUNK 16) on a 16x8 canvas in BLEND mode. Each canvas is hashed with FNV-1a and compared to a golden table. The scenes and the table are stored in PROGMEM.
  • examples/Test/Test.ino: runs the check in setup() on the ATmega328P and on AVR parts with 48 KB or more of flash. It prints polygon hashes match host, or polygon hash mismatch on a difference. The two kernels add about 24 KB, so the Uno is at 27 KB of 32 KB. A Leonardo's USB stack would not fit, so it is gated out.
  • tests/fl/gfx/draw_polygon.hpp: a host test renders the same scenes and pins the same golden table. If it passes on the host and the AVR check passes too, AVR output matches host output.
  • ci/runners/avr8js_runner.py: --halt-on-error now also matches polygon hash mismatch, and Test is only judged a success if the match marker is present.

This reuses the existing uno_avr8js_test path. No workflow files were changed.

Evidence

  • bash test --run uno Test: all 16 hashes match host, AVR8JS: 1 passed.
  • I put back the fix(gfx): drawPolygon renders identically on AVR (16-bit int) #5301 bugs locally in src/, one at a time, and checked that the AVR run fails:
    • Exact: narrowing the column extent to int before the clamp fails at polygon scene 3 exact ... polygon hash mismatch.
    • ABuffer: doing ytop - 4*py in int fails at polygon scene 4 abuffer ... polygon hash mismatch.
  • bash lint passes, and bash test --cpp passes (371/371 unit, 96/96 examples). ci/tests/test_avr8js_runner.py passes.

Follow-ups (out of scope)

Summary by CodeRabbit

  • Tests
    • Added polygon-rendering checks across multiple scenes and both fill modes, comparing rendered output against expected results.
    • AVR test runs now require the polygon checks to pass, alongside existing setup and loop checks; missing or mismatched results fail the run.
    • Added coverage for polygon-rendering results in the host test suite.

Host builds use a 32-bit int, so 16-bit-int overflows in drawPolygon
(#5301) only show up on AVR. examples/Test now renders 8 scenes with
both kernels (Exact, ABuffer) at the AVR tier (MAXN 8, CHUNK 16) on a
16x8 canvas and compares FNV-1a hashes to a golden table in
examples/Test/PolygonHashes.h. A host test in draw_polygon.hpp pins the
same table, so an AVR match means AVR renders identically to the host.

The avr8js runner halts on "polygon hash mismatch" and requires the
"polygon hashes match host" marker for Test. The scenes target the #5301
paths: re-introducing the Exact column-extent narrowing fails scene 3,
and re-introducing the ABuffer ytop - 4*py int math fails scene 4.

The check is gated to the ATmega328P and 48 KB+ AVR parts (both kernels
add ~24 KB of flash).

Fixes #5324
@zackees zackees added the ci-test:avr8js Select FastLED board CI cells label Nov 21, 2026
@coderabbitai

coderabbitai Bot commented Nov 21, 2026 •

Copy link
Copy Markdown

Explain Change →

Note

.coderabbit.yaml has unrecognized properties

CodeRabbit is using all valid settings from your configuration. Unrecognized properties (listed below) have been ignored and may indicate typos or deprecated fields that can be removed.

Parsing warnings: 1

Validation error: Unrecognized key: "enabled" at "reviews.pre_merge_checks"
Configuration instructions

  • Please see the configuration documentation for more information.
  • You can also validate your configuration using the online YAML validator.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

No actionable comments were generated in the recent review.

Walkthrough

The Test sketch now compares polygon render hashes with host golden values on qualifying AVR targets. Host tests perform the same comparisons. The AVR8JS runner requires a success marker and rejects a mismatch marker.

Changes: Polygon Hash Regression Checks

Layer / File(s) Summary
Polygon scenes, hashes, and host validation
examples/Test/PolygonHashes.h, tests/fl/gfx/draw_polygon.hpp
Adds eight polygon scenes and golden hashes for the Exact and ABuffer kernels. The host test renders each scene with both kernels and checks the resulting hashes.
AVR sketch hash checks
examples/Test/Test.ino
Enables hash checks for qualifying AVR targets. The sketch compares both kernel hashes for every scene and prints a success message only when all comparisons match.
AVR8JS output verdict
ci/runners/avr8js_runner.py, ci/tests/test_avr8js_runner.py
The runner requires the hash success marker and rejects the mismatch marker. Tests cover missing hashes and mismatches, including a mismatch followed by a success marker.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Change: Other

Sequence Diagram(s)

sequenceDiagram
  participant avr8js_runner
  participant Test_ino as Test.ino
  participant renderHash
  avr8js_runner->>Test_ino: Run Test sketch
  Test_ino->>renderHash: Render scene with selected kernel
  renderHash-->>Test_ino: Return canvas hash
  Test_ino-->>avr8js_runner: Print success or mismatch marker
  avr8js_runner->>avr8js_runner: Evaluate output markers and exit code
Loading

Possibly related issues

  • FastLED/FastLED issue 5335 — The tracking issue lists the permanent AVR runtime regression check as open work; this change adds the drawPolygon hash-check portion described by the supplied context.
Merge Risk: Minimal · up to 26d62

This adds an AVR regression check for polygon drawing and makes the AVR8JS runner require the hash result. It only affects test and CI paths, with no production behavior change. Merge risk is minimal.

Pre-merge checks: Passed 4

Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title names the main change: a drawPolygon scene-hash check on the avr8js Uno, compared against host golden hashes. The changeset adds the PolygonHashes fixture, the setup() check in Test.ino, the…
Linked Issues check Passed Directly linked issue #5324 asks for a permanent AVR runtime regression check that runs the drawPolygon scene and kernel harness and compares per-scene hashes with host output. The PR implements this …
Out of Scope Changes check Passed All changed files connect to the drawPolygon AVR-versus-host check. PolygonHashes.h holds the scenes, golden table, and render helpers. Test.ino wires the check into the AVR build. draw_polygon.hpp ru…
Full details: Title check

Explanation

The title names the main change: a drawPolygon scene-hash check on the avr8js Uno, compared against host golden hashes. The changeset adds the PolygonHashes fixture, the setup() check in Test.ino, the runner marker and mismatch handling, and the matching tests, so the title matches the primary change. The title is 70 characters and uses the conventional ci(avr): prefix. It is concise and specific. The title does not mention the runner's new polygon-hash error pattern, but it does not need to cover every detail.

Full details: Linked Issues check

Explanation

Directly linked issue #5324 asks for a permanent AVR runtime regression check that runs the drawPolygon scene and kernel harness and compares per-scene hashes with host output. The PR implements this for drawPolygon. examples/Test/PolygonHashes.h defines 8 Q16.16 scenes, renders each with the Exact and ABuffer kernels at the AVR tier (MAXN 8, CHUNK 16) on a 16x8 canvas in BLEND mode, hashes the canvas with FNV-1a, and compares against a PROGMEM golden table. examples/Test/Test.ino runs this in setup() on ATmega328P and on AVR parts with at least 48 KB flash, and prints a match or mismatch marker. tests/fl/gfx/draw_polygon.hpp pins the same golden table on the host. ci/runners/avr8js_runner.py treats polygon hash mismatch as a failure and requires the match marker. The PR description reports a local run with all 16 hashes matching (AVR8JS: 1 passed). This is a reported result, not verified in this review. The issue proposal also names other math-heavy paths. The PR states these are follow-ups (#5303, #5292) and does not cover them. Those paths remain open under #5324. The drawPolygon portion of the objective is met.

Full details: Out of Scope Changes check

Explanation

All changed files connect to the drawPolygon AVR-versus-host check. PolygonHashes.h holds the scenes, golden table, and render helpers. Test.ino wires the check into the AVR build. draw_polygon.hpp runs the same golden table on the host. avr8js_runner.py and test_avr8js_runner.py make the runner judge the new mismatch and match markers. The PR states that no workflow files changed and that CI routing changes are out of scope. No changed file was found to be unrelated to the linked issue. The Leonardo exclusion and flash gating in Test.ino are part of the same check and are documented in the PR description.

Finishing Touches

Generate unit tests (beta)

  • Commit to this branch
  • Create a new PR
Fix failing CI checks

  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 972deaa and 26d6277.

Files selected for processing: 5

  • ci/runners/avr8js_runner.py
  • ci/tests/test_avr8js_runner.py
  • examples/Test/PolygonHashes.h
  • examples/Test/Test.ino
  • tests/fl/gfx/draw_polygon.hpp

Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 2 remain after this review.

@github-actions github-actions Bot added the sanitized Title, body and conversation screened; review text requires separate screening. label Nov 21, 2026
@fastled-project-sync fastled-project-sync Bot moved this to Triage in FastLED Tracker Nov 21, 2026
@github-actions github-actions Bot added sanitized Title, body and conversation screened; review text requires separate screening. and removed sanitized Title, body and conversation screened; review text requires separate screening. labels Nov 21, 2026
@github-actions github-actions Bot added sanitized Title, body and conversation screened; review text requires separate screening. and removed sanitized Title, body and conversation screened; review text requires separate screening. labels Nov 21, 2026
@zackees
zackees added this pull request to the merge queue Nov 21, 2026
Merged via the queue into master with commit d0e0517 Nov 21, 2026
248 of 255 checks passed
@zackees
zackees deleted the pilot/5324-avr-polygon-hashes branch November 21, 2026 06:57
@fastled-project-sync fastled-project-sync Bot moved this from Triage to Done in FastLED Tracker Nov 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci-test:avr8js Select FastLED board CI cells sanitized Title, body and conversation screened; review text requires separate screening.

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

ci(avr): permanent AVR runtime regression check for 16-bit-int bugs

1 participant