Skip to content

Conversation

Le-Zheng
Copy link
Collaborator

@Le-Zheng Le-Zheng commented Nov 30, 2023

Copy link

pytorch-bot bot commented Nov 30, 2023

🔗 Helpful Links

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

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

✅ No Failures

As of commit f19e007 with merge base cb489e7 (image):
💚 Looks good so far! There are no failures yet. 💚

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

_gelu_fusion_1(get_qlinear(2)),
dtype=original_pattern_output_dtype,
),
UnaryAttr("gelu", [], ""): generate_pattern_with_output_quant(
Copy link
Collaborator

Choose a reason for hiding this comment

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

This UnaryAttr("gelu", [], "") should have different algorithm_attr as above, right?

Copy link
Collaborator

Choose a reason for hiding this comment

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

I believe we should set the algorithm_attr for GeLU here to distinguish 2 different algorithms.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Thank you for your feedback! I've made the requested changes.

super().__init__()
self.linear = torch.nn.Linear(4, 4, use_bias)
self.unary_fn = torch.nn.ReLU()
if postop == torch.nn.GELU:
self.unary_fn = postop(approximate=post_op_algo)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Looks like you already pass in a instance of torch.nn.GELU(), I am afraid it can't be initialized here again?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

You are right! Thanks for the comment and changed accordingly.

…n for gelu inside inductor"


**Summary**
Enable QLinear Unary pattern for gelu with int8 

**Test plan**
python test/inductor/test_mkldnn_pattern_matcher.py -k test_qlinear_unary


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

[ghstack-poisoned]
Le-Zheng added a commit that referenced this pull request Dec 1, 2023
…inside inductor

ghstack-source-id: f4986f9
Pull Request resolved: #114854
@@ -496,6 +517,8 @@ def qconv_binary(match: Match, *args, **kwargs):


def _register_quantization_unary_fusion():
from .mkldnn_fusion import _gelu_fusion_1, _gelu_fusion_2
Copy link
Collaborator

Choose a reason for hiding this comment

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

_gelu_fusion_1 is for erf and _gelu_fusion_2 is for tanh approximation? If so, can we give more meaningful name to them instead of "1" and "2"?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Thank you for your feedback! I use _gelu_fusion_erf and _gelu_fusion_tanh instead.

…n for gelu inside inductor"


**Summary**
Enable QLinear Unary pattern for gelu with int8 

**Test plan**
python test/inductor/test_mkldnn_pattern_matcher.py -k test_qlinear_unary


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

[ghstack-poisoned]
…n for gelu inside inductor"


**Summary**
Enable QLinear Unary pattern for gelu with int8 

**Test plan**
python test/inductor/test_mkldnn_pattern_matcher.py -k test_qlinear_unary


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

[ghstack-poisoned]
Le-Zheng added a commit that referenced this pull request Dec 1, 2023
…usion for gelu inside inductor

ghstack-source-id: f42e8f2
Pull Request resolved: #114854
…n for gelu inside inductor"


**Summary**
Enable QLinear Unary pattern for gelu with int8 

**Test plan**
python test/inductor/test_mkldnn_pattern_matcher.py -k test_qlinear_unary


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

[ghstack-poisoned]
…n for gelu inside inductor"


**Summary**
Enable QLinear Unary pattern for gelu with int8 

**Test plan**
python test/inductor/test_mkldnn_pattern_matcher.py -k test_qlinear_unary


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

[ghstack-poisoned]
…n for gelu inside inductor"


**Summary**
Enable QLinear Unary pattern for gelu with int8 

**Test plan**
python test/inductor/test_mkldnn_pattern_matcher.py -k test_qlinear_unary


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

[ghstack-poisoned]
Le-Zheng added a commit that referenced this pull request Dec 4, 2023
…antization linear pattern fusion for gelu inside inductor

ghstack-source-id: 7fa14d7
Pull Request resolved: #114854
…n for gelu inside inductor"


**Summary**
Enable QLinear Unary pattern for gelu with int8 

**Test plan**
python test/inductor/test_mkldnn_pattern_matcher.py -k test_qlinear_unary


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

[ghstack-poisoned]
self.linear2 = torch.nn.Linear(4, 4, use_bias)
self.unary_fn2 = torch.nn.ReLU()
if unary_op == torch.nn.GELU():
Copy link
Collaborator

Choose a reason for hiding this comment

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

2 different GELU instances should not be same always.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Thanks for the comment and changed accordingly.

…n for gelu inside inductor"


**Summary**
Enable QLinear Unary pattern for gelu with int8 

**Test plan**
python test/inductor/test_mkldnn_pattern_matcher.py -k test_qlinear_gelu_cpu


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

[ghstack-poisoned]
…n for gelu inside inductor"


**Summary**
Enable QLinear Unary pattern for gelu with int8 

**Test plan**
python test/inductor/test_mkldnn_pattern_matcher.py -k test_qlinear_gelu_cpu


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

[ghstack-poisoned]
Le-Zheng added a commit to Le-Zheng/pytorch that referenced this pull request Dec 20, 2023
… for gelu inside inductor

ghstack-source-id: 458d785
Pull Request resolved: pytorch#114854
…n for gelu inside inductor"


**Summary**
Enable QLinear Unary pattern for gelu with int8 

**Test plan**
python test/inductor/test_mkldnn_pattern_matcher.py -k test_qlinear_gelu_cpu


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

[ghstack-poisoned]
Le-Zheng added a commit to Le-Zheng/pytorch that referenced this pull request Dec 20, 2023
… fusion for gelu inside inductor

ghstack-source-id: c7ffc92
Pull Request resolved: pytorch#114854
…n for gelu inside inductor"


**Summary**
Enable QLinear Unary pattern for gelu with int8 

**Test plan**
python test/inductor/test_mkldnn_pattern_matcher.py -k test_qlinear_gelu_cpu


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

[ghstack-poisoned]
Le-Zheng added a commit to Le-Zheng/pytorch that referenced this pull request Dec 21, 2023
… for gelu inside inductor

ghstack-source-id: 3e91151
Pull Request resolved: pytorch#114854
…n for gelu inside inductor"


**Summary**
Enable QLinear Unary pattern for gelu with int8 

**Test plan**
python test/inductor/test_mkldnn_pattern_matcher.py -k test_qlinear_gelu_cpu


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

[ghstack-poisoned]
@Le-Zheng Le-Zheng requested a review from jgong5 December 22, 2023 07:55
…n for gelu inside inductor"


**Summary**
Enable QLinear Unary pattern for gelu with int8 

**Test plan**
python test/inductor/test_mkldnn_pattern_matcher.py -k test_qlinear_gelu_cpu


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

[ghstack-poisoned]
Copy link
Contributor

github-actions bot commented Mar 2, 2024

Looks like this PR hasn't been updated in a while so we're going to go ahead and mark this as Stale.
Feel free to remove the Stale label if you feel this was a mistake.
If you are unable to remove the Stale label please contact a maintainer in order to do so.
If you want the bot to never mark this PR stale again, add the no-stale label.
Stale pull requests will automatically be closed after 30 days of inactivity.

@github-actions github-actions bot added the Stale label Mar 2, 2024
[ghstack-poisoned]
@leslie-fang-intel leslie-fang-intel added ciflow/trunk Trigger trunk jobs on your pull request topic: not user facing topic category and removed Stale labels Mar 13, 2024
[ghstack-poisoned]
@leslie-fang-intel
Copy link
Collaborator

@pytorchbot merge

@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

pytorchmergebot pushed a commit that referenced this pull request Mar 14, 2024
…_mixed_bf16 for gelu (#116004)

**Summary**
Enable QLinear Unary pattern for gelu with int8_mix_bf16

**Test plan**
python test/inductor/test_mkldnn_pattern_matcher.py -k test_qlinear_gelu_int8_mixed_bf16

Co-authored-by: leslie-fang-intel <leslie.fang@intel.com>
Pull Request resolved: #116004
Approved by: https://github.com/jgong5, https://github.com/leslie-fang-intel
ghstack dependencies: #114853, #114854
@github-actions github-actions bot deleted the gh/le-zheng/10/head branch April 14, 2024 02:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants