diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 38208c0fa..aa5745367 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -14,10 +14,9 @@ jobs: build_linux: name: Builds IMEX on Linux runs-on: ubuntu-latest - timeout-minutes: 450 - - env: - LLVM_SHA_FILE: /home/runner/work/mlir-extensions/mlir-extensions/build_tools/llvm_version.txt + defaults: + run: + shell: bash -l -eo pipefail {0} strategy: matrix: @@ -37,51 +36,40 @@ jobs: activate-environment: imex-devel - name: Conda info - shell: bash -le {0} run: conda info - name: Install Build tools - shell: bash -le {0} run: | conda install cmake ninja conda-forge::lit conda-forge::doxygen conda list - name: Checkout repo uses: actions/checkout@v4 - with: - fetch-depth: 0 - name: Setup Cache Vars run: | - echo 'LLVM_SHA<> $GITHUB_ENV - cat $LLVM_SHA_FILE >> $GITHUB_ENV - echo 'EOF' >> $GITHUB_ENV + echo LLVM_SHA=$(cat build_tools/llvm_version.txt) | tee -a $GITHUB_ENV - name: Cache LLLVM-MLIR id: cache-llvm-mlir uses: actions/cache@v4 env: - LLVM_CACHE_NUMBER: 1 # Increase to reset cache + LLVM_CACHE_NUMBER: 2 # Increase to reset cache with: path: | - /home/runner/work/llvm-mlir/_mlir_install/** + ${{ github.workspace }}/mlir key: ${{ runner.os }}-build-llvm-${{ env.LLVM_CACHE_NUMBER }}-${{ env.LLVM_SHA }} - name: Build LLVM-MLIR if: steps.cache-llvm-mlir.outputs.cache-hit != 'true' - shell: bash -el {0} - timeout-minutes: 420 run: | - mkdir -p /home/runner/work/llvm-mlir - pushd /home/runner/work/llvm-mlir - echo "INFO: Need to rebuild LLVM-MLIR. Previous installation for MLIR not found" - np=`nproc` - echo "INFO: nproc $np" git clone https://github.com/llvm/llvm-project --branch main --single-branch cd llvm-project - git checkout ${LLVM_SHA} - if [ -d "/home/runner/work/mlir-extensions/mlir-extensions/build_tools/patches" ]; then git apply /home/runner/work/mlir-extensions/mlir-extensions/build_tools/patches/*.patch; fi - cmake -G Ninja -B _build -S llvm \ + git checkout $LLVM_SHA + git apply ../build_tools/patches/*.patch + + echo "INFO: Need to rebuild LLVM-MLIR. Previous installation for MLIR not found" + cmake -G Ninja -B build -S llvm \ -DCMAKE_BUILD_TYPE=MinSizeRel \ -DLLVM_ENABLE_PROJECTS=mlir \ -DLLVM_ENABLE_ASSERTIONS=ON \ @@ -90,25 +78,16 @@ jobs: -DLLVM_TARGETS_TO_BUILD=X86 \ -DLLVM_ENABLE_BINDINGS=OFF \ -DLLVM_ENABLE_ZSTD=OFF \ - -DCMAKE_INSTALL_PREFIX=/home/runner/work/llvm-mlir/_mlir_install - cmake --build _build --target install - popd + -DCMAKE_INSTALL_PREFIX=${{ github.workspace }}/mlir + cmake --build build --target install - name: Build IMEX and run lit tests shell: bash -le {0} run: | - external_lit=`which lit` - echo ${external_lit} - cd /home/runner/work/mlir-extensions/mlir-extensions - cmake -S . -B _build -GNinja \ - -DCMAKE_BUILD_TYPE=Release \ - -DLLVM_EXTERNAL_LIT=${external_lit} \ - -DMLIR_DIR=/home/runner/work/llvm-mlir/_mlir_install/lib/cmake/mlir \ - -DLLVM_LIT_ARGS=-a - cmake --build _build --target check-imex + ./scripts/compile.sh -DLLVM_LIT_ARGS="-a" -DLLVM_EXTERNAL_LIT=$(which lit) -DMLIR_DIR=${{ github.workspace }}/mlir/lib/cmake/mlir + cmake --build build --target check-imex - name: Build doxygen docs shell: bash -le {0} run: | - cd /home/runner/work/mlir-extensions/mlir-extensions - cmake --build _build --target doc_doxygen + cmake --build build --target doc_doxygen diff --git a/dev_scripts/compile.sh b/dev_scripts/compile.sh deleted file mode 100644 index 5fe080b82..000000000 --- a/dev_scripts/compile.sh +++ /dev/null @@ -1,31 +0,0 @@ -#!/bin/sh - -set -e -set -vx - -cd $(dirname "$0")/.. -mlir_dir=$(pwd -P) - -cd .. -if test -d llvm-project -then - cd llvm-project - git clean -fd -else - git clone https://github.com/llvm/llvm-project.git - cd llvm-project -fi - -git reset --hard HEAD -git checkout $(cat $mlir_dir/build_tools/llvm_version.txt) -git apply $mlir_dir/build_tools/patches/* -cmake -G Ninja -B build -S llvm \ - -DLLVM_ENABLE_PROJECTS=mlir \ - -DLLVM_BUILD_EXAMPLES=ON \ - -DLLVM_TARGETS_TO_BUILD="X86" \ - -DCMAKE_BUILD_TYPE=Release \ - -DLLVM_ENABLE_ASSERTIONS=ON \ - -DLLVM_EXTERNAL_PROJECTS="Imex" \ - -DLLVM_EXTERNAL_IMEX_SOURCE_DIR=$mlir_dir - -cmake --build build --target check-imex diff --git a/scripts/compile.sh b/scripts/compile.sh new file mode 100755 index 000000000..d69232d8c --- /dev/null +++ b/scripts/compile.sh @@ -0,0 +1,8 @@ +#!/bin/sh + +set -e +set -vx + +cd $(dirname "$0")/.. + +cmake -S . -B build -GNinja -DCMAKE_BUILD_TYPE=Release -DLLVM_ENABLE_ASSERTIONS=ON -DLLVM_USE_LINKER=gold -DLLVM_ENABLE_ZSTD=OFF "$@"