<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/109128>109128</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            [mlir] [transform] Attempt to generalize a convolution
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            mlir
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          iviarcio
      </td>
    </tr>
</table>

<pre>
    I'm trying to generalize a linalg convolution (see code below) and the compiler crashed (see the file 
[crash.txt](https://github.com/user-attachments/files/17043886/crash.txt)
attached).

// RUN: mlir-opt "$1".mlir --pass-pipeline=" \
// RUN: builtin.module(transform-interpreter{ \
// RUN: debug-bind-trailing-args=linalg.depthwise_conv_2d_nhwc_hwcm},canonicalize,cse,symbol-dce)" \
// RUN:   -o "$1"_opt.mlir

// Original depthwise_conv_2d_nhwc_hwcm to be converted into generic.
func.func @depthwise_conv_2d_nhwc_hwcm(%input: tensor<2x4x5x2xf32>, %filter: tensor<2x2x2x3xf32>, %output: tensor<2x3x4x2x3xf32>) {
  %depw = linalg.depthwise_conv_2d_nhwc_hwcm
     { dilations = dense<1> : tensor<2xi64>, strides = dense<1> : tensor<2xi64> }
     ins(%input, %filter : tensor<2x4x5x2xf32>, tensor<2x2x2x3xf32>)
    outs(%output : tensor<2x3x4x2x3xf32>) -> tensor<2x3x4x2x3xf32>
  return %depw : tensor<2x3x4x2x3xf32>
}

module attributes {transform.with_named_sequence} {

  transform.named_sequence @__transform_main(
    %arg0: !transform.any_op,
    %conv: !transform.op<"linalg.depthwise_conv_2d_nhwc_hwcm">) {

 transform.debug.emit_remark_at %conv, "Input conv" : !transform.op<"linalg.depthwise_conv_2d_nhwc_hwcm">

    %res = transform.structured.generalize %conv
      : !transform.op<"linalg.depthwise_conv_2d_nhwc_hwcm">
      -> !transform.any_op 

    transform.debug.emit_remark_at %res, "result" : !transform.any_op

    transform.y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