llvm-project icon indicating copy to clipboard operation
llvm-project copied to clipboard

[mlir][linalg vectoriser] Assertion `map.isProjectedPermutation( true)' failed.

Open banach-space opened this issue 3 years ago • 3 comments

input.mlir

module {
func.func @pipeline_dispatch_0_depthwise_conv_2d_nhwc_hwc_1x1082x1920x1x1x3(%extracted_slice_1: tensor<1x3x4x1xi32>, %extracted_slice_2: tensor<1x1x1xi32> ) -> tensor<1x3x4x1xi32>{
  %arg7 = tensor.empty() : tensor<1x3x4x1xi32>
  %19 = linalg.depthwise_conv_2d_nhwc_hwc {dilations = dense<1> : tensor<2xi64>, strides = dense<1> : tensor<2xi64>} ins(%extracted_slice_1, %extracted_slice_2 : tensor<1x3x4x1xi32>, tensor<1x1x1xi32>) outs(%arg7 : tensor<1x3x4x1xi32>) -> tensor<1x3x4x1xi32>
  return %19 : tensor<1x3x4x1xi32>
}
 transform.sequence failures(propagate) {
  ^bb0(%arg0: !pdl.operation):
    %0 = transform.structured.match ops{["linalg.depthwise_conv_2d_nhwc_hwc"]} in %arg0
    %1 = get_closest_isolated_parent %0 : (!pdl.operation) -> !pdl.operation
    %2 = transform.structured.vectorize %1
  }
}

To reproduce:

$ mlir-opt  --test-transform-dialect-interpreter  input.mlir
mlir-opt: /llvm-project/mlir/lib/IR/AffineMap.cpp:707: mlir::AffineMap mlir::inverseAndBroadcastProjectedPermutation(mlir::AffineMap): Assertion `map.isProjectedPermutation( true)' failed.
(...)

The assertion is being hit in inverseAndBroadcastProjectedPermutation.

Context Extracted from https://github.com/iree-org/iree/issues/11808.

CC @nicolasvasilache @dcaballe @ThomasRaoux (based on Git history)

-Andrzej

banach-space avatar Jan 22 '23 16:01 banach-space

@llvm/issue-subscribers-mlir

llvmbot avatar Jan 22 '23 16:01 llvmbot

@llvm/issue-subscribers-mlir-linalg

llvmbot avatar Jan 22 '23 16:01 llvmbot

I confirmed that this crash is fixed by https://github.com/llvm/llvm-project/commit/b858309ddc977d5e70de54f3fa3888915b5fbc0c, and that #130181 now blocks the same path earlier with a graceful Attempted to vectorize, but failed error.

Men-cotton avatar Mar 19 '26 16:03 Men-cotton