forked from llvm/llvm-project
-
Notifications
You must be signed in to change notification settings - Fork 5
133 lines (127 loc) · 4.11 KB
/
ruyisdk-qemu-rvv-tests.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
name: RuyiSDK QEMU RVV Tests
on:
workflow_dispatch:
push:
ignore-forks: true
branches:
- 'xtheadvector'
- 'rebase-*'
paths:
- 'llvm/**'
- 'clang/**'
- '.github/workflows/ruyisdk-qemu-rvv-tests.yml'
pull_request:
ignore-forks: true
branches:
- 'xtheadvector'
- 'rebase-*'
paths:
- 'llvm/**'
- 'clang/**'
- '.github/workflows/ruyisdk-qemu-rvv-tests.yml'
concurrency:
# Skip intermediate builds: always.
# Cancel intermediate builds: only if it is a pull request build.
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ startsWith(github.ref, 'refs/pull/') }}
jobs:
check_qemu:
name: Test RVV
runs-on: ubuntu-latest
steps:
- name: Setup RISCV GNU Toolchain
uses: imkiva/setup-riscv-gnu-toolchain@latest
with:
version: '2024.04.12'
arch: riscv64 # or riscv32
libc: glibc # or elf, musl
compiler: gcc # or llvm
os: ubuntu-22.04 # or ubuntu-20.04
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: '3.11'
- name: Install Ninja
uses: llvm/actions/install-ninja@main
- name: Setup ccache
uses: hendrikmuhs/ccache-action@v1
with:
max-size: 500M
key: sccache-${{ matrix.os }}
variant: sccache
- name: Setup mold
uses: rui314/setup-mold@v1
- name: Checkout LLVM
uses: actions/checkout@v3
with:
fetch-depth: 250
- name: Build QEMU 6.2
run: |
sudo apt-get update
sudo apt-get install -y build-essential libglib2.0-dev libpixman-1-dev liblzma-dev
wget https://download.qemu.org/qemu-6.2.0.tar.xz
tar -xf qemu-6.2.0.tar.xz
pushd qemu-6.2.0
./configure --disable-curl --target-list=riscv32-softmmu,riscv64-softmmu,riscv32-linux-user,riscv64-linux-user
make -j$(nproc)
popd
- name: Sanity check QEMU
run: |
./qemu-6.2.0/build/qemu-riscv64 --version
./qemu-6.2.0/build/qemu-riscv64 -cpu rv64,x-v=true,vlen=256,elen=64,vext_spec=v0.7.1 -L $RISCV_SYSROOT --help
- name: Build LLVM
run: |
mkdir -p llvm-build
pushd llvm-build
cmake -GNinja \
-DCMAKE_BUILD_TYPE=Release \
-DLLDB_INCLUDE_TESTS=OFF \
-DBUILD_SHARED_LIBS=true \
-DLLVM_ENABLE_PROJECTS="clang" \
-DLLVM_TARGETS_TO_BUILD="RISCV" \
-DLLVM_USE_LINKER=mold \
-DDEFAULT_SYSROOT="$RISCV_SYSROOT" \
-DLLVM_DEFAULT_TARGET_TRIPLE="riscv64-unknown-linux-gnu" \
../llvm
ninja clang
popd
- name: Checkout rvv-intrinsic-doc
uses: actions/checkout@master
with:
repository: riscv-non-isa/rvv-intrinsic-doc
path: rvv-intrinsic-doc
- name: Run RVV tests with QEMU
run: |
export QEMU_EXE=$PWD/qemu-6.2.0/build/qemu-riscv64
export CLANG_EXE=$PWD/llvm-build/bin/clang
ln -s $RISCV_HOME/lib/gcc llvm-build/lib/gcc
pushd rvv-intrinsic-doc/examples
TESTS=(
# rvv_branch.c
rvv_index.c
# rvv_matmul.c
rvv_memcpy.c
# rvv_reduce.c
rvv_saxpy.c
rvv_sgemm.c
rvv_strcmp.c
rvv_strcpy.c
rvv_strlen.c
rvv_strncpy.c
)
for test in "${TESTS[@]}"; do
echo "Compiling $test"
$CLANG_EXE -march=rv64gc_xtheadvector -O1 $test -o ${test%%.*}
echo "Running $test"
$QEMU_EXE \
-cpu rv64,x-v=true,vlen=256,elen=64,vext_spec=v0.7.1 \
-L $RISCV_SYSROOT \
${test%%.*} 2>&1 | tee ${test%%.*}.log
content="$(cat ${test%%.*}.log)"
if [[ x"$content" != x"pass" ]]; then
echo "Test $test failed with the following output"
echo "$content"
exit 1
fi
done
popd