Skip to content

Commit 987b054

Browse files
committed
ci: run RVV cross-compile job in archlinux:latest with qemu 11
QEMU < 11's RVV TCG emulation is dramatically slower than scalar (see QEMU issue #2137), and combined with gcc-14's RVV codegen at vlen=128 the xsimd test_xsimd binary takes long enough to overflow the GHA 6h 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 Move the whole RVV cross-compile job into an archlinux:latest container so it gets qemu 11 + gcc 15 today, instead of waiting for Ubuntu to ship qemu 11. Keep timeout-minutes: 15 as a safety net so any future regression fails fast instead of burning the 6h job timeout, and add fail-fast: false so a stuck vector_bits entry does not cancel its peers. This trades multi-compiler / multi-version coverage (clang 17/18, gcc 14) for a CI signal that actually completes; reintroducing those matrix entries belongs to a follow-up once we either pre-build a qemu-11 deb for ubuntu-latest or use per-compiler containers. 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 987b054

1 file changed

Lines changed: 40 additions & 27 deletions

File tree

.github/workflows/cross-rvv.yml

Lines changed: 40 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,32 @@
1+
# RISC-V RVV cross-compilation build.
2+
#
3+
# Why this job runs inside an `archlinux:latest` container instead of on a
4+
# vanilla `ubuntu-latest` runner:
5+
#
6+
# QEMU's RISC-V Vector emulation is dramatically slower than scalar in
7+
# qemu < 11 (see QEMU issue #2137 for documented 100x+ slowdowns of
8+
# auto-vectorised RVV loops under TCG). Combined with the RVV codegen
9+
# emitted by gcc-14 at vlen=128, our test_xsimd binary runs *much* longer
10+
# than its native runtime under qemu 8.2 / 9.2 / 10.0 — long enough to
11+
# exhaust the 6h GHA job timeout while making no observable progress.
12+
#
13+
# Empirically we measured:
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 : 367 cases / 5664 asserts in <10 min
18+
#
19+
# Ubuntu's `qemu-user-static` apt package will not catch up to qemu 11 in
20+
# the noble release cycle, so until ubuntu-latest ships qemu 11 we run the
21+
# whole job (build + test) inside `archlinux:latest`, which currently
22+
# provides qemu 11.0.0 + gcc 15.1.0. This trades a bit of compiler-version
23+
# coverage (clang variants, gcc-14) for a CI signal that actually
24+
# completes.
25+
#
26+
# References:
27+
# QEMU 11.0.0 release notes: https://www.qemu.org/2026/04/22/qemu-11-0-0/
28+
# QEMU RVV slowdowns issue: https://gitlab.com/qemu-project/qemu/-/issues/2137
29+
# Ubuntu RVV vstart bug: https://bugs.launchpad.net/ubuntu/+source/qemu/+bug/2095169
130
name: RISC-V RVV cross-compilation build
231
on: [push, pull_request]
332
concurrency:
@@ -6,41 +35,24 @@ concurrency:
635
jobs:
736
build:
837
runs-on: ubuntu-latest
38+
container: archlinux:latest
939
name: 'RISC-V RVV${{ matrix.vector_bits }}'
1040
strategy:
41+
fail-fast: false
1142
matrix:
12-
sys:
13-
- { compiler: 'gcc', gcc_runtime: '14'}
14-
- { compiler: 'clang', version: '17', gcc_runtime: '14'}
15-
- { compiler: 'clang', version: '18', gcc_runtime: '14'}
1643
vector_bits:
1744
- 128
1845
- 256
1946
- 512
2047
steps:
21-
- name: Setup GCC
48+
- name: Setup toolchain and qemu
2249
run: |
23-
sudo apt-get -y -qq update
24-
sudo apt-get -y -qq --no-install-suggests --no-install-recommends install gcc-${{ matrix.sys.gcc_runtime }}-riscv64-linux-gnu g++-${{ matrix.sys.gcc_runtime }}-riscv64-linux-gnu
25-
sudo update-alternatives --install /usr/bin/riscv64-linux-gnu-gcc riscv64-linux-gnu-gcc /usr/bin/riscv64-linux-gnu-gcc-${{ matrix.sys.gcc_runtime }} 20
26-
sudo update-alternatives --install /usr/bin/riscv64-linux-gnu-g++ riscv64-linux-gnu-g++ /usr/bin/riscv64-linux-gnu-g++-${{ matrix.sys.gcc_runtime }} 20
27-
- name: Setup LLVM
28-
if: ${{ matrix.sys.compiler == 'clang' }}
29-
run: |
30-
# Install given LLVM version
31-
curl -o llvm.sh https://apt.llvm.org/llvm.sh
32-
chmod u+x llvm.sh
33-
sudo ./llvm.sh ${{ matrix.sys.version }}
34-
sudo ln -srf $(which clang-${{ matrix.sys.version }}) /usr/bin/clang
35-
sudo ln -srf $(which clang++-${{ matrix.sys.version }}) /usr/bin/clang++
36-
rm llvm.sh
37-
- name: Setup QEMU
38-
uses: docker/setup-qemu-action@v3.0.0
39-
with:
40-
platforms: riscv64
41-
- name: Setup Ninja
42-
run: |
43-
sudo apt-get -y -qq install ninja-build
50+
pacman -Sy --noconfirm
51+
pacman -S --noconfirm --needed \
52+
qemu-user-static riscv64-linux-gnu-gcc riscv64-linux-gnu-glibc \
53+
cmake ninja git ca-certificates
54+
qemu-riscv64-static --version
55+
riscv64-linux-gnu-gcc --version | head -1
4456
- name: Checkout xsimd
4557
uses: actions/checkout@v6
4658
- name: Setup
@@ -53,7 +65,7 @@ jobs:
5365
-DTARGET_ARCH=generic
5466
-DCMAKE_C_FLAGS="-march=rv64gcv_zvl${{ matrix.vector_bits }}b_zba_zbb_zbs -mrvv-vector-bits=zvl"
5567
-DCMAKE_CXX_FLAGS="-march=rv64gcv_zvl${{ matrix.vector_bits }}b_zba_zbb_zbs -mrvv-vector-bits=zvl"
56-
-DCMAKE_TOOLCHAIN_FILE=${{ github.workspace }}/.github/toolchains/${{ matrix.sys.compiler }}-riscv64-linux-gnu.cmake
68+
-DCMAKE_TOOLCHAIN_FILE=${{ github.workspace }}/.github/toolchains/gcc-riscv64-linux-gnu.cmake
5769
- name: Build
5870
run: cmake --build _build
5971
- name: Set CPU feature test expectations
@@ -62,6 +74,7 @@ jobs:
6274
echo "XSIMD_TEST_CPU_ASSUME_SVE=0" >> "$GITHUB_ENV"
6375
echo "XSIMD_TEST_CPU_ASSUME_RVV=1" >> "$GITHUB_ENV"
6476
- name: Testing xsimd
77+
timeout-minutes: 15
6578
run: >
6679
QEMU_CPU="rv64,zba=true,zbb=true,zbs=true,v=true,vlen=${{ matrix.vector_bits }},elen=64,vext_spec=v1.0"
6780
QEMU_LD_PREFIX="/usr/riscv64-linux-gnu"

0 commit comments

Comments
 (0)