Skip to content

update opencv dnn to support cann version >=6.3#23936

Merged
asmorkalov merged 16 commits intoopencv:4.xfrom
SaltFish-T:4.x
Jul 27, 2023
Merged

update opencv dnn to support cann version >=6.3#23936
asmorkalov merged 16 commits intoopencv:4.xfrom
SaltFish-T:4.x

Conversation

@SaltFish-T
Copy link
Copy Markdown
Contributor

1.modify the search path of "libopsproto.so" in OpenCVFindCANN.cmake
2.add the search path of "libgraph_base.so" in OpenCVFindCANN.cmake
3.automatic check Ascend socVersion,and test on Ascend310/Ascend310B/Ascend910B well

Medify search path of libopsproto.so
add libgraph_base.so to libs_cann
modify the include path of "all_ops.h"
Automatically identify the socVersion and verify it
return()
endif()

# * libgraph_base.so 添加
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Please use English for comments.

endif()
# * libopsproto.so
set(lib_opsproto "${CANN_INSTALL_DIR}/opp/op_proto/built-in")
set(lib_opsproto "${CANN_INSTALL_DIR}/opp/built-in/op_proto/lib/linux/${CMAKE_HOST_SYSTEM_PROCESSOR}")
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

CANN version check?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

${CMAKE_HOST_SYSTEM_PROCESSOR} = x86_64 or aarch64. This depends on which CPU architecture is used

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I mean, that different versions of CANN SDK has different layout. M.b. we need to presume compatibility and have both branches with version check?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

It's a good way. In my tests, this change is uitable for cann version 6.3 and above.

endif()

if(EXISTS "${CANN_INSTALL_DIR}/opp/op_proto/built-in/inc")
set(LOW_CANN_VERSION "YES" )
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Can we use CANN_VERSION_BELOW_6_3_ALPHA002 to make it meaningful?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

OK,this makes it easier to understand

@fengyuentau fengyuentau self-assigned this Jul 14, 2023
Remove whitespace at the end of a line
Copy link
Copy Markdown
Member

@fengyuentau fengyuentau left a comment

Choose a reason for hiding this comment

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

👍 Tried with this patch with old CANN and the build was successful.

Copy link
Copy Markdown
Member

@fengyuentau fengyuentau left a comment

Choose a reason for hiding this comment

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

👍 Tried with this patch with old CANN and the build was successful.

@asmorkalov
Copy link
Copy Markdown
Contributor

@SaltFish-T Thanks a lot for the patch. Could you recommend ready Dockerfile for installation instructions in English for CANN SDK. It looks like it's useful have it in CI as build target at least.

Comment on lines +15 to +16
if(UNIX)
else()
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

if (NOT UNIX)

if(UNIX)
else()
set(HAVE_CANN OFF)
message(STATUS "CANN: CANN toolkit supports unix but not ${CMAKE_SYSTEM_NAME}. Turning off HAVE_CANN")
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I propose to use message(WARNING). It's highlighted red and caught by CI.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I use message(WARNING) in every place that "set(HAVE_CANN OFF)".

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.

👍

@asmorkalov asmorkalov merged commit ab6bffc into opencv:4.x Jul 27, 2023
@asmorkalov asmorkalov mentioned this pull request Jul 27, 2023
@fengyuentau fengyuentau added this to the 4.9.0 milestone Aug 10, 2023
@fengyuentau fengyuentau added the category:dnn_cann CANN backend related issues in DNN module label Sep 13, 2023
thewoz pushed a commit to thewoz/opencv that referenced this pull request Jan 4, 2024
Update opencv dnn to support cann version >=6.3 opencv#23936

1.modify the search path of "libopsproto.so" in OpenCVFindCANN.cmake
2.add the search path of "libgraph_base.so" in OpenCVFindCANN.cmake
3.automatic check Ascend socVersion,and test on Ascend310/Ascend310B/Ascend910B well
thewoz pushed a commit to thewoz/opencv that referenced this pull request May 29, 2024
Update opencv dnn to support cann version >=6.3 opencv#23936

1.modify the search path of "libopsproto.so" in OpenCVFindCANN.cmake
2.add the search path of "libgraph_base.so" in OpenCVFindCANN.cmake
3.automatic check Ascend socVersion,and test on Ascend310/Ascend310B/Ascend910B well
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

category: build/install category:dnn_cann CANN backend related issues in DNN module category: dnn

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants