Skip to content
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

Calculation on tensor views fails on MPS - Placeholder shape mismatches #95482

Closed
gau-nernst opened this issue Feb 24, 2023 · 0 comments · Fixed by kulinseth/pytorch#362
Closed
Labels
module: crash Problem manifests as a hard crash, as opposed to a RuntimeError module: mps Related to Apple Metal Performance Shaders framework triaged This issue has been looked at a team member, and triaged and prioritized into an appropriate module

Comments

@gau-nernst
Copy link

gau-nernst commented Feb 24, 2023

🐛 Describe the bug

Calculation on tensor views fails on MPS. Python crashes

import torch

x = torch.randn(2, 3, 3, device="mps")
x = x[:1]
out = x[:, 0:1, 0:1] * x[:, 1:2, 1:2]

Output

/AppleInternal/Library/BuildRoots/810eba08-405a-11ed-86e9-6af958a02716/Library/Caches/com.apple.xbs/Sources/MetalPerformanceShadersGraph/mpsgraph/MetalPerformanceShadersGraph/Core/Files/MPSGraph.mm:673: failed assertion `Placeholder shape mismatches (expected 1 vs got tensorData with 3) at dimIdx = 2'
[1]    73020 abort      python debug.py

There is no crash when I change device="cpu" or remove x = x[:1]

Versions

Collecting environment information...
PyTorch version: 2.0.0.dev20230224
Is debug build: False
CUDA used to build PyTorch: None
ROCM used to build PyTorch: N/A

OS: macOS 13.0 (arm64)
GCC version: Could not collect
Clang version: 14.0.0 (clang-1400.0.29.102)
CMake version: version 3.24.0
Libc version: N/A

Python version: 3.10.9 | packaged by conda-forge | (main, Feb 2 2023, 20:26:08) [Clang 14.0.6 ] (64-bit runtime)
Python platform: macOS-13.0-arm64-arm-64bit
Is CUDA available: False
CUDA runtime version: No CUDA
CUDA_MODULE_LOADING set to: N/A
GPU models and configuration: No CUDA
Nvidia driver version: No CUDA
cuDNN version: No CUDA
HIP runtime version: N/A
MIOpen runtime version: N/A
Is XNNPACK available: True

CPU:
Apple M1

Versions of relevant libraries:
[pip3] mypy==1.0.1
[pip3] mypy-extensions==1.0.0
[pip3] numpy==1.24.2
[pip3] torch==2.0.0.dev20230224
[conda] numpy 1.24.2 pypi_0 pypi
[conda] pytorch 2.0.0.dev20230224 py3.10_0 pytorch-nightly

cc @kulinseth @albanD @malfet @DenisVieriu97 @razarmehr @abhudev

@ezyang ezyang added module: crash Problem manifests as a hard crash, as opposed to a RuntimeError triaged This issue has been looked at a team member, and triaged and prioritized into an appropriate module module: mps Related to Apple Metal Performance Shaders framework labels Feb 27, 2023
cyyever pushed a commit to cyyever/pytorch_private that referenced this issue Mar 2, 2023
kulinseth pushed a commit to kulinseth/pytorch that referenced this issue Mar 2, 2023
malfet pushed a commit that referenced this issue Mar 2, 2023
Fixes #95482
Pull Request resolved: #95762
Approved by: https://github.com/razarmehr

Co-authored-by: Denis Vieriu <dvieriu@apple.com>
cyyever pushed a commit to cyyever/pytorch_private that referenced this issue Mar 5, 2023
cyyever pushed a commit to cyyever/pytorch_private that referenced this issue Mar 5, 2023
pruthvistony pushed a commit to ROCm/pytorch that referenced this issue May 3, 2023
…orch#95871)

Fixes pytorch#95482
Pull Request resolved: pytorch#95762
Approved by: https://github.com/razarmehr

Co-authored-by: Denis Vieriu <dvieriu@apple.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
module: crash Problem manifests as a hard crash, as opposed to a RuntimeError module: mps Related to Apple Metal Performance Shaders framework triaged This issue has been looked at a team member, and triaged and prioritized into an appropriate module
Projects
None yet
2 participants