Sitelet https://github.com/astral-sh/python-build-standalone/pull/1294
Skip to content

Use generic scheduling on Apple Silicon - #1294

Open
joshuarli wants to merge 1 commit into
astral-sh:mainfrom
joshuarli:codex/apple-silicon-generic-tuning
Open

joshuarli wants to merge 1 commit into
astral-sh:mainfrom
joshuarli:codex/apple-silicon-generic-tuning

Conversation

@joshuarli

Copy link
Copy Markdown

Summary

Make the macOS arm64 target's CPU policy explicit: retain the Apple Silicon-compatible M1 instruction baseline, while requesting generic scheduling instead of tuning the universal artifact to a particular M generation.

This keeps the existing -arch arm64 and macOS 11 deployment target. PGO and LTO settings are unchanged.

Measurements

On an M1 Pro, I built CPython 3.14.6 with PGO and ThinLTO using LLVM 23.1.1 and compared the proposed flags against both plain -arch arm64 and explicit M1 tuning. Across five small workloads, the proposed flags were within measurement noise of plain -arch arm64; explicit M1 tuning was about 3–11% faster than the proposed generic scheduling policy. That is an intentional universal-target tradeoff, measured on one machine, not a broad hardware claim.

Validation

  • LLVM 22.1.3, the currently pinned PBS toolchain, accepts the proposed flags.
  • A full CPython 3.14.6 PGO + ThinLTO build using these flags succeeded with LLVM 23.1.1 in an independent build harness.
  • No PBS build or test harness was run for this change; the upstream CI should validate the target configuration.

@joshuarli
joshuarli marked this pull request as ready for review September 24, 2026 04:43
@jjhelmus

Copy link
Copy Markdown
Contributor

On a M5 Max I found almost no performance change with these setting using the fastmark benchmarks.

Clang defaults to -mcpu=apple-m1 -mtune=apple-m1 with the existing -arch arm64 -mmacosx-version-min=11.0 flags. In LLVM 23, mtune=generic targets the Cortex-A510 scheduling model which seems less appropriate than the default.

This branch has not been deployed

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants