-
Notifications
You must be signed in to change notification settings - Fork 203
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #774 from camel-cdr/main
Implement RISC-V Vector 1.0 kernels
- Loading branch information
Showing
147 changed files
with
5,396 additions
and
116 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
# | ||
# Copyright 2020 - 2022 Free Software Foundation, Inc. | ||
# | ||
# This file is part of VOLK | ||
# | ||
# SPDX-License-Identifier: LGPL-3.0-or-later | ||
# | ||
|
||
name: Run VOLK tests on different RVV configurations | ||
|
||
on: [push, pull_request] | ||
|
||
jobs: | ||
Tests: | ||
runs-on: ubuntu-24.04 | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
submodules: "recursive" | ||
- name: Install packages | ||
run: | | ||
sudo apt-get update -q -y | ||
sudo apt-get install -y python3-mako cmake qemu-user-static g++-14-riscv64-linux-gnu clang-18 | ||
mkdir build | ||
cd build | ||
- name: Test gcc-14 VLEN=128 | ||
run: | | ||
cd build; rm -rf * | ||
CXX=riscv64-linux-gnu-g++-14 CC=riscv64-linux-gnu-gcc-14 VLEN=128 \ | ||
cmake -DCMAKE_TOOLCHAIN_FILE=../cmake/Toolchains/rv64gcv-linux-gnu.cmake .. | ||
make -j$(nproc) | ||
ARGS=-V make test | ||
- name: Test gcc-14 VLEN=256 | ||
run: | | ||
cd build; rm -rf * | ||
CXX=riscv64-linux-gnu-g++-14 CC=riscv64-linux-gnu-gcc-14 VLEN=256 \ | ||
cmake -DCMAKE_TOOLCHAIN_FILE=../cmake/Toolchains/rv64gcv-linux-gnu.cmake .. -DCMAKE_BUILD_TYPE=Release | ||
make -j$(nproc) | ||
ARGS=-V make test | ||
- name: Test clang-18 VLEN=512 | ||
run: | | ||
cd build; rm -rf * | ||
CXX=clang++-18 CC=clang-18 CFLAGS=--target=riscv64-linux-gnu VLEN=512 \ | ||
cmake -DCMAKE_TOOLCHAIN_FILE=../cmake/Toolchains/rv64gcv-linux-gnu.cmake .. | ||
make -j$(nproc) | ||
ARGS=-V make test | ||
- name: Test clang-18 VLEN=1024 | ||
run: | | ||
cd build; rm -rf * | ||
CXX=clang++-18 CC=clang-18 CFLAGS=--target=riscv64-linux-gnu VLEN=1024 \ | ||
cmake -DCMAKE_TOOLCHAIN_FILE=../cmake/Toolchains/rv64gcv-linux-gnu.cmake .. -DCMAKE_BUILD_TYPE=Release | ||
make -j$(nproc) | ||
ARGS=-V make test | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#if (__riscv_v_intrinsic >= 1000000 || __clang_major__ >= 18 || __GNUC__ >= 14) | ||
int main() { return 0; } | ||
#else | ||
#error "rvv intrinsics aren't supported" | ||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
# | ||
# Copyright 2024 Free Software Foundation, Inc. | ||
# | ||
# This file is part of VOLK | ||
# | ||
# SPDX-License-Identifier: LGPL-3.0-or-later | ||
# | ||
|
||
set(CMAKE_SYSTEM_NAME Linux) | ||
set(CMAKE_SYSTEM_PROCESSOR riscv64) | ||
|
||
set(CMAKE_C_COMPILER $ENV{CC}) | ||
set(CMAKE_ASM_COMPILER ${CMAKE_C_COMPILER}) | ||
set(CMAKE_CXX_COMPILER $ENV{CXX}) | ||
|
||
set(CMAKE_C_FLAGS "$ENV{CFLAGS} -march=rv64gcv" CACHE STRING "" FORCE) | ||
set(CMAKE_CXX_FLAGS ${CMAKE_C_FLAGS} CACHE STRING "" FORCE) | ||
set(CMAKE_ASM_FLAGS "${CMAKE_C_FLAGS} -g" CACHE STRING "" FORCE) | ||
|
||
set(CMAKE_OBJCOPY | ||
${RISCV64_TOOLCHAIN_DIR}/${TOOLCHAIN_PREFIX}objcopy | ||
CACHE INTERNAL "objcopy tool") | ||
set(CMAKE_SIZE_UTIL | ||
${RISCV64_TOOLCHAIN_DIR}/${TOOLCHAIN_PREFIX}size | ||
CACHE INTERNAL "size tool") | ||
|
||
set(CMAKE_FIND_ROOT_PATH ${BINUTILS_PATH}) | ||
|
||
set(QEMU_VLEN $ENV{VLEN}) | ||
if(NOT QEMU_VLEN) | ||
set(QEMU_VLEN "128") | ||
endif() | ||
|
||
set(CMAKE_CROSSCOMPILING_EMULATOR "qemu-riscv64-static -L /usr/riscv64-linux-gnu/ -cpu rv64,zba=true,zbb=true,v=on,vlen=${QEMU_VLEN},rvv_ta_all_1s=on,rvv_ma_all_1s=on") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
/* -*- c++ -*- */ | ||
/* | ||
* Copyright 2024 Free Software Foundation, Inc. | ||
* | ||
* This file is part of VOLK | ||
* | ||
* SPDX-License-Identifier: LGPL-3.0-or-later | ||
*/ | ||
|
||
/* | ||
* This file is intended to hold RVV intrinsics of intrinsics. | ||
* They should be used in VOLK kernels to avoid copy-paste. | ||
*/ | ||
|
||
#ifndef INCLUDE_VOLK_VOLK_RVV_INTRINSICS_H_ | ||
#define INCLUDE_VOLK_VOLK_RVV_INTRINSICS_H_ | ||
#include <riscv_vector.h> | ||
|
||
#define RISCV_SHRINK2(op, T, S, v) \ | ||
__riscv_##op(__riscv_vget_##T##S##m1(v, 0), \ | ||
__riscv_vget_##T##S##m1(v, 1), \ | ||
__riscv_vsetvlmax_e##S##m1()) | ||
|
||
#define RISCV_SHRINK4(op, T, S, v) \ | ||
__riscv_##op(__riscv_##op(__riscv_vget_##T##S##m1(v, 0), \ | ||
__riscv_vget_##T##S##m1(v, 1), \ | ||
__riscv_vsetvlmax_e##S##m1()), \ | ||
__riscv_##op(__riscv_vget_##T##S##m1(v, 2), \ | ||
__riscv_vget_##T##S##m1(v, 3), \ | ||
__riscv_vsetvlmax_e##S##m1()), \ | ||
__riscv_vsetvlmax_e##S##m1()) | ||
|
||
#define RISCV_SHRINK8(op, T, S, v) \ | ||
__riscv_##op(__riscv_##op(__riscv_##op(__riscv_vget_##T##S##m1(v, 0), \ | ||
__riscv_vget_##T##S##m1(v, 1), \ | ||
__riscv_vsetvlmax_e##S##m1()), \ | ||
__riscv_##op(__riscv_vget_##T##S##m1(v, 2), \ | ||
__riscv_vget_##T##S##m1(v, 3), \ | ||
__riscv_vsetvlmax_e##S##m1()), \ | ||
__riscv_vsetvlmax_e##S##m1()), \ | ||
__riscv_##op(__riscv_##op(__riscv_vget_##T##S##m1(v, 4), \ | ||
__riscv_vget_##T##S##m1(v, 5), \ | ||
__riscv_vsetvlmax_e##S##m1()), \ | ||
__riscv_##op(__riscv_vget_##T##S##m1(v, 6), \ | ||
__riscv_vget_##T##S##m1(v, 7), \ | ||
__riscv_vsetvlmax_e##S##m1()), \ | ||
__riscv_vsetvlmax_e##S##m1()), \ | ||
__riscv_vsetvlmax_e##S##m1()) | ||
|
||
#define RISCV_PERM4(f, v, vidx) \ | ||
__riscv_vcreate_v_u8m1_u8m4( \ | ||
f(__riscv_vget_u8m1(v, 0), vidx, __riscv_vsetvlmax_e8m1()), \ | ||
f(__riscv_vget_u8m1(v, 1), vidx, __riscv_vsetvlmax_e8m1()), \ | ||
f(__riscv_vget_u8m1(v, 2), vidx, __riscv_vsetvlmax_e8m1()), \ | ||
f(__riscv_vget_u8m1(v, 3), vidx, __riscv_vsetvlmax_e8m1())) | ||
|
||
#define RISCV_LUT4(f, vtbl, v) \ | ||
__riscv_vcreate_v_u8m1_u8m4( \ | ||
f(vtbl, __riscv_vget_u8m1(v, 0), __riscv_vsetvlmax_e8m1()), \ | ||
f(vtbl, __riscv_vget_u8m1(v, 1), __riscv_vsetvlmax_e8m1()), \ | ||
f(vtbl, __riscv_vget_u8m1(v, 2), __riscv_vsetvlmax_e8m1()), \ | ||
f(vtbl, __riscv_vget_u8m1(v, 3), __riscv_vsetvlmax_e8m1())) | ||
|
||
#define RISCV_PERM8(f, v, vidx) \ | ||
__riscv_vcreate_v_u8m1_u8m8( \ | ||
f(__riscv_vget_u8m1(v, 0), vidx, __riscv_vsetvlmax_e8m1()), \ | ||
f(__riscv_vget_u8m1(v, 1), vidx, __riscv_vsetvlmax_e8m1()), \ | ||
f(__riscv_vget_u8m1(v, 2), vidx, __riscv_vsetvlmax_e8m1()), \ | ||
f(__riscv_vget_u8m1(v, 3), vidx, __riscv_vsetvlmax_e8m1()), \ | ||
f(__riscv_vget_u8m1(v, 4), vidx, __riscv_vsetvlmax_e8m1()), \ | ||
f(__riscv_vget_u8m1(v, 5), vidx, __riscv_vsetvlmax_e8m1()), \ | ||
f(__riscv_vget_u8m1(v, 6), vidx, __riscv_vsetvlmax_e8m1()), \ | ||
f(__riscv_vget_u8m1(v, 7), vidx, __riscv_vsetvlmax_e8m1())) | ||
|
||
#define RISCV_VMFLTZ(T, v, vl) __riscv_vmslt(__riscv_vreinterpret_i##T(v), 0, vl) | ||
|
||
#endif /* INCLUDE_VOLK_VOLK_RVV_INTRINSICS_H_ */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.