-
Notifications
You must be signed in to change notification settings - Fork 25.7k
add Half support for AdaptiveAvgPool2d and AdaptiveMaxPool2d on CPU #102079
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
[ghstack-poisoned]
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/102079
Note: Links to docs will display an error until the docs builds have been completed. ✅ No FailuresAs of commit c585986 with merge base fb88760 ( This comment was automatically generated by Dr. CI and updates every 15 minutes. |
…n CPU" cc jgong5 mingfeima XiaobingSuper sanchitintel ashokei jingxu10 [ghstack-poisoned]
…n CPU" cc jgong5 mingfeima XiaobingSuper sanchitintel ashokei jingxu10 [ghstack-poisoned]
ghstack-source-id: 9b6db36 Pull Request resolved: pytorch#102079
…2d on CPU" ### Testing Single core: shape | fp32 forward / ms | fp16 forward / ms | bf16 forward / ms | fp32 backward / ms | fp16 backward / ms | bf16 backward / ms -- | -- | -- | -- | -- | -- | -- input size: (2, 56, 264, 264), output size: (100, 100) | 71.5826 | 78.7460 | 85.7195 | 7.3925 | 6.0618 | 6.2596 input size: (2, 56, 264, 264), output size: (50, 50) | 28.122 | 30.8572 | 36.6366 | 6.2645 | 3.4781 | 3.6628 input size: (32, 32, 100, 100), output size: (50, 50) | 109.2978 | 115.0330 | 121.9500 | 13.4329 | 10.2769 | 12.1975 input size: (16, 4, 300, 300), output size: (100, 100) | 34.1849 | 36.5876 | 40.9862 | 4.7719 | 4.3362 | 4.1417 28 cores: shape | fp32 forward / ms | fp16 forward / ms | bf16 forward / ms | fp32 backward / ms | fp16 backward / ms | bf16 backward / ms -- | -- | -- | -- | -- | -- | -- input size: (2, 56, 264, 264), output size: (100, 100) | 3.1809 | 3.5057 | 3.6728 | 0.6657 | 0.3138 | 0.2934 input size: (2, 56, 264, 264), output size: (50, 50) | 1.2779 | 1.3869 | 1.5238 | 0.4223 | 0.1775 | 0.1825 input size: (32, 32, 100, 100), output size: (50, 50) | 4.7942 | 4.9670 | 5.2330 | 1.7146 | 0.6477 | 0.7001 input size: (16, 4, 300, 300), output size: (100, 100) | 1.9522 | 2.0879 | 2.3155 | 0.4370 | 0.3175 | 0.2828 cc jgong5 mingfeima XiaobingSuper sanchitintel ashokei jingxu10 [ghstack-poisoned]
…2d on CPU" ### Testing Single core: AdaptiveMaxPool2d: shape | fp32 forward / ms | fp16 forward / ms | bf16 forward / ms | fp32 backward / ms | fp16 backward / ms | bf16 backward / ms -- | -- | -- | -- | -- | -- | -- input size: (2, 56, 264, 264), output size: (100, 100) | 71.5826 | 78.7460 | 85.7195 | 7.3925 | 6.0618 | 6.2596 input size: (2, 56, 264, 264), output size: (50, 50) | 28.122 | 30.8572 | 36.6366 | 6.2645 | 3.4781 | 3.6628 input size: (32, 32, 100, 100), output size: (50, 50) | 109.2978 | 115.0330 | 121.9500 | 13.4329 | 10.2769 | 12.1975 input size: (16, 4, 300, 300), output size: (100, 100) | 34.1849 | 36.5876 | 40.9862 | 4.7719 | 4.3362 | 4.1417 28 cores: AdaptiveMaxPool2d: shape | fp32 forward / ms | fp16 forward / ms | bf16 forward / ms | fp32 backward / ms | fp16 backward / ms | bf16 backward / ms -- | -- | -- | -- | -- | -- | -- input size: (2, 56, 264, 264), output size: (100, 100) | 3.1809 | 3.5057 | 3.6728 | 0.6657 | 0.3138 | 0.2934 input size: (2, 56, 264, 264), output size: (50, 50) | 1.2779 | 1.3869 | 1.5238 | 0.4223 | 0.1775 | 0.1825 input size: (32, 32, 100, 100), output size: (50, 50) | 4.7942 | 4.9670 | 5.2330 | 1.7146 | 0.6477 | 0.7001 input size: (16, 4, 300, 300), output size: (100, 100) | 1.9522 | 2.0879 | 2.3155 | 0.4370 | 0.3175 | 0.2828 cc jgong5 mingfeima XiaobingSuper sanchitintel ashokei jingxu10 [ghstack-poisoned]
…2d on CPU" ### Testing Single core: AdaptiveMaxPool2d: shape | fp32 forward / ms | fp16 forward / ms | bf16 forward / ms | fp32 backward / ms | fp16 backward / ms | bf16 backward / ms -- | -- | -- | -- | -- | -- | -- input size: (2, 56, 264, 264), output size: (100, 100) | 71.5826 | 78.7460 | 85.7195 | 7.3925 | 6.0618 | 6.2596 input size: (2, 56, 264, 264), output size: (50, 50) | 28.122 | 30.8572 | 36.6366 | 6.2645 | 3.4781 | 3.6628 input size: (32, 32, 100, 100), output size: (50, 50) | 109.2978 | 115.0330 | 121.9500 | 13.4329 | 10.2769 | 12.1975 input size: (16, 4, 300, 300), output size: (100, 100) | 34.1849 | 36.5876 | 40.9862 | 4.7719 | 4.3362 | 4.1417 28 cores: AdaptiveMaxPool2d: shape | fp32 forward / ms | fp16 forward / ms | bf16 forward / ms | fp32 backward / ms | fp16 backward / ms | bf16 backward / ms -- | -- | -- | -- | -- | -- | -- input size: (2, 56, 264, 264), output size: (100, 100) | 3.1809 | 3.5057 | 3.6728 | 0.6657 | 0.3138 | 0.2934 input size: (2, 56, 264, 264), output size: (50, 50) | 1.2779 | 1.3869 | 1.5238 | 0.4223 | 0.1775 | 0.1825 input size: (32, 32, 100, 100), output size: (50, 50) | 4.7942 | 4.9670 | 5.2330 | 1.7146 | 0.6477 | 0.7001 input size: (16, 4, 300, 300), output size: (100, 100) | 1.9522 | 2.0879 | 2.3155 | 0.4370 | 0.3175 | 0.2828 cc jgong5 mingfeima XiaobingSuper sanchitintel ashokei jingxu10 [ghstack-poisoned]
…2d on CPU" ### Testing Single core: AdaptiveMaxPool2d: shape | fp32 forward / ms | fp16 forward / ms | bf16 forward / ms | fp32 backward / ms | fp16 backward / ms | bf16 backward / ms -- | -- | -- | -- | -- | -- | -- input size: (2, 56, 264, 264), output size: (100, 100) | 71.5826 | 78.7460 | 85.7195 | 7.3925 | 6.0618 | 6.2596 input size: (2, 56, 264, 264), output size: (50, 50) | 28.122 | 30.8572 | 36.6366 | 6.2645 | 3.4781 | 3.6628 input size: (32, 32, 100, 100), output size: (50, 50) | 109.2978 | 115.0330 | 121.9500 | 13.4329 | 10.2769 | 12.1975 input size: (16, 4, 300, 300), output size: (100, 100) | 34.1849 | 36.5876 | 40.9862 | 4.7719 | 4.3362 | 4.1417 28 cores: AdaptiveMaxPool2d: shape | fp32 forward / ms | fp16 forward / ms | bf16 forward / ms | fp32 backward / ms | fp16 backward / ms | bf16 backward / ms -- | -- | -- | -- | -- | -- | -- input size: (2, 56, 264, 264), output size: (100, 100) | 3.1809 | 3.5057 | 3.6728 | 0.6657 | 0.3138 | 0.2934 input size: (2, 56, 264, 264), output size: (50, 50) | 1.2779 | 1.3869 | 1.5238 | 0.4223 | 0.1775 | 0.1825 input size: (32, 32, 100, 100), output size: (50, 50) | 4.7942 | 4.9670 | 5.2330 | 1.7146 | 0.6477 | 0.7001 input size: (16, 4, 300, 300), output size: (100, 100) | 1.9522 | 2.0879 | 2.3155 | 0.4370 | 0.3175 | 0.2828 cc jgong5 mingfeima XiaobingSuper sanchitintel ashokei jingxu10 [ghstack-poisoned]
…2d on CPU" ### Testing Single core: AdaptiveMaxPool2d: shape | fp32 forward / ms | fp16 forward / ms | bf16 forward / ms | fp32 backward / ms | fp16 backward / ms | bf16 backward / ms -- | -- | -- | -- | -- | -- | -- input size: (2, 56, 264, 264), output size: (100, 100) | 71.5826 | 78.7460 | 85.7195 | 7.3925 | 6.0618 | 6.2596 input size: (2, 56, 264, 264), output size: (50, 50) | 28.122 | 30.8572 | 36.6366 | 6.2645 | 3.4781 | 3.6628 input size: (32, 32, 100, 100), output size: (50, 50) | 109.2978 | 115.0330 | 121.9500 | 13.4329 | 10.2769 | 12.1975 input size: (16, 4, 300, 300), output size: (100, 100) | 34.1849 | 36.5876 | 40.9862 | 4.7719 | 4.3362 | 4.1417 28 cores: AdaptiveMaxPool2d: shape | fp32 forward / ms | fp16 forward / ms | bf16 forward / ms | fp32 backward / ms | fp16 backward / ms | bf16 backward / ms -- | -- | -- | -- | -- | -- | -- input size: (2, 56, 264, 264), output size: (100, 100) | 3.1809 | 3.5057 | 3.6728 | 0.6657 | 0.3138 | 0.2934 input size: (2, 56, 264, 264), output size: (50, 50) | 1.2779 | 1.3869 | 1.5238 | 0.4223 | 0.1775 | 0.1825 input size: (32, 32, 100, 100), output size: (50, 50) | 4.7942 | 4.9670 | 5.2330 | 1.7146 | 0.6477 | 0.7001 input size: (16, 4, 300, 300), output size: (100, 100) | 1.9522 | 2.0879 | 2.3155 | 0.4370 | 0.3175 | 0.2828 cc jgong5 mingfeima XiaobingSuper sanchitintel ashokei jingxu10 [ghstack-poisoned]
|
@malfet Could you please review this PR again ? Thanks. |
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.
Thank you for eliminating the if, not please do not make unnecessary changes (like renaming accsalar_t, which is used throughout the folder) or defining param_t`, which is tautologically equal to float in the code as it is written right now)
|
|
||
| namespace { | ||
|
|
||
| template <typename scalar_t, typename accscalar_t> |
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.
Sorry, I don't understand the reply. This change is unrelated to PR title/description, please do not make it.
|
@malfet Thanks for your comments, but I still have some doubts. In pytorch there are codes like |
…2d on CPU" ### Testing Single core: AdaptiveMaxPool2d: shape | fp32 forward / ms | fp16 forward / ms | bf16 forward / ms | fp32 backward / ms | fp16 backward / ms | bf16 backward / ms -- | -- | -- | -- | -- | -- | -- input size: (2, 56, 264, 264), output size: (100, 100) | 71.5826 | 78.7460 | 85.7195 | 7.3925 | 6.0618 | 6.2596 input size: (2, 56, 264, 264), output size: (50, 50) | 28.122 | 30.8572 | 36.6366 | 6.2645 | 3.4781 | 3.6628 input size: (32, 32, 100, 100), output size: (50, 50) | 109.2978 | 115.0330 | 121.9500 | 13.4329 | 10.2769 | 12.1975 input size: (16, 4, 300, 300), output size: (100, 100) | 34.1849 | 36.5876 | 40.9862 | 4.7719 | 4.3362 | 4.1417 28 cores: AdaptiveMaxPool2d: shape | fp32 forward / ms | fp16 forward / ms | bf16 forward / ms | fp32 backward / ms | fp16 backward / ms | bf16 backward / ms -- | -- | -- | -- | -- | -- | -- input size: (2, 56, 264, 264), output size: (100, 100) | 3.1809 | 3.5057 | 3.6728 | 0.6657 | 0.3138 | 0.2934 input size: (2, 56, 264, 264), output size: (50, 50) | 1.2779 | 1.3869 | 1.5238 | 0.4223 | 0.1775 | 0.1825 input size: (32, 32, 100, 100), output size: (50, 50) | 4.7942 | 4.9670 | 5.2330 | 1.7146 | 0.6477 | 0.7001 input size: (16, 4, 300, 300), output size: (100, 100) | 1.9522 | 2.0879 | 2.3155 | 0.4370 | 0.3175 | 0.2828 cc jgong5 mingfeima XiaobingSuper sanchitintel ashokei jingxu10 [ghstack-poisoned]
…2d on CPU" ### Testing Single core: AdaptiveMaxPool2d: shape | fp32 forward / ms | fp16 forward / ms | bf16 forward / ms | fp32 backward / ms | fp16 backward / ms | bf16 backward / ms -- | -- | -- | -- | -- | -- | -- input size: (2, 56, 264, 264), output size: (100, 100) | 71.5826 | 78.7460 | 85.7195 | 7.3925 | 6.0618 | 6.2596 input size: (2, 56, 264, 264), output size: (50, 50) | 28.122 | 30.8572 | 36.6366 | 6.2645 | 3.4781 | 3.6628 input size: (32, 32, 100, 100), output size: (50, 50) | 109.2978 | 115.0330 | 121.9500 | 13.4329 | 10.2769 | 12.1975 input size: (16, 4, 300, 300), output size: (100, 100) | 34.1849 | 36.5876 | 40.9862 | 4.7719 | 4.3362 | 4.1417 28 cores: AdaptiveMaxPool2d: shape | fp32 forward / ms | fp16 forward / ms | bf16 forward / ms | fp32 backward / ms | fp16 backward / ms | bf16 backward / ms -- | -- | -- | -- | -- | -- | -- input size: (2, 56, 264, 264), output size: (100, 100) | 3.1809 | 3.5057 | 3.6728 | 0.6657 | 0.3138 | 0.2934 input size: (2, 56, 264, 264), output size: (50, 50) | 1.2779 | 1.3869 | 1.5238 | 0.4223 | 0.1775 | 0.1825 input size: (32, 32, 100, 100), output size: (50, 50) | 4.7942 | 4.9670 | 5.2330 | 1.7146 | 0.6477 | 0.7001 input size: (16, 4, 300, 300), output size: (100, 100) | 1.9522 | 2.0879 | 2.3155 | 0.4370 | 0.3175 | 0.2828 cc jgong5 mingfeima XiaobingSuper sanchitintel ashokei jingxu10 [ghstack-poisoned]
…2d on CPU" ### Testing Single core: AdaptiveMaxPool2d: shape | fp32 forward / ms | fp16 forward / ms | bf16 forward / ms | fp32 backward / ms | fp16 backward / ms | bf16 backward / ms -- | -- | -- | -- | -- | -- | -- input size: (2, 56, 264, 264), output size: (100, 100) | 71.5826 | 78.7460 | 85.7195 | 7.3925 | 6.0618 | 6.2596 input size: (2, 56, 264, 264), output size: (50, 50) | 28.122 | 30.8572 | 36.6366 | 6.2645 | 3.4781 | 3.6628 input size: (32, 32, 100, 100), output size: (50, 50) | 109.2978 | 115.0330 | 121.9500 | 13.4329 | 10.2769 | 12.1975 input size: (16, 4, 300, 300), output size: (100, 100) | 34.1849 | 36.5876 | 40.9862 | 4.7719 | 4.3362 | 4.1417 28 cores: AdaptiveMaxPool2d: shape | fp32 forward / ms | fp16 forward / ms | bf16 forward / ms | fp32 backward / ms | fp16 backward / ms | bf16 backward / ms -- | -- | -- | -- | -- | -- | -- input size: (2, 56, 264, 264), output size: (100, 100) | 3.1809 | 3.5057 | 3.6728 | 0.6657 | 0.3138 | 0.2934 input size: (2, 56, 264, 264), output size: (50, 50) | 1.2779 | 1.3869 | 1.5238 | 0.4223 | 0.1775 | 0.1825 input size: (32, 32, 100, 100), output size: (50, 50) | 4.7942 | 4.9670 | 5.2330 | 1.7146 | 0.6477 | 0.7001 input size: (16, 4, 300, 300), output size: (100, 100) | 1.9522 | 2.0879 | 2.3155 | 0.4370 | 0.3175 | 0.2828 cc jgong5 mingfeima XiaobingSuper sanchitintel ashokei jingxu10 [ghstack-poisoned]
|
@malfet I removed some unnecessary changes. Could you please review this PR ? Thank you. |
|
@malfet Could you please review this PR again ? Thank you for your help. |
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.
Thank you for the updates, looks good to me
|
@pytorchbot merge |
Merge failedReason: This PR needs a If not, please add the To add a label, you can comment to pytorchbot, for example For more information, see Details for Dev Infra teamRaised by workflow job |
|
@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 |
Stack from ghstack (oldest at bottom):
Testing
Single core:
AdaptiveMaxPool2d:
28 cores:
AdaptiveMaxPool2d:
cc @jgong5 @mingfeima @XiaobingSuper @sanchitintel @ashokei @jingxu10