Skip to content

cuda4dnn(concat): write outputs from previous layers directly into concat's output#16161

Merged
alalek merged 3 commits intoopencv:masterfrom
YashasSamaga:cuda4dnn-concat-fusion
Feb 20, 2020
Merged

cuda4dnn(concat): write outputs from previous layers directly into concat's output#16161
alalek merged 3 commits intoopencv:masterfrom
YashasSamaga:cuda4dnn-concat-fusion

Conversation

@YashasSamaga
Copy link
Copy Markdown
Contributor

@YashasSamaga YashasSamaga commented Dec 14, 2019

This pullrequest changes

  • optimizes out concat layer by forcing the layers providing input to the concat to directly write to the corresponding section of concat's output
force_builders=Custom,docs
buildworker:Custom=linux-4
docker_image:Custom=ubuntu-cuda:16.04

build_image:Custom Mac=openvino-2019r3.0
build_image:Custom Win=openvino-2019r3.0
test_opencl:Custom Win=OFF
test_modules:Custom Mac=dnn,java,python3

@alalek
Copy link
Copy Markdown
Member

alalek commented Dec 16, 2019

Do you have any suggestions how to test that (avoid future regressions)?

@YashasSamaga YashasSamaga force-pushed the cuda4dnn-concat-fusion branch from 75f5297 to a97c736 Compare December 17, 2019 07:43
@YashasSamaga
Copy link
Copy Markdown
Contributor Author

YashasSamaga commented Dec 17, 2019

Oops, I should have rebased after PR16092 was merged and enable more Concat fusions. Sorry.

I am not sure if I understood you correctly but the current tests have models where concat is fused.

@alalek
Copy link
Copy Markdown
Member

alalek commented Jan 11, 2020

Can we track applied fusing through checking of Net::dump() output? (using some test networks)

@YashasSamaga
Copy link
Copy Markdown
Contributor Author

YashasSamaga commented Jan 13, 2020

The Net::dump() output appear to be identical with and without concat fusion. I don't know if this is intended.

Maybe dump could be tweaked to dump fusion information too.

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.

@YashasSamaga could you modify Net::dump() to show fusion information too. It's important for debug.

@YashasSamaga YashasSamaga force-pushed the cuda4dnn-concat-fusion branch from a97c736 to 4a30a38 Compare January 26, 2020 06:25
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 1f695c4 into opencv:master Feb 20, 2020
a-sajjad72 pushed a commit to a-sajjad72/opencv that referenced this pull request Mar 30, 2023
cuda4dnn(concat): write outputs from previous layers directly into concat's output

* eliminate concat by directly writing to its output buffer

* fix concat fusion not happening sometimes

* use a whitelist instead of a blacklist
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

category: dnn category: gpu/cuda (contrib) OpenCV 4.0+: moved to opencv_contrib

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants