-
Notifications
You must be signed in to change notification settings - Fork 216
Implement RISC-V Vector 1.0 kernels #774
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
baa9c71
add RISC-V Vector extension (RVV) kernels
camel-cdr 2e2ba03
add braces around one-liners for loops
camel-cdr 433af9b
use with submodules recursive in RVV CI
camel-cdr 848b68d
Merge branch 'gnuradio:main' into main
camel-cdr 99127fa
RVV CI: build sequentially with verbose
camel-cdr 8e88f1e
use segmented store in rotator2 rvvseg implementation
camel-cdr File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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
jdemel marked this conversation as resolved.
Show resolved
Hide resolved
|
This file contains hidden or 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()) | ||
jdemel marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| #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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.