-
-
Notifications
You must be signed in to change notification settings - Fork 2k
ci: build the published macOS and Windows artifacts with PGO #14246
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
sylvestre
wants to merge
1
commit into
uutils:main
Choose a base branch
from
sylvestre:pgo-windows
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+86
−45
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -368,28 +368,34 @@ jobs: | |
| matrix: | ||
| job: | ||
| # - { os , target , default-features, features , use-cross , toolchain, skip-tests, workspace-tests, skip-package, skip-publish } | ||
| # `pgo: PGO` marks a published target whose instrumented binary the | ||
| # runner can execute, which is what training a profile needs. It is | ||
| # therefore off for the `cross` targets (no emulator) and the wasm | ||
| # ones (no runtime). The value is spelled `PGO` because GitHub appends | ||
| # the matrix values to the job title, so those jobs read as | ||
| # "Build (..., x86_64-unknown-linux-gnu, ..., PGO)". | ||
| - { os: ubuntu-latest , target: arm-unknown-linux-gnueabihf , features: feat_os_unix_gnueabihf , use-cross: use-cross , skip-tests: true } | ||
| - { os: ubuntu-24.04-arm , target: aarch64-unknown-linux-gnu , features: feat_os_unix_gnueabihf } | ||
| - { os: ubuntu-24.04-arm , target: aarch64-unknown-linux-gnu , features: feat_os_unix_gnueabihf, pgo: PGO } | ||
| - { os: ubuntu-latest , target: aarch64-unknown-linux-musl , features: feat_os_unix_musl , use-cross: use-cross , skip-tests: true } | ||
| - { os: ubuntu-latest , target: riscv64gc-unknown-linux-musl , features: feat_os_unix_musl , use-cross: use-cross , skip-tests: true } | ||
| # - { os: ubuntu-latest , target: x86_64-unknown-linux-gnu , features: feat_selinux , use-cross: use-cross } | ||
| - { os: ubuntu-latest , target: i686-unknown-linux-gnu , features: "feat_os_unix,test_risky_names", use-cross: use-cross } | ||
| - { os: ubuntu-latest , target: i686-unknown-linux-musl , features: feat_os_unix_musl , use-cross: use-cross } | ||
| - { os: ubuntu-latest , target: x86_64-unknown-linux-gnu , features: "feat_os_unix,test_risky_names", use-cross: use-cross, skip-publish: true } | ||
| - { os: ubuntu-latest , target: x86_64-unknown-linux-gnu , features: "feat_os_unix,uudoc" , use-cross: no, workspace-tests: true } | ||
| - { os: ubuntu-latest , target: x86_64-unknown-linux-gnu , features: "feat_os_unix,uudoc" , use-cross: no, workspace-tests: true, pgo: PGO } | ||
| - { os: ubuntu-latest , target: x86_64-unknown-linux-musl , features: feat_os_unix_musl , use-cross: use-cross } | ||
| - { os: ubuntu-latest , target: x86_64-unknown-netbsd, features: "feat_os_unix", use-cross: use-cross , skip-tests: true , check-only: true } | ||
| # - { os: ubuntu-latest , target: x86_64-unknown-redox , features: feat_os_unix_redox , use-cross: redoxer , skip-tests: true , check-only: true } | ||
| - { os: ubuntu-latest , target: wasm32-wasip1, default-features: false, features: feat_wasm, skip-tests: true } | ||
| - { os: ubuntu-latest , target: wasm32-wasip2, default-features: false, features: feat_wasm, skip-tests: true } | ||
| - { os: macos-latest , target: aarch64-apple-darwin , features: feat_os_unix, workspace-tests: true } # M1 CPU | ||
| - { os: macos-latest , target: aarch64-apple-darwin , features: feat_os_unix, workspace-tests: true, pgo: PGO } # M1 CPU | ||
| # PR #7964: chcon should not break build without the feature. cargo check is enough to detect it. | ||
| - { os: macos-latest , target: aarch64-apple-darwin , workspace-tests: true, check-only: true } # M1 CPU | ||
| - { os: macos-latest , target: x86_64-apple-darwin , features: feat_os_unix, workspace-tests: true } | ||
| - { os: windows-latest , target: i686-pc-windows-msvc , features: feat_os_windows } | ||
| - { os: macos-latest , target: x86_64-apple-darwin , features: feat_os_unix, workspace-tests: true, pgo: PGO } | ||
| - { os: windows-latest , target: i686-pc-windows-msvc , features: feat_os_windows, pgo: PGO } | ||
| # msvc and gnu works on the same target. So publishing msvc is enough. | ||
| - { os: windows-latest , target: x86_64-pc-windows-gnu , features: feat_os_windows, skip-publish: true } | ||
| - { os: windows-latest , target: x86_64-pc-windows-msvc , features: feat_os_windows } | ||
| - { os: windows-latest , target: x86_64-pc-windows-msvc , features: feat_os_windows, pgo: PGO } | ||
| - { os: windows-latest , target: aarch64-pc-windows-msvc , features: feat_os_windows, use-cross: use-cross , skip-tests: true } | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There is native runner for Win11 arm if it is the reason that PGO is disabled. |
||
| steps: | ||
| - uses: actions/checkout@v7.0.1 | ||
|
|
@@ -635,36 +641,25 @@ jobs: | |
| ${{ steps.dep_vars.outputs.CARGO_UTILITY_LIST_OPTIONS }} -p coreutils | ||
| env: | ||
| RUST_BACKTRACE: "1" | ||
| - name: Decide whether to train PGO | ||
| shell: bash | ||
| run: | | ||
| ## PGO needs to run the instrumented binary, so it is limited to the | ||
| ## natively-built, published targets. x86_64-apple-darwin is excluded: | ||
| ## it is cross-compiled on an arm64 runner, which cannot execute it. | ||
| PGO=0 | ||
| if [ '${{ matrix.job.skip-publish }}' != 'true' ] && \ | ||
| [ '${{ matrix.job.check-only }}' != 'true' ] && \ | ||
| [ '${{ matrix.job.use-cross }}' != 'use-cross' ]; then | ||
| case '${{ matrix.job.target }}' in | ||
| x86_64-unknown-linux-gnu|aarch64-unknown-linux-gnu|aarch64-apple-darwin) PGO=1 ;; | ||
| esac | ||
| fi | ||
| echo "PGO=${PGO}" >> "$GITHUB_ENV" | ||
| - name: Install llvm-tools (PGO) | ||
| if: env.PGO == '1' | ||
| if: matrix.job.pgo | ||
| shell: bash | ||
| run: rustup component add llvm-tools | ||
| - name: Train PGO profiles | ||
| if: env.PGO == '1' | ||
| if: matrix.job.pgo | ||
| shell: bash | ||
| run: | | ||
| ## The target dir is relative: on Windows `github.workspace` is a | ||
| ## backslash path that git-bash would not resolve. The script writes the | ||
| ## profile's absolute path (natively spelled) to profdata-path.txt. | ||
| ./util/build-pgo.sh \ | ||
| --target-dir "${{ github.workspace }}/target/coreutils-pgo" \ | ||
| --target "${{ matrix.job.target }}" \ | ||
| --target-dir target/coreutils-pgo \ | ||
| --features "${{ matrix.job.features }}" \ | ||
| --train-only | ||
| echo "RUSTFLAGS=${RUSTFLAGS:+${RUSTFLAGS} }-Cprofile-use=${{ github.workspace }}/target/coreutils-pgo/coreutils.profdata" >> "$GITHUB_ENV" | ||
| echo "RUSTFLAGS=${RUSTFLAGS:+${RUSTFLAGS} }-Cprofile-use=$(cat target/coreutils-pgo/profdata-path.txt)" >> "$GITHUB_ENV" | ||
| - name: Verify PGO is applied to the published build | ||
| if: env.PGO == '1' | ||
| if: matrix.job.pgo | ||
| shell: bash | ||
| run: | | ||
| ## The release artifact must be the PGO build: if RUSTFLAGS did not | ||
|
|
@@ -674,7 +669,7 @@ jobs: | |
| *-Cprofile-use=*) ;; | ||
| *) echo "::error::-Cprofile-use missing from RUSTFLAGS" ; exit 1 ;; | ||
| esac | ||
| test -s "${{ github.workspace }}/target/coreutils-pgo/coreutils.profdata" | ||
| test -s "$(cat target/coreutils-pgo/profdata-path.txt)" | ||
| - name: Build coreutils | ||
| shell: bash | ||
| if: matrix.job.skip-publish != true && matrix.job.check-only != true && matrix.job.target != 'x86_64-pc-windows-msvc' | ||
|
|
||
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
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I7m not sure why we pay it for i686