Build riscv with c++ intrinsics#17922
Conversation
|
|
||
| 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.
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.
"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. |
asmorkalov
left a comment
There was a problem hiding this comment.
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 |
|
|
||
| #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.
Please revert the change here till we do not have specific optimizations.
48db9b5 to
8c6130c
Compare
|
@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! |
| #define CV_CPU_AVX512_CLX 261 | ||
| #define CV_CPU_AVX512_ICL 262 | ||
|
|
||
| #define CV_CPU_RVV 300 |
There was a problem hiding this comment.
Please use 210 here and below.
256+ is used for "groups".
There was a problem hiding this comment.
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.