Skip to content

CoreML crashes when running convolution #11688

@GregoryComer

Description

@GregoryComer

🐛 Describe the bug

I can consistently repro a segfault an M1 pro running the following model.

import torch

from executorch.backends.apple.coreml.partition import CoreMLPartitioner
from executorch.exir import to_edge_transform_and_lower
from executorch.extension.pybindings.portable_lib import _load_for_executorch_from_buffer

class Model(torch.nn.Module):
    def __init__(self):
        super().__init__()
        self.conv = torch.nn.Conv1d(16, 4, 6, stride=8, padding=0, dilation=2, groups=2, bias=False)    
    def forward(self, x):
        return self.conv(x)

model = Model()
inputs = (
    torch.randn(2, 16, 11),
)

eager_outputs = model(*inputs)
print(f"Eager: {eager_outputs.shape} {eager_outputs}")

lowered = to_edge_transform_and_lower(
    torch.export.export(model, inputs),
    partitioner=[CoreMLPartitioner()],
).to_executorch()

et_model = _load_for_executorch_from_buffer(lowered.buffer)
et_outputs = et_model([*inputs])[0]

et_outputs - eager_outputs

Versions

coremltools version 8.3
executorch commit 67b6009 (Jun 14)

cc @kimishpatel @YifanShenSZ @cymbalrush @metascroy

Metadata

Metadata

Assignees

No one assigned

    Labels

    backend testerThis bug was found by the backend test suite.module: coremlIssues related to Apple's Core ML delegation and code under backends/apple/coreml/

    Type

    Projects

    Status

    Backlog

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions