8000 [Inductor] Add fused_attention pattern matcher with additional clone by Valentine233 · Pull Request #108141 · pytorch/pytorch · GitHub
[go: up one dir, main page]

Skip to content

[Inductor] Add fused_attention pattern matcher with additional clone #108141

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

Closed
wants to merge 1 commit into from

Conversation

Valentine233
Copy link
Collaborator
@Valentine233 Valentine233 commented Aug 29, 2023

A previous PR #106274 decomposes aten.dropout and would create a clone() when eval() or p=0. This makes many SDPA-related models fail to match fused_attention pattern matchers.

This PR adds new fused_attention pattern matchers with an additional clone to re-enable the SDPA op matching.

cc @jgong5 @mingfeima @XiaobingSuper @sanchitintel @ashokei @jingxu10 @voznesenskym @penguinwu @EikanWang @Guobing-Chen @zhuhaozhe @blzheng @Xia-Weiwen @wenzhe-nrv @jiayisunx @peterbell10 @ipiszy @ngimel @yf225 @chenyang78 @kadeng @muchulee8 @aakhundov

@pytorch-bot
Copy link
pytorch-bot bot commented Aug 29, 2023

🔗 Helpful Links

🧪 See artifacts and rendered test results at hud.pytorch.org/pr/108141

Note: Links to docs will display an error until the docs builds have been completed.

✅ No Failures

As of commit 8eb66b8 with merge base 60bb02a (image):
💚 Looks good so far! There are no failures yet. 💚

This comment was automatically generated by Dr. CI and updates every 15 minutes.

Copy link
Collaborator
@jgong5 jgong5 left a comment

Choose a reason for hiding this comment

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

Can we add remove_extra_clones call to joint_graph_passes the similar way as it is invoked in the post grad pass? This way, we don't need to add extra patterns to match the redundant clones.

@albanD albanD requested a review from drisspg August 29, 2023 17:49
@drisspg drisspg requested a review from eellison August 29, 2023 18:09
Copy link
Contributor
@eellison eellison left a comment

Choose a reason for hiding this comment

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

@jgong5 the clone removal pass has subtle correctness conditions, so it might be better to do in post grad. we could look into doing it in the joint but I don't know if it should block this pr.

@jgong5
Copy link
Collaborator
jgong5 commented Aug 30, 2023

@jgong5 the clone removal pass has subtle correctness conditions, so it might be better to do in post grad. we could look into doing it in the joint but I don't know if it should block this pr.

Oh, I didn't realize it. Yes, let's get this PR in first then.

@eellison
Copy link
Contributor

@pytorchbot merge

@pytorch-bot pytorch-bot bot added the ciflow/trunk Trigger trunk jobs on your pull request label Aug 30, 2023
@pytorchmergebot
Copy link
Collaborator

Merge started

Your 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

Advanced Debugging
Check the merge workflow status
here

Valentine233 added a commit that referenced this pull request Aug 31, 2023
…108141)

A previous PR #106274 decomposes `aten.dropout` and would create a `clone()` when `eval()` or `p=0`. This makes many SDPA-related models fail to match fused_attention pattern matchers.

This PR adds new fused_attention pattern matchers with an additional clone to re-enable the SDPA op matching.

Pull Request resolved: #108141
Approved by: https://github.com/jgong5, https://github.com/eellison
CaoE pushed a commit to CaoE/pytorch that referenced this pull request Sep 1, 2023
…ytorch#108141)

A previous PR pytorch#106274 decomposes `aten.dropout` and would create a `clone()` when `eval()` or `p=0`. This makes many SDPA-related models fail to match fused_attention pattern matchers.

This PR adds new fused_attention pattern matchers with an additional clone to re-enable the SDPA op matching.

Pull Request resolved: pytorch#108141
Approved by: https://github.com/jgong5, https://github.com/eellison
atalman pushed a commit that referenced this pull request Sep 5, 2023
…108141) (#108327)

A previous PR #106274 decomposes `aten.dropout` and would create a `clone()` when `eval()` or `p=0`. This makes many SDPA-related models fail to match fused_attention pattern matchers.

This PR adds new fused_attention pattern matchers with an additional clone to re-enable the SDPA op matching.

Pull Request resolved: #108141
Approved by: https://github.com/jgong5, https://github.com/eellison
eellison added a commit that referenced this pull request Sep 12, 2023
When dropout is traced in inference, it creates a clone() instead of training pattern of rand() etc. This was partially addressed by manually #108141, however that did not cover all of the patterns that included dropout, and there is no reason we should have to specify them manually.

This updates the inference patterns generated to trace with dropout_p = 0.0.

cc voznesenskym penguinwu EikanWang jgong5 Guobing-Chen XiaobingSuper zhuhaozhe blzheng Xia-Weiwen wenzhe-nrv jiayisunx peterbell10 ipiszy ngimel yf225 chenyang78 kadeng muchulee8 aakhundov

[ghstack-poisoned]
eellison added a commit that referenced this pull request Sep 13, 2023
…0, cleanup"


When dropout is traced in inference, it creates a clone() instead of training pattern of rand() etc. This was partially addressed by manually #108141, however that did not cover all of the patterns that included dropout, and there is no reason we should have to specify them manually.

This updates the inference patterns generated to trace with dropout_p = 0.0.

cc voznesenskym penguinwu EikanWang jgong5 Guobing-Chen XiaobingSuper zhuhaozhe blzheng Xia-Weiwen wenzhe-nrv jiayisunx peterbell10 ipiszy ngimel yf225 chenyang78 kadeng muchulee8 aakhundov

[ghstack-poisoned]
eellison added a commit that referenced this pull request Sep 13, 2023
When dropout is traced in inference, it creates a clone() instead of training pattern of rand() etc. This was partially addressed by manually #108141, however that did not cover all of the patterns that included dropout, and there is no reason we should have to specify them manually.

This updates the inference patterns generated to trace with dropout_p = 0.0.

cc voznesenskym penguinwu EikanWang jgong5 Guobing-Chen XiaobingSuper zhuhaozhe blzheng Xia-Weiwen wenzhe-nrv jiayisunx peterbell10 ipiszy ngimel yf225 chenyang78 kadeng muchulee8 aakhundov

[ghstack-poisoned]
eellison added a commit that referenced this pull request Sep 14, 2023
…0, cleanup"


When dropout is traced in inference, it creates a clone() instead of training pattern of rand() etc. This was partially addressed by manually #108141, however that did not cover all of the patterns that included dropout, and there is no reason we should have to specify them manually.

This updates the inference patterns generated to trace with dropout_p = 0.0.

cc voznesenskym penguinwu EikanWang jgong5 Guobing-Chen XiaobingSuper zhuhaozhe blzheng Xia-Weiwen wenzhe-nrv jiayisunx peterbell10 ipiszy ngimel yf225 chenyang78 kadeng muchulee8 aakhundov

[ghstack-poisoned]
eellison added a commit that referenced this pull request Sep 14, 2023
When dropout is traced in inference, it creates a clone() instead of training pattern of rand() etc. This was partially addressed by manually #108141, however that did not cover all of the patterns that included dropout, and there is no reason we should have to specify them manually.

This updates the inference patterns generated to trace with dropout_p = 0.0.

cc voznesenskym penguinwu EikanWang jgong5 Guobing-Chen XiaobingSuper zhuhaozhe blzheng Xia-Weiwen wenzhe-nrv jiayisunx peterbell10 ipiszy ngimel yf225 chenyang78 kadeng muchulee8 aakhundov

[ghstack-poisoned]
pytorchmergebot pushed a commit that referenced this pull request Sep 15, 2023
When dropout is traced in inference, it creates a clone() instead of training pattern of rand() etc. This was partially addressed by manually #108141, however that did not cover all of the patterns that included dropout, and there is no reason we should have to specify them manually.

This updates the inference patterns generated to trace with dropout_p = 0.0.

Pull Request resolved: #109118
Approved by: https://github.com/drisspg, https://github.com/Valentine233
@github-actions github-actions bot deleted the fuse_attention_pattern branch February 28, 2025 02:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ciflow/inductor ciflow/trunk Trigger trunk jobs on your pull request intel This tag is for PR from Intel Merged module: inductor open source topic: not user facing topic category
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

5 participants
0