-
Notifications
You must be signed in to change notification settings - Fork 3.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[CUTLASS] Residual connection fusion #9820
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
commit d4a78a3 Author: Masahiro Masuda <[email protected]> Date: Thu Dec 23 16:33:41 2021 +0900 fixed residual block check condition commit 6ee5a39 Author: Masahiro Masuda <[email protected]> Date: Thu Dec 23 16:25:04 2021 +0900 minor fix commit 8af8b30 Author: Masahiro Masuda <[email protected]> Date: Thu Dec 23 16:18:50 2021 +0900 remove SimplifyExpr pass commit 20ae2d8 Author: Masahiro Masuda <[email protected]> Date: Thu Dec 23 16:16:46 2021 +0900 fix bad merge commit 17eed22 Author: Masahiro Masuda <[email protected]> Date: Thu Dec 23 16:13:53 2021 +0900 black commit fda151b Author: Masahiro Masuda <[email protected]> Date: Thu Dec 23 16:09:45 2021 +0900 Support residual block fusion commit ce9d52f Author: Masahiro Masuda <[email protected]> Date: Thu Dec 23 15:56:32 2021 +0900 Remove SimplifyExpr pass from the pipeline (makes DETR result nan) commit d3b681d Author: Masahiro Masuda <[email protected]> Date: Thu Dec 23 15:47:07 2021 +0900 fix no_beta_scaling values commit 87b36db Author: Masahiro Masuda <[email protected]> Date: Thu Dec 23 14:59:40 2021 +0900 fill in TODO doc commit fd67595 Author: Masahiro Masuda <[email protected]> Date: Thu Dec 23 14:31:06 2021 +0900 Refactor cutlass kernel generation and selection
masahi
requested review from
anijain2305,
areusch,
comaniac,
icemelon,
jroesch,
junrushao,
jwfromm,
manupak,
MarisaKirisame,
mbaret,
mbrookhart,
merrymercy,
slyubomirsky,
tqchen,
trevor-m,
vinx13,
wweic,
yzhliu,
zhiics and
ZihengJiang
as code owners
January 3, 2022 06:40
comaniac
approved these changes
Jan 3, 2022
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
ylc
pushed a commit
to ylc/tvm
that referenced
this pull request
Jan 7, 2022
* [CUTLASS] Support residual block fusion for conv2d commit d4a78a3 Author: Masahiro Masuda <[email protected]> Date: Thu Dec 23 16:33:41 2021 +0900 fixed residual block check condition commit 6ee5a39 Author: Masahiro Masuda <[email protected]> Date: Thu Dec 23 16:25:04 2021 +0900 minor fix commit 8af8b30 Author: Masahiro Masuda <[email protected]> Date: Thu Dec 23 16:18:50 2021 +0900 remove SimplifyExpr pass commit 20ae2d8 Author: Masahiro Masuda <[email protected]> Date: Thu Dec 23 16:16:46 2021 +0900 fix bad merge commit 17eed22 Author: Masahiro Masuda <[email protected]> Date: Thu Dec 23 16:13:53 2021 +0900 black commit fda151b Author: Masahiro Masuda <[email protected]> Date: Thu Dec 23 16:09:45 2021 +0900 Support residual block fusion commit ce9d52f Author: Masahiro Masuda <[email protected]> Date: Thu Dec 23 15:56:32 2021 +0900 Remove SimplifyExpr pass from the pipeline (makes DETR result nan) commit d3b681d Author: Masahiro Masuda <[email protected]> Date: Thu Dec 23 15:47:07 2021 +0900 fix no_beta_scaling values commit 87b36db Author: Masahiro Masuda <[email protected]> Date: Thu Dec 23 14:59:40 2021 +0900 fill in TODO doc commit fd67595 Author: Masahiro Masuda <[email protected]> Date: Thu Dec 23 14:31:06 2021 +0900 Refactor cutlass kernel generation and selection * do not try to support broadcast binary op * add comments * remove residual input shape check
ylc
pushed a commit
to ylc/tvm
that referenced
this pull request
Jan 13, 2022
* [CUTLASS] Support residual block fusion for conv2d commit d4a78a3 Author: Masahiro Masuda <[email protected]> Date: Thu Dec 23 16:33:41 2021 +0900 fixed residual block check condition commit 6ee5a39 Author: Masahiro Masuda <[email protected]> Date: Thu Dec 23 16:25:04 2021 +0900 minor fix commit 8af8b30 Author: Masahiro Masuda <[email protected]> Date: Thu Dec 23 16:18:50 2021 +0900 remove SimplifyExpr pass commit 20ae2d8 Author: Masahiro Masuda <[email protected]> Date: Thu Dec 23 16:16:46 2021 +0900 fix bad merge commit 17eed22 Author: Masahiro Masuda <[email protected]> Date: Thu Dec 23 16:13:53 2021 +0900 black commit fda151b Author: Masahiro Masuda <[email protected]> Date: Thu Dec 23 16:09:45 2021 +0900 Support residual block fusion commit ce9d52f Author: Masahiro Masuda <[email protected]> Date: Thu Dec 23 15:56:32 2021 +0900 Remove SimplifyExpr pass from the pipeline (makes DETR result nan) commit d3b681d Author: Masahiro Masuda <[email protected]> Date: Thu Dec 23 15:47:07 2021 +0900 fix no_beta_scaling values commit 87b36db Author: Masahiro Masuda <[email protected]> Date: Thu Dec 23 14:59:40 2021 +0900 fill in TODO doc commit fd67595 Author: Masahiro Masuda <[email protected]> Date: Thu Dec 23 14:31:06 2021 +0900 Refactor cutlass kernel generation and selection * do not try to support broadcast binary op * add comments * remove residual input shape check
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This adds support for fusing a residual block of the form
UnaryOp(BinaryOp(ActivationOp(TensorOp(X) + bias), residual))
into one cutlass kernel, which I thought was not possible until recently. As discussed in NVIDIA/cutlass#347 (comment), it turns out that one of cutlass conv2d kernels already supports computingelementwise(alpha x conv + beta x C + per_channel_bias)
. With a little tweak (or one might say it is an abuse of the intended API usage), it is possible to support fully general residual blocks found in deep learning models.As expected, this brings good speedup on resnet based models (resnet50 and DETR-R50 below). On other models, speedup is modest or it even becomes worse (
deeplabv3
, strange result, haven't looked into what's going on).@comaniac @Laurawly @hwu36