8000 [cpu][vec] support reduce ops for add and max by Valentine233 · Pull Request #144065 · pytorch/pytorch · GitHub
[go: up one dir, main page]

Skip to content

[cpu][vec] support reduce ops for add and max #144065

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

Closed
wants to merge 6 commits into from
Closed

Conversation

Valentine233
Copy link
Collaborator
@Valentine233 Valentine233 commented Jan 2, 2025

Description

During the support of INT8 SDPA pytorch/ao#1372, we find that at::vec::vec_reduce_all<int32_t> would go into slow scalar path when doing sum and max. So here, we support the two reduce-related ops reduce_add and reduce_max for vec512 and vec256, using the Sequence instructions.

Details

  • Support vectorized reduce_add and reduce_max for dtypes int32 and float32, using the Sequence instructions;
  • Implement the scalar version for fallback path in vec base;
  • Add the operator reduce in vec base, in order to simplify the codes.

cc @jgong5 @mingfeima @XiaobingSuper @sanchitintel @ashokei @jingxu10

8000
Copy link
pytorch-bot bot commented Jan 2, 2025

🔗 Helpful Links

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

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

✅ No Failures

As of commit 211ea77 with merge base 0431d47 (image):
💚 Looks good so far! There are no failures yet. 💚

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

@pytorch-bot pytorch-bot bot added the module: cpu CPU specific problem (e.g., perf, algorithm) label Jan 2, 2025
@Valentine233 Valentine233 added the topic: not user facing topic category label Jan 2, 2025
Copy link
Collaborator
@mingfeima mingfeima left a comment

Choose a reason for hiding this comment

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

generally OK, but it's better to have avx2 added as well. otherwise avx2 is going to be slow, which might not be aware by the caller.

@Valentine233
Copy link
Collaborator Author

generally OK, but it's better to have avx2 added as well. otherwise avx2 is going to be slow, which might not be aware by the caller.

Thanks! The avx2-related ops have been added.

@Valentine233 Valentine233 added the ciflow/trunk Trigger trunk jobs on your pull request label Jan 3, 2025
@Valentine233
Copy link
Collaborator Author

@pytorchbot merge

@pytorchmergebot
Copy link
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

@github-actions github-actions bot deleted the add_reduce_op branch February 3, 2025 02:04
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 module: cpu CPU specific problem (e.g., perf, algorithm) open source topic: not user facing topic category
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants
0