Skip to content

fix(mp3): pin codegen audit compiler to prevent cache-dependent regressions #4779

Open

Description

@zackees

Context

The MP3 CPU audit fails in PR #4774 at minimp3-float/codegen/riscv32-esp/dct32/instructions: 47 exceeds the pinned 44 plus 5% tolerance (46.2). Reproduced in CI runs 37699075000 and 37700808770.

Two investigation rounds isolated compiler selection:

  • src/third_party/minimp3 and ci/codec_cpu are identical between unchanged master 61d6ccf and the PR. The isolated codegen probe already uses -fno-exceptions, independently of ESP project staging.
  • Explicit GCC 13.2.0 (esp-13.2.0_20240530) produces the same counts on unchanged master and the PR: float dct32 47, float polyphase 185, fixed dct32 88, fixed polyphase 88.
  • Explicit GCC 14.2.0 (20260121) on the same current sources produces 44, 185, 81, 88 respectively. Its float dct32 matches the existing baseline.

The workflow warms several boards and adds cached compiler directories to PATH. ci/codec_cpu/audit.py selects a PATH compiler before searching cached packages. The measured compiler can therefore vary with installed package/cache contents.

Proposal

Select the codegen compiler deterministically and record compiler version/provenance alongside the baseline and current report. Define the supported compiler rather than raising a threshold to mask selection drift.

Acceptance criteria

  • RED: reproduce ambiguous selection with both supported compiler versions present and show the 47-versus-44 result on identical sources.
  • GREEN: explicit deterministic selection produces the intended metric regardless of PATH/cache ordering.
  • Report compiler path, version and target flags with each target-codegen result.
  • Preserve existing decoder sources and instruction thresholds unless a separately justified compiler baseline migration is required.

Decisions

Open questions

Which compiler version should be the supported baseline for each audited target?

Activity

  1. zackees commented on Oct 7, 2026

    @zackees
    MemberAuthor

    Read-only follow-up identified a narrow implementation proposal in ci/codec_cpu/audit.py and its existing tests:

    • Discover all candidate compiler directories rather than accepting the first PATH match.
    • Select the explicitly supported baseline compiler version and derive objdump from the same directory.
    • Record resolved compiler path/version, companion tool version and effective flags in codegen provenance.
    • Fail with a clear missing-version/tool-pair diagnostic rather than silently selecting a different compiler.
    • RED/GREEN coverage should demonstrate GCC13 preceding GCC14, reversed candidate ordering, inherited FBUILD_CACHE_DIR discovery, missing companion tools and missing required compiler version.

    The existing CI warm-up must actually provide the selected compiler before deciding whether source-only selection is sufficient. Do not claim that availability is proven from the local cache. No implementation, baseline threshold or workflow change has been made.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions