KEMBAR78
[MPS] Extend atomic operations to all int types by malfet · Pull Request #158179 · pytorch/pytorch · GitHub
Skip to content

Conversation

@malfet
Copy link
Contributor

@malfet malfet commented Jul 12, 2025

Stack from ghstack (oldest at bottom):

That fixes index_put(..., accumulate=True) for all dtypes

int64 operation is not really atomic, but eventually consistent from the index_put_accumulate kernel point of view: i.e. by the end of the operation results in the global memory are indeed accumulation of the operands at given indices

The only ones that are not covered right now are int64

[ghstack-poisoned]
@malfet malfet requested a review from kulinseth as a code owner July 12, 2025 02:29
@pytorch-bot pytorch-bot bot added ciflow/mps Run MPS tests (subset of trunk) release notes: mps Release notes category labels Jul 12, 2025
@pytorch-bot
Copy link

pytorch-bot bot commented Jul 12, 2025

🔗 Helpful Links

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

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

⏳ No Failures, 40 Pending

As of commit ac32251 with merge base dd93883 (image):
💚 Looks good so far! There are no failures yet. 💚

UNSTABLE - The following job is marked as unstable, possibly due to flakiness on trunk:

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

malfet added a commit that referenced this pull request Jul 12, 2025
The only ones that are not covered right now are int64

ghstack-source-id: f15eab0
Pull Request resolved: #158179
@malfet malfet requested a review from dcci July 12, 2025 02:30
@malfet malfet added the topic: improvements topic category label Jul 12, 2025
union {
uint i;
T t[2];
T t[elem_per_enum];
Copy link
Collaborator

Choose a reason for hiding this comment

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

Nit can this be a real array type since array is constexpr length?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Do you mean metal::array? Or something like char4?

Copy link
Collaborator

Choose a reason for hiding this comment

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

metal::array

That fixes index_put for all dtypes but int64 (as Metal only has atomic loads and stores for this dtype)

[ghstack-poisoned]
malfet added a commit that referenced this pull request Jul 14, 2025
The only ones that are not covered right now are int64

ghstack-source-id: 1152fc2
Pull Request resolved: #158179
@malfet malfet changed the title [MPS] Extend atomic operations to more int types [MPS] Extend atomic operations to all int types Jul 14, 2025
@malfet
Copy link
Contributor Author

malfet commented Jul 14, 2025

@pytorchbot merge -f "Lint + MPS are green"

@pytorchmergebot
Copy link
Collaborator

Merge started

Your change will be merged immediately since you used the force (-f) flag, bypassing any CI checks (ETA: 1-5 minutes). Please use -f as last resort and instead consider -i/--ignore-current to continue the merge ignoring current failures. This will allow currently pending tests to finish and report signal before the merge.

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 gh/malfet/437/head branch August 14, 2025 02:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ciflow/mps Run MPS tests (subset of trunk) Merged release notes: mps Release notes category topic: improvements topic category

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants