Skip to content

Update RISC-V back-end to RVV 0.10#20278

Merged
opencv-pushbot merged 1 commit intoopencv:masterfrom
joy2myself:rvv-0.10
Jul 9, 2021
Merged

Update RISC-V back-end to RVV 0.10#20278
opencv-pushbot merged 1 commit intoopencv:masterfrom
joy2myself:rvv-0.10

Conversation

@joy2myself
Copy link
Copy Markdown
Contributor

@joy2myself joy2myself commented Jun 18, 2021

Description

This patch updates the RISC-V vector implementation of Wide Universal Intrinsics to RVV 0.10, making it consistent with the latest riscv-gnu-toolchain (https://github.com/riscv/riscv-gnu-toolchain/tree/rvv-intrinsic, Commit ID: 28271f03bb538d926ad2889dc8ad1b0cb1b3b45c). At present, this version can achieve the same status as the previous version, that is, it has passed all HAL tests. And 11485 passed, 21 failed in core tests.

The details are as follows:

  • Update toolchain file riscv64-gcc.toolchain.cmake to match the latest compilation options.
  • Update CPU check file cpu_rvv.cpp.
  • Update intrin_rvv.hpp. Update all RVV native intrinsic interfaces to RVV 0.10.

Test

  • Build riscv-gnu-toolchain and QEMU simulator
git clone git@github.com:riscv/riscv-gnu-toolchain.git -b rvv-intrinsic
cd riscv-gnu-toolchain
git submodule update --init --recursive
./configure --prefix=/opt/RISCV --with-arch=rv64gcv_zfh --with-abi=lp64d
make linux -j$(nproc)
make build-qemu -j$(nproc)
  • Build OpenCV for RISC-V
git clone git@github.com:joy2myself/opencv.git -b rvv-0.10
cd opencv
mkdir build && cd build
cmake -DCMAKE_TOOLCHAIN_FILE=../platforms/linux/riscv64-gcc.toolchain.cmake ../
make -j$(nproc)
  • Accuracy Test
/opt/RISCV/bin/qemu-riscv64 -cpu rv64,x-v=true opencv/build/bin/opencv_test_core
  • Test Result
[----------] Global test environment tear-down
[ SKIPSTAT ] 14 tests skipped
[ SKIPSTAT ] TAG='mem_6gb' skip 1 tests
[ SKIPSTAT ] TAG='skip_other' skip 13 tests
[==========] 11506 tests from 249 test cases ran. (3475482 ms total)
[  PASSED  ] 11485 tests.
[  FAILED  ] 21 tests, listed below:
[  FAILED  ] Core_Add.AddToColumnWhen3Rows
[  FAILED  ] Core_Add.AddToColumnWhen4Rows
[  FAILED  ] MinMaxLoc.Mat_IntMax_Without_Mask
[  FAILED  ] Core_CountNonZero.accuracy
[  FAILED  ] Core_InputOutput.filestorage_base64_basic_read_XML
[  FAILED  ] Core_InputOutput.filestorage_base64_basic_read_YAML
[  FAILED  ] Core_InputOutput.filestorage_base64_basic_read_JSON
[  FAILED  ] Core_globbing.accuracy
[  FAILED  ] Core_Array.basic_operations
[  FAILED  ] Core_Array.expressions
[  FAILED  ] Core_Transform.accuracy
[  FAILED  ] Core_Pow.accuracy
[  FAILED  ] Core_Phase.accuracy32f
[  FAILED  ] Core_Phase.accuracy64f
[  FAILED  ] Core_Cmp/ElemWiseTest.accuracy/0, where GetParam() = 16-byte object <F0-CF 94-00 00-00 00-00 F0-D4 94-00 00-00 00-00>
[  FAILED  ] Core_CmpS/ElemWiseTest.accuracy/0, where GetParam() = 16-byte object <70-D7 94-00 00-00 00-00 F0-D9 94-00 00-00 00-00>
[  FAILED  ] Core_InRangeS/ElemWiseTest.accuracy/0, where GetParam() = 16-byte object <30-92 62-00 00-00 00-00 50-50 94-00 00-00 00-00>
[  FAILED  ] Core_InRange/ElemWiseTest.accuracy/0, where GetParam() = 16-byte object <F0-33 95-00 00-00 00-00 70-FF 94-00 00-00 00-00>
[  FAILED  ] Core_Log/ElemWiseTest.accuracy/0, where GetParam() = 16-byte object <B0-01 90-00 00-00 00-00 D0-52 94-00 00-00 00-00>
[  FAILED  ] Core_CountNonZero/ElemWiseTest.accuracy/0, where GetParam() = 16-byte object <30-0E 90-00 00-00 00-00 B0-0B 90-00 00-00 00-00>
[  FAILED  ] Core_MinMaxLoc/ElemWiseTest.accuracy/0, where GetParam() = 16-byte object <40-52 97-00 00-00 00-00 90-52 97-00 00-00 00-00>

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

@joy2myself
Copy link
Copy Markdown
Contributor Author

@vpisarev Hi Vadim. I'm not sure if this failed CI check is related to my patch. Would you please confirm whether this patch can be merged. At present, this patch may be helpful to DNN module optimization project of GSoC.

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.

Looks good to me in general. I'll check the solution with simulator and will come back soon.

@asmorkalov asmorkalov self-requested a review July 9, 2021 12:34
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.

@asmorkalov
Copy link
Copy Markdown
Contributor

@alalek Could you merge the PR?

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.

4 participants