Skip to content

[TorchToLinalg] Add contracting dimension check for aten.convolution - #4920

Open
dharineesh1309 wants to merge 1 commit into
llvm:mainfrom
dharineesh1309:conv-contracting-dim-guard
Open

dharineesh1309 wants to merge 1 commit into
llvm:mainfrom
dharineesh1309:conv-contracting-dim-guard

Conversation

@dharineesh1309

Copy link
Copy Markdown

The convolution lowering validated that groups divides the channel counts but never checked that the input channel dimension matches the weight's contracting dimension. Emit a runtime guard via checkDimEqualHelper, as the matmul lowering does:

  • regular: input.C == weight.dim1 * groups
  • transposed: input.C == weight.dim0

Static shapes fold the check away, so existing lowerings are unchanged.

Fixes #352

The convolution lowering validated that `groups` divides the channel
counts but never checked that the input channel dimension matches the
weight's contracting dimension. Emit a runtime guard via
checkDimEqualHelper, as the matmul lowering does:

  - regular:    input.C == weight.dim1 * groups
  - transposed: input.C == weight.dim0

Static shapes fold the check away, so existing lowerings are unchanged.

Fixes llvm#352

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

TorchToLinalg for AtenConv2dOp does not emit error guards

1 participant