Skip to content

Commit 3ecd6ec

Browse files
committed
ci: split RVV cross-compile into apt-qemu (vlen>=256) + arch-qemu11 (vlen=128)
QEMU < 11's RVV TCG emulation is dramatically slower than scalar (QEMU issue #2137). At vlen=128, gcc's RVV codegen for our test_xsimd ends up running long enough under apt-shipped qemu-user-static (8.2.x noble, 9.x plucky, 10.x trixie) to overflow the 6h GHA job timeout while making no observable progress. Measured locally: qemu 8.2.2 (Ubuntu 24.04 apt) : test_xsimd at vlen=128 times out qemu 9.2.1 (Ubuntu 25.04 plucky) : ditto qemu 10.0.8 (Debian trixie) : ditto qemu 11.0.0 (Arch) + gcc 15.1 : 367 cases / 5664 asserts in <10 min Vlens >= 256 stay within the test step budget on apt qemu (smaller emulator slowdown per logical op). Keep the existing cross-rvv.yml workflow as-is — multi-compiler matrix (gcc-14, clang-17/18), apt qemu-user-static — but drop vector_bits=128 from its matrix and add fail-fast: false plus a 15 min timeout-minutes safety net so a stuck entry doesn't cancel its peers or burn 6h. Add a sibling workflow cross-rvv-arch.yml that runs the build and test inside archlinux:latest (qemu 11 + gcc 15.1) and covers vector_bits=128/256/512. This restores RVV vlen=128 coverage today without waiting for ubuntu-latest to ship qemu 11. References: QEMU 11.0.0 release notes https://www.qemu.org/2026/04/22/qemu-11-0-0/ QEMU RVV slowdowns issue https://gitlab.com/qemu-project/qemu/-/issues/2137 Ubuntu RVV vstart bug https://bugs.launchpad.net/ubuntu/+source/qemu/+bug/2095169
1 parent b395957 commit 3ecd6ec

2 files changed

Lines changed: 109 additions & 4 deletions

File tree

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
# RISC-V RVV cross-compilation build using qemu 11 + gcc 15 (Arch Linux).
2+
#
3+
# Why this workflow exists alongside cross-rvv.yml:
4+
#
5+
# QEMU's RISC-V Vector emulation is dramatically slower than scalar in
6+
# qemu < 11 (see QEMU issue #2137 for documented 100x+ slowdowns of
7+
# auto-vectorised RVV loops under TCG). At vlen=128 the slowdown is large
8+
# enough that gcc's RVV codegen for our test suite causes the qemu-user
9+
# emulator to make no observable progress within the 6h GHA timeout —
10+
# i.e. the apt-shipped qemu-user-static (8.2.x in noble, 9.x in plucky)
11+
# can't run xsimd's full test_xsimd at vlen=128.
12+
#
13+
# Empirically:
14+
# qemu 8.2.2 (Ubuntu 24.04 apt) : test_xsimd at vlen=128 times out
15+
# qemu 9.2.1 (Ubuntu 25.04 plucky) : ditto
16+
# qemu 10.0.8 (Debian trixie) : ditto
17+
# qemu 11.0.0 (Arch) + gcc 15.1 : 367 cases / 5664 asserts in <10 min
18+
#
19+
# So vlen=128 RVV coverage lives in this workflow, which runs the build
20+
# and test inside an `archlinux:latest` container (qemu 11 + gcc 15.1).
21+
# The matching ubuntu-runner workflow `cross-rvv.yml` keeps multi-compiler
22+
# matrix coverage (gcc-14, clang-17/18) for vlens >= 256, where the apt
23+
# qemu is fast enough.
24+
#
25+
# References:
26+
# QEMU 11.0.0 release notes: https://www.qemu.org/2026/04/22/qemu-11-0-0/
27+
# QEMU RVV slowdowns issue: https://gitlab.com/qemu-project/qemu/-/issues/2137
28+
# Ubuntu RVV vstart bug: https://bugs.launchpad.net/ubuntu/+source/qemu/+bug/2095169
29+
name: RISC-V RVV cross-compilation build (qemu 11)
30+
on: [push, pull_request]
31+
concurrency:
32+
group: ${{ github.workflow }}-${{ github.job }}-${{ github.ref }}
33+
cancel-in-progress: true
34+
jobs:
35+
build:
36+
runs-on: ubuntu-latest
37+
container: archlinux:latest
38+
name: 'RISC-V RVV${{ matrix.vector_bits }} (qemu 11)'
39+
strategy:
40+
fail-fast: false
41+
matrix:
42+
vector_bits:
43+
- 128
44+
- 256
45+
- 512
46+
steps:
47+
- name: Setup toolchain and qemu
48+
run: |
49+
pacman -Sy --noconfirm
50+
pacman -S --noconfirm --needed \
51+
qemu-user-static riscv64-linux-gnu-gcc riscv64-linux-gnu-glibc \
52+
cmake ninja git ca-certificates
53+
qemu-riscv64-static --version
54+
riscv64-linux-gnu-gcc --version | head -1
55+
- name: Checkout xsimd
56+
uses: actions/checkout@v6
57+
- name: Setup
58+
run: >
59+
cmake -S . -B _build
60+
-GNinja
61+
-DBUILD_TESTS=ON
62+
-DDOWNLOAD_DOCTEST=ON
63+
-DCMAKE_BUILD_TYPE=Release
64+
-DTARGET_ARCH=generic
65+
-DCMAKE_C_FLAGS="-march=rv64gcv_zvl${{ matrix.vector_bits }}b_zba_zbb_zbs -mrvv-vector-bits=zvl"
66+
-DCMAKE_CXX_FLAGS="-march=rv64gcv_zvl${{ matrix.vector_bits }}b_zba_zbb_zbs -mrvv-vector-bits=zvl"
67+
-DCMAKE_TOOLCHAIN_FILE=.github/toolchains/gcc-riscv64-linux-gnu.cmake
68+
- name: Build
69+
run: cmake --build _build
70+
- name: Set CPU feature test expectations
71+
run: |
72+
echo "XSIMD_TEST_CPU_ASSUME_SSE4_2=0" >> "$GITHUB_ENV"
73+
echo "XSIMD_TEST_CPU_ASSUME_SVE=0" >> "$GITHUB_ENV"
74+
echo "XSIMD_TEST_CPU_ASSUME_RVV=1" >> "$GITHUB_ENV"
75+
- name: Testing xsimd
76+
timeout-minutes: 15
77+
# Invoke qemu-riscv64-static explicitly. Inside the archlinux:latest
78+
# container we don't have permission to register binfmt_misc with the
79+
# host kernel, so exec'ing the riscv64 ELF directly fails with
80+
# "Exec format error".
81+
run: >
82+
QEMU_CPU="rv64,zba=true,zbb=true,zbs=true,v=true,vlen=${{ matrix.vector_bits }},elen=64,vext_spec=v1.0"
83+
QEMU_LD_PREFIX="/usr/riscv64-linux-gnu"
84+
qemu-riscv64-static ./test/test_xsimd
85+
working-directory: _build

.github/workflows/cross-rvv.yml

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,17 @@
1+
# RISC-V RVV cross-compilation build (Ubuntu apt qemu, multi-compiler matrix).
2+
#
3+
# vlen=128 is intentionally NOT covered here. Ubuntu's qemu-user-static
4+
# (8.2.x in noble, 9.x in plucky) hangs on the xsimd test_xsimd binary at
5+
# vlen=128 — see QEMU issue #2137 (RVV TCG slowdowns) for the underlying
6+
# emulator behaviour. Until ubuntu-latest ships qemu 11+, vlen=128 coverage
7+
# lives in cross-rvv-arch.yml, which runs inside an archlinux:latest
8+
# container with qemu 11. Vlens >= 256 run fast enough under the apt qemu
9+
# to stay within the test step's timeout.
10+
#
11+
# References:
12+
# QEMU 11.0.0 release notes: https://www.qemu.org/2026/04/22/qemu-11-0-0/
13+
# QEMU RVV slowdowns issue: https://gitlab.com/qemu-project/qemu/-/issues/2137
14+
# Ubuntu RVV vstart bug: https://bugs.launchpad.net/ubuntu/+source/qemu/+bug/2095169
115
name: RISC-V RVV cross-compilation build
216
on: [push, pull_request]
317
concurrency:
@@ -8,13 +22,13 @@ jobs:
822
runs-on: ubuntu-latest
923
name: 'RISC-V RVV${{ matrix.vector_bits }}'
1024
strategy:
25+
fail-fast: false
1126
matrix:
1227
sys:
1328
- { compiler: 'gcc', gcc_runtime: '14'}
1429
- { compiler: 'clang', version: '17', gcc_runtime: '14'}
1530
- { compiler: 'clang', version: '18', gcc_runtime: '14'}
1631
vector_bits:
17-
- 128
1832
- 256
1933
- 512
2034
steps:
@@ -35,9 +49,14 @@ jobs:
3549
sudo ln -srf $(which clang++-${{ matrix.sys.version }}) /usr/bin/clang++
3650
rm llvm.sh
3751
- name: Setup QEMU
38-
uses: docker/setup-qemu-action@v3.0.0
39-
with:
40-
platforms: riscv64
52+
# Use the qemu-user-static package shipped by the runner image rather
53+
# than docker/setup-qemu-action: tonistiigi/binfmt pins an even older
54+
# qemu (~6.x/7.x) whose RVV implementation miscompiles vmulh* and is
55+
# known to hang test_xsimd until the 6h GHA timeout.
56+
run: |
57+
sudo apt-get -y -qq update
58+
sudo apt-get -y -qq --no-install-suggests --no-install-recommends install qemu-user-static
59+
qemu-riscv64-static --version
4160
- name: Setup Ninja
4261
run: |
4362
sudo apt-get -y -qq install ninja-build
@@ -62,6 +81,7 @@ jobs:
6281
echo "XSIMD_TEST_CPU_ASSUME_SVE=0" >> "$GITHUB_ENV"
6382
echo "XSIMD_TEST_CPU_ASSUME_RVV=1" >> "$GITHUB_ENV"
6483
- name: Testing xsimd
84+
timeout-minutes: 15
6585
run: >
6686
QEMU_CPU="rv64,zba=true,zbb=true,zbs=true,v=true,vlen=${{ matrix.vector_bits }},elen=64,vext_spec=v1.0"
6787
QEMU_LD_PREFIX="/usr/riscv64-linux-gnu"

0 commit comments

Comments
 (0)