CARVIEW |
Navigation Menu
-
-
Notifications
You must be signed in to change notification settings - Fork 56.2k
Build riscv with c++ intrinsics #17922
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
Build riscv with c++ intrinsics #17922
Conversation
@@ -102,6 +103,8 @@ ocv_optimization_process_obsolete_option(ENABLE_NEON NEON OFF) | |||
|
|||
ocv_optimization_process_obsolete_option(ENABLE_VSX VSX ON) | |||
|
|||
ocv_optimization_process_obsolete_option(ENABLE_RISCV RISCV OFF) |
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.
ENABLE_RISCV
is bad choise as it's general architecture name. I propose to use something ENABLE_RVV
or enable ENABLE_RISCV_VEXT
.
cmake/checks/cpu_riscv.cpp
Outdated
return (int)vfmv_f_s_f32m1_f32(val); | ||
} | ||
#else | ||
#error "RISCV is not supported" |
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.
"RISC-V vector extension"
General recommendation: replace |
There is build failure with clang:
|
753f6f4
to
3e85280
Compare
I have updated the code for naming issue. Use |
There is build issue still:
|
3e85280
to
b79ecef
Compare
I have updated the code. Fixed clang build issues. |
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.
I fixed CMake toolchain file to build the library. Please squash commits to have one commit in PR.
@joy2myself Please also take a look on CI status: https://pullrequest.opencv.org/buildbot/builders/precommit_docs/builds/25946 |
e80d3a7
to
98f47fa
Compare
Hi Alex, I squashed commits to one and fixed the whitespace issue. |
Dockerfile with ready environment: https://github.com/asmorkalov/riscv-experiments/blob/master/Dockerfile |
#endif | ||
|
||
#if (CV_SSE2 || CV_NEON || CV_VSX || CV_MSA || CV_WASM_SIMD) && !defined(CV_FORCE_SIMD128_CPP) | ||
|
||
#if (CV_SSE2 || CV_NEON || CV_VSX || CV_MSA || CV_WASM_SIMD/* || CV_RVV*/) && !defined(CV_FORCE_SIMD128_CPP) |
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.
Please revert the change here till we do not have specific optimizations.
48db9b5
to
8c6130c
Compare
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.
👍
@mshabunin Hi, Maksim. Thanks a lot for your review. Firstly, I'd like to explain that this patch just added the toolchain file for cross compiling and extended some files for target RISC-V. The code in file |
8c6130c
to
e418f43
Compare
I have resolved changes except these in |
e418f43
to
033687b
Compare
@mshabunin Hi, Maksim. I have finished all the changes you requested. Please review it again. Thank you! |
@@ -269,6 +269,8 @@ namespace cv { | |||
#define CV_CPU_AVX512_CLX 261 | |||
#define CV_CPU_AVX512_ICL 262 | |||
|
|||
#define CV_CPU_RVV 300 |
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.
Please use 210 here and below.
256+ is used for "groups".
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.
Fixed. Thanks a lot for your review!
- Added cross compile cmake file for target riscv64-clang - Extended cmake for RISC-V and added instruction checks - Created intrin_rvv.hpp with C++ version universal intrinsics
033687b
to
ff4c387
Compare
@alalek Can we merge the PR? |
This PR From GSoC Project "Optimize OpenCV for RISC-V"
This PR added cross compiling environment for RISC-V and use C++ version universal intrinsics for building.
PR contains:
Added toolchain file for target
riscv64-clang
.Extended CMake for RISC-V and add instruction checks (cmake/checks/cpu_riscv.cpp).
Created intrin_riscv.hpp with C++ version universal intrinsics.
Pull Request Readiness Checklist
See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request
Patch to opencv_extra has the same branch name.