-
Notifications
You must be signed in to change notification settings - Fork 35
155 lines (134 loc) · 5.18 KB
/
build-enzyme-v0.0.130.yaml
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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
name: Build Enzyme v0.0.130
on:
push:
branches: [ main ]
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
determine_runner:
if: github.event.pull_request.draft == false
name: Determine runner type to use
uses: ./.github/workflows/determine-workflow-runner.yml
with:
default_runner: ubuntu-22.04
constants:
name: "Set build matrix"
uses: ./.github/workflows/constants.yaml
needs: [determine_runner]
with:
multiple_compilers: ${{ github.trigger == 'push' && github.ref_name == 'main' }}
runs_on: ${{ needs.determine_runner.outputs.runner_group }}
llvm:
name: LLVM Build
needs: [constants, determine_runner]
runs-on: ${{ needs.determine_runner.outputs.runner_group }}
strategy:
matrix:
compiler: ${{ fromJson(needs.constants.outputs.compilers) }}
steps:
- name: Checkout Catalyst repo
uses: actions/checkout@v4
# Both the LLVM source and build folder are required for further dialect builds.
# Caching is significantly faster than git cloning since LLVM is such a large repository.
- name: Cache LLVM Source
id: cache-llvm-source
uses: actions/cache@v4
with:
path: mlir/llvm-project
key: llvm-${{ needs.constants.outputs.llvm_version }}-default-source
enableCrossOsArchive: true
- name: Clone LLVM Submodule
if: steps.cache-llvm-source.outputs.cache-hit != 'true'
uses: actions/checkout@v4
with:
repository: llvm/llvm-project
ref: ${{ needs.constants.outputs.llvm_version }}
path: mlir/llvm-project
- name: Cache LLVM Build
id: cache-llvm-build
uses: actions/cache@v4
with:
path: llvm-build
key: ${{ runner.os }}-llvm-${{ needs.constants.outputs.llvm_version }}-default-build-${{ matrix.compiler }}
- name: Install Deps
if: steps.cache-llvm-build.outputs.cache-hit != 'true'
run: |
sudo apt-get update
sudo apt-get install -y python3 python3-pip cmake ninja-build clang lld
python3 --version | grep ${{ needs.constants.outputs.primary_python_version }}
python3 -m pip install numpy pybind11
- name: Build LLVM
if: steps.cache-llvm-build.outputs.cache-hit != 'true'
# Note: Disable instrumentation for the mlir runtime support library,
# as user programs aren't instrumented.
run: |
# echo 'target_compile_options(mlir_c_runner_utils PRIVATE "-fno-sanitize=all")' \
# >> mlir/llvm-project/mlir/lib/ExecutionEngine/CMakeLists.txt
C_COMPILER=$(which ${{ needs.constants.outputs[format('c_compiler.{0}', matrix.compiler)] }}) \
CXX_COMPILER=$(which ${{ needs.constants.outputs[format('cxx_compiler.{0}', matrix.compiler)] }}) \
LLVM_BUILD_DIR="$(pwd)/llvm-build" \
COMPILER_LAUNCHER="" \
make llvm
enzyme:
name: Enzyme Build
needs: [constants, llvm, determine_runner]
runs-on: ${{ needs.determine_runner.outputs.runner_group }}
strategy:
matrix:
compiler: ${{ fromJson(needs.constants.outputs.compilers) }}
steps:
- name: Checkout Catalyst repo
uses: actions/checkout@v4
- name: Cache Enzyme Source
id: cache-enzyme-source
uses: actions/cache@v4
with:
path: mlir/Enzyme
key: enzyme-v0.0.130-default-source
enableCrossOsArchive: true
- name: Clone Enzyme Submodule
if: steps.cache-enzyme-build.outputs.cache-hit != 'true'
uses: actions/checkout@v4
with:
repository: EnzymeAD/Enzyme
ref: v0.0.130
path: mlir/Enzyme
- name: Cache Enzyme Build
id: cache-enzyme-build
uses: actions/cache@v4
with:
path: enzyme-build
key: ${{ runner.os }}-enzyme-${{ needs.constants.outputs.llvm_version }}-v0.0.130-default-build-${{ matrix.compiler }}
- name: Get Cached LLVM Source
id: cache-llvm-source
if: steps.cache-enzyme-build.outputs.cache-hit != 'true'
uses: actions/cache@v4
with:
path: mlir/llvm-project
key: llvm-${{ needs.constants.outputs.llvm_version }}-default-source
enableCrossOsArchive: true
fail-on-cache-miss: true
- name: Get Cached LLVM Build
id: cache-llvm-build
if: steps.cache-enzyme-build.outputs.cache-hit != 'true'
uses: actions/cache@v4
with:
path: llvm-build
key: ${{ runner.os }}-llvm-${{ needs.constants.outputs.llvm_version }}-default-build-${{ matrix.compiler }}
fail-on-cache-miss: true
- name: Install Deps
if: steps.cache-enzyme-build.outputs.cache-hit != 'true'
run: |
sudo apt-get update
sudo apt-get install -y cmake ninja-build clang lld
- name: Build Enzyme
if: steps.cache-enzyme-build.outputs.cache-hit != 'true'
run: |
C_COMPILER=$(which ${{ needs.constants.outputs[format('c_compiler.{0}', matrix.compiler)] }}) \
CXX_COMPILER=$(which ${{ needs.constants.outputs[format('cxx_compiler.{0}', matrix.compiler)] }}) \
LLVM_BUILD_DIR="$(pwd)/llvm-build" \
ENZYME_BUILD_DIR="$(pwd)/enzyme-build" \
COMPILER_LAUNCHER="" \
make enzyme