pytorch / pytorch/executorch

CoreML model is crashing on iPhone GPU, but not on iPhone CPU or macOS GPU

Open
#11,541 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

module: coreml
Dominant language
Python
Stars
5k
Forks
1.2k
Avg merge
2d 10h
Merged PRs (30d)
581

Description

🐛 Describe the bug

A customer has reported a speech-to-text recognition runs correctly on CoreML on the macbook via pybindings, but crashes when run on the iPhone using the GPU compute unit:

/Library/Caches/com.apple.xbs/Sources/MetalPerformanceShadersGraph/mpsgraph/MetalPerformanceShadersGraph/Core/Files/MPSGraphTensorData.mm:203: failed assertion `shape.count = 0 != strides.count = 2'

The model does run on the iPhone when the compute unit is set to CPU_ONLY. A self-contained repro is provided here: https://github.com/chmjkb/canary-et-repro/blob/main/coreml_canary_repro.ipynb

I have confirmed the model runs on the macbook via pybindings, and by extracting the mlpackage from the *.pte file I have confirmed that it runs on the GPU on the macbook without crashing with the profile tool. I have also confirmed the mlpackage runs on the iPhone using CPU_ONLY with the profile tool, but crashes on the iPhone using CPU_AND_GPU.

Versions

NA

cc @kimishpatel @YifanShenSZ @cymbalrush

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the self-contained coreml_canary_repro.ipynb and reproduce the model on iPhone with CPU_ONLY versus CPU_AND_GPU. Compare the extracted mlpackage runs using the profile tool and the reported MPSGraphTensorData assertion; done means the iPhone GPU path no longer crashes while CPU and macOS behavior remain working.

Written by the indexing model from the issue text.

Assessment

Tech stack
ios, python
Domain
machine-learning, mobile
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.