-
Notifications
You must be signed in to change notification settings - Fork 86
173 lines (151 loc) · 6.77 KB
/
buildAndTestRyzenAI.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
name: Build and Test with AIE tools on Ryzen AI
on:
push:
branches:
- main
- test-ryzen-ai
pull_request:
# Allows you to run this workflow manually from the Actions tab by
# selecting CI and then "Run workflow" menu on the right branch
# and clicking on "launch_tmate_terminal_for_debug".
# Unfortunately this works only for the default branch.
# So you can either
# - change the default branch of the PR on the GitHub repository owning the PR
# and launching in Actions tab;
# - or edit directly the step below which runs tmate and push to the
# PR, ignoring the manual workflow launch.
workflow_dispatch:
launch_tmate_terminal_for_debug:
type: boolean
description: 'Run the build with tmate debugging enabled (https://github.com/marketplace/actions/debugging-with-tmate)'
required: false
default: false
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-ryzenai-${{ github.event.number || github.sha }}
cancel-in-progress: true
env:
DEBIAN_FRONTEND: noninteractive
XILINXD_LICENSE_FILE: /opt/xilinx/Xilinx.lic
jobs:
build-repo:
name: Build and Test with AIE tools on Ryzen AI
runs-on: amd7940hs
steps:
- name: Display environment variables
run: env
- name: User and group ids
run: id -a
- name: Execution context information
# Display a lot of information to help further development
# https://docs.github.com/en/actions/learn-github-actions/variables
# https://docs.github.com/en/enterprise-cloud@latest/actions/learn-github-actions/contexts
# The problem is that echo-ing directly "${{ toJSON(github) }}"
# in the shell is not escaped and for example '&' breaks
# things or can lead to server-side script injection. :-(
# So, use environment setting and display the environment
# variable in the shell between "" to avoid unsafe
# interpretation.
env:
execution_context_var_github: ${{ toJSON(github) }}
execution_context_var_env: ${{ toJSON(env) }}
execution_context_var_vars: ${{ toJSON(vars) }}
execution_context_var_job: ${{ toJSON(job) }}
execution_context_var_steps: ${{ toJSON(steps) }}
execution_context_var_runner: ${{ toJSON(runner) }}
execution_context_var_strategy: ${{ toJSON(strategy) }}
execution_context_var_matrix: ${{ toJSON(matrix) }}
execution_context_var_needs: ${{ toJSON(needs) }}
execution_context_var_inputs: ${{ toJSON(inputs) }}
run: |
echo "::group::github context"
echo "$execution_context_var_github"
echo "::endgroup::"
echo "::group::env context"
echo "$execution_context_var_env"
echo "::endgroup::"
echo "::group::vars context"
echo "$execution_context_var_vars"
echo "::endgroup::"
echo "::group::job context"
echo "$execution_context_var_job"
echo "::endgroup::"
echo "::group::steps context"
echo "$execution_context_var_steps"
echo "::endgroup::"
echo "::group::runner context"
echo "$execution_context_var_runner"
echo "::endgroup::"
echo "::group::strategy context"
echo "$execution_context_var_strategy"
echo "::endgroup::"
echo "::group::matrix context"
echo "$execution_context_var_matrix"
echo "::endgroup::"
echo "::group::needs context"
echo "$execution_context_var_needs"
echo "::endgroup::"
echo "::group::inputs context"
echo "$execution_context_var_inputs"
echo "::endgroup::"
- uses: actions/checkout@v3
with:
submodules: "true"
# Launch an ssh session via a proxy server if there is a need
# for debug. This seems to live for 35 min max
# https://github.com/mxschmitt/action-tmate
- name: Setup tmate session
uses: mxschmitt/action-tmate@v3
# To run this, launch it manually on the default branch and
# click on "launch_tmate_terminal_for_debug"
if: github.event_name == 'workflow_dispatch'
&& inputs.launch_tmate_terminal_for_debug
- name: Run commands
run: |
pip cache purge
source /opt/xilinx/xrt/setup.sh
python -m venv aie-venv
source aie-venv/bin/activate
pip install -r python/requirements.txt
pip install jupyter
sed -i.bak 's/OUTPUT_TIMEOUT = 10/OUTPUT_TIMEOUT = 100/g' \
$(python -c 'import site; print(site.getsitepackages()[0])')/jupyter_client/runapp.py
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
# I have no clue why but the system clock on GHA containers is like 12 hours ahead.
# That means wheels have file with time stamps in the future which makes ninja loop
# forever when configuring. Set the time to some arbitrary stamp in the past just to be safe.
find mlir -exec touch -a -m -t 201108231405.14 {} \;
mkdir build
pushd build
export PATH=/opt/Xilinx/Vitis/2023.2/bin:/opt/Xilinx/Vitis/2023.2/aietools/bin:$PATH
cmake .. -G Ninja \
-DPython3_EXECUTABLE=$(which python) \
-DCMAKE_INSTALL_PREFIX=$PWD/../mlir_aie \
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
-DCMAKE_C_COMPILER_LAUNCHER=ccache \
-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_MODULE_PATH=$PWD/../cmake/modulesXilinx \
-DLLVM_EXTERNAL_LIT=$(which lit) \
-DMLIR_DIR=$PWD/../mlir/lib/cmake/mlir \
-DXRT_ROOT=/opt/xilinx/xrt \
-DAIE_ENABLE_PYTHON_PASSES=OFF \
-DAIE_ENABLE_XRT_PYTHON_BINDINGS=ON \
-DAIE_INCLUDE_INTEGRATION_TESTS=OFF
ninja install
# hack: timed out tests aren't fails...
LIT_PATH=$(python -c "import lit; from pathlib import Path; print(Path(lit.__file__).parent)")
sed -i.bak 's/TIMEOUT = ResultCode("TIMEOUT", "Timed Out", True)/TIMEOUT = ResultCode("TIMEOUT", "Timed Out", False)/g' $LIT_PATH/Test.py
export LIT_OPTS="-sv --time-tests --timeout 600 -j12 --show-unsupported --show-excluded"
ninja check-aie
ninja check-reference-designs
popd