Repository navigation
[C++] Add RISC-V Vector (RVV) support and dynamic dispatch #51340
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
Open
zhanchangbao-sanechips
wants to merge
8
commits into
apache:main
Choose a base branch
from
zhanchangbao-sanechips:rvvopt
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
74efff7
GH-51334: [C++] Add RISC-V Vector (RVV) support and dynamic dispatch
zhanchangbao-sanechips 2490175
Merge branch 'apache:main' into rvvopt
zhanchangbao-sanechips 6dae1b4
GH-51334: [C++] Add RISC-V Vector (RVV) support and dynamic dispatch
zhanchangbao-sanechips 4fffad3
Merge branch 'apache:main' into rvvopt
zhanchangbao-sanechips 1409867
Merge branch 'apache:main' into rvvopt
zhanchangbao-sanechips 1577b85
Merge branch 'apache:main' into rvvopt
zhanchangbao-sanechips 2a9a1ec
GH-51334: [C++] Fix RVV code formatting
zhanchangbao-sanechips dc8c919
GH-51334: [C++] Use per-vector-width RVV dispatch macros
zhanchangbao-sanechips 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 |
|---|---|---|
|
|
@@ -59,6 +59,7 @@ python/doc/ | |
|
|
||
| .vscode | ||
| .idea/ | ||
| .icodemate/ | ||
| .pytest_cache/ | ||
| pkgs | ||
| docker_cache | ||
|
|
||
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -167,6 +167,24 @@ elseif(ARROW_CPU_FLAG STREQUAL "aarch64") | |
| if(ARROW_SIMD_LEVEL STREQUAL "DEFAULT") | ||
| set(ARROW_SIMD_LEVEL "NEON") | ||
| endif() | ||
| elseif(ARROW_CPU_FLAG STREQUAL "riscv64") | ||
| set(ARROW_RVV_MARCH "rv64gcv") | ||
| check_cxx_compiler_flag("-march=${ARROW_RVV_MARCH}" CXX_SUPPORTS_RVV) | ||
| if(CXX_SUPPORTS_RVV AND ARROW_RUNTIME_SIMD_LEVEL MATCHES "^(RVV128|RVV256|RVV512|MAX)$") | ||
| set(ARROW_HAVE_RUNTIME_RVV128 ON) | ||
| add_definitions(-DARROW_HAVE_RUNTIME_RVV128) | ||
| endif() | ||
| if(CXX_SUPPORTS_RVV AND ARROW_RUNTIME_SIMD_LEVEL MATCHES "^(RVV256|RVV512|MAX)$") | ||
| set(ARROW_HAVE_RUNTIME_RVV256 ON) | ||
| add_definitions(-DARROW_HAVE_RUNTIME_RVV256) | ||
| endif() | ||
| if(CXX_SUPPORTS_RVV AND ARROW_RUNTIME_SIMD_LEVEL MATCHES "^(RVV512|MAX)$") | ||
| set(ARROW_HAVE_RUNTIME_RVV512 ON) | ||
| add_definitions(-DARROW_HAVE_RUNTIME_RVV512) | ||
| endif() | ||
| if(ARROW_SIMD_LEVEL STREQUAL "DEFAULT") | ||
| set(ARROW_SIMD_LEVEL "NONE") | ||
| endif() | ||
| endif() | ||
|
|
||
| # Support C11 | ||
|
|
@@ -547,6 +565,24 @@ if(ARROW_CPU_FLAG STREQUAL "aarch64") | |
| message(WARNING "ARROW_SIMD_LEVEL=${ARROW_SIMD_LEVEL} not supported by Arm.") | ||
| endif() | ||
| endif() | ||
| if(ARROW_CPU_FLAG STREQUAL "riscv64") | ||
| if(ARROW_SIMD_LEVEL MATCHES "RVV") | ||
| if(NOT CXX_SUPPORTS_RVV) | ||
| message(FATAL_ERROR "RVV required but compiler doesn't support it.") | ||
| endif() | ||
| set(CXX_COMMON_FLAGS "${CXX_COMMON_FLAGS} -march=${ARROW_RVV_MARCH}") | ||
| string(REGEX MATCH "[0-9]+" RVV_VECTOR_BITS ${ARROW_SIMD_LEVEL}) | ||
| if(RVV_VECTOR_BITS) | ||
| set(ARROW_HAVE_RVV${RVV_VECTOR_BITS} ON) | ||
| add_definitions(-DARROW_HAVE_RVV${RVV_VECTOR_BITS}) | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Shouldn't we also enable a compiler option for the given vector size, as in SVE above? |
||
| else() | ||
| set(ARROW_HAVE_RVV ON) | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Perhaps call it |
||
| add_definitions(-DARROW_HAVE_RVV) | ||
| endif() | ||
| elseif(NOT ARROW_SIMD_LEVEL STREQUAL "NONE") | ||
| message(WARNING "ARROW_SIMD_LEVEL=${ARROW_SIMD_LEVEL} not supported by riscv64.") | ||
| endif() | ||
| endif() | ||
|
|
||
| if(NOT WIN32 AND NOT APPLE) | ||
| if(ARROW_USE_MOLD) | ||
|
|
||
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: add line break as above.