Skip to content

Make the implementation of optimization in DNN adjustable to different vector sizes with RVV intrinsics.#20521

Merged
alalek merged 6 commits intoopencv:masterfrom
hanliutong:dev-rvv-multiVLEN
Oct 5, 2021
Merged

Make the implementation of optimization in DNN adjustable to different vector sizes with RVV intrinsics.#20521
alalek merged 6 commits intoopencv:masterfrom
hanliutong:dev-rvv-multiVLEN

Conversation

@hanliutong
Copy link
Copy Markdown
Contributor

@hanliutong hanliutong commented Aug 9, 2021

PR for GSoC'21 project on Optimize OpenCV DNN for RISC-V. Related PR #20287.

This PR will further optimize DNN on the basis of #20287, especially when VLEN>128.

In #20287, we have used RVV Intrinsic to optimize the 4 kernel functions in DNN. However, if RVV vectors are 256-bit wide or more longer, then the current implementation will use only a part of them. This PR tries to adjustable to different vector sizes.

Functions Implement && Build block size Max used of vReg (v0-v31)
fastGEMM ⏱ Ready for review 4*7 32
fastGEMM1T ⏱ Ready for review 15*2 32
fastConv ⏱ Ready for review 3*8 28
fastDepthwiseConv ⏱ Ready for review / 18

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

@hanliutong hanliutong marked this pull request as ready for review August 24, 2021 04:48
@hanliutong hanliutong changed the title WIP: Make the implementation of optimization in DNN adjustable to different vector sizes with RVV intrinsics. Make the implementation of optimization in DNN adjustable to different vector sizes with RVV intrinsics. Aug 26, 2021
Copy link
Copy Markdown
Contributor

@asmorkalov asmorkalov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 Tested with QEMU and vlen=128,256

@asmorkalov asmorkalov self-requested a review October 5, 2021 14:07
Copy link
Copy Markdown
Contributor

@asmorkalov asmorkalov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@alalek alalek merged commit e5fb504 into opencv:master Oct 5, 2021
@alalek alalek mentioned this pull request Oct 15, 2021
@hanliutong hanliutong deleted the dev-rvv-multiVLEN branch November 9, 2021 07:50
a-sajjad72 pushed a commit to a-sajjad72/opencv that referenced this pull request Mar 30, 2023
Make the implementation of optimization in DNN adjustable to different vector sizes with RVV intrinsics.

* Update fastGEMM for multi VLEN.

* Update fastGEMM1T for multi VLEN.

* Update fastDepthwiseConv for multi VLEN.

* Update fastConv for multi VLEN.

* Replace malloc with cv::AutoBuffer.
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.

3 participants