8000 [MPS] Fix large copy by malfet · Pull Request #124635 · pytorch/pytorch · GitHub
[go: up one dir, main page]

Skip to content

[MPS] Fix large copy #124635

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 4 commits into from
Closed

[MPS] Fix large copy #124635

wants to merge 4 commits into from

Conversation

malfet
Copy link
Contributor
@malfet malfet commented Apr 22, 2024

By slicing copyFromBuffer:sourceOffset:toBuffer:destinationOffset:size: into 2Gb chunks

Add regression test, but limit it to machines with 12Gb of RAM or more, and MacOS 14+, as on MacOS 13 attempt to alloc 4Gb tensor fails with:

/AppleInternal/Library/BuildRoots/c651a45f-806e-11ed-a221-7ef33c48bc85/Library/Caches/com.apple.xbs/Sources/MetalPerformanceShaders/MPSCore/Types/MPSNDArray.mm:724: failed assertion `[MPSNDArray initWithDevice:descriptor:] Error: total bytes of NDArray > 2**32'

Fixes #124335

By slicing `copyFromBuffer:sourceOffset:toBuffer:destinationOffset:size:` into 2Gb chunks

Fixes #124335
@malfet malfet requested a review from kulinseth as a code owner April 22, 2024 18:06
Copy link
pytorch-bot bot commented Apr 22, 2024

🔗 Helpful Links

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

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

✅ You can merge normally! (2 Unrelated Failures)

As of commit d5fe270 with merge base 0affd23 (image):

FLAKY - The following jobs failed but were likely due to flakiness present on trunk:

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

@pytorch-bot pytorch-bot bot added ciflow/mps Run MPS tests (subset of trunk) release notes: mps Release notes category labels Apr 22, 2024
@malfet malfet added topic: bug fixes topic category and removed release notes: mps Release notes category ciflow/mps Run MPS tests (subset of trunk) labels Apr 22, 2024
@malfet malfet requested a review from albanD April 22, 2024 18:06
@malfet malfet added release notes: mps Release notes category ciflow/mps Run MPS tests (subset of trunk) labels Apr 22, 2024
@malfet malfet added this to the 2.3.1 milestone Apr 22, 2024
@malfet
Copy link
Contributor Author
malfet commented Apr 22, 2024

@pytorchbot merge -f "MPS and lint 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

petrex pushed a commit to petrex/pytorch that referenced this pull request May 3, 2024
By slicing `copyFromBuffer:sourceOffset:toBuffer:destinationOffset:size:` into 2Gb chunks

Add regression test, but limit it to machines with 12Gb of RAM or more, and MacOS 14+, as on MacOS 13 attempt to alloc 4Gb tensor fails with:
```
/AppleInternal/Library/BuildRoots/c651a45f-806e-11ed-a221-7ef33c48bc85/Library/Caches/com.apple.xbs/Sources/MetalPerformanceShaders/MPSCore/Types/MPSNDArray.mm:724: failed assertion `[MPSNDArray initWithDevice:descriptor:] Error: total bytes of NDArray > 2**32'
```

Fixes pytorch#124335

Pull Request resolved: pytorch#124635
Approved by: https://github.com/kulinseth
@atalman
Copy link
Contributor
atalman commented May 13, 2024

@pytorchbot cherry-pick --onto release/2.3 -c critical

pytorchbot pushed a commit that referenced this pull request May 13, 2024
By slicing `copyFromBuffer:sourceOffset:toBuffer:destinationOffset:size:` into 2Gb chunks

Add regression test, but limit it to machines with 12Gb of RAM or more, and MacOS 14+, as on MacOS 13 attempt to alloc 4Gb tensor fails with:
```
/AppleInternal/Library/BuildRoots/c651a45f-806e-11ed-a221-7ef33c48bc85/Library/Caches/com.apple.xbs/Sources/MetalPerformanceShaders/MPSCore/Types/MPSNDArray.mm:724: failed assertion `[MPSNDArray initWithDevice:descriptor:] Error: total bytes of NDArray > 2**32'
```

Fixes #124335

Pull Request resolved: #124635
Approved by: https://github.com/kulinseth

(cherry picked from commit abf3f90)
@pytorchbot
Copy link
Collaborator
pytorchbot commented May 13, 2024 8000

Cherry picking #124635

The cherry pick PR is at #126104 and it is recommended to link a critical cherry pick PR with an issue

Details for Dev Infra team Raised by workflow job

huydhn pushed a commit that referenced this pull request May 13, 2024
[MPS] Fix large copy (#124635)

By slicing `copyFromBuffer:sourceOffset:toBuffer:destinationOffset:size:` into 2Gb chunks

Add regression test, but limit it to machines with 12Gb of RAM or more, and MacOS 14+, as on MacOS 13 attempt to alloc 4Gb tensor fails with:
```
/AppleInternal/Library/BuildRoots/c651a45f-806e-11ed-a221-7ef33c48bc85/Library/Caches/com.apple.xbs/Sources/MetalPerformanceShaders/MPSCore/Types/MPSNDArray.mm:724: failed assertion `[MPSNDArray initWithDevice:descriptor:] Error: total bytes of NDArray > 2**32'
```

Fixes #124335

Pull Request resolved: #124635
Approved by: https://github.com/kulinseth

(cherry picked from commit abf3f90)

Co-authored-by: Nikita Shulga <nshulga@meta.com>
@github-actions github-actions bot deleted the malfet/mps-fix-large-copy branch June 13, 2024 01:53
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: bug fixes topic category
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Data corrupted when transferring over 4GiB to MPS
5 participants
0