CoreML model is crashing on iPhone GPU, but not on iPhone CPU or macOS GPU
Nobody has claimed this yet.
- 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
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- 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