Skip to content
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

Test PGO on x64-darwin #108837

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 13 additions & 24 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,26 +42,6 @@ jobs:
TOOLSTATE_REPO: "https://github.com/rust-lang-nursery/rust-toolstate"
CACHE_DOMAIN: ci-caches.rust-lang.org
if: "github.event_name == 'pull_request'"
continue-on-error: "${{ matrix.tidy }}"
strategy:
matrix:
include:
- name: mingw-check
tidy: false
os: ubuntu-20.04-xl
env: {}
- name: mingw-check-tidy
tidy: true
os: ubuntu-20.04-xl
env: {}
- name: x86_64-gnu-llvm-14
tidy: false
os: ubuntu-20.04-xl
env: {}
- name: x86_64-gnu-tools
tidy: false
os: ubuntu-20.04-xl
env: {}
timeout-minutes: 600
runs-on: "${{ matrix.os }}"
steps:
Expand Down Expand Up @@ -313,7 +293,7 @@ jobs:
os: ubuntu-20.04-xl
- name: dist-x86_64-apple
env:
SCRIPT: "./x.py dist bootstrap --include-default-paths --host=x86_64-apple-darwin --target=x86_64-apple-darwin"
SCRIPT: PGO_HOST=x86_64-apple-darwin python3 src/ci/stage-build.py python3 x.py dist bootstrap --include-default-paths --host=x86_64-apple-darwin --target=x86_64-apple-darwin
RUST_CONFIGURE_ARGS: "--enable-full-tools --enable-sanitizers --enable-profiler --set rust.jemalloc --set llvm.ninja=false --set rust.lto=thin"
RUSTC_RETRY_LINKER_ON_SEGFAULT: 1
MACOSX_DEPLOYMENT_TARGET: 10.7
Expand Down Expand Up @@ -594,9 +574,18 @@ jobs:
strategy:
matrix:
include:
- name: dist-x86_64-linux
os: ubuntu-20.04-xl
env: {}
- name: dist-x86_64-apple
env:
SCRIPT: PGO_HOST=x86_64-apple-darwin python3 src/ci/stage-build.py python3 x.py dist bootstrap --include-default-paths --host=x86_64-apple-darwin --target=x86_64-apple-darwin
RUST_CONFIGURE_ARGS: "--enable-full-tools --enable-sanitizers --enable-profiler --set rust.jemalloc --set llvm.ninja=false --set rust.lto=thin"
RUSTC_RETRY_LINKER_ON_SEGFAULT: 1
MACOSX_DEPLOYMENT_TARGET: 10.7
SELECT_XCODE: /Applications/Xcode_13.4.1.app
NO_LLVM_ASSERTIONS: 1
NO_DEBUG_ASSERTIONS: 1
NO_OVERFLOW_CHECKS: 1
DIST_REQUIRE_ALL_TOOLS: 1
os: macos-12-xl
timeout-minutes: 600
runs-on: "${{ matrix.os }}"
steps:
Expand Down
55 changes: 32 additions & 23 deletions src/ci/github-actions/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -288,25 +288,25 @@ jobs:
env:
<<: [*shared-ci-variables, *public-variables]
if: github.event_name == 'pull_request'
continue-on-error: ${{ matrix.tidy }}
strategy:
matrix:
include:
- name: mingw-check
<<: *job-linux-xl
tidy: false

- name: mingw-check-tidy
<<: *job-linux-xl
tidy: true

- name: x86_64-gnu-llvm-14
<<: *job-linux-xl
tidy: false

- name: x86_64-gnu-tools
<<: *job-linux-xl
tidy: false
# continue-on-error: ${{ matrix.tidy }}
# strategy:
# matrix:
# include:
# - name: mingw-check
# <<: *job-linux-xl
# tidy: false

# - name: mingw-check-tidy
# <<: *job-linux-xl
# tidy: true

# - name: x86_64-gnu-llvm-14
# <<: *job-linux-xl
# tidy: false

# - name: x86_64-gnu-tools
# <<: *job-linux-xl
# tidy: false

auto:
permissions:
Expand Down Expand Up @@ -478,7 +478,7 @@ jobs:

- name: dist-x86_64-apple
env:
SCRIPT: ./x.py dist bootstrap --include-default-paths --host=x86_64-apple-darwin --target=x86_64-apple-darwin
SCRIPT: PGO_HOST=x86_64-apple-darwin python3 src/ci/stage-build.py python3 x.py dist bootstrap --include-default-paths --host=x86_64-apple-darwin --target=x86_64-apple-darwin
RUST_CONFIGURE_ARGS: --enable-full-tools --enable-sanitizers --enable-profiler --set rust.jemalloc --set llvm.ninja=false --set rust.lto=thin
RUSTC_RETRY_LINKER_ON_SEGFAULT: 1
MACOSX_DEPLOYMENT_TARGET: 10.7
Expand Down Expand Up @@ -749,9 +749,18 @@ jobs:
strategy:
matrix:
include:
- &dist-x86_64-linux
name: dist-x86_64-linux
<<: *job-linux-xl
- name: dist-x86_64-apple
env:
SCRIPT: PGO_HOST=x86_64-apple-darwin python3 src/ci/stage-build.py python3 x.py dist bootstrap --include-default-paths --host=x86_64-apple-darwin --target=x86_64-apple-darwin
RUST_CONFIGURE_ARGS: --enable-full-tools --enable-sanitizers --enable-profiler --set rust.jemalloc --set llvm.ninja=false --set rust.lto=thin
RUSTC_RETRY_LINKER_ON_SEGFAULT: 1
MACOSX_DEPLOYMENT_TARGET: 10.7
SELECT_XCODE: /Applications/Xcode_13.4.1.app
NO_LLVM_ASSERTIONS: 1
NO_DEBUG_ASSERTIONS: 1
NO_OVERFLOW_CHECKS: 1
DIST_REQUIRE_ALL_TOOLS: 1
<<: *job-macos-xl

master:
name: master
Expand Down
5 changes: 4 additions & 1 deletion src/ci/scripts/install-clang.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,12 @@ if isMacOS; then
bindir="$(xcode-select --print-path)/Toolchains/XcodeDefault.xctoolchain/usr/bin"
else
file="${MIRRORS_BASE}/clang%2Bllvm-${LLVM_VERSION}-x86_64-apple-darwin.tar.xz"
mkdir -p citools
cd citools
retry curl -f "${file}" -o "clang+llvm-${LLVM_VERSION}-x86_64-apple-darwin.tar.xz"
tar xJf "clang+llvm-${LLVM_VERSION}-x86_64-apple-darwin.tar.xz"
bindir="$(pwd)/clang+llvm-${LLVM_VERSION}-x86_64-apple-darwin/bin"
mv "clang+llvm-${LLVM_VERSION}-x86_64-apple-darwin" clang-rust
bindir="$(pwd)/clang-rust/bin"
fi

ciCommandSetEnv CC "${bindir}/clang"
Expand Down
45 changes: 45 additions & 0 deletions src/ci/stage-build.py
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,49 @@ def supports_bolt(self) -> bool:
return False


class DarwinPipeline(Pipeline):
def __init__(self):
self.checkout_dir = Path(os.getcwd())

def checkout_path(self) -> Path:
return self.checkout_dir

def downloaded_llvm_dir(self) -> Path:
return self.checkout_path() / "citools" / "clang-rust"

def build_root(self) -> Path:
return self.checkout_path()

def opt_artifacts(self) -> Path:
return Path("/tmp/tmp-multistage/opt-artifacts")

def build_rustc_perf(self):
# rustc-perf version from 2022-07-22
perf_commit = "3c253134664fdcba862c539d37f0de18557a9a4c"
rustc_perf_zip_path = self.opt_artifacts() / "perf.zip"

def download_rustc_perf():
download_file(
f"https://github.com/rust-lang/rustc-perf/archive/{perf_commit}.zip",
rustc_perf_zip_path
)
with change_cwd(self.opt_artifacts()):
unpack_archive(rustc_perf_zip_path)
move_path(Path(f"rustc-perf-{perf_commit}"), self.rustc_perf_dir())
delete_file(rustc_perf_zip_path)

retry_action(download_rustc_perf, "Download rustc-perf")

with change_cwd(self.rustc_perf_dir()):
cmd([self.cargo_stage_0(), "build", "-p", "collector"], env=dict(
RUSTC=str(self.rustc_stage_0()),
RUSTC_BOOTSTRAP="1"
))

def supports_bolt(self) -> bool:
return False


def get_timestamp() -> float:
return time.time()

Expand Down Expand Up @@ -576,6 +619,8 @@ def create_pipeline() -> Pipeline:
return LinuxPipeline()
elif sys.platform in ("cygwin", "win32"):
return WindowsPipeline()
elif sys.platform == "darwin":
return DarwinPipeline()
else:
raise Exception(f"Optimized build is not supported for platform {sys.platform}")

Expand Down