Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

hanliutong
Copy link
Contributor

@hanliutong hanliutong commented Feb 28, 2023

This patch is going to fix the incomplete compatibility layer by adding more compatibility functions into the HAL compatibility layer.

The HAL compatibility layer was introduced by #22179 when we supported the scalable RVV backend, which mainly includes some new universal intrinsic that have to be introduced in the RVV backend. And then with this HAL compatibility layer, we can use the new universal intrinsic in other non-scalable backends.

However, when the HAL compatibility layer is implemented, I used the compile-time wide universal intrinsic type (e.g. v_float32). It works fine most of the time, but the following special cases have problems: When using a specific narrow universal intrinsic type in a wide SIMD target.

For example, in #22440, v_add for v_float32x4 is called. It can be compiled on any 128-bits SIMD target but failed on 256/512 bits SIMD target like AVX2. Because v_float32 is defined as v_float32x8 in this case, then no functions for v_add(v_float32x4 ...) is defined.

This patch fixes the issue and modifies the relevant use case by using the new Universal Intrinsic (like v_add).

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 another license that is incompatible with OpenCV
  • The PR is proposed to the proper branch
  • There is a reference to the 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
force_builders=Custom
build_image:Custom=riscv-clang-rvv
Xbuild_image:Custom=riscv-clang-rvv-128
Xbuild_image:Custom=riscv-gcc-rvv-07
test_modules:Custom=core,imgproc,dnn
buildworker:Custom=linux-4
test_timeout:Custom=600
build_contrib:Custom=OFF

@asmorkalov
Copy link
Contributor

@hanliutong I apologize for the large delay. The PR has conflicts. Could you rebase and fix conflicts?

@hanliutong hanliutong force-pushed the fix_hal_compatibility branch from 3083f5c to be14f1d Compare March 27, 2023 13:24
@hanliutong hanliutong force-pushed the fix_hal_compatibility branch from be14f1d to a809ae4 Compare March 27, 2023 13:31
@hanliutong
Copy link
Contributor Author

Conflicts have already been fixed

@opencv-alalek opencv-alalek added this to the 4.8.0 milestone Apr 6, 2023
@asmorkalov asmorkalov merged commit 3f02c9d into opencv:4.x Apr 11, 2023
@asmorkalov asmorkalov mentioned this pull request May 31, 2023
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