Skip to content

Replace operators with wrapper functions on universal intrinsics backends#26109

Merged
asmorkalov merged 12 commits intoopencv:4.xfrom
WanliZhong:univ_intrin_operator2warpper
Sep 13, 2024
Merged

Replace operators with wrapper functions on universal intrinsics backends#26109
asmorkalov merged 12 commits intoopencv:4.xfrom
WanliZhong:univ_intrin_operator2warpper

Conversation

@WanliZhong
Copy link
Copy Markdown
Member

@WanliZhong WanliZhong commented Sep 4, 2024

This PR aims to replace the operators(logic, arithmetic, bit) with wrapper functions(v_add, v_eq, v_and...)

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=simd-emulator
buildworker:Custom=linux-1,linux-4

@WanliZhong WanliZhong changed the title Replace operators with wrapper funciotn in universal intrinsics Replace operators with wrapper functions on universal intrinsics backends Sep 4, 2024
@vpisarev
Copy link
Copy Markdown
Contributor

vpisarev commented Sep 9, 2024

@WanliZhong, please, check it; it now does not complain on v_add & v_mul, but complains about v_exp etc.

@asmorkalov
Copy link
Copy Markdown
Contributor

@fengyuentau could you check longsoon branch?

@asmorkalov
Copy link
Copy Markdown
Contributor

@mshabunin @opencv-alalek could you take a look?

@asmorkalov asmorkalov added cleanup Code cleanup (e.g, drop legacy C-API, legacy unmaintained code) and removed optimization labels Sep 11, 2024
@asmorkalov asmorkalov added this to the 4.11.0 milestone Sep 11, 2024
@WanliZhong
Copy link
Copy Markdown
Member Author

@asmorkalov Longsoon tests are all passed. (GUI test failed is not related to this PR, because it's server)
Screenshot 2024-09-12 at 12 36 35

@asmorkalov
Copy link
Copy Markdown
Contributor

cc @hanliutong

@WanliZhong
Copy link
Copy Markdown
Member Author

The default test error about v_exp should be fixed in #25891, I have included this PR and it passed the test but not in this PR.

In file included from /build/precommit_custom_linux/4.x/opencv/modules/core/include/opencv2/core/hal/intrin.hpp:961:0,
                 from /build/precommit_custom_linux/4.x/opencv/modules/core/src/precomp.hpp:88,
                 from /build/precommit_custom_linux/build/modules/core/mathfuncs_core.avx2.cpp:2:
/build/precommit_custom_linux/4.x/opencv/modules/core/include/opencv2/core/hal/intrin_math.hpp: In function 'cv::hal_EMULATOR_CPP::simd256::v_float32 cv::hal_EMULATOR_CPP::simd256::v_erf(const v_float32&)':
/build/precommit_custom_linux/4.x/opencv/modules/core/include/opencv2/core/hal/intrin_math.hpp:453:40: error: no matching function for call to 'v_exp(cv::hal_EMULATOR_CPP::simd256::v_float32&)'
         v_float32 exp = v_exp(neg_pow_2);
                                        ^

@asmorkalov asmorkalov merged commit c8080aa into opencv:4.x Sep 13, 2024
@asmorkalov asmorkalov self-assigned this Sep 13, 2024
@asmorkalov asmorkalov mentioned this pull request Sep 20, 2024
thewoz pushed a commit to CobbsLab/OPENCV that referenced this pull request Feb 13, 2025
…warpper

Replace operators with wrapper functions on universal intrinsics backends opencv#26109

This PR aims to replace the operators(logic, arithmetic, bit) with wrapper functions(v_add, v_eq, v_and...)

### Pull Request Readiness Checklist

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

- [x] I agree to contribute to the project under Apache 2 License.
- [x] 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
- [x] 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
@artyom-beilis
Copy link
Copy Markdown

Why?

Seriously why breaking existing code that uses the intrinsics? OpenCV is actually only sane library I found around that provides useful cross platform intrinsics. What would you remove useful C++ operators?

Why breaking user code - especially for a projects that is used all around the world!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

category: core cleanup Code cleanup (e.g, drop legacy C-API, legacy unmaintained code)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants