From fb5c6a98d4ddde95f0010138dd55272fb3c36080 Mon Sep 17 00:00:00 2001 From: andreroesti Date: Mon, 4 Nov 2024 15:32:37 -0800 Subject: [PATCH] rework CI and Docker image --- .github/workflows/build.yaml | 28 ++++++++++++++++ .github/workflows/test.yaml | 62 ------------------------------------ docker/Dockerfile | 2 +- docker/setup-build.sh | 13 ++++---- docker/setup-llvm.sh | 9 ++---- 5 files changed, 39 insertions(+), 75 deletions(-) create mode 100644 .github/workflows/build.yaml delete mode 100644 .github/workflows/test.yaml diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml new file mode 100644 index 0000000..217db18 --- /dev/null +++ b/.github/workflows/build.yaml @@ -0,0 +1,28 @@ +name: Build LLVM and LLVM-MCAD inside Docker +on: + push: + #schedule: + # # Run nightly at 08:00 UTC (aka 00:00 Pacific, aka 03:00 Eastern) + # - cron: '0 8 * * *' + +permissions: + contents: read # Default everything to read-only + +env: + WORKSPACE_PATH: ${{ github.workspace }} + +jobs: + build: + # We need to run self-hosted because the GitHub runners run out of disk space. + runs-on: [self-hosted, linux] + steps: + - uses: actions/checkout@v4 + with: + path: 'LLVM-MCA-Daemon' + - name: install dependencies + run: sudo ./docker/setup-deps.sh + - name: build LLVM + run: ./docker/setup-llvm.sh + - name: build LLVM-MCA-Daemon + run: ./docker/setup-build.sh + \ No newline at end of file diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml deleted file mode 100644 index 10539d4..0000000 --- a/.github/workflows/test.yaml +++ /dev/null @@ -1,62 +0,0 @@ -name: Build and Test libc++ -on: - push: - #schedule: - # # Run nightly at 08:00 UTC (aka 00:00 Pacific, aka 03:00 Eastern) - # - cron: '0 8 * * *' - -permissions: - contents: read # Default everything to read-only - -env: - WORKSPACE_PATH: ${{ github.workspace }} - -jobs: - build: - runs-on: ubuntu-latest - steps: - - name: Maximize build space - run: | - echo "Available storage before:" - sudo df -h - echo - sudo rm -rf /usr/share/dotnet - sudo rm -rf /usr/local/lib/android - sudo rm -rf /opt/ghc - sudo rm -rf /opt/hostedtoolcache/CodeQL - echo "Available storage after:" - sudo df -h - echo - - uses: actions/checkout@v4 - - name: install dependencies - run: sudo ./docker/setup-deps.sh - - name: build LLVM - run: ./docker/setup-llvm.sh - - name: build LLVM-MCA-Daemon - run: ./docker/setup-build.sh - - -# Maximize build space action above used from https://github.com/drivendataorg/zamba/pull/336/files, -# used here under license: -# -# > MIT License -# -# > Copyright (c) 2022 DrivenData Inc. -# -# > Permission is hereby granted, free of charge, to any person obtaining a copy -# > of this software and associated documentation files (the "Software"), to deal -# > in the Software without restriction, including without limitation the rights -# > to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# > copies of the Software, and to permit persons to whom the Software is -# > furnished to do so, subject to the following conditions: -# -# > The above copyright notice and this permission notice shall be included in all -# > copies or substantial portions of the Software. -# -# > THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# > IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# > FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# > AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# > LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# > OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -# > SOFTWARE. \ No newline at end of file diff --git a/docker/Dockerfile b/docker/Dockerfile index ec98465..b472f53 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -22,7 +22,7 @@ RUN setup/setup-llvm.sh COPY docker/setup-build.sh ./setup/ RUN setup/setup-build.sh -ENV PATH="/work/LLVM-MCA-Daemon/build:/opt/llvm-14/bin:$PATH" +ENV PATH="/work/mcad-build:/opt/llvm-14/bin:$PATH" RUN rm /etc/apt/apt.conf.d/docker-clean ENTRYPOINT ["llvm-mcad"] diff --git a/docker/setup-build.sh b/docker/setup-build.sh index e9234bb..b761d09 100755 --- a/docker/setup-build.sh +++ b/docker/setup-build.sh @@ -5,15 +5,16 @@ set -e export DEBIAN_FRONTEND=noninteractive if [ -z "${WORKSPACE_PATH}" ]; then -WORKSPACE_PATH=/work/LLVM-MCA-Daemon +WORKSPACE_PATH=/work fi -mkdir -p ${WORKSPACE_PATH}/build -cd ${WORKSPACE_PATH}/build +mkdir -p ${WORKSPACE_PATH}/mcad-build +mkdir -p ${WORKSPACE_PATH}/mcad-install +cd ${WORKSPACE_PATH}/mcad-build -cmake -G Ninja -DCMAKE_BUILD_TYPE=Debug -DCMAKE_INSTALL_PREFIX=/opt/LLVM-MCA-Daemon \ +cmake -G Ninja -DCMAKE_BUILD_TYPE=Debug -DCMAKE_INSTALL_PREFIX=${WORKSPACE_PATH}/mcad-install \ -DCMAKE_C_COMPILER=clang-14 -DCMAKE_CXX_COMPILER=clang++-14 \ - -DLLVM_DIR=/opt/llvm-main/lib/cmake/llvm \ + -DLLVM_DIR=${WORKSPACE_PATH}/llvm-install/lib/cmake/llvm \ -DLLVM_MCAD_ENABLE_PLUGINS="tracer;binja;vivisect" \ - ../ + ${WORKSPACE_PATH}/LLVM-MCA-Daemon ninja diff --git a/docker/setup-llvm.sh b/docker/setup-llvm.sh index 202510c..c6d57f7 100755 --- a/docker/setup-llvm.sh +++ b/docker/setup-llvm.sh @@ -5,7 +5,7 @@ set -e export DEBIAN_FRONTEND=noninteractive if [ -z "${WORKSPACE_PATH}" ]; then -WORKSPACE_PATH=/work/LLVM-MCA-Daemon +WORKSPACE_PATH=/work fi # Run ./setup-deps.sh before this to install dependencies needed to build LLVM @@ -13,14 +13,11 @@ fi # Applying the patches requires that our git user has an identity. git config --global user.email "workflow@example.com" git config --global user.name "Workflow" - git clone https://github.com/llvm/llvm-project.git llvm cd llvm -git am < ${WORKSPACE_PATH}/patches/add-identifier-to-mca-instruction.patch -git am < ${WORKSPACE_PATH}/patches/start-mapping-e500-itenerary-model-to-new-schedule.patch -git am < ${WORKSPACE_PATH}/patches/abstract-memory-group.patch +git am ${WORKSPACE_PATH}/LLVM-MCA-Daemon/patches/*.patch mkdir build && cd build -cmake -G Ninja -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_INSTALL_PREFIX=/opt/llvm-main \ +cmake -G Ninja -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_INSTALL_PREFIX=${WORKSPACE_PATH}/llvm-install \ -DCMAKE_C_COMPILER=clang-14 -DCMAKE_CXX_COMPILER=clang++-14 \ -DLLVM_USE_LINKER=lld-14 -DLLVM_ENABLE_ASSERTIONS=ON \ -DLLVM_TOOL_LLVM_MCA_BUILD=ON \