optimize BFloat16 elemwise operators CPU: sigmoid, sigmoid_backward, tanh_backward, addcmul, addcdiv#55221
optimize BFloat16 elemwise operators CPU: sigmoid, sigmoid_backward, tanh_backward, addcmul, addcdiv#55221mingfeima wants to merge 24 commits intogh/mingfeima/19/basefrom
Conversation
…l, addcdiv [ghstack-poisoned]
🔗 Helpful links
💊 CI failures summary and remediationsAs of commit 6cc108f (more details on the Dr. CI page):
🕵️ 1 new failure recognized by patternsThe following CI failures do not appear to be due to upstream breakages:
|
|
Since this PR is not related to parallelization feature, only single core perf is tested: - AT_DISPATCH_FLOATING_TYPES(iter.dtype(), "tanh_backward_cpu", [&]() {
+ AT_DISPATCH_FLOATING_TYPES_AND(kBFloat16, iter.dtype(), "tanh_backward_cpu", [&]() {
before: sigmoid: 1x128x1024: fp32: 0.101 ms; bf16: 0.272 ms
after: sigmoid: 1x128x1024: fp32: 0.109 ms; bf16: 0.144 ms
before: sigmoid backward: 1x128x1024: fp32: 0.114 ms; bf16: 0.154 ms
after: sigmoid backward: 1x128x1024: fp32: 0.111 ms; bf16: 0.091 ms
before: tanh backward: 1x128x1024: fp32: 0.110 ms; bf16: 0.185 ms
after: tanh backward: 1x128x1024: fp32: 0.111 ms; bf16: 0.085 ms
before: sigmoid: 1x128x1024: fp32: 0.241 ms; bf16: 0.480 ms
after: sigmoid: 1x128x1024: fp32: 0.237 ms; bf16: 0.238 ms
before: sigmoid backward: 1x128x1024: fp32: 0.128 ms; bf16: 0.299 ms
after: sigmoid backward: 1x128x1024: fp32: 0.131 ms; bf16: 0.149 ms
before: tanh backward: 1x128x1024: fp32: 0.134 ms; bf16: 0.299 ms
after: tanh backward: 1x128x1024: fp32: 0.136 ms; bf16: 0.131 ms |
…_backward, tanh_backward, addcmul, addcdiv" [ghstack-poisoned]
…_backward, tanh_backward, addcmul, addcdiv" [ghstack-poisoned]
…_backward, tanh_backward, addcmul, addcdiv" [ghstack-poisoned]
…_backward, tanh_backward, addcmul, addcdiv" [ghstack-poisoned]
…_backward, tanh_backward, addcmul, addcdiv" [ghstack-poisoned]
…_backward, tanh_backward, addcmul, addcdiv" [ghstack-poisoned]
…_backward, tanh_backward, addcmul, addcdiv" [ghstack-poisoned]
…l, addcdiv ghstack-source-id: 6de211e Pull Request resolved: pytorch#55221
…_backward, tanh_backward, addcmul, addcdiv" [ghstack-poisoned]
…_backward, tanh_backward, addcmul, addcdiv" [ghstack-poisoned]
…_backward, tanh_backward, addcmul, addcdiv" [ghstack-poisoned]
…l, addcdiv ghstack-source-id: 0705d16 Pull Request resolved: pytorch#55221
|
@VitalyFedyunin has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator. |
…_backward, tanh_backward, addcmul, addcdiv" Differential Revision: [D28836797](https://our.internmc.facebook.com/intern/diff/D28836797) [ghstack-poisoned]
…_backward, tanh_backward, addcmul, addcdiv" Differential Revision: [D28836797](https://our.internmc.facebook.com/intern/diff/D28836797) [ghstack-poisoned]
…_backward, tanh_backward, addcmul, addcdiv" Differential Revision: [D28836797](https://our.internmc.facebook.com/intern/diff/D28836797) [ghstack-poisoned]
…_backward, tanh_backward, addcmul, addcdiv" Differential Revision: [D28836797](https://our.internmc.facebook.com/intern/diff/D28836797) [ghstack-poisoned]
|
@VitalyFedyunin has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator. |
VitalyFedyunin
left a comment
There was a problem hiding this comment.
Please change code pattern from dispatching on all types and specializing on bfloat16 to check type first and dispatch only on right types.
…_backward, tanh_backward, addcmul, addcdiv" Differential Revision: [D28836797](https://our.internmc.facebook.com/intern/diff/D28836797) [ghstack-poisoned]
|
@VitalyFedyunin has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator. |
…_backward, tanh_backward, addcmul, addcdiv" Differential Revision: [D28836797](https://our.internmc.facebook.com/intern/diff/D28836797) [ghstack-poisoned]
…_backward, tanh_backward, addcmul, addcdiv" Differential Revision: [D28836797](https://our.internmc.facebook.com/intern/diff/D28836797) [ghstack-poisoned]
…_backward, tanh_backward, addcmul, addcdiv" Differential Revision: [D28836797](https://our.internmc.facebook.com/intern/diff/D28836797) [ghstack-poisoned]
|
rebased! |
…_backward, tanh_backward, addcmul, addcdiv" Differential Revision: [D28836797](https://our.internmc.facebook.com/intern/diff/D28836797) [ghstack-poisoned]
|
rebased! |
…_backward, tanh_backward, addcmul, addcdiv" Differential Revision: [D28836797](https://our.internmc.facebook.com/intern/diff/D28836797) [ghstack-poisoned]
|
rebased! |
…_backward, tanh_backward, addcmul, addcdiv" Differential Revision: [D28836797](https://our.internmc.facebook.com/intern/diff/D28836797) [ghstack-poisoned]
…_backward, tanh_backward, addcmul, addcdiv" Differential Revision: [D28836797](https://our.internmc.facebook.com/intern/diff/D28836797) [ghstack-poisoned]
…_backward, tanh_backward, addcmul, addcdiv" Differential Revision: [D28836797](https://our.internmc.facebook.com/intern/diff/D28836797) [ghstack-poisoned]
|
rebased! |
|
@VitalyFedyunin has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator. |
|
@VitalyFedyunin merged this pull request in 94d6215. |
Stack from ghstack:
Differential Revision: D28836797