Repository navigation
fix(mp3): the SIMD gate measures the runner fleet, not the kernel (#4183) - #4263
Conversation
) `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
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (1)
Included review availability: Your plan provides up to 8 included reviews per hour; 1 remains after this review. 📝 WalkthroughWalkthroughThe 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 ChangesMP3 SIMD speed validation
Estimated code review effort: 1 (Trivial) | ~5 minutes Merge Risk: ⚪ Minimal · up to 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)
✨ 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 |
…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]>
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 onlyci/tools/) atspeedup=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:
/Users/runner,/opt/homebrew), so the slow population is not only GHA x86 as the issue supposed.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:bash test --cpp— 300/300 unit, 84/84 examplesbash lint— clean, exit 0Refs #4183, #4175, #4155
🤖 Generated with Claude Code
https://claude.ai/code/session_01MLhWkMfzLjrnLTDMBE6Fj9
Summary by CodeRabbit