-
Notifications
You must be signed in to change notification settings - Fork 45
93 lines (78 loc) · 2.95 KB
/
build.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
name: Cross-compile IMEX on CPUs
on:
push:
branches:
- main
pull_request:
branches:
- main
permissions: read-all
jobs:
build_linux:
name: Builds IMEX on Linux
runs-on: ubuntu-latest
defaults:
run:
shell: bash -l -eo pipefail {0}
strategy:
matrix:
python: [3.9]
steps:
- name: Cancel Previous Runs
uses: styfle/[email protected]
with:
access_token: ${{ github.token }}
- name: Setup conda
uses: conda-incubator/setup-miniconda@v3
with:
auto-update-conda: true
python-version: ${{ matrix.python }}
activate-environment: imex-devel
- name: Conda info
run: conda info
- name: Install Build tools
run: |
conda install cmake ninja conda-forge::lit conda-forge::doxygen
conda list
- name: Checkout repo
uses: actions/checkout@v4
- name: Setup Cache Vars
run: |
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: 2 # Increase to reset cache
with:
path: |
${{ 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'
run: |
git clone https://github.com/llvm/llvm-project --branch main --single-branch
cd llvm-project
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 \
-DLLVM_USE_LINKER=gold \
-DLLVM_INSTALL_UTILS=ON \
-DLLVM_TARGETS_TO_BUILD=X86 \
-DLLVM_ENABLE_BINDINGS=OFF \
-DLLVM_ENABLE_ZSTD=OFF \
-DCMAKE_INSTALL_PREFIX=${{ github.workspace }}/mlir
cmake --build build --target install
- name: Build IMEX and run lit tests
shell: bash -le {0}
run: |
./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: |
cmake --build build --target doc_doxygen