-
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
[CUDNN] Support gradient kernels #9986
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
masahi
requested review from
anijain2305,
areusch,
comaniac,
Huyuwei,
icemelon,
jcf94,
jroesch,
junrushao,
jwfromm,
kazum,
kevinthesun,
Laurawly,
liangfu,
MarisaKirisame,
mbrookhart,
merrymercy,
slyubomirsky,
tmoreau89,
tqchen,
vinx13,
wweic,
yzhliu,
zhiics and
ZihengJiang
as code owners
January 19, 2022 20:34
masahi
force-pushed
the
cudnn-grad-kernels
branch
4 times, most recently
from
January 21, 2022 07:23
63a5548
to
6a2f900
Compare
Hzfengsy
approved these changes
Jan 22, 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
commit 426e5dc Author: Masahiro Masuda <masahi129@gmail.com> Date: Tue Jan 18 11:48:53 2022 +0900 black commit 211a58b Author: Masahiro Masuda <masahi129@gmail.com> Date: Tue Jan 18 11:43:52 2022 +0900 fp16 also works commit c2a34d4 Author: Masahiro Masuda <masahi129@gmail.com> Date: Tue Jan 18 11:36:36 2022 +0900 nhwc test also worked commit c0609ab Author: Masahiro Masuda <masahi129@gmail.com> Date: Tue Jan 18 11:21:23 2022 +0900 nchw test worked commit 2bf68c7 Author: Masahiro Masuda <masahi129@gmail.com> Date: Tue Jan 18 10:41:35 2022 +0900 add test stub commit c86b128 Author: Masahiro Masuda <masahi129@gmail.com> Date: Tue Jan 18 10:32:09 2022 +0900 add python definition stub commit 3166952 Author: Masahiro Masuda <masahi129@gmail.com> Date: Tue Jan 18 06:57:18 2022 +0900 bwd filter compiled commit e311ba3 Author: Masahiro Masuda <masahi129@gmail.com> Date: Tue Jan 18 06:27:55 2022 +0900 dgrad compiled commit 47f35be Author: Masahiro Masuda <masahi129@gmail.com> Date: Tue Jan 18 06:16:43 2022 +0900 add dgrad stub commit ebed032 Author: Masahiro Masuda <masahi129@gmail.com> Date: Mon Jan 17 17:01:56 2022 +0900 cpplint commit 834f54a Author: Masahiro Masuda <masahi129@gmail.com> Date: Mon Jan 17 16:55:58 2022 +0900 remove cudnn get output commit dcbd9c9 Author: Masahiro Masuda <masahi129@gmail.com> Date: Mon Jan 17 16:28:07 2022 +0900 more refactor commit 146464e Author: Masahiro Masuda <masahi129@gmail.com> Date: Mon Jan 17 15:57:35 2022 +0900 Introduce SetConvdescriptors to refactor cudnn/conv_forward.cc
masahi
force-pushed
the
cudnn-grad-kernels
branch
from
January 22, 2022 18:26
e81da2a
to
7ed295c
Compare
YuchenJin
approved these changes
Jan 22, 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! Thanks @masahi!
Thanks @comaniac @Hzfengsy @YuchenJin |
yuanfz98
pushed a commit
to yuanfz98/tvm
that referenced
this pull request
Jan 24, 2022
* Dgrad nchw, nhwc, fp16 working commit 426e5dc Author: Masahiro Masuda <masahi129@gmail.com> Date: Tue Jan 18 11:48:53 2022 +0900 black commit 211a58b Author: Masahiro Masuda <masahi129@gmail.com> Date: Tue Jan 18 11:43:52 2022 +0900 fp16 also works commit c2a34d4 Author: Masahiro Masuda <masahi129@gmail.com> Date: Tue Jan 18 11:36:36 2022 +0900 nhwc test also worked commit c0609ab Author: Masahiro Masuda <masahi129@gmail.com> Date: Tue Jan 18 11:21:23 2022 +0900 nchw test worked commit 2bf68c7 Author: Masahiro Masuda <masahi129@gmail.com> Date: Tue Jan 18 10:41:35 2022 +0900 add test stub commit c86b128 Author: Masahiro Masuda <masahi129@gmail.com> Date: Tue Jan 18 10:32:09 2022 +0900 add python definition stub commit 3166952 Author: Masahiro Masuda <masahi129@gmail.com> Date: Tue Jan 18 06:57:18 2022 +0900 bwd filter compiled commit e311ba3 Author: Masahiro Masuda <masahi129@gmail.com> Date: Tue Jan 18 06:27:55 2022 +0900 dgrad compiled commit 47f35be Author: Masahiro Masuda <masahi129@gmail.com> Date: Tue Jan 18 06:16:43 2022 +0900 add dgrad stub commit ebed032 Author: Masahiro Masuda <masahi129@gmail.com> Date: Mon Jan 17 17:01:56 2022 +0900 cpplint commit 834f54a Author: Masahiro Masuda <masahi129@gmail.com> Date: Mon Jan 17 16:55:58 2022 +0900 remove cudnn get output commit dcbd9c9 Author: Masahiro Masuda <masahi129@gmail.com> Date: Mon Jan 17 16:28:07 2022 +0900 more refactor commit 146464e Author: Masahiro Masuda <masahi129@gmail.com> Date: Mon Jan 17 15:57:35 2022 +0900 Introduce SetConvdescriptors to refactor cudnn/conv_forward.cc * add python function for cudnn wgrad * adding wgrad test * black * wgrad nchw and nhwc worked * remove bwd algo name stuff * compute output shape properly * swap arg order in wgrad * add kernel size arg in test * black * cleanup * more fix * fix dgrad test * support running relay conv2d_backward_weight directly with cudnn * black * refactor reference function to support nhwc * removed unused function * lint * enable offloading conv2d_transpose to cudnn dgrad * relax tol * name fix, remove print
ylc
pushed a commit
to ylc/tvm
that referenced
this pull request
Feb 16, 2022
* Dgrad nchw, nhwc, fp16 working commit 426e5dc Author: Masahiro Masuda <masahi129@gmail.com> Date: Tue Jan 18 11:48:53 2022 +0900 black commit 211a58b Author: Masahiro Masuda <masahi129@gmail.com> Date: Tue Jan 18 11:43:52 2022 +0900 fp16 also works commit c2a34d4 Author: Masahiro Masuda <masahi129@gmail.com> Date: Tue Jan 18 11:36:36 2022 +0900 nhwc test also worked commit c0609ab Author: Masahiro Masuda <masahi129@gmail.com> Date: Tue Jan 18 11:21:23 2022 +0900 nchw test worked commit 2bf68c7 Author: Masahiro Masuda <masahi129@gmail.com> Date: Tue Jan 18 10:41:35 2022 +0900 add test stub commit c86b128 Author: Masahiro Masuda <masahi129@gmail.com> Date: Tue Jan 18 10:32:09 2022 +0900 add python definition stub commit 3166952 Author: Masahiro Masuda <masahi129@gmail.com> Date: Tue Jan 18 06:57:18 2022 +0900 bwd filter compiled commit e311ba3 Author: Masahiro Masuda <masahi129@gmail.com> Date: Tue Jan 18 06:27:55 2022 +0900 dgrad compiled commit 47f35be Author: Masahiro Masuda <masahi129@gmail.com> Date: Tue Jan 18 06:16:43 2022 +0900 add dgrad stub commit ebed032 Author: Masahiro Masuda <masahi129@gmail.com> Date: Mon Jan 17 17:01:56 2022 +0900 cpplint commit 834f54a Author: Masahiro Masuda <masahi129@gmail.com> Date: Mon Jan 17 16:55:58 2022 +0900 remove cudnn get output commit dcbd9c9 Author: Masahiro Masuda <masahi129@gmail.com> Date: Mon Jan 17 16:28:07 2022 +0900 more refactor commit 146464e Author: Masahiro Masuda <masahi129@gmail.com> Date: Mon Jan 17 15:57:35 2022 +0900 Introduce SetConvdescriptors to refactor cudnn/conv_forward.cc * add python function for cudnn wgrad * adding wgrad test * black * wgrad nchw and nhwc worked * remove bwd algo name stuff * compute output shape properly * swap arg order in wgrad * add kernel size arg in test * black * cleanup * more fix * fix dgrad test * support running relay conv2d_backward_weight directly with cudnn * black * refactor reference function to support nhwc * removed unused function * lint * enable offloading conv2d_transpose to cudnn dgrad * relax tol * name fix, remove print
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 computing conv2d gradient wrt data and filter by cudnn. See the change in
test_cudnn.py
. The diff is large but majority of them are boilerplate.Also enabled offloading the relay
conv2d_backward_weight
op introduced in #9954 directly to the cudnn equivalent without legalization. The op strategy for that op is only populated when cudnn is in enabled in the target, otherwise emit an error and suggest runningLegalize
pass. This feature can go into a separate PR if desired (the last part of commits).After opening this PR, I realized that I haven't enabled offloading relay(UPDATE: Done, can also go into a separate PR)conv2d_transpose
op to the cudnn dgrad kernel. I'll follow up later.cc @vinx13 @comaniac @tkonolige @Laurawly @Hzfengsy @YuchenJin