Skip to content

RuntimeError: length >= offset INTERNAL ASSERT FAILED at "/Users/runner/work/_temp/anaconda/conda-bld/pytorch_1675757334591/work/aten/src/ATen/mps/MPSStream.mm":122, please report a bug to PyTorch.  #94390

@ivegner

Description

@ivegner

🐛 Describe the bug

The following code deterministically produces the following output and error when running on MPS, but not on CPU:

0
1
2
Traceback (most recent call last):
  File "/Users/ivan/Documents/Code/Year1/IndependentProject/test_bug.py", line 9, in <module>
    interp_z[:, i] = interpolation[i]
RuntimeError: length >= offset INTERNAL ASSERT FAILED at "/Users/runner/work/_temp/anaconda/conda-bld/pytorch_1675757334591/work/aten/src/ATen/mps/MPSStream.mm":122, please report a bug to PyTorch. 

Code:

import torch

z = torch.rand((1, 10))

interpolation = torch.zeros(10)
for i in range(z.size(1)):
    print(i)
    interp_z = z.clone().to("mps") # does not error when .to("cpu")
    interp_z[:, i] = interpolation[i]

Versions

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

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

Python version: 3.9.16 | packaged by conda-forge | (main, Feb  1 2023, 21:38:11)  [Clang 14.0.6 ] (64-bit runtime)
Python platform: macOS-12.6-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 M2

Versions of relevant libraries:
[pip3] mypy-extensions==1.0.0
[pip3] numpy==1.24.2
[pip3] pytorch-lightning==1.9.0
[pip3] torch==2.0.0.dev20230207
[pip3] torchmetrics==0.11.1
[pip3] torchvision==0.15.0.dev20230207
[conda] numpy                     1.24.2           py39hff61c6a_0    conda-forge
[conda] pytorch                   2.0.0.dev20230207         py3.9_0    pytorch-nightly
[conda] pytorch-lightning         1.9.0              pyhd8ed1ab_1    conda-forge
[conda] torchmetrics              0.11.1             pyhd8ed1ab_0    conda-forge
[conda] torchvision               0.15.0.dev20230207        py39_cpu    pytorch-nightly

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    module: mpsRelated to Apple Metal Performance Shaders frameworktriagedThis issue has been looked at a team member, and triaged and prioritized into an appropriate module

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions