Skip to content

fix(mp3): the SIMD gate measures the runner fleet, not the kernel (#4183) - #4263

Merged
zackees merged 1 commit into
masterfrom
fix/4183-simd-gate-fleet-spread
Sep 10, 2026
Merged

zackees merged 1 commit into
masterfrom
fix/4183-simd-gate-fleet-spread

Conversation

@zackees

@zackees zackees commented Sep 10, 2026 •

Copy link
Copy Markdown
Member

FL_CHECK_GE(ratio, 0.95) has taken the default branch red at random and is the only thing blocking #4175. It also just failed an unrelated lint-tooling PR (#4256, which touches only ci/tools/) at speedup=0.922x, which is what prompted this.

The cause is settled; two measurements are new

Your investigation on the issue established the shape: the ratio is bimodal across the fleet, not noisy around one value — 0.904, 0.920, 0.922, 0.924, 0.945 on some machines against 1.080 on others. The decisive detail was that the fastest scalar time of the lot produced the worst ratio, so it is not contention.

Two things this adds:

  • The 0.922 above came from a macOS ARM runner (/Users/runner, /opt/homebrew), so the slow population is not only GHA x86 as the issue supposed.
  • An optimised build on my host measures 0.993x–1.005x across runs — between the two populations, and itself straddling the margin that 0.95 depended on.

So 0.95 sits inside the spread. As a gate it reports which runner drew the job.

What replaces it

A floor far outside any fleet variation: ratio >= 0.5. A vector path twice as slow as the scalar one it replaces is a defect on any machine.

Stated plainly, because it is a real loss: this will not catch a subtle regression. Nothing measured here can — that is the finding — and that job belongs to ci/codec_cpu/audit.py, which builds optimised and compares against recorded baselines rather than against the scalar path on whatever silicon it drew. The in-source comment already named that as the gate that counts; this makes the two stop overlapping.

The ratio is still printed on every run, so a shift in either population stays visible.

This is option 1 from your list, with a floor kept rather than dropping the assertion entirely. Option 2 (threshold ~0.88) I did not take: the slow population reaches 0.904, so 0.88 leaves ~2% of margin against a distribution that has already moved 19%.

The "~1.10x" claim is corrected

It describes the fast population only, and read as though there were one answer.

Verification note

The assertion is __OPTIMIZE__-gated, so quick mode compiles it out. My first attempt at this mutation ran against a stale binary and looked like a survivor — the same trap as earlier in this program. Redone in a release build:

mutation result
scale the ratio to a quarter FAIL — the floor fires
unmutated passes at 0.993x
  • bash test --cpp — 300/300 unit, 84/84 examples
  • bash lint — clean, exit 0

Refs #4183, #4175, #4155

🤖 Generated with Claude Code

https://claude.ai/code/session_01MLhWkMfzLjrnLTDMBE6Fj9

Summary by CodeRabbit

  • Tests
    • Relaxed the optimized-build performance threshold for fixed-point SIMD MP3 decoding tests to account for variance across CI environments.
    • Updated test documentation with observed performance ranges and clarified that regression detection is handled separately.

)

`FL_CHECK_GE(ratio, 0.95)` has taken the default branch red at random and is
the only thing blocking #4175. It also just failed an unrelated lint-tooling
PR at 0.922x, which is what prompted this.

The issue's own investigation settled the cause: the ratio is bimodal across
GitHub's fleet, not noisy around one value -- 0.904, 0.920, 0.922, 0.924,
0.945 on some machines against 1.080 on others. The decisive detail is that
the *fastest* scalar time of the lot produced the worst ratio, so it is not
contention. The kernel is genuinely faster on part of the fleet and genuinely
slower on the rest, and both are correct measurements of different hardware.

Two measurements this adds. The 0.922 above came from a **macOS ARM** runner,
so the slow population is not only GHA x86 as the issue supposed. And an
optimised build on my host measures **0.993x-1.005x across runs** -- between
the two populations, and itself straddling the margin the 0.95 threshold
depended on.

0.95 sits inside that spread, so as a gate it reports which runner drew the
job. What replaces it is a floor far outside any fleet variation: a vector
path twice as slow as the scalar one it replaces is a defect on any machine.

Stated plainly, because it is a real loss: this will not catch a subtle
regression. Nothing measured here can -- that is the finding -- and that job
belongs to `ci/codec_cpu/audit.py`, which builds optimised and compares
against recorded baselines rather than against the scalar path on whatever
silicon it drew. The in-source comment already named that as the gate that
counts. The ratio is still printed on every run, so a shift in either
population stays visible.

The "x86 measures ~1.10x" claim is corrected: it describes the fast
population only, and reads as though there were one answer.

Verified in an optimised build, since the assertion is `__OPTIMIZE__`-gated
and quick mode compiles it out -- a first attempt at this mutation ran against
a stale binary and looked like a survivor. Scaling the ratio to a quarter
fails the case; the real ratio passes.

Refs #4183, #4175, #4155

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01MLhWkMfzLjrnLTDMBE6Fj9
@coderabbitai

coderabbitai Bot commented Sep 10, 2026 •

Copy link
Copy Markdown

Review Change StackReview Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Advanced

Run ID: d7fad1e4-6e76-4a17-9598-3ca7ca78854f

📥 Commits

Reviewing files that changed from the base of the PR and between a2f2a7f and 614c1b7.

📒 Files selected for processing (1)
  • tests/fl/codec/mp3_fixed_point.hpp

Included review availability: Your plan provides up to 8 included reviews per hour; 1 remains after this review.


📝 Walkthrough

Walkthrough

The MP3 fixed-point SIMD speed test lowers its optimized-build ratio threshold from 0.95 to 0.5. Comments document bimodal CI runner measurements and identify ci/codec_cpu/audit.py as the regression detector.

Changes

MP3 SIMD speed validation

Layer / File(s) Summary
SIMD speed gate and benchmark guidance
tests/fl/codec/mp3_fixed_point.hpp
The optimized-build assertion now requires a ratio of at least 0.5. Comments document measured runner variance and updated unoptimized-build ranges.

Estimated code review effort: 1 (Trivial) | ~5 minutes

Merge Risk: ⚪ Minimal · up to 614c1

This change makes the MP3 SIMD benchmark tolerant of documented runner variance while retaining performance visibility and baseline auditing. No merge-blocking current-head risk remains.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly identifies the MP3 SIMD performance gate as the main change and explains that runner variability affects its measurement.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 1…
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/4183-simd-gate-fleet-spread

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 merged commit c8b3a4f into master Sep 10, 2026
9 checks passed
@fastled-project-sync fastled-project-sync Bot moved this from Triage to Done in FastLED Tracker Sep 10, 2026
zackees added a commit that referenced this pull request Sep 10, 2026
…lds it (#4183) (#4266)

* fix(mp3): stop pointing the SIMD perf gate at an audit that never builds it

#4263 relaxed the SIMD-vs-scalar wall-clock check to a `ratio >= 0.5` floor,
which was right -- the fleet is bimodal (0.904 to 1.080) and no threshold in
that band separates a regression from which runner GitHub drew. But it
justified the loss by saying the real gate lives in `ci/codec_cpu/audit.py`,
"which builds optimised and compares against recorded baselines". I wrote that.
It is false.

`_common_compile_flags()` passes `-DMINIMP3_NO_SIMD`, and so do
`callgrind.py` and `text_size.py`. Every build path that audit has is scalar,
on purpose: `MP3D_HAVE_INT_SIMD` needs SSE2 or NEON, no platform under
src/platforms/ is either, and the WASM build passes no -msimd128, so a SIMD-on
host run would measure kernels no board executes. The doc already says this
loudly under "Disable SIMD when tracing on the host" -- the test comment was
pointing at the one file that documents doing the opposite.

So the true state is that **nothing gates how fast the vector path is**, and
that is defensible on its own terms rather than by deferring to a gate that
does not exist: those kernels run only in host unit tests and native desktop
builds. Their correctness is gated exactly, by the bit-identical case in the
same file, which compares decoded samples rather than times and therefore
holds on any machine.

Comment corrected in both branches (the -O0 branch carried the same claim and
predates #4263). Doc says it in the section that lists what the gate misses.

Two guards added, since the invariant was documented and unenforced:

- every compile path in ci/codec_cpu/ carries the define
- the codegen audit's three-flag filter does not widen to swallow it

Mutation-tested: dropping the define from audit.py, callgrind.py or
text_size.py fails, and so does widening either filter to a prefix match.

Refs #4183, #4263.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01MLhWkMfzLjrnLTDMBE6Fj9

* review(mp3): build the filtered flag list with an explicit loop

.cursorrules asks for explicit loops over comprehensions. Same filter, same
assertion; the mutation that widens the drop list to a prefix match still
fails the case.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01MLhWkMfzLjrnLTDMBE6Fj9

---------

Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
@zackees
zackees deleted the fix/4183-simd-gate-fleet-spread branch November 5, 2026 05:52
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