forked from Xilinx/mlir-air
-
Notifications
You must be signed in to change notification settings - Fork 1
192 lines (162 loc) · 6.83 KB
/
buildAndTestAieTools.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
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
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
name: Build and Test with AIE tools
on:
push:
branches:
- main
# pull_request:
# types: [assigned, opened, synchronize, reopened, ready_for_review]
workflow_dispatch:
inputs:
AIR_COMMIT:
description: 'which air commit to build'
type: string
required: false
default: ''
LIT_FILTER:
description: 'LIT_FILTER for tests (regex of paths in test/)'
type: string
required: false
default: ''
defaults:
run:
shell: bash
concurrency:
# A PR number if a pull request and otherwise the commit hash. This cancels
# queued and in-progress runs for the same PR (presubmit) or commit
# (postsubmit).
group: ci-build-test-air-tools-linux-${{ github.event.number || github.sha }}
cancel-in-progress: true
env:
DEBIAN_FRONTEND: noninteractive
jobs:
build-repo:
name: Build and Test
runs-on: ubuntu-latest
steps:
- name: Free disk space
uses: descriptinc/free-disk-space@main
with:
tool-cache: true
android: true
dotnet: true
haskell: true
large-packages: true
swap-storage: false
- name: Docker prune
shell: bash
run: |
docker system prune -a -f
- uses: uraimo/[email protected]
name: Run commands
id: runcmd
with:
distro: none
base_image: ghcr.io/xilinx/mlir-aie/xilinx:latest
githubToken: ${{ github.token }}
dockerRunArgs: |
--mac-address ${{ secrets.XILINX_MAC }}
run: |
ls -l /opt/Xilinx/Vitis/2023.2/
# this is the inverse of `base64 -w 1000000 Xilinx.lic`
# the -w ("wrap after 1000000 cols") is so that there are no spaces in the XILINX_LIC env var
echo -n "${{ secrets.XILINX_LIC }}" | base64 --decode > ~/.Xilinx/Xilinx.lic
# add the ROCm repos
mkdir --parents --mode=0755 /etc/apt/keyrings
wget https://repo.radeon.com/rocm/rocm.gpg.key -O - | \
gpg --dearmor | tee /etc/apt/keyrings/rocm.gpg > /dev/null
for ver in 5.3.3 5.4.3 5.5.1 5.6; do
echo "deb [arch=amd64 signed-by=/etc/apt/keyrings/rocm.gpg] https://repo.radeon.com/rocm/apt/$ver focal main" \
| tee --append /etc/apt/sources.list.d/rocm.list
done
echo -e 'Package: *\nPin: release o=repo.radeon.com\nPin-Priority: 600' \
| tee /etc/apt/preferences.d/rocm-pin-600
apt update
apt install -y rocm-hip-runtime-dev5.6.0 python3.10-venv \
libboost-all-dev pkg-config libelf-dev elfutils \
libdwarf-dev libsysfs-dev clang libssl-dev uuid-dev
apt-get clean
cd /
mkdir install
python -m venv air-venv
source air-venv/bin/activate
git clone --recursive https://github.com/Xilinx/mlir-air.git
cd /mlir-air
git checkout ${{ github.head_ref }}
if [ x"${{ inputs.AIR_COMMIT }}" != x"" ]; then
git reset --hard ${{ inputs.AIR_COMMIT }}
fi
utils/clone-mlir-aie.sh
pushd mlir-aie
pip install -r python/requirements.txt
pip install -r python/requirements_ml.txt
HOST_MLIR_PYTHON_PACKAGE_PREFIX=aie pip install -r python/requirements_extras.txt
pip install joblib
pushd third_party/aie-rt/driver/src
make -f Makefile.Linux CFLAGS="-D__AIEAMDAIR__"
popd
mkdir -p /install/aie-rt/lib
cp -a third_party/aie-rt/driver/src/*.so* /install/aie-rt/lib
cp -a third_party/aie-rt/driver/include /install/aie-rt
VERSION=$(utils/clone-llvm.sh --get-wheel-version)
pip -q download mlir==$VERSION \
-f https://github.com/Xilinx/mlir-aie/releases/expanded_assets/mlir-distro
unzip -q mlir-*.whl
find mlir -exec touch -a -m -t 201108231405.14 {} \;
# don't delete the space in the sed
pushd cmake/modulesXilinx && sed -i.bak 's/ VITIS_VPP//g' FindVitis.cmake && popd
mkdir build && cd build
export PATH=/opt/Xilinx/Vitis/2023.2/bin:/opt/Xilinx/Vitis/2023.2/aietools/bin:$PATH
cmake .. -G Ninja \
-DMLIR_DIR=$PWD/../mlir/lib/cmake/mlir \
-DCMAKE_BUILD_TYPE=Release \
-DVITIS_ROOT=/opt/Xilinx/Vitis/2023.2/ \
-DVitis_VERSION_MAJOR=2023 \
-DVitis_VERSION_MINOR=2 \
-DCMAKE_MODULE_PATH=$PWD/../cmake/modulesXilinx \
-DLLVM_EXTERNAL_LIT=$(which lit) \
-DAIE_INCLUDE_INTEGRATION_TESTS=OFF \
-DAIE_ENABLE_PYTHON_PASSES=OFF \
-DCMAKE_EXE_LINKER_FLAGS_INIT="-fuse-ld=lld" \
-DCMAKE_MODULE_LINKER_FLAGS_INIT="-fuse-ld=lld" \
-DCMAKE_SHARED_LINKER_FLAGS_INIT="-fuse-ld=lld" \
-DCMAKE_C_COMPILER_LAUNCHER=ccache \
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
-DCMAKE_INSTALL_PREFIX=/install \
-DLibXAIE_ROOT=/install/aie-rt \
-DAIE_ENABLE_GENERATE_CDO_DIRECT=ON
ninja install
ls /install
popd
cd /mlir-air
if [ x"${{ inputs.LIT_FILTER }}" == x"" ]; then
export LIT_FILTER="${{ inputs.LIT_FILTER }}"
fi
export LIT_OPTS="-sv --timeout 300 -j1 --time-tests --order=random"
utils/clone-rocm-air-platforms.sh
utils/github-clone-build-libxaie.sh
ROCm-air-platforms/utils/clone-build-roct.sh
ROCm-air-platforms/utils/clone-build-rocr.sh
mkdir build_assert
pushd build_assert
cmake .. \
-GNinja \
-DCMAKE_TOOLCHAIN_FILE=`pwd`/../cmake/modules/toolchain_x86_64.cmake \
-DCMAKE_BUILD_TYPE=Debug \
-DLLVM_ENABLE_ASSERTIONS=ON \
-DCMAKE_MODULE_PATH=`pwd`/../mlir-aie/cmake/modulesXilinx \
-DMLIR_DIR=`pwd`/../mlir-aie/mlir/lib/cmake/mlir \
-DAIE_DIR=/install/lib/cmake/aie \
-DLibXAIE_ROOT=/install/aie-rt \
-Dhsa-runtime64_DIR=`pwd`/../rocm/lib/cmake/hsa-runtime64/ \
-Dhsakmt_DIR=`pwd`/../rocm/lib/cmake/hsakmt/ \
-DAIR_RUNTIME_TARGETS:STRING="x86_64" \
-Dx86_64_TOOLCHAIN_FILE=`pwd`/../cmake/modules/toolchain_x86_64.cmake \
-DLLVM_EXTERNAL_LIT=$(which lit) \
-DCMAKE_EXPORT_COMPILE_COMMANDS=ON \
-DCMAKE_INSTALL_PREFIX=/install
ninja
ninja check-air-cpp
ninja check-air-mlir
ninja check-air-python
ninja check-air-e2e
popd