Skip to content

use float as accumulate type for reduce Ops: min, max, minmax on CPU - #96079

Closed
mingfeima wants to merge 11 commits into
gh/mingfeima/107/basefrom
gh/mingfeima/107/head
Closed

mingfeima wants to merge 11 commits into
gh/mingfeima/107/basefrom
gh/mingfeima/107/head

Conversation

@mingfeima

@mingfeima mingfeima commented Mar 6, 2023 •

Copy link
Copy Markdown
Collaborator

Stack from ghstack (oldest at bottom):

Use float32 as acc type for min, max and minmax, in the function vec::reduce_all, float16 inputs will be accumulated in float32.

The performance benefit basically comes from the vectorization of Half #96076

Tested on Intel(R) Xeon(R) Gold 6248 CPU @ 2.50GHz

single socket

(before)
### using OMP_NUM_THREADS=20
### using numactl --physcpubind=0-19 --membind=0
max: size: torch.Size([64, 128, 1024])  2.071 ms

(after)
### using OMP_NUM_THREADS=20
### using numactl --physcpubind=0-19 --membind=0
max: size: torch.Size([64, 128, 1024])  0.071 ms

single core

(before)
### using OMP_NUM_THREADS=1
### using numactl --physcpubind=0 --membind=0
max: size: torch.Size([64, 128, 1024])  33.488 ms

(after)
### using OMP_NUM_THREADS=1
### using numactl --physcpubind=0 --membind=0
max: size: torch.Size([64, 128, 1024])  0.953 ms

cc @jgong5 @XiaobingSuper @sanchitintel @ashokei @jingxu10

@pytorch-bot

pytorch-bot Bot commented Mar 6, 2023 •

Copy link
Copy Markdown

🔗 Helpful Links

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

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

✅ No Failures

As of commit 3293ec2:
💚 Looks good so far! There are no failures yet. 💚

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

…max on CPU"

cc jgong5 XiaobingSuper sanchitintel ashokei jingxu10

[ghstack-poisoned]
…max on CPU"

cc jgong5 XiaobingSuper sanchitintel ashokei jingxu10

[ghstack-poisoned]
…max on CPU"

cc jgong5 XiaobingSuper sanchitintel ashokei jingxu10

[ghstack-poisoned]
…max on CPU"

cc jgong5 XiaobingSuper sanchitintel ashokei jingxu10

[ghstack-poisoned]
@mingfeima
mingfeima marked this pull request as ready for review March 10, 2023 08:09
@mingfeima mingfeima added release notes: intel release notes category module: half Related to float16 half-precision floats labels Mar 10, 2023
…max on CPU"

cc jgong5 XiaobingSuper sanchitintel ashokei jingxu10

[ghstack-poisoned]
…max on CPU"


Use float32 as acc type for `min`, `max` and `minmax`, in the function ` vec::reduce_all`, float16 inputs will be accumulated in float32.

cc jgong5 XiaobingSuper sanchitintel ashokei jingxu10

[ghstack-poisoned]
…max on CPU"


Use float32 as acc type for `min`, `max` and `minmax`, in the function ` vec::reduce_all`, float16 inputs will be accumulated in float32.

cc jgong5 XiaobingSuper sanchitintel ashokei jingxu10

[ghstack-poisoned]
…max on CPU"


Use float32 as acc type for `min`, `max` and `minmax`, in the function ` vec::reduce_all`, float16 inputs will be accumulated in float32.

cc jgong5 XiaobingSuper sanchitintel ashokei jingxu10

[ghstack-poisoned]
…max on CPU"


Use float32 as acc type for `min`, `max` and `minmax`, in the function ` vec::reduce_all`, float16 inputs will be accumulated in float32.

cc jgong5 XiaobingSuper sanchitintel ashokei jingxu10

[ghstack-poisoned]
…max on CPU"


Use float32 as acc type for `min`, `max` and `minmax`, in the function ` vec::reduce_all`, float16 inputs will be accumulated in float32.

cc jgong5 XiaobingSuper sanchitintel ashokei jingxu10

[ghstack-poisoned]
@mingfeima mingfeima added the ciflow/trunk Trigger trunk jobs on your pull request label Apr 9, 2023
@mingfeima

Copy link
Copy Markdown
Collaborator Author

@pytorchbot merge

@pytorchmergebot

Copy link
Copy Markdown
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

skotapati pushed a commit to kulinseth/pytorch that referenced this pull request Apr 10, 2023
…ytorch#96079)

Use float32 as acc type for `min`, `max` and `minmax`, in the function ` vec::reduce_all`, float16 inputs will be accumulated in float32.

The performance benefit basically comes from the vectorization of `Half` pytorch#96076

Tested on Intel(R) Xeon(R) Gold 6248 CPU @ 2.50GHz

**single socket**
```
(before)
### using OMP_NUM_THREADS=20
### using numactl --physcpubind=0-19 --membind=0
max: size: torch.Size([64, 128, 1024])  2.071 ms

(after)
### using OMP_NUM_THREADS=20
### using numactl --physcpubind=0-19 --membind=0
max: size: torch.Size([64, 128, 1024])  0.071 ms
```

**single core**
```
(before)
### using OMP_NUM_THREADS=1
### using numactl --physcpubind=0 --membind=0
max: size: torch.Size([64, 128, 1024])  33.488 ms

(after)
### using OMP_NUM_THREADS=1
### using numactl --physcpubind=0 --membind=0
max: size: torch.Size([64, 128, 1024])  0.953 ms
```

Pull Request resolved: pytorch#96079
Approved by: https://github.com/jgong5, https://github.com/kit1980
@facebook-github-bot
facebook-github-bot deleted the gh/mingfeima/107/head branch June 8, 2023 18:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ciflow/trunk Trigger trunk jobs on your pull request Merged merging module: cpu CPU specific problem (e.g., perf, algorithm) module: half Related to float16 half-precision floats open source release notes: intel release notes category

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

5 participants