From 46a3979a6f049071870226caf249727fee42729b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9my=20Rakic?= Date: Mon, 6 Mar 2023 23:16:29 +0000 Subject: [PATCH 1/5] darwin: install clang at known location --- src/ci/scripts/install-clang.sh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/ci/scripts/install-clang.sh b/src/ci/scripts/install-clang.sh index 02b72625d6eb5..4093f73d430c0 100755 --- a/src/ci/scripts/install-clang.sh +++ b/src/ci/scripts/install-clang.sh @@ -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" From 47a2e290b4e9a1157093886a9b0dfb24a41e8449 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9my=20Rakic?= Date: Mon, 6 Mar 2023 23:19:46 +0000 Subject: [PATCH 2/5] pgo: add darwin pipeline --- src/ci/stage-build.py | 45 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) diff --git a/src/ci/stage-build.py b/src/ci/stage-build.py index fe3083dc31e46..76c36833a6fb4 100644 --- a/src/ci/stage-build.py +++ b/src/ci/stage-build.py @@ -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() @@ -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}") From cf6c1f9c46623cde75c29b572cefea4f517d7305 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9my=20Rakic?= Date: Mon, 6 Mar 2023 23:41:53 +0000 Subject: [PATCH 3/5] enable PGO on x64-darwin --- .github/workflows/ci.yml | 2 +- src/ci/github-actions/ci.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 44f789c592ba2..cd65f11e5f93a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -313,7 +313,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 diff --git a/src/ci/github-actions/ci.yml b/src/ci/github-actions/ci.yml index 11f1532bef594..4be87a17cef4c 100644 --- a/src/ci/github-actions/ci.yml +++ b/src/ci/github-actions/ci.yml @@ -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 From a6f38a9336476b60a9a8f4a35461ee59b734b0e2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9my=20Rakic?= Date: Tue, 7 Mar 2023 00:03:19 +0000 Subject: [PATCH 4/5] tmp: deactivate linux PR builders No need to waste resources building the PR on linux, when only the osx builder will be tested. --- .github/workflows/ci.yml | 20 ------------------- src/ci/github-actions/ci.yml | 38 ++++++++++++++++++------------------ 2 files changed, 19 insertions(+), 39 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index cd65f11e5f93a..2801b19ef1376 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -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: diff --git a/src/ci/github-actions/ci.yml b/src/ci/github-actions/ci.yml index 4be87a17cef4c..58dc16a2382cb 100644 --- a/src/ci/github-actions/ci.yml +++ b/src/ci/github-actions/ci.yml @@ -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: From c9fe5a828468bbbce1c512df97d8c588fb9128e1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9my=20Rakic?= Date: Tue, 7 Mar 2023 00:17:23 +0000 Subject: [PATCH 5/5] tmp: make try builds use x64-darwin job --- .github/workflows/ci.yml | 15 ++++++++++++--- src/ci/github-actions/ci.yml | 15 ++++++++++++--- 2 files changed, 24 insertions(+), 6 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2801b19ef1376..ad58319e892a1 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -574,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: diff --git a/src/ci/github-actions/ci.yml b/src/ci/github-actions/ci.yml index 58dc16a2382cb..a614a86628cca 100644 --- a/src/ci/github-actions/ci.yml +++ b/src/ci/github-actions/ci.yml @@ -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