Skip to content
This repository was archived by the owner on Jul 1, 2025. It is now read-only.

[CPU] Optimize MaxPool2D and AvgPool2D. - #4997

Closed
mciprian13 wants to merge 5 commits into
pytorch:masterfrom
mciprian13:optimize_cpu_pool
Closed

[CPU] Optimize MaxPool2D and AvgPool2D.#4997
mciprian13 wants to merge 5 commits into
pytorch:masterfrom
mciprian13:optimize_cpu_pool

Conversation

@mciprian13

@mciprian13 mciprian13 commented Oct 19, 2020

Copy link
Copy Markdown
Contributor

Summary

  • Optimize MaxPool2D and AvgPool2D (around 30 to 40 % faster for large number of channels) by removing the use of libjit_getXYZ sort of macros for accessing tensors.
  • Unify the AvgPool2D CPU quantized kernels for both flavors of the CountIncludePads and use only fix-point arithmetic (previously for the CountIncludePads false some floating-point was used)
  • Treat the special case when the padding is larger than the pooling window size (when the pooling window includes only padding pixel then we return 0 for that window).

Test Plan
Add unit tests for the special case when the padding is larger than the pooling window size.

@stale

stale Bot commented Nov 16, 2020

Copy link
Copy Markdown

This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 15 days if no further activity occurs. Thank you for your contributions.

@mciprian13

Copy link
Copy Markdown
Contributor Author

ping!

@facebook-github-bot facebook-github-bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

@842974287 has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.

@842974287 842974287 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LG! Do you mind also add these operator tests in the NNPIOperaterTest blacklist as well.

Comment thread lib/LLVMIRCodeGen/libjit/libjit_defs.h Outdated
Comment thread lib/LLVMIRCodeGen/libjit/libjit.cpp Outdated
@mciprian13

mciprian13 commented Nov 22, 2020

Copy link
Copy Markdown
Contributor Author

@842974287 I also added the unit tests to NNPI black list. Can we have this landed then? Also could you please take a look on #4971. Thanks a lot for your time!

@facebook-github-bot facebook-github-bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

@842974287 has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.

@842974287

Copy link
Copy Markdown
Contributor

@mciprian13 No problem, I'll take a look on #4971. Thanks a lot for doing this!

@facebook-github-bot

Copy link
Copy Markdown

@842974287 merged this pull request in 6bd0b20.

@mciprian13
mciprian13 deleted the optimize_cpu_pool branch July 21, 2021 18:21
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants