forked from coredac/neura
-
Notifications
You must be signed in to change notification settings - Fork 0
160 lines (139 loc) · 5.3 KB
/
main.yml
File metadata and controls
160 lines (139 loc) · 5.3 KB
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
156
157
158
159
160
name: build
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
env:
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
BUILD_TYPE: Release
LLVM_COMMIT: "6146a88f60492b520a36f8f8f3231e15f3cc6082"
CCACHE_DIR: "${{ github.workspace }}/.ccache"
CCACHE_COMPRESS: "true"
CCACHE_MAXSIZE: "1G"
jobs:
build:
# The CMake configure and build commands are platform agnostic and should work equally well on Windows or Mac.
# You can convert this to a matrix build if you need cross-platform coverage.
# See: https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix
runs-on: ubuntu-22.04
strategy:
fail-fast: false
matrix:
python-version: ["3.11.13"]
steps:
- uses: actions/checkout@v3
with:
submodules: true
# Update references
- name: Git Submodule Update
run: |
git submodule update --init --recursive
# install ninja
- name: install ninja for LLVM build
run: sudo apt-get install ninja-build
# install ccache
- name: install ccache & lld
run: |
sudo apt-get install ccache
sudo apt-get install lld
# Restores ccache directory.
- name: ccache cache
uses: actions/cache@v4
with:
path: ${{ env.CCACHE_DIR }}
key: ${{ runner.os }}-ccache-llvm-${{ env.LLVM_COMMIT }}-${{ github.sha }}
# Restores from the last successful build of this LLVM version.
restore-keys: |
${{ runner.os }}-ccache-llvm-${{ env.LLVM_COMMIT }}-
# install graphviz
- name: install graphviz
run: sudo apt-get install graphviz
# setup LLVM
- name: install a specific version of LLVM
working-directory: ${{github.workspace}}
run: |
mkdir -p ${{ env.CCACHE_DIR }}
git --version
git clone --depth 1 --filter=blob:none --revision=${{ env.LLVM_COMMIT }} https://github.com/llvm/llvm-project.git
cd llvm-project
mkdir build && cd build
cmake -G Ninja ../llvm \
-DLLVM_ENABLE_PROJECTS="mlir;clang" \
-DLLVM_BUILD_EXAMPLES=OFF \
-DLLVM_TARGETS_TO_BUILD="Native" \
-DCMAKE_BUILD_TYPE=Release \
-DLLVM_ENABLE_ASSERTIONS=ON \
-DCMAKE_C_COMPILER=clang \
-DCMAKE_CXX_COMPILER=clang++ \
-DCMAKE_CXX_STANDARD=17 \
-DCMAKE_CXX_FLAGS="-std=c++17 -frtti" \
-DLLVM_ENABLE_LLD=ON \
-DMLIR_INSTALL_AGGREGATE_OBJECTS=ON \
-DLLVM_ENABLE_RTTI=ON \
-DLLVM_CCACHE_BUILD=ON \
-DCMAKE_C_COMPILER_LAUNCHER=ccache \
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache
echo "CCache Status before build:"
ccache -s
cmake --build .
echo "CCache Status after build:"
ccache -s
# Add LLVM tools to PATH
echo "${{github.workspace}}/llvm-project/build/bin" >> $GITHUB_PATH
# setup mlir-cgra
- name: setup dataflow tool-chain
working-directory: ${{github.workspace}}
run: |
mkdir build && cd build
cmake -G Ninja .. \
-DLLVM_DIR=${{github.workspace}}/llvm-project/build/lib/cmake/llvm \
-DMLIR_DIR=${{github.workspace}}/llvm-project/build/lib/cmake/mlir \
-DMLIR_SOURCE_DIR=${{github.workspace}}/llvm-project/mlir \
-DMLIR_BINARY_DIR=${{github.workspace}}/llvm-project/build \
-DCMAKE_CXX_FLAGS="-std=c++17"
ninja
# # install clang-12/opt-12
# - name: install LLVM and Clang for scripts/experiment
# uses: egor-tensin/setup-clang@v1
# with:
# version: 12
# platform: x64
# # add path
# - name: add paths
# working-directory: ${{github.workspace}}
# run: |
# echo "${{github.workspace}}/llvm-project/build/bin" >> $GITHUB_PATH
# echo "${{github.workspace}}/build/bin" >> $GITHUB_PATH
# # run demo baseline
# - name: run demo baseline
# working-directory: ${{github.workspace}}
# run: |
# cd ./experiments/demo/baseline
# sh script.sh
# ./simulate
# Sets up Python environment for torch-mlir
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
# Installs NumPy 1.x first (compatable with torch-mlir)
- name: Install NumPy 1.x
run: pip install "numpy<2.0"
- name: Install PyTorch
run: |
wget https://github.com/llvm/torch-mlir/releases/download/snapshot-20231229.1067/torch-2.2.0.dev20231204+cpu-cp311-cp311-linux_x86_64.whl
pip install torch-2.2.0.dev20231204+cpu-cp311-cp311-linux_x86_64.whl
- name: Install torch-mlir
run: |
wget https://github.com/llvm/torch-mlir/releases/download/snapshot-20231229.1067/torch_mlir-20231229.1067-cp311-cp311-linux_x86_64.whl
pip install torch_mlir-20231229.1067-cp311-cp311-linux_x86_64.whl
# shows ccache stats to verify it's working.
- name: ccache stats
run: ccache -s
# run demo cgra
- name: run test
working-directory: ${{github.workspace}}
run: |
cd ${{github.workspace}}/test
${{github.workspace}}/llvm-project/build/bin/llvm-lit . -v