Skip to content

Conv3d with circular padding on portable fails at runtime #11704

Open
@GregoryComer

Description

@GregoryComer

🐛 Describe the bug

The following repro produces an artifact that can't run at runtime. I haven't looked deeply yet to figure out where the issue is, so this needs more triage. Might be in the pytorch decomp, might be in the kernels.

Repro:

import torch

from executorch.exir import to_edge_transform_and_lower, EdgeCompileConfig, to_edge
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.Conv3d(5, 5, 3, padding_mode="circular")
        
    def forward(self, x):
        return self.conv(x)

model = Model()
inputs = (
    torch.randn(1, 5, 6, 6, 6),
)

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

ep = torch.export.export(model.eval(), inputs)
print(ep)

lowered = to_edge_transform_and_lower(
    ep,
    compile_config=EdgeCompileConfig(_check_ir_validity=False)
).to_executorch()

print(lowered.exported_program())

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

et_outputs - eager_outputs

Output:

[kernel_ops_util.cpp:345] Check failed (in.dim() == 3 || in.dim() == 4): Expect input tensor to be 3-D or 4-D, but got, 5.
[op_convolution.cpp:377] Check failed (check_convolution_args( in, weight, bias, stride, padding, dilation, transposed, output_padding, groups, out)): 
[method.cpp:1322] KernelCall failed at instruction 0:5 in operator aten::convolution.out: 0x12
[method.cpp:1328] arg 0 with type id 1
[method.cpp:1328] arg 1 with type id 1
[method.cpp:1328] arg 2 with type id 1
[method.cpp:1328] arg 3 with type id 8
[method.cpp:1328] arg 4 with type id 8
[method.cpp:1328] arg 5 with type id 8
[method.cpp:1328] arg 6 with type id 5
[method.cpp:1328] arg 7 with type id 8
[method.cpp:1328] arg 8 with type id 4
[method.cpp:1328] arg 9 with type id 1
[method.cpp:1328] arg 10 with type id 1

Versions

Nightly

cc @JacobSzwejbka @angelayi @larryliu0820 @manuelcandales

Metadata

Metadata

Assignees

No one assigned

    Labels

    backend testerThis bug was found by the backend test suite.module: exirIssues related to Export IR and the code under exir/module: kernelsIssues related to kernel libraries and utilities, and code under kernels/

    Type

    Projects

    Status

    To triage

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions