Repository navigation
Conversation
[ghstack-poisoned]
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/96082
Note: Links to docs will display an error until the docs builds have been completed. ❌ 1 FailuresAs of commit 459accf: This comment was automatically generated by Dr. CI and updates every 15 minutes. |
This was referenced Mar 6, 2023
mingfeima
marked this pull request as draft
March 6, 2023 05:56
…n CPU" cc jgong5 XiaobingSuper sanchitintel ashokei jingxu10 [ghstack-poisoned]
…n CPU" cc jgong5 XiaobingSuper sanchitintel ashokei jingxu10 [ghstack-poisoned]
…n CPU" cc jgong5 XiaobingSuper sanchitintel ashokei jingxu10 [ghstack-poisoned]
…n CPU" cc jgong5 XiaobingSuper sanchitintel ashokei jingxu10 [ghstack-poisoned]
…n CPU" cc jgong5 XiaobingSuper sanchitintel ashokei jingxu10 [ghstack-poisoned]
…n CPU" cc jgong5 XiaobingSuper sanchitintel ashokei jingxu10 [ghstack-poisoned]
mingfeima
marked this pull request as ready for review
March 14, 2023 02:28
This was referenced Mar 15, 2023
Originally `sum` has a specialized path for `BFloat16`, this patch expands that path to `Half` as well. Without this path, `Half` will also be accumulated in `Float`, but in a slower non-vectorized path in `load_reduce_vec`. Performance result on Intel(R) Xeon(R) Gold 6248 CPU @ 2.50GHz: previously `Half` is much slower than `BFloat16`, now they are of the same level. ### Performance before ``` ### using single socket of 20 cores Input shape: torch.Size([128, 1024, 1024]) ; dtype: torch.float32 ; time per iter: 4.879 ms Input shape: torch.Size([128, 1024, 1024]) ; dtype: torch.bfloat16 ; time per iter: 2.363 ms Input shape: torch.Size([128, 1024, 1024]) ; dtype: torch.float16 ; time per iter: 13.875 ms ### using single core Input shape: torch.Size([128, 1024, 1024]) ; dtype: torch.float32 ; time per iter: 43.573 ms Input shape: torch.Size([128, 1024, 1024]) ; dtype: torch.bfloat16 ; time per iter: 27.743 ms Input shape: torch.Size([128, 1024, 1024]) ; dtype: torch.float16 ; time per iter: 208.055 ms ``` ### Performance after ``` ### using single socket of 20 cores Input shape: torch.Size([128, 1024, 1024]) ; dtype: torch.float32 ; time per iter: 4.817 ms Input shape: torch.Size([128, 1024, 1024]) ; dtype: torch.bfloat16 ; time per iter: 2.380 ms Input shape: torch.Size([128, 1024, 1024]) ; dtype: torch.float16 ; time per iter: 2.361 ms ### using single core Input shape: torch.Size([128, 1024, 1024]) ; dtype: torch.float32 ; time per iter: 42.986 ms Input shape: torch.Size([128, 1024, 1024]) ; dtype: torch.bfloat16 ; time per iter: 27.766 ms Input shape: torch.Size([128, 1024, 1024]) ; dtype: torch.float16 ; time per iter: 27.753 ms ``` cc jgong5 XiaobingSuper sanchitintel ashokei jingxu10 [ghstack-poisoned]
Originally `sum` has a specialized path for `BFloat16`, this patch expands that path to `Half` as well. Without this path, `Half` will also be accumulated in `Float`, but in a slower non-vectorized path in `load_reduce_vec`. Performance result on Intel(R) Xeon(R) Gold 6248 CPU @ 2.50GHz: previously `Half` is much slower than `BFloat16`, now they are of the same level. ### Performance before ``` ### using single socket of 20 cores Input shape: torch.Size([128, 1024, 1024]) ; dtype: torch.float32 ; time per iter: 4.879 ms Input shape: torch.Size([128, 1024, 1024]) ; dtype: torch.bfloat16 ; time per iter: 2.363 ms Input shape: torch.Size([128, 1024, 1024]) ; dtype: torch.float16 ; time per iter: 13.875 ms ### using single core Input shape: torch.Size([128, 1024, 1024]) ; dtype: torch.float32 ; time per iter: 43.573 ms Input shape: torch.Size([128, 1024, 1024]) ; dtype: torch.bfloat16 ; time per iter: 27.743 ms Input shape: torch.Size([128, 1024, 1024]) ; dtype: torch.float16 ; time per iter: 208.055 ms ``` ### Performance after ``` ### using single socket of 20 cores Input shape: torch.Size([128, 1024, 1024]) ; dtype: torch.float32 ; time per iter: 4.817 ms Input shape: torch.Size([128, 1024, 1024]) ; dtype: torch.bfloat16 ; time per iter: 2.380 ms Input shape: torch.Size([128, 1024, 1024]) ; dtype: torch.float16 ; time per iter: 2.361 ms ### using single core Input shape: torch.Size([128, 1024, 1024]) ; dtype: torch.float32 ; time per iter: 42.986 ms Input shape: torch.Size([128, 1024, 1024]) ; dtype: torch.bfloat16 ; time per iter: 27.766 ms Input shape: torch.Size([128, 1024, 1024]) ; dtype: torch.float16 ; time per iter: 27.753 ms ``` cc jgong5 XiaobingSuper sanchitintel ashokei jingxu10 [ghstack-poisoned]
Originally `sum` has a specialized path for `BFloat16`, this patch expands that path to `Half` as well. Without this path, `Half` will also be accumulated in `Float`, but in a slower non-vectorized path in `load_reduce_vec`. Performance result on Intel(R) Xeon(R) Gold 6248 CPU @ 2.50GHz: previously `Half` is much slower than `BFloat16`, now they are of the same level. ### Performance before ``` ### using single socket of 20 cores Input shape: torch.Size([128, 1024, 1024]) ; dtype: torch.float32 ; time per iter: 4.879 ms Input shape: torch.Size([128, 1024, 1024]) ; dtype: torch.bfloat16 ; time per iter: 2.363 ms Input shape: torch.Size([128, 1024, 1024]) ; dtype: torch.float16 ; time per iter: 13.875 ms ### using single core Input shape: torch.Size([128, 1024, 1024]) ; dtype: torch.float32 ; time per iter: 43.573 ms Input shape: torch.Size([128, 1024, 1024]) ; dtype: torch.bfloat16 ; time per iter: 27.743 ms Input shape: torch.Size([128, 1024, 1024]) ; dtype: torch.float16 ; time per iter: 208.055 ms ``` ### Performance after ``` ### using single socket of 20 cores Input shape: torch.Size([128, 1024, 1024]) ; dtype: torch.float32 ; time per iter: 4.817 ms Input shape: torch.Size([128, 1024, 1024]) ; dtype: torch.bfloat16 ; time per iter: 2.380 ms Input shape: torch.Size([128, 1024, 1024]) ; dtype: torch.float16 ; time per iter: 2.361 ms ### using single core Input shape: torch.Size([128, 1024, 1024]) ; dtype: torch.float32 ; time per iter: 42.986 ms Input shape: torch.Size([128, 1024, 1024]) ; dtype: torch.bfloat16 ; time per iter: 27.766 ms Input shape: torch.Size([128, 1024, 1024]) ; dtype: torch.float16 ; time per iter: 27.753 ms ``` cc jgong5 XiaobingSuper sanchitintel ashokei jingxu10 [ghstack-poisoned]
Originally `sum` has a specialized path for `BFloat16`, this patch expands that path to `Half` as well. Without this path, `Half` will also be accumulated in `Float`, but in a slower non-vectorized path in `load_reduce_vec`. Performance result on Intel(R) Xeon(R) Gold 6248 CPU @ 2.50GHz: previously `Half` is much slower than `BFloat16`, now they are of the same level. ### Performance before ``` ### using single socket of 20 cores Input shape: torch.Size([128, 1024, 1024]) ; dtype: torch.float32 ; time per iter: 4.879 ms Input shape: torch.Size([128, 1024, 1024]) ; dtype: torch.bfloat16 ; time per iter: 2.363 ms Input shape: torch.Size([128, 1024, 1024]) ; dtype: torch.float16 ; time per iter: 13.875 ms ### using single core Input shape: torch.Size([128, 1024, 1024]) ; dtype: torch.float32 ; time per iter: 43.573 ms Input shape: torch.Size([128, 1024, 1024]) ; dtype: torch.bfloat16 ; time per iter: 27.743 ms Input shape: torch.Size([128, 1024, 1024]) ; dtype: torch.float16 ; time per iter: 208.055 ms ``` ### Performance after ``` ### using single socket of 20 cores Input shape: torch.Size([128, 1024, 1024]) ; dtype: torch.float32 ; time per iter: 4.817 ms Input shape: torch.Size([128, 1024, 1024]) ; dtype: torch.bfloat16 ; time per iter: 2.380 ms Input shape: torch.Size([128, 1024, 1024]) ; dtype: torch.float16 ; time per iter: 2.361 ms ### using single core Input shape: torch.Size([128, 1024, 1024]) ; dtype: torch.float32 ; time per iter: 42.986 ms Input shape: torch.Size([128, 1024, 1024]) ; dtype: torch.bfloat16 ; time per iter: 27.766 ms Input shape: torch.Size([128, 1024, 1024]) ; dtype: torch.float16 ; time per iter: 27.753 ms ``` cc jgong5 XiaobingSuper sanchitintel ashokei jingxu10 [ghstack-poisoned]
Originally `sum` has a specialized path for `BFloat16`, this patch expands that path to `Half` as well. Without this path, `Half` will also be accumulated in `Float`, but in a slower non-vectorized path in `load_reduce_vec`. Performance result on Intel(R) Xeon(R) Gold 6248 CPU @ 2.50GHz: previously `Half` is much slower than `BFloat16`, now they are of the same level. ### Performance before ``` ### using single socket of 20 cores Input shape: torch.Size([128, 1024, 1024]) ; dtype: torch.float32 ; time per iter: 4.879 ms Input shape: torch.Size([128, 1024, 1024]) ; dtype: torch.bfloat16 ; time per iter: 2.363 ms Input shape: torch.Size([128, 1024, 1024]) ; dtype: torch.float16 ; time per iter: 13.875 ms ### using single core Input shape: torch.Size([128, 1024, 1024]) ; dtype: torch.float32 ; time per iter: 43.573 ms Input shape: torch.Size([128, 1024, 1024]) ; dtype: torch.bfloat16 ; time per iter: 27.743 ms Input shape: torch.Size([128, 1024, 1024]) ; dtype: torch.float16 ; time per iter: 208.055 ms ``` ### Performance after ``` ### using single socket of 20 cores Input shape: torch.Size([128, 1024, 1024]) ; dtype: torch.float32 ; time per iter: 4.817 ms Input shape: torch.Size([128, 1024, 1024]) ; dtype: torch.bfloat16 ; time per iter: 2.380 ms Input shape: torch.Size([128, 1024, 1024]) ; dtype: torch.float16 ; time per iter: 2.361 ms ### using single core Input shape: torch.Size([128, 1024, 1024]) ; dtype: torch.float32 ; time per iter: 42.986 ms Input shape: torch.Size([128, 1024, 1024]) ; dtype: torch.bfloat16 ; time per iter: 27.766 ms Input shape: torch.Size([128, 1024, 1024]) ; dtype: torch.float16 ; time per iter: 27.753 ms ``` cc jgong5 XiaobingSuper sanchitintel ashokei jingxu10 [ghstack-poisoned]
Contributor
|
Looks like this PR hasn't been updated in a while so we're going to go ahead and mark this as |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Stack from ghstack (oldest at bottom):
Originally
sumhas a specialized path forBFloat16, this patch expands that path toHalfas well. Without this path,Halfwill also be accumulated inFloat, but in a slower non-vectorized path inload_reduce_vec.Performance result on Intel(R) Xeon(R) Gold 6248 CPU @ 2.50GHz: previously
Halfis much slower thanBFloat16, now they are of the same level.Performance before
Performance after
cc @jgong5 @XiaobingSuper @sanchitintel @ashokei @jingxu10