forked from pytorch/benchmark
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support grad_to_none, properly benchmark layernorm backward
Summary: We don't want to benchmark gradient accumulation, which is why triton's do_bench provides the `grad_to_none` argument, which sets the associated tensor's grads to `None` outside the timed region. This diff plumbs that through triton bench and uses it in layernorm I also fixed an error in which the x input gradient included some extra compute: the X input is `-2 + 0.5 * randn`, but you don't want to set `requires_grad` on the `randn` or else you differentiate the `mul` and `add` also, when it's just input preparation. Reviewed By: chenyang78, sijiac Differential Revision: D55882037 fbshipit-source-id: 73619731033f2f49fdf7872e47d0cba6f58329b3
- Loading branch information
1 parent
5813012
commit d9a9600
Showing
2 changed files
with
18 additions
and
3 deletions.
There are no files selected for viewing
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
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