-
Notifications
You must be signed in to change notification settings - Fork 24.9k
[Inductor] Set prop_kind to forward_inference when grad is not needed for mkldnn_linear_pointwise and mkldnn_convolution_pointwise #147072
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
Conversation
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/147072
Note: Links to docs will display an error until the docs builds have been completed. ✅ You can merge normally! (2 Unrelated Failures)As of commit 472288c with merge base 790f93d ( FLAKY - The following job failed but was likely due to flakiness present on trunk:
UNSTABLE - The following job is marked as unstable, possibly due to flakiness on trunk:
This comment was automatically generated by Dr. CI and updates every 15 minutes. |
auto aprop_kind = ideep::prop_kind::forward; | ||
bool maybe_backward = GradMode::is_enabled() && | ||
(input_t.requires_grad() || weight_t.requires_grad() || | ||
(bias_opt.has_value() && bias_opt->defined() && | ||
bias_opt->requires_grad())); | ||
if (!maybe_backward) { | ||
aprop_kind = ideep::prop_kind::forward_inference; | ||
} |
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.
define a helper method for this repeated code block
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.
I modified the code, I directly set aprop_kind
in mkldnn_linear_pointwise_binary
function to forward_inference
since binary fusion is only for inference. Could you please review it again? Thanks!
@pytorchbot merge |
Merge startedYour change will be merged once all checks pass (ETA 0-4 Hours). Learn more about merging in the wiki. Questions? Feedback? Please reach out to the PyTorch DevX Team |
… for mkldnn_linear_pointwise and mkldnn_convolution_pointwise (pytorch#147072) Summary: The `prop_kind` of `mkldnn._linear_pointwise`, `mkldnn._linear_pointwise.binary`, `mkldnn._convolution_pointwise.binary` and `mkldnn._convolution_pointwise_.binary` are always `dnnl_forward`, i.e., `dnnl_forward_training` , regardless of whether `grad` is needed. Setting `prop_kind` to `dnnl_forward_inference` for these ops when `grad` is not needed could have better performance. Pull Request resolved: pytorch#147072 Approved by: https://github.com/leslie-fang-intel, https://github.com/CaoE, https://github.com/jansel
Stack from ghstack (oldest at bottom):
Summary:
The
prop_kind
ofmkldnn._linear_pointwise
,mkldnn._linear_pointwise.binary
,mkldnn._convolution_pointwise.binary
andmkldnn._convolution_pointwise_.binary
are alwaysdnnl_forward
, i.e.,dnnl_forward_training
, regardless of whethergrad
is needed. Settingprop_kind
todnnl_forward_inference
for these ops whengrad
is not needed could have better performance.cc @jgong5 @mingfeima @XiaobingSuper @sanchitintel @ashokei @jingxu10