|
| 1 | +name: RISC-V RVV cross-compilation build |
| 2 | +on: [push, pull_request] |
| 3 | +concurrency: |
| 4 | + group: ${{ github.workflow }}-${{ github.job }}-${{ github.ref }} |
| 5 | + cancel-in-progress: true |
| 6 | +jobs: |
| 7 | + build: |
| 8 | + runs-on: ubuntu-latest |
| 9 | + name: 'RISC-V RVV${{ matrix.vector_bits }}' |
| 10 | + strategy: |
| 11 | + 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'} |
| 16 | + vector_bits: |
| 17 | + - 128 |
| 18 | + - 256 |
| 19 | + - 512 |
| 20 | + steps: |
| 21 | + - name: Setup GCC |
| 22 | + 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 |
| 44 | + - name: Checkout xsimd |
| 45 | + uses: actions/checkout@v6 |
| 46 | + - name: Setup |
| 47 | + run: > |
| 48 | + cmake -S . -B _build |
| 49 | + -GNinja |
| 50 | + -DBUILD_TESTS=ON |
| 51 | + -DDOWNLOAD_DOCTEST=ON |
| 52 | + -DCMAKE_BUILD_TYPE=Release |
| 53 | + -DTARGET_ARCH=generic |
| 54 | + -DCMAKE_C_FLAGS="-march=rv64gcv_zvl${{ matrix.vector_bits }}b_zba_zbb_zbs -mrvv-vector-bits=zvl" |
| 55 | + -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 |
| 57 | + - name: Build |
| 58 | + run: cmake --build _build |
| 59 | + - name: Set CPU feature test expectations |
| 60 | + run: | |
| 61 | + echo "XSIMD_TEST_CPU_ASSUME_SSE4_2=0" >> "$GITHUB_ENV" |
| 62 | + echo "XSIMD_TEST_CPU_ASSUME_SVE=0" >> "$GITHUB_ENV" |
| 63 | + echo "XSIMD_TEST_CPU_ASSUME_RVV=1" >> "$GITHUB_ENV" |
| 64 | + - name: Testing xsimd |
| 65 | + run: > |
| 66 | + QEMU_CPU="rv64,zba=true,zbb=true,zbs=true,v=true,vlen=${{ matrix.vector_bits }},elen=64,vext_spec=v1.0" |
| 67 | + QEMU_LD_PREFIX="/usr/riscv64-linux-gnu" |
| 68 | + ./test/test_xsimd |
| 69 | + working-directory: ${{ github.workspace }}/_build |
0 commit comments