Skip to content
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

[XLA:CPU][oneDNN] Move addend shape checks to the rewriter and alias result to addend when feasible #17637

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

akhilgoe
Copy link
Contributor

This PR:

  1. Moves the addend shape check to the rewriter so that the code to append oneDNN post-ops can be shared between matmul and convolution kernels.
  2. Adds a new oneDNN post-op type that will perform in-place addition whenever there is no broadcast overhead.
  3. Pads the MemrefInfoPod emitted on stack so that it aligns with the system cacheline.
  4. Adds tests to verify the functionality.

Copy link
Member

@penpornk penpornk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the PR and sorry for the delay!

Comment on lines 148 to 150
case OneDnnFusionConfig::SUM:
post_ops.append_sum();
break;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CreateMatMulPrimDesc has been refactored to onednn_util.cc in #18527. Please rebase this PR?

@@ -50,6 +50,7 @@ message OneDnnFusionConfig {
ELU = 8;
RELU6 = 9;
SIGMOID = 10;
SUM = 11;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you please add a comment explaining that this is in-place accumulation? The name alone isn't enough to disambiguate it from BINARY_ADD.

Comment on lines +713 to +715
if (kind == OneDnnFusionConfig::SUM) {
custom_call->set_output_to_operand_aliasing({{{}, {addend_idx, {}}}});
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you please add a comment in the code explaining why we need to set the aliasing?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes in this file seem self-contained. Can we refactor it to another PR?

Copy link
Contributor Author

@akhilgoe akhilgoe Oct 29, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @penpornk, yes you are right. I have created this PR #18688
I will rebase this PR to remove these changes and address your comments. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants