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
RISC-V: support RVV 0.7 in mainline RVV intrinsics #23246
Conversation
@mshabunin I added |
Which qemu do you use? Why is it I only tested core and imgproc in Xuantie qemu. I will run the whole testsuite and compare results with yours. |
Please merge build + test steps instructions for different scenarios. |
Updated the description, also filed an issue to the T-Head toolchain: T-head-Semi/xuantie-gnu-toolchain#5 - apparently toolchain built from sources can not compile OpenCV with RVV 0.7 support, but prebuilt one can. Also added my Docker-based testing environment: https://github.com/mshabunin/riscv-check |
#ifdef __THEAD_VERSION__ | ||
# if __riscv_v == 7000 // -march=rv64gcv0p7 | ||
# include <fenv.h> | ||
# define CV_RISCV_OLD |
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.
CV_RISCV_OLD
This name is unclear.
Please be more specific when and why we use it.
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.
Renamed to CV_RVV_THEAD_0_7
and added a comment
626c2f1
to
903ec0e
Compare
@Lzingnow , I didn't try to build with elf toolchain. Your issue is that you should build |
Hello, I have successfully installed the rvv-next branch of riscv-gnu-toolchain by following the above procedure. Then, I downloaded the source code for opencv4.8. Build with the following commands:
At this point, it indicates that the installation was successful. Next, I want to write c++ code that calls the opencv library to generate an executable file that can run on a CPU that supports rvv1.0. Specifically, the PULP project's ara project. Here I test the resize function, c++ code is as follows:
The specific compilation options are as follows:
But I did not find the vector instruction after decompilation. May I ask why? The files resize.o and resize.dump are attached.
|
Your |
@mshabunin Thank you very much. I got the executable file containing the vector instructions by setting up static compilation. But I also have a question about whether the opencv library for This is because I once tried to compile opencv libraries using the |
We do not build OpenCV for bare metal environments, it is not supported officially. In general OpenCV uses C/C++ libraries, some POSIX functions and a threading library (pthreads). If your toolchain can provide these interfaces, then perhaps it might work. |
Thank you for your reply. |
Hello, I would like to know if you have encountered such problems when testing with the rvv-next branch. After compiling the opencv library using the 1.Compile qemu:
But there was an error:
Then I found another
But there is still one mistake: In addition, I also tried I don't know how to solve this problem. |
I think I solved the problem, but instead of using qemu under the
|
Recent T-Head GCC have ability to produce RVV 0.7.1 compatible machine code using mainline intrinsics syntax. It makes possible to have single intrinsics implementation for both 0.7 and 1.0 versions (
intrin_rvv.hpp
, maybe scalable too).Build and test with RVV 1.0 (non-scalable)
Using one of the following toolchains:
Using one of the following qemu:
Build and test with RVV 0.7.1 (non-scalable)
Using one of the following toolchains:
Build from sources(:exclamation:can not build OpenCV in this mode at this moment:exclamation:): https://github.com/T-head-Semi/xuantie-gnu-toolchainUsing qemu:
Notes:
v_trunc
implementation have modified because there is no corresponding_rtz_
intrinsics in 0.7v_absdiff
have been reimplemented to avoid using 64-bit types for 32-bit inputv_check_
also updated to use 32-bit internallyCV_SIMD128_64F
guard was missing in some places