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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bugs about permute function using MPS #81557

Closed
zhaoBowen612 opened this issue Jul 15, 2022 · 5 comments
Closed

Bugs about permute function using MPS #81557

zhaoBowen612 opened this issue Jul 15, 2022 · 5 comments
Assignees
Labels
bug 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

@zhaoBowen612
Copy link

zhaoBowen612 commented Jul 15, 2022

馃悰 Describe the bug

class FCN(nn.Module):
def init(self):
super(FCN, self).init()
self.conv1 = nn.Conv1d(1, 128, 3)
self.gap = nn.AdaptiveAvgPool1d(1)
self.fc = nn.Linear(128, 2)

def forward(self, x):
    batch_size = x.size(0)
    x = self.conv1(x)
    x = self.gap(x)
    x = x.view(batch_size, -1)
    x = self.fc(x)
    x = torch.log_softmax(x, dim=1)
    return x

if name == 'main':
model = FCN().to('mps')
out = model(torch.randn(128, 176, 1).permute(0, 2, 1).to('mps')). # This line shows the error "Assertion failed: (mapIt != _jitValueTypes.end()), function getStaticType, file MPSRuntime_Project.h, line 435."

# out = model(torch.randn(128, 1, 176).to('mps')).  # This could work well.

Versions

PyTorch version: 1.13.0.dev20220714
Is debug build: False
CUDA used to build PyTorch: None
ROCM used to build PyTorch: N/A

OS: macOS 12.4 (arm64)
GCC version: Could not collect
Clang version: 13.1.6 (clang-1316.0.21.2.5)
CMake version: version 3.22.1
Libc version: N/A

Python version: 3.9.12 | packaged by conda-forge | (main, Mar 24 2022, 23:25:14) [Clang 12.0.1 ] (64-bit runtime)
Python platform: macOS-12.4-arm64-arm-64bit
Is CUDA available: False
CUDA runtime version: No CUDA
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

Versions of relevant libraries:
[pip3] numpy==1.21.5
[pip3] torch==1.13.0.dev20220714
[pip3] torchaudio==0.14.0.dev20220603
[pip3] torchvision==0.14.0.dev20220714
[conda] torch 1.13.0.dev20220714 pypi_0 pypi
[conda] torchaudio 0.14.0.dev20220603 pypi_0 pypi
[conda] torchvision 0.14.0.dev20220714 pypi_0 pypi

cc @kulinseth @albanD

@qqaatw
Copy link
Collaborator

qqaatw commented Jul 17, 2022

I can reproduce. The repro can be simplified as the following:

def repro():
    model = torch.nn.Conv1d(1, 128, 3)
    a = torch.ones(128, 176, 1).permute(0, 2, 1)
    out = model(a)  # pass

    a_mps = a.to("mps")
    model = model.to("mps")
    out = model(a_mps)  # fail

@DenisVieriu97
Copy link
Collaborator

Thanks @zhaoBowen612 and @qqaatw for the repro. We'll take a look at the crash

@kulinseth kulinseth added 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 bug labels Jul 19, 2022
@zhaoBowen612
Copy link
Author

It seems that the function "transpose" has the same problem...

@zhaoBowen612
Copy link
Author

It seems the problem still exists? @DenisVieriu97

@DenisVieriu97
Copy link
Collaborator

DenisVieriu97 commented Aug 9, 2022

@zhaoBowen612 the fix has not been merged in PyTorch master yet. I'll update this thread when the change gets merged

facebook-github-bot pushed a commit that referenced this issue Aug 10, 2022
Summary:
Fixes #81557

cc DenisVieriu97

Pull Request resolved: #83121
Approved by: https://github.com/malfet

Test Plan: contbuild & OSS CI, see https://hud.pytorch.org/commit/pytorch/pytorch/b3dea3e413e1d58fa92ebc60616c6a78c331fcc0

Reviewed By: seemethere

Differential Revision: D38585878

fbshipit-source-id: 159dc308cc6f14ab4fe12d59bd5619bca0ce88ea
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 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
Development

Successfully merging a pull request may close this issue.

4 participants