Repository navigation
Build the pie extensions from the core's profile and cache the musl PHP builds - #6880
Open
ondrejmirtes wants to merge 2 commits into
Open
ondrejmirtes wants to merge 2 commits into
ondrejmirtes wants to merge 2 commits into
Conversation
…again The self-contained extensions of the pie legs ran a full `make pgo` each: an instrumented build, a training run and the optimised build, 6-18 minutes per leg. The core jobs now pack the core's share of their profile (`make SPLIT=1 pgo-pack`, uploaded as turbo-pgo-profile-<platform> and carried over with a reused core), and the pie legs build from it with `make pgo-from-profile`, which falls back to `make pgo` when another compiler recorded the profile. The core compiles to the same code against every version's headers, but GCC instruments before optimising: with the 8.5 core's profile, 85 of 33136 functions mismatch on 8.2-zts (none on 8.4, 8.4-zts, 8.5), and those build without a profile.
The musl thread-safe legs and 8.2 build PHP from the release tarball, about 6 minutes per leg. install-alpine-php.sh now keeps that build in $PHP_CACHE_DIR, which phar.yml restores with actions/cache under the key `install-alpine-php.sh --resolve` prints (Alpine release, architecture, PHP release, thread safety), so a new patch release or RC builds again. Installing from the cache takes seconds. Amp-Thread-ID: https://ampcode.com/threads/T-01a18495-f2db-74a3-a734-f1c0dbe24b9f
| - name: "Resolve the PHP build to cache (Alpine container)" | ||
| id: alpine-php | ||
| if: matrix.target.family == 'musl' | ||
| run: sh .github/scripts/install-alpine-php.sh --resolve >> "$GITHUB_OUTPUT" |
| # see turbo-compile | ||
| - name: "Resolve the PHP build to cache" | ||
| id: alpine-php | ||
| run: docker exec alpine-build sh .github/scripts/install-alpine-php.sh --resolve >> "$GITHUB_OUTPUT" |
| # see turbo-compile | ||
| - name: "Resolve the PHP build to cache" | ||
| id: alpine-php | ||
| run: docker exec alpine-test sh .github/scripts/install-alpine-php.sh --resolve >> "$GITHUB_OUTPUT" |
|
|
||
| - name: "Restore the PHP build (Alpine container)" | ||
| if: steps.alpine-php.outputs.release != '' | ||
| uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0 |
|
|
||
| - name: "Restore the PHP build" | ||
| if: steps.alpine-php.outputs.release != '' | ||
| uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0 |
|
|
||
| - name: "Restore the PHP build" | ||
| if: steps.alpine-php.outputs.release != '' | ||
| uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Two changes to cut the time of the Turbo compile legs in
phar.yml.pie legs reuse the core's PGO profile. Each
pieleg used to run a fullmake pgo(instrumented build, training run, optimised build): 6–18 minutes per leg, about 320 runner-minutes on the 2.3.3 release, and on the critical path of everything that needsturbo-compile. The core jobs now pack the core's share of their profile (make SPLIT=1 pgo-pack, artifactturbo-pgo-profile-<platform>, carried over with a reused core), and thepielegs build from it withmake pgo-from-profile. When another compiler recorded the profile (e.g. the 8.6 NTS musl leg onalpine:edge), it falls back tomake pgo.GCC instruments before optimising, so the shared core is not always the same control flow against other headers: with the 8.5 core's profile, 85 of 33136 functions mismatch on 8.2-zts, none on 8.4, 8.4-zts or 8.5. Those functions build without a profile (
-Wno-coverage-mismatch).Verified in the CI images: core trained in
gnu-php8.5, then an 8.2-zts self-contained build from its profile ingnu-php8.2-ztstook 1m26s on 4 cores, reports the expected version, andturbo-ext/tests/smoke.phpprintsALL OK. The macOS (clang) leg was not run locally.musl legs cache the PHP they build from source. The thread-safe legs and 8.2 build PHP from the tarball (~6 min per leg).
install-alpine-php.shkeeps that build in$PHP_CACHE_DIR, restored withactions/cacheunder the keyinstall-alpine-php.sh --resolveprints (Alpine release, arch, PHP release, ZTS) plus the hash ofbuild-php.sh. Verified inalpine:3.24with 8.3 ZTS: 3m30s to build, 4s from the cache. Coversturbo-compile,turbo-compile-musl-arm64andturbo-differential-musl.The core jobs are part of the reuse fingerprint, so the first run after this compiles every core once more.