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

Add compile.sh to CI #939

Merged
merged 20 commits into from
Oct 25, 2024
Merged
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
53 changes: 16 additions & 37 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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<<EOF' >> $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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we really need this one?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

while things may work if I revert it, there is no sense in reverting it

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the standard practice is to increase the counter every time we need the cache to be rebuilt

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 \
Expand All @@ -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
31 changes: 0 additions & 31 deletions dev_scripts/compile.sh

This file was deleted.

8 changes: 8 additions & 0 deletions scripts/compile.sh
Original file line number Diff line number Diff line change
@@ -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 "$@"
Loading