forked from ROCm/ROCR-Runtime
-
Notifications
You must be signed in to change notification settings - Fork 1
195 lines (169 loc) · 5.87 KB
/
ci-linux.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
193
194
195
name: CI Linux
on:
workflow_dispatch:
inputs:
force_debug_with_tmate:
type: boolean
description: 'Run the build with tmate session'
required: false
default: false
debug_with_tmate:
type: boolean
description: 'Run the build with a tmate session ONLY in case of failure'
required: false
default: false
release:
type: boolean
description: 'Release to latest'
required: false
default: false
pull_request:
merge_group:
push:
branches:
- amd-staging
concurrency:
group: ci-build-test-cpp-linux-${{ github.event.number || github.sha }}
cancel-in-progress: true
jobs:
build:
name: Build (linux)
runs-on: ubuntu-22.04
container:
image: quay.io/pypa/manylinux_2_28_x86_64
env:
GITHUB_SHA: ${{ github.sha }}
steps:
- name: Install tmate
run: dnf install -y epel-release && dnf install -y tmate
- name: Install deps
run: |
dnf install -y almalinux-release-devel
yum install -y elfutils-libelf-devel p7zip p7zip-plugins \
sudo ncurses-compat-libs openssh vim-common
- name: Setup Cpp
uses: aminya/setup-cpp@v1
with:
compiler: llvm-18
cmake: true
ninja: true
- name: "Checking out repository"
uses: actions/checkout@8f4b7f84864484a7bf31766abe9204da3cbe65b3 # v3.5.0
with:
submodules: recursive
- name: Build and install libnuma
run: |
curl --silent -L \
https://github.com/numactl/numactl/releases/download/v2.0.18/numactl-2.0.18.tar.gz \
-o numactl-2.0.18.tar.gz
tar -xf numactl-2.0.18.tar.gz
pushd numactl-2.0.18
./configure
# i have no idea why this is necessary
# but without it you get something about "can't cd into dir"
sed -i '7563s/`cd "$dir" && pwd`/$dir/g' libtool
make install
popd
- name: Hack ROCR
run: |
sed -i 's/amdgcn-amd-amdhsa/amdgcn-amd-amdhsa -nogpulib/g' runtime/hsa-runtime/core/runtime/blit_shaders/CMakeLists.txt
sed -i 's/amdgcn-amd-amdhsa/amdgcn-amd-amdhsa -nogpulib/g' runtime/hsa-runtime/core/runtime/trap_handler/CMakeLists.txt
sed -i 's/amdgcn-amd-amdhsa/amdgcn-amd-amdhsa -nogpulib/g' runtime/hsa-runtime/image/blit_src/CMakeLists.txt
- name: Build ROCR distro
run: |
rocr_dir="$(cd $GITHUB_WORKSPACE && pwd)"
build_rocr_dir="$GITHUB_WORKSPACE/rocr-build"
mkdir -p "$build_rocr_dir"
build_rocr_dir="$(cd $build_rocr_dir && pwd)"
rocr_install_dir="$GITHUB_WORKSPACE/rocr-install"
cmake -GNinja \
-DCMAKE_BUILD_TYPE=Release \
-DBUILD_SHARED_LIBS=ON \
-DCMAKE_INSTALL_PREFIX="$rocr_install_dir" \
-DClang_DIR=$HOME/llvm/lib/cmake/clang \
-DLLVM_DIR=$HOME/llvm/lib/cmake/llvm \
-DIMAGE_SUPPORT=OFF \
-S "$rocr_dir" -B "$build_rocr_dir"
cmake --build "$build_rocr_dir" --target install
tar -cf rocr-${GITHUB_SHA::8}.tar rocr-install
- name: Upload artifacts
uses: actions/upload-artifact@v4
if: ${{ !cancelled() }}
with:
name: linux_x86_64_distro
path: rocr-*.tar
if-no-files-found: warn
- name: Setup tmate session
if: ${{ (failure() && inputs.debug_with_tmate) || inputs.force_debug_with_tmate }}
uses: mxschmitt/action-tmate@v3.18
with:
limit-access-to-actor: true
install-dependencies: false
test_aie:
name: AIE tests
needs: build
strategy:
fail-fast: false
matrix:
runs-on: [linux-phoenix]
runs-on: ${{ matrix.runs-on }}
steps:
- name: "Checking out repository"
uses: actions/checkout@8f4b7f84864484a7bf31766abe9204da3cbe65b3
- name: Download artifacts
uses: actions/download-artifact@v4
with:
name: linux_x86_64_distro
- name: Extract artifact
run: |
tar -xf rocr-*.tar
echo hsa_runtime64_ROOT="$PWD/rocr-install" >> $GITHUB_ENV
- name: Build and run AIE smoke test
run: |
pushd rocrtst/suites/aie
build_dir="$PWD/build"
mkdir -p $build_dir
cmake -GNinja \
-DCMAKE_BUILD_TYPE=Release \
"-Dhsa-runtime64_DIR=$hsa_runtime64_ROOT/lib64/cmake/hsa-runtime64" \
-S "$PWD" -B "$build_dir"
cmake --build "$build_dir" --target aie_hsa_bare_add_one
"$build_dir"/aie_hsa_bare_add_one $PWD
popd
- name: Build AIE test suite
run: |
pushd rocrtst/suites/aie
build_dir="$PWD/build"
mkdir -p $build_dir
cmake -GNinja \
-DCMAKE_BUILD_TYPE=Release \
"-Dhsa-runtime64_DIR=$hsa_runtime64_ROOT/lib64/cmake/hsa-runtime64" \
-S "$PWD" -B "$build_dir"
cmake --build "$build_dir" --target aie_hsa_dispatch_test
"$build_dir"/aie_hsa_dispatch_test $PWD
popd
release:
name: Release
if: ${{ inputs.release }}
needs: [build, test_aie]
runs-on: ubuntu-22.04
permissions:
id-token: write
contents: write
steps:
- name: Download artifacts
uses: actions/download-artifact@v4
with:
name: linux_x86_64_distro
- name: Release current commit
uses: ncipollo/release-action@v1.12.0
with:
artifacts: rocr-*.tar
token: "${{ secrets.GITHUB_TOKEN }}"
tag: "latest"
name: "latest"
removeArtifacts: false
allowUpdates: true
replacesArtifacts: true
makeLatest: true
artifactErrorsFailBuild: true