-
Notifications
You must be signed in to change notification settings - Fork 26.3k
add channels last with mixed data type support for GroupNorm backward #89485
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
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/89485
Note: Links to docs will display an error until the docs builds have been completed. ✅ No FailuresAs of commit a8eb674: This comment was automatically generated by Dr. CI and updates every 15 minutes. |
[ghstack-poisoned]
…rm backward" ### Motivation 1. Add channels last support for GroupNorm backward to make sure GroupNorm fully support channels last. 2. Same as #88663, mixed data type support is also needed for channels last implementation of GroupNorm backward. ### Testing Single socket (28cores): * Contiguous: shape | forward / s | forward / s | backward / s | backward / s -- | -- | -- | -- | -- | fp32 | mixed fp32 bf16 | fp32 | mixed fp32 bf16 [10, 128, 20, 20] | 3.20E-05 | 3.60E-05 | 8.31E-05 | 8.13E-05 [10, 128, 50, 50] | 0.000126 | 0.000115 | 0.000356 | 0.000257 * Channels Last: shape | forward / s | forward / s | backward / s | backward / s -- | -- | -- | -- | -- | fp32 | mixed fp32 bf16 | fp32 | mixed fp32 bf16 [10, 128, 20, 20] | 4.11E-05 | 4.12E-05 | 9.74E-05 | 9.66E-05 [10, 128, 50, 50] | 0.000179 | 0.000178 | 0.000393 | 0.000317 Single core: * Contiguous: shape | forward / s | forward / s | backward / s | backward / s -- | -- | -- | -- | -- | fp32 | mixed fp32 bf16 | fp32 | mixed fp32 bf16 [10, 128, 20, 20] | 2.47E-04 | 2.53E-04 | 5.92E-04 | 4.50E-04 [10, 128, 50, 50] | 0.001559 | 0.001384 | 0.004343 | 0.002436 * Channels Last: shape | forward / s | forward / s | backward / s | backward / s -- | -- | -- | -- | -- | fp32 | mixed fp32 bf16 | fp32 | mixed fp32 bf16 [10, 128, 20, 20] | 2.27E-04 | 3.24E-04 | 0.0006224 | 0.000459 [10, 128, 50, 50] | 0.00167 | 0.001278 | 0.0041858 | 0.003027 [ghstack-poisoned]
…rm backward" ### Motivation 1. Add channels last support for GroupNorm backward to make sure GroupNorm fully support channels last. 2. Same as #88663, mixed data type support is also needed for channels last implementation of GroupNorm backward. ### Testing Single socket (28cores): * Contiguous: shape | forward / s | forward / s | backward / s | backward / s -- | -- | -- | -- | -- | fp32 | mixed fp32 bf16 | fp32 | mixed fp32 bf16 [10, 128, 20, 20] | 3.20E-05 | 3.60E-05 | 8.31E-05 | 8.13E-05 [10, 128, 50, 50] | 0.000126 | 0.000115 | 0.000356 | 0.000257 * Channels Last: shape | forward / s | forward / s | backward / s | backward / s -- | -- | -- | -- | -- | fp32 | mixed fp32 bf16 | fp32 | mixed fp32 bf16 [10, 128, 20, 20] | 4.11E-05 | 4.12E-05 | 9.74E-05 | 9.66E-05 [10, 128, 50, 50] | 0.000179 | 0.000178 | 0.000393 | 0.000317 Single core: * Contiguous: shape | forward / s | forward / s | backward / s | backward / s -- | -- | -- | -- | -- | fp32 | mixed fp32 bf16 | fp32 | mixed fp32 bf16 [10, 128, 20, 20] | 2.47E-04 | 2.53E-04 | 5.92E-04 | 4.50E-04 [10, 128, 50, 50] | 0.001559 | 0.001384 | 0.004343 | 0.002436 * Channels Last: shape | forward / s | forward / s | backward / s | backward / s -- | -- | -- | -- | -- | fp32 | mixed fp32 bf16 | fp32 | mixed fp32 bf16 [10, 128, 20, 20] | 2.27E-04 | 3.24E-04 | 0.0006224 | 0.000459 [10, 128, 50, 50] | 0.00167 | 0.001278 | 0.0041858 | 0.003027 [ghstack-poisoned]
…rm backward" ### Motivation 1. Add channels last support for GroupNorm backward to make sure GroupNorm fully support channels last. 2. Same as #88663, mixed data type support is also needed for channels last implementation of GroupNorm backward. ### Testing Single socket (28cores): * Contiguous: shape | forward / s | forward / s | backward / s | backward / s -- | -- | -- | -- | -- | fp32 | mixed fp32 bf16 | fp32 | mixed fp32 bf16 [10, 128, 20, 20] | 3.20E-05 | 3.60E-05 | 8.31E-05 | 8.13E-05 [10, 128, 50, 50] | 0.000126 | 0.000115 | 0.000356 | 0.000257 * Channels Last: shape | forward / s | forward / s | backward / s | backward / s -- | -- | -- | -- | -- | fp32 | mixed fp32 bf16 | fp32 | mixed fp32 bf16 [10, 128, 20, 20] | 4.11E-05 | 4.12E-05 | 9.74E-05 | 9.66E-05 [10, 128, 50, 50] | 0.000179 | 0.000178 | 0.000393 | 0.000317 Single core: * Contiguous: shape | forward / s | forward / s | backward / s | backward / s -- | -- | -- | -- | -- | fp32 | mixed fp32 bf16 | fp32 | mixed fp32 bf16 [10, 128, 20, 20] | 2.47E-04 | 2.53E-04 | 5.92E-04 | 4.50E-04 [10, 128, 50, 50] | 0.001559 | 0.001384 | 0.004343 | 0.002436 * Channels Last: shape | forward / s | forward / s | backward / s | backward / s -- | -- | -- | -- | -- | fp32 | mixed fp32 bf16 | fp32 | mixed fp32 bf16 [10, 128, 20, 20] | 2.27E-04 | 3.24E-04 | 0.0006224 | 0.000459 [10, 128, 50, 50] | 0.00167 | 0.001278 | 0.0041858 | 0.003027 [ghstack-poisoned]
…rm backward" ### Motivation 1. Add channels last support for GroupNorm backward to make sure GroupNorm fully support channels last. 2. Same as #88663, mixed data type support is also needed for channels last implementation of GroupNorm backward. ### Testing Single socket (28cores): * Contiguous: shape | forward / s | forward / s | backward / s | backward / s -- | -- | -- | -- | -- | fp32 | mixed fp32 bf16 | fp32 | mixed fp32 bf16 [10, 128, 20, 20] | 3.20E-05 | 3.60E-05 | 8.31E-05 | 8.13E-05 [10, 128, 50, 50] | 0.000126 | 0.000115 | 0.000356 | 0.000257 * Channels Last: shape | forward / s | forward / s | backward / s | backward / s -- | -- | -- | -- | -- | fp32 | mixed fp32 bf16 | fp32 | mixed fp32 bf16 [10, 128, 20, 20] | 4.11E-05 | 4.12E-05 | 9.74E-05 | 9.66E-05 [10, 128, 50, 50] | 0.000179 | 0.000178 | 0.000393 | 0.000317 Single core: * Contiguous: shape | forward / s | forward / s | backward / s | backward / s -- | -- | -- | -- | -- | fp32 | mixed fp32 bf16 | fp32 | mixed fp32 bf16 [10, 128, 20, 20] | 2.47E-04 | 2.53E-04 | 5.92E-04 | 4.50E-04 [10, 128, 50, 50] | 0.001559 | 0.001384 | 0.004343 | 0.002436 * Channels Last: shape | forward / s | forward / s | backward / s | backward / s -- | -- | -- | -- | -- | fp32 | mixed fp32 bf16 | fp32 | mixed fp32 bf16 [10, 128, 20, 20] | 2.27E-04 | 3.24E-04 | 0.0006224 | 0.000459 [10, 128, 50, 50] | 0.00167 | 0.001278 | 0.0041858 | 0.003027 [ghstack-poisoned]
…rm backward" ### Motivation 1. Add channels last support for GroupNorm backward to make sure GroupNorm fully support channels last. 2. Same as #88663, mixed data type support is also needed for channels last implementation of GroupNorm backward. ### Testing Single socket (28cores): * Contiguous: shape | forward / s | forward / s | backward / s | backward / s -- | -- | -- | -- | -- | fp32 | mixed fp32 bf16 | fp32 | mixed fp32 bf16 [10, 128, 20, 20] | 3.20E-05 | 3.60E-05 | 8.31E-05 | 8.13E-05 [10, 128, 50, 50] | 0.000126 | 0.000115 | 0.000356 | 0.000257 * Channels Last: shape | forward / s | forward / s | backward / s | backward / s -- | -- | -- | -- | -- | fp32 | mixed fp32 bf16 | fp32 | mixed fp32 bf16 [10, 128, 20, 20] | 4.11E-05 | 4.12E-05 | 9.74E-05 | 9.66E-05 [10, 128, 50, 50] | 0.000179 | 0.000178 | 0.000393 | 0.000317 Single core: * Contiguous: shape | forward / s | forward / s | backward / s | backward / s -- | -- | -- | -- | -- | fp32 | mixed fp32 bf16 | fp32 | mixed fp32 bf16 [10, 128, 20, 20] | 2.47E-04 | 2.53E-04 | 5.92E-04 | 4.50E-04 [10, 128, 50, 50] | 0.001559 | 0.001384 | 0.004343 | 0.002436 * Channels Last: shape | forward / s | forward / s | backward / s | backward / s -- | -- | -- | -- | -- | fp32 | mixed fp32 bf16 | fp32 | mixed fp32 bf16 [10, 128, 20, 20] | 2.27E-04 | 3.24E-04 | 0.0006224 | 0.000459 [10, 128, 50, 50] | 0.00167 | 0.001278 | 0.0041858 | 0.003027 cc VitalyFedyunin jgong5 mingfeima XiaobingSuper sanchitintel ashokei jingxu10 [ghstack-poisoned]
…rm backward" ### Motivation 1. Add channels last support for GroupNorm backward to make sure GroupNorm fully support channels last. 2. Same as #88663, mixed data type support is also needed for channels last implementation of GroupNorm backward. ### Testing Single socket (28cores): * Contiguous: shape | forward / s | forward / s | backward / s | backward / s -- | -- | -- | -- | -- | fp32 | mixed fp32 bf16 | fp32 | mixed fp32 bf16 [10, 128, 20, 20] | 3.20E-05 | 3.60E-05 | 8.31E-05 | 8.13E-05 [10, 128, 50, 50] | 0.000126 | 0.000115 | 0.000356 | 0.000257 * Channels Last: shape | forward / s | forward / s | backward / s | backward / s -- | -- | -- | -- | -- | fp32 | mixed fp32 bf16 | fp32 | mixed fp32 bf16 [10, 128, 20, 20] | 4.11E-05 | 4.12E-05 | 9.74E-05 | 9.66E-05 [10, 128, 50, 50] | 0.000179 | 0.000178 | 0.000393 | 0.000317 Single core: * Contiguous: shape | forward / s | forward / s | backward / s | backward / s -- | -- | -- | -- | -- | fp32 | mixed fp32 bf16 | fp32 | mixed fp32 bf16 [10, 128, 20, 20] | 2.47E-04 | 2.53E-04 | 5.92E-04 | 4.50E-04 [10, 128, 50, 50] | 0.001559 | 0.001384 | 0.004343 | 0.002436 * Channels Last: shape | forward / s | forward / s | backward / s | backward / s -- | -- | -- | -- | -- | fp32 | mixed fp32 bf16 | fp32 | mixed fp32 bf16 [10, 128, 20, 20] | 2.27E-04 | 3.24E-04 | 0.0006224 | 0.000459 [10, 128, 50, 50] | 0.00167 | 0.001278 | 0.0041858 | 0.003027 cc VitalyFedyunin jgong5 mingfeima XiaobingSuper sanchitintel ashokei jingxu10 [ghstack-poisoned]
…rm backward" ### Motivation 1. Add channels last support for GroupNorm backward to make sure GroupNorm fully support channels last. 2. Same as #88663, mixed data type support is also needed for channels last implementation of GroupNorm backward. ### Testing Single socket (28cores): * Contiguous: shape | forward / s | forward / s | backward / s | backward / s -- | -- | -- | -- | -- | fp32 | mixed fp32 bf16 | fp32 | mixed fp32 bf16 [10, 128, 20, 20] | 3.20E-05 | 3.60E-05 | 8.31E-05 | 8.13E-05 [10, 128, 50, 50] | 0.000126 | 0.000115 | 0.000356 | 0.000257 * Channels Last: shape | forward / s | forward / s | backward / s | backward / s -- | -- | -- | -- | -- | fp32 | mixed fp32 bf16 | fp32 | mixed fp32 bf16 [10, 128, 20, 20] | 4.11E-05 | 4.12E-05 | 9.74E-05 | 9.66E-05 [10, 128, 50, 50] | 0.000179 | 0.000178 | 0.000393 | 0.000317 Single core: * Contiguous: shape | forward / s | forward / s | backward / s | backward / s -- | -- | -- | -- | -- | fp32 | mixed fp32 bf16 | fp32 | mixed fp32 bf16 [10, 128, 20, 20] | 2.47E-04 | 2.53E-04 | 5.92E-04 | 4.50E-04 [10, 128, 50, 50] | 0.001559 | 0.001384 | 0.004343 | 0.002436 * Channels Last: shape | forward / s | forward / s | backward / s | backward / s -- | -- | -- | -- | -- | fp32 | mixed fp32 bf16 | fp32 | mixed fp32 bf16 [10, 128, 20, 20] | 2.27E-04 | 3.24E-04 | 0.0006224 | 0.000459 [10, 128, 50, 50] | 0.00167 | 0.001278 | 0.0041858 | 0.003027 cc VitalyFedyunin jgong5 mingfeima XiaobingSuper sanchitintel ashokei jingxu10 [ghstack-poisoned]
…rm backward" ### Motivation 1. Add channels last support for GroupNorm backward to make sure GroupNorm fully support channels last. 2. Same as #88663, mixed data type support is also needed for channels last implementation of GroupNorm backward. ### Testing Single socket (28cores): * Contiguous: shape | forward / s | forward / s | backward / s | backward / s -- | -- | -- | -- | -- | fp32 | mixed fp32 bf16 | fp32 | mixed fp32 bf16 [10, 128, 20, 20] | 3.20E-05 | 3.60E-05 | 8.31E-05 | 8.13E-05 [10, 128, 50, 50] | 0.000126 | 0.000115 | 0.000356 | 0.000257 * Channels Last: shape | forward / s | forward / s | backward / s | backward / s -- | -- | -- | -- | -- | fp32 | mixed fp32 bf16 | fp32 | mixed fp32 bf16 [10, 128, 20, 20] | 4.11E-05 | 4.12E-05 | 9.74E-05 | 9.66E-05 [10, 128, 50, 50] | 0.000179 | 0.000178 | 0.000393 | 0.000317 Single core: * Contiguous: shape | forward / s | forward / s | backward / s | backward / s -- | -- | -- | -- | -- | fp32 | mixed fp32 bf16 | fp32 | mixed fp32 bf16 [10, 128, 20, 20] | 2.47E-04 | 2.53E-04 | 5.92E-04 | 4.50E-04 [10, 128, 50, 50] | 0.001559 | 0.001384 | 0.004343 | 0.002436 * Channels Last: shape | forward / s | forward / s | backward / s | backward / s -- | -- | -- | -- | -- | fp32 | mixed fp32 bf16 | fp32 | mixed fp32 bf16 [10, 128, 20, 20] | 2.27E-04 | 3.24E-04 | 0.0006224 | 0.000459 [10, 128, 50, 50] | 0.00167 | 0.001278 | 0.0041858 | 0.003027 cc VitalyFedyunin jgong5 mingfeima XiaobingSuper sanchitintel ashokei jingxu10 [ghstack-poisoned]
|
@pytorchbot merge |
Merge failedReason: Not merging any PRs at the moment because there is a merge blocking https://github.com/pytorch/pytorch/labels/ci:%20sev issue open at: Details for Dev Infra teamRaised by workflow job |
…rm backward" ### Motivation 1. Add channels last support for GroupNorm backward to make sure GroupNorm fully support channels last. 2. Same as #88663, mixed data type support is also needed for channels last implementation of GroupNorm backward. ### Testing Single socket (28cores): * Contiguous: shape | forward / s | forward / s | backward / s | backward / s -- | -- | -- | -- | -- | fp32 | mixed fp32 bf16 | fp32 | mixed fp32 bf16 [10, 128, 20, 20] | 3.20E-05 | 3.60E-05 | 8.31E-05 | 8.13E-05 [10, 128, 50, 50] | 0.000126 | 0.000115 | 0.000356 | 0.000257 * Channels Last: shape | forward / s | forward / s | backward / s | backward / s -- | -- | -- | -- | -- | fp32 | mixed fp32 bf16 | fp32 | mixed fp32 bf16 [10, 128, 20, 20] | 4.11E-05 | 4.12E-05 | 9.74E-05 | 9.66E-05 [10, 128, 50, 50] | 0.000179 | 0.000178 | 0.000393 | 0.000317 Single core: * Contiguous: shape | forward / s | forward / s | backward / s | backward / s -- | -- | -- | -- | -- | fp32 | mixed fp32 bf16 | fp32 | mixed fp32 bf16 [10, 128, 20, 20] | 2.47E-04 | 2.53E-04 | 5.92E-04 | 4.50E-04 [10, 128, 50, 50] | 0.001559 | 0.001384 | 0.004343 | 0.002436 * Channels Last: shape | forward / s | forward / s | backward / s | backward / s -- | -- | -- | -- | -- | fp32 | mixed fp32 bf16 | fp32 | mixed fp32 bf16 [10, 128, 20, 20] | 2.27E-04 | 3.24E-04 | 0.0006224 | 0.000459 [10, 128, 50, 50] | 0.00167 | 0.001278 | 0.0041858 | 0.003027 cc VitalyFedyunin jgong5 mingfeima XiaobingSuper sanchitintel ashokei jingxu10 [ghstack-poisoned]
…rm backward" ### Motivation 1. Add channels last support for GroupNorm backward to make sure GroupNorm fully support channels last. 2. Same as #88663, mixed data type support is also needed for channels last implementation of GroupNorm backward. ### Testing Single socket (28cores): * Contiguous: shape | forward / s | forward / s | backward / s | backward / s -- | -- | -- | -- | -- | fp32 | mixed fp32 bf16 | fp32 | mixed fp32 bf16 [10, 128, 20, 20] | 3.20E-05 | 3.60E-05 | 8.31E-05 | 8.13E-05 [10, 128, 50, 50] | 0.000126 | 0.000115 | 0.000356 | 0.000257 * Channels Last: shape | forward / s | forward / s | backward / s | backward / s -- | -- | -- | -- | -- | fp32 | mixed fp32 bf16 | fp32 | mixed fp32 bf16 [10, 128, 20, 20] | 4.11E-05 | 4.12E-05 | 9.74E-05 | 9.66E-05 [10, 128, 50, 50] | 0.000179 | 0.000178 | 0.000393 | 0.000317 Single core: * Contiguous: shape | forward / s | forward / s | backward / s | backward / s -- | -- | -- | -- | -- | fp32 | mixed fp32 bf16 | fp32 | mixed fp32 bf16 [10, 128, 20, 20] | 2.47E-04 | 2.53E-04 | 5.92E-04 | 4.50E-04 [10, 128, 50, 50] | 0.001559 | 0.001384 | 0.004343 | 0.002436 * Channels Last: shape | forward / s | forward / s | backward / s | backward / s -- | -- | -- | -- | -- | fp32 | mixed fp32 bf16 | fp32 | mixed fp32 bf16 [10, 128, 20, 20] | 2.27E-04 | 3.24E-04 | 0.0006224 | 0.000459 [10, 128, 50, 50] | 0.00167 | 0.001278 | 0.0041858 | 0.003027 cc VitalyFedyunin jgong5 mingfeima XiaobingSuper sanchitintel ashokei jingxu10 [ghstack-poisoned]
|
@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 |
…rm backward" ### Motivation 1. Add channels last support for GroupNorm backward to make sure GroupNorm fully support channels last. 2. Same as #88663, mixed data type support is also needed for channels last implementation of GroupNorm backward. ### Testing Single socket (28cores): * Contiguous: shape | forward / s | forward / s | backward / s | backward / s -- | -- | -- | -- | -- | fp32 | mixed fp32 bf16 | fp32 | mixed fp32 bf16 [10, 128, 20, 20] | 3.20E-05 | 3.60E-05 | 8.31E-05 | 8.13E-05 [10, 128, 50, 50] | 0.000126 | 0.000115 | 0.000356 | 0.000257 * Channels Last: shape | forward / s | forward / s | backward / s | backward / s -- | -- | -- | -- | -- | fp32 | mixed fp32 bf16 | fp32 | mixed fp32 bf16 [10, 128, 20, 20] | 4.11E-05 | 4.12E-05 | 9.74E-05 | 9.66E-05 [10, 128, 50, 50] | 0.000179 | 0.000178 | 0.000393 | 0.000317 Single core: * Contiguous: shape | forward / s | forward / s | backward / s | backward / s -- | -- | -- | -- | -- | fp32 | mixed fp32 bf16 | fp32 | mixed fp32 bf16 [10, 128, 20, 20] | 2.47E-04 | 2.53E-04 | 5.92E-04 | 4.50E-04 [10, 128, 50, 50] | 0.001559 | 0.001384 | 0.004343 | 0.002436 * Channels Last: shape | forward / s | forward / s | backward / s | backward / s -- | -- | -- | -- | -- | fp32 | mixed fp32 bf16 | fp32 | mixed fp32 bf16 [10, 128, 20, 20] | 2.27E-04 | 3.24E-04 | 0.0006224 | 0.000459 [10, 128, 50, 50] | 0.00167 | 0.001278 | 0.0041858 | 0.003027 cc VitalyFedyunin jgong5 mingfeima XiaobingSuper sanchitintel ashokei jingxu10 [ghstack-poisoned]
|
@malfet Is there any adjustments that can be made in later PRs. Thanks for your any suggestions. |
|
This PR regressed training step for https://github.com/lucidrains/DALLE2-pytorch, see #92166 |
|
@malfet Sorry for the incontinence. Can we move the |
That's what I'm doing: forcing the continuous on the CUDA side, but also adding the unit test so it would not regress again |
|
@malfet Thank you very much ! I will submit a PR for the issue. |
Fixes regression introduced by #89485 Adds test to prevent those regressions from happening in the future In process, discovered that GroupNormBackwards on CPU does not produce the same results if input and gradient memory_format is different
Fixes regression introduced by #89485 Adds test to prevent those regressions from happening in the future In process, discovered that GroupNormBackwards on CPU does not produce the same results if input and gradient memory_format is different Fixes #92166 Pull Request resolved: #92671 Approved by: https://github.com/ngimel, https://github.com/xuzhao9
Stack from ghstack (oldest at bottom):
Motivation
Testing
Single socket (28cores):
Single core:
cc @ezyang @gchanan @jgong5 @mingfeima @XiaobingSuper @sanchitintel @ashokei @jingxu10 @VitalyFedyunin