Skip to content
This repository was archived by the owner on Dec 24, 2024. It is now read-only.

Commit 878904a

Browse files
committed
[WIP] AIE CI tests
1 parent f505444 commit 878904a

8 files changed

+1914
-0
lines changed

.github/workflows/ci-linux.yml

+204
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,204 @@
1+
name: CI Linux
2+
3+
on:
4+
workflow_call:
5+
workflow_dispatch:
6+
pull_request:
7+
merge_group:
8+
push:
9+
branches:
10+
- main
11+
12+
concurrency:
13+
# A PR number if a pull request and otherwise the commit hash. This cancels
14+
# queued and in-progress runs for the same PR (presubmit) or commit
15+
# (postsubmit).
16+
group: ci-build-test-cpp-linux-${{ github.event.number || github.sha }}
17+
cancel-in-progress: true
18+
19+
jobs:
20+
build:
21+
name: Build (linux)
22+
strategy:
23+
fail-fast: false
24+
matrix:
25+
runs-on:
26+
- ubuntu-22.04
27+
# - nod-ai-shared-cpubuilder-manylinux-x86_64
28+
runs-on: ${{ matrix.runs-on }}
29+
env:
30+
CACHE_DIR: ${{ github.workspace }}/.container-cache
31+
CACHE_KEY: linux-build-manylinux-v1-${{ github.event.number || format('{0}-{1}', github.ref_name, github.run_number) }}
32+
steps:
33+
- name: Install tmate
34+
if: ${{ matrix.runs-on == 'nod-ai-shared-cpubuilder-manylinux-x86_64' }}
35+
run: dnf install -y epel-release && dnf install -y tmate
36+
37+
- name: Set unified TZ
38+
uses: szenius/[email protected]
39+
with:
40+
# this is an arbitrary choice
41+
timezoneLinux: "Asia/Singapore"
42+
timezoneMacos: "Asia/Singapore"
43+
timezoneWindows: "Singapore Standard Time"
44+
45+
- name: Configure local git mirrors
46+
if: ${{ matrix.runs-on == 'nod-ai-shared-cpubuilder-manylinux-x86_64' }}
47+
run: |
48+
/gitmirror/scripts/trigger_update_mirrors.sh
49+
/gitmirror/scripts/git_config.sh
50+
51+
- name: Install deps
52+
if: ${{ matrix.runs-on == 'nod-ai-shared-cpubuilder-manylinux-x86_64' }}
53+
run: |
54+
dnf install -y almalinux-release-devel
55+
yum install -y elfutils-libelf-devel p7zip p7zip-plugins
56+
57+
- name: Install deps
58+
if: ${{ matrix.runs-on == 'ubuntu-22.04' }}
59+
run: |
60+
sudo apt install -y libelf-dev libnuma-dev libdrm-dev
61+
62+
- name: Setup Cpp
63+
if: ${{ matrix.runs-on == 'ubuntu-22.04' }}
64+
uses: aminya/setup-cpp@v1
65+
with:
66+
compiler: llvm-18
67+
cmake: true
68+
ninja: true
69+
ccache: true
70+
71+
- name: "Checking out repository"
72+
uses: actions/checkout@8f4b7f84864484a7bf31766abe9204da3cbe65b3 # v3.5.0
73+
with:
74+
submodules: recursive
75+
76+
- name: Enable cache
77+
uses: actions/cache/restore@v3
78+
with:
79+
path: ${{ env.CACHE_DIR }}
80+
key: ${{ env.CACHE_KEY }}
81+
restore-keys: linux-build-
82+
83+
- name: Configure ccache
84+
run: |
85+
export cache_dir="${{ env.CACHE_DIR }}"
86+
if [ -z "${cache_dir}" ]; then
87+
cache_dir="${{ github.workspace }}/.build-cache"
88+
mkdir -p "${cache_dir}"
89+
cache_dir="$(cd ${cache_dir} && pwd)"
90+
fi
91+
echo "Caching to ${cache_dir}"
92+
mkdir -p "${cache_dir}/ccache"
93+
export CCACHE_DIR="${cache_dir}/ccache" >> $GITHUB_ENV
94+
export CCACHE_MAXSIZE="700M" >> $GITHUB_ENV
95+
export CMAKE_C_COMPILER_LAUNCHER=ccache >> $GITHUB_ENV
96+
export CMAKE_CXX_COMPILER_LAUNCHER=ccache >> $GITHUB_ENV
97+
export CCACHE_COMPILERCHECK="string:$(clang --version)" >> $GITHUB_ENV
98+
99+
- name: Build and install libnuma
100+
if: ${{ matrix.runs-on == 'nod-ai-shared-cpubuilder-manylinux-x86_64' }}
101+
run: |
102+
curl --silent -L \
103+
https://github.com/numactl/numactl/releases/download/v2.0.18/numactl-2.0.18.tar.gz \
104+
-o numactl-2.0.18.tar.gz
105+
tar -xf numactl-2.0.18.tar.gz
106+
pushd numactl-2.0.18
107+
./configure
108+
make install
109+
popd
110+
111+
- name: Hack ROCR
112+
run: |
113+
sed -i 's/amdgcn-amd-amdhsa/amdgcn-amd-amdhsa -nogpulib/g' runtime/hsa-runtime/core/runtime/blit_shaders/CMakeLists.txt
114+
sed -i 's/amdgcn-amd-amdhsa/amdgcn-amd-amdhsa -nogpulib/g' runtime/hsa-runtime/core/runtime/trap_handler/CMakeLists.txt
115+
sed -i 's/amdgcn-amd-amdhsa/amdgcn-amd-amdhsa -nogpulib/g' runtime/hsa-runtime/image/blit_src/CMakeLists.txt
116+
117+
- name: Build ROCR distro
118+
run: |
119+
rocr_dir="$(cd ${{ github.workspace }} && pwd)"
120+
build_rocr_dir="${{ github.workspace }}/rocr-build"
121+
mkdir -p "$build_rocr_dir"
122+
build_rocr_dir="$(cd $build_rocr_dir && pwd)"
123+
rocr_install_dir="${{ github.workspace }}/rocr-install"
124+
125+
cmake -GNinja \
126+
-DCMAKE_BUILD_TYPE=Release \
127+
-DCMAKE_INSTALL_PREFIX="$rocr_install_dir" \
128+
-DClang_DIR=/usr/lib/llvm-18/lib/cmake/clang \
129+
-DLLVM_DIR=/usr/lib/llvm-18/lib/cmake/llvm \
130+
-DIMAGE_SUPPORT=OFF \
131+
-S "$rocr_dir" -B "$build_rocr_dir"
132+
cmake --build "$build_rocr_dir" --target install
133+
134+
- name: Create artifacts
135+
if: ${{ !cancelled() }}
136+
run: |
137+
tar -cf rocr-$(git rev-parse --short HEAD).tar -C rocr-install *
138+
ls -l
139+
140+
- name: Upload artifacts
141+
uses: actions/upload-artifact@v4
142+
if: ${{ !cancelled() }}
143+
with:
144+
name: linux_x86_64_distro
145+
path: rocr-*.tar
146+
if-no-files-found: warn
147+
148+
- name: Save cache
149+
uses: actions/cache/save@v3
150+
if: ${{ !cancelled() }}
151+
with:
152+
path: ${{ env.CACHE_DIR }}
153+
key: ${{ env.CACHE_KEY }}
154+
155+
- name: Setup tmate session
156+
if: ${{ failure() }}
157+
uses: mxschmitt/[email protected]
158+
with:
159+
limit-access-to-actor: true
160+
install-dependencies: ${{ matrix.runs-on == 'ubuntu-22.04' }}
161+
162+
test_aie:
163+
name: AIE tests
164+
needs: build
165+
strategy:
166+
fail-fast: false
167+
matrix:
168+
runs-on: [linux-phoenix]
169+
runs-on: ${{ matrix.runs-on }}
170+
steps:
171+
- name: "Checking out repository"
172+
uses: actions/checkout@8f4b7f84864484a7bf31766abe9204da3cbe65b3
173+
174+
- name: Download artifacts
175+
uses: actions/download-artifact@v4
176+
with:
177+
name: linux_x86_64_distro
178+
179+
- name: Extract artifact
180+
run: |
181+
mkdir -p rocr-install
182+
tar -xf rocr-*.tar -C rocr-install
183+
export hsa_runtime64_ROOT="$PWD/rocr-install" >> $GITHUB_ENV
184+
185+
- name: Build AIE test suite
186+
run: |
187+
pushd rocrtst/suites/aie
188+
build_dir="$PWD/build"
189+
mkdir -p $build_dir
190+
cmake -GNinja \
191+
-DCMAKE_BUILD_TYPE=Release \
192+
-Dhsa_runtime64_ROOT="${hsa_runtime64_ROOT}" \
193+
-S "$PWD" -B "$build_dir"
194+
cmake --build "$build_dir" --target \
195+
aie_hsa_bare_add_one \
196+
aie_hsa_dispatch_test
197+
popd
198+
199+
- name: Run AIE test suite
200+
run: |
201+
pushd rocrtst/suites/aie
202+
build_dir="$PWD/build"
203+
./"$build_dir"/aie_hsa_bare_add_one $PWD
204+
./"$build_dir"/aie_hsa_dispatch_test $PWD

rocrtst/suites/aie/CMakeLists.txt

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
find_package(hsa-runtime64 CONFIG REQUIRED NAMES hsa_runtime64)
2+
3+
# smoke test
4+
add_executable(aie_hsa_bare_add_one aie_hsa_bare_add_one.cc)
5+
6+
# hsa test
7+
add_executable(aie_hsa_dispatch_test aie_hsa_dispatch_test.cc)
8+
target_link_libraries(aie_hsa_dispatch_test PUBLIC hsa-runtime64::hsa-runtime64)

rocrtst/suites/aie/add_one.pdi

3.47 KB
Binary file not shown.

rocrtst/suites/aie/add_one_insts.txt

+68
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
06030100
2+
00000105
3+
00000007
4+
00000110
5+
00000001
6+
00000000
7+
0001D000
8+
00000030
9+
00000400
10+
00000000
11+
00000000
12+
00000000
13+
80000000
14+
00000000
15+
00000000
16+
02000000
17+
00000081
18+
00000030
19+
00000000
20+
00000000
21+
00000000
22+
00000000
23+
0001D004
24+
00000000
25+
00000001
26+
00000000
27+
00000000
28+
00000000
29+
00000000
30+
00000000
31+
0001D204
32+
00000000
33+
80000000
34+
00000018
35+
00000001
36+
00000000
37+
0001D020
38+
00000030
39+
00000400
40+
00000000
41+
00000000
42+
00000000
43+
80000000
44+
00000000
45+
00000000
46+
02000000
47+
00000081
48+
00000030
49+
00000000
50+
00000000
51+
00000000
52+
00000000
53+
0001D024
54+
00000000
55+
00000000
56+
00000000
57+
00000000
58+
00000000
59+
00000000
60+
00000000
61+
0001D214
62+
00000000
63+
00000001
64+
00000018
65+
00000080
66+
00000010
67+
00000000
68+
00010100

0 commit comments

Comments
 (0)