Skip to content

Fix RVV toolchain conflicts.#20182

Merged
opencv-pushbot merged 1 commit intoopencv:masterfrom
hanliutong:master
May 31, 2021
Merged

Fix RVV toolchain conflicts.#20182
opencv-pushbot merged 1 commit intoopencv:masterfrom
hanliutong:master

Conversation

@hanliutong
Copy link
Copy Markdown
Contributor

@hanliutong hanliutong commented May 30, 2021

Thanks to @damonyu1989 for bringing us a parallel implementations based on RVV 0.7.1 with pr #19778. However, there is a minor bug that causes conflicts with the existing toolchain.

In cv_cpu_dispatch.h,

#if defined(__riscv) && defined(__riscv_vector)
# include<riscv-vector.h>
# define CV_RVV071 1
#endif

CV_RVV071 will be defined when __riscv, __riscv_vector are defined, which are compiler preset macros. This will cause conflicts because any compiler that supports RVV will generate these two macros, not specific to RVV 0.7.1. This means that when you try to compile OpenCV using the toolchain base on the latest RVV draft of the standard, you will incorrectly define the macro CV_RVV071 and try to reference a header file(riscv-vector.h) that does not exist (renamed riscv_vector.h), which will cause the compilation to fail.

Therefore, I added a preset macro in cmake to solve the problem.

Pull Request Readiness Checklist

See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request

  • I agree to contribute to the project under Apache 2 License.
  • To the best of my knowledge, the proposed patch is not based on a code under GPL or other license that is incompatible with OpenCV
  • The PR is proposed to proper branch
  • There is reference to original bug report and related work
  • There is accuracy test, performance test and test data in opencv_extra repository, if applicable
    Patch to opencv_extra has the same branch name.
  • The feature is well documented and sample code can be built with the project CMake

@vpisarev vpisarev self-requested a review May 31, 2021 08:07
@vpisarev
Copy link
Copy Markdown
Contributor

nice solution! 👍

@opencv-pushbot opencv-pushbot merged commit 73ee01a into opencv:master May 31, 2021
@alalek alalek mentioned this pull request Jun 4, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants