Issue 98008
Summary [mlir] Transform interpreter crashes on `tile_using_for` for specific tiling sequence
Labels mlir
Assignees ubfx
Reporter ubfx
    Just stumbled on this, crashing when running the transform interpreter on it.

```mlir
module attributes {transform.with_named_sequence} {
  transform.named_sequence @__transform_main(%arg0: !transform.any_op {transform.readonly}) {
    %0 = transform.structured.match ops{["linalg.depthwise_conv_2d_nhwc_hwc"]} in %arg0 : (!transform.any_op) -> !transform.any_op
    %tiled_linalg_op, %loops = transform.structured.tile_using_for %0 tile_sizes [0, 4, 1, 4, 3, 1] interchange = [] : (!transform.any_op) -> (!transform.any_op, !transform.any_op)
    %tiled_linalg_op_0, %loops_1 = transform.structured.tile_using_for %tiled_linalg_op tile_sizes [0, 1, 0, 0, 1, 0] interchange = [] {"alloc-levels" = array<i64: 2, 1, 1>} : (!transform.any_op) -> (!transform.any_op, !transform.any_op)
    transform.yield 
  }
  func.func @main(%arg0: tensor<1x66x66x16xi8>, %arg1: tensor<3x3x16xi8>, %arg2: tensor<1x64x64x16xi64>) -> tensor<1x64x64x16xi64> {
    %0 = linalg.depthwise_conv_2d_nhwc_hwc {dilations = dense<1> : tensor<2xi64>, strides = dense<1> : tensor<2xi64>} ins(%arg0, %arg1 : tensor<1x66x66x16xi8>, tensor<3x3x16xi8>) outs(%arg2 : tensor<1x64x64x16xi64>) -> tensor<1x64x64x16xi64>
    return %0 : tensor<1x64x64x16xi64>
  }
}
```

stacktrace:
```
❯ ~/.local/bin/mlir-opt --transform-interpreter dw1_crash.mlir                                                                                                                                                                                                    ─╯
realloc(): invalid pointer
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
Stack dump:
0.      Program arguments: /user/fschneider/.local/bin/mlir-opt --transform-interpreter dw1_crash.mlir
 #0 0x0000558402939e08 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/user/fschneider/.local/bin/mlir-opt+0x2f97e08)
 #1 0x0000558402937a3e llvm::sys::RunSignalHandlers() (/user/fschneider/.local/bin/mlir-opt+0x2f95a3e)
 #2 0x000055840293a7aa SignalHandler(int) Signals.cpp:0:0
 #3 0x00007fa812a54db0 __restore_rt (/lib64/libc.so.6+0x54db0)
 #4 0x00007fa812aa154c __pthread_kill_implementation (/lib64/libc.so.6+0xa154c)
 #5 0x00007fa812a54d06 gsignal (/lib64/libc.so.6+0x54d06)
 #6 0x00007fa812a287f3 abort (/lib64/libc.so.6+0x287f3)
 #7 0x00007fa812a29130 _IO_peekc_locked.cold (/lib64/libc.so.6+0x29130)
 #8 0x00007fa812aab617 (/lib64/libc.so.6+0xab617)
 #9 0x00007fa812aafe0c __libc_realloc (/lib64/libc.so.6+0xafe0c)
#10 0x00005584028f98a2 llvm::SmallVectorBase<unsigned int>::grow_pod(void*, unsigned long, unsigned long) (/user/fschneider/.local/bin/mlir-opt+0x2f578a2)
#11 0x00005584032cb96c mlir::transform::TileUsingForOp::apply(mlir::transform::TransformRewriter&, mlir::transform::TransformResults&, mlir::transform::TransformState&) (/user/fschneider/.local/bin/mlir-opt+0x392996c)
#12 0x000055840326aae0 mlir::transform::detail::TransformOpInterfaceInterfaceTraits::Model<mlir::transform::TileUsingForOp>::apply(mlir::transform::detail::TransformOpInterfaceInterfaceTraits::Concept const*, mlir::Operation*, mlir::transform::TransformRewriter&, mlir::transform::TransformResults&, mlir::transform::TransformState&) DialectExtension.cpp:0:0
#13 0x000055840724c8e1 mlir::transform::TransformState::applyTransform(mlir::transform::TransformOpInterface) (/user/fschneider/.local/bin/mlir-opt+0x78aa8e1)
#14 0x000055840484d3f1 applySequenceBlock(mlir::Block&, mlir::transform::FailurePropagationMode, mlir::transform::TransformState&, mlir::transform::TransformResults&) TransformOps.cpp:0:0
#15 0x0000558404851ce4 mlir::transform::NamedSequenceOp::apply(mlir::transform::TransformRewriter&, mlir::transform::TransformResults&, mlir::transform::TransformState&) (/user/fschneider/.local/bin/mlir-opt+0x4eafce4)
#16 0x00005584047f6630 mlir::transform::detail::TransformOpInterfaceInterfaceTraits::Model<mlir::transform::NamedSequenceOp>::apply(mlir::transform::detail::TransformOpInterfaceInterfaceTraits::Concept const*, mlir::Operation*, mlir::transform::TransformRewriter&, mlir::transform::TransformResults&, mlir::transform::TransformState&) TransformDialect.cpp:0:0
#17 0x000055840724c8e1 mlir::transform::TransformState::applyTransform(mlir::transform::TransformOpInterface) (/user/fschneider/.local/bin/mlir-opt+0x78aa8e1)
#18 0x00005584072591ae mlir::transform::applyTransforms(mlir::Operation*, mlir::transform::TransformOpInterface, mlir::RaggedArray<llvm::PointerUnion<mlir::Operation*, mlir::Attribute, mlir::Value>> const&, mlir::transform::TransformOptions const&, bool) (/user/fschneider/.local/bin/mlir-opt+0x78b71ae)
#19 0x000055840488ad95 mlir::transform::applyTransformNamedSequence(mlir::RaggedArray<llvm::PointerUnion<mlir::Operation*, mlir::Attribute, mlir::Value>>, mlir::transform::TransformOpInterface, mlir::ModuleOp, mlir::transform::TransformOptions const&) (/user/fschneider/.local/bin/mlir-opt+0x4ee8d95)
#20 0x0000558404886a1e (anonymous namespace)::InterpreterPass::runOnOperation() InterpreterPass.cpp:0:0
#21 0x00005584051ea432 mlir::detail::OpToOpPassAdaptor::run(mlir::Pass*, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int) (/user/fschneider/.local/bin/mlir-opt+0x5848432)
#22 0x00005584051edbb7 mlir::PassManager::run(mlir::Operation*) (/user/fschneider/.local/bin/mlir-opt+0x584bbb7)
#23 0x00005584051e5bf6 performActions(llvm::raw_ostream&, std::__1::shared_ptr<llvm::SourceMgr> const&, mlir::MLIRContext*, mlir::MlirOptMainConfig const&) MlirOptMain.cpp:0:0
#24 0x00005584051e58e0 llvm::LogicalResult llvm::function_ref<llvm::LogicalResult (std::__1::unique_ptr<llvm::MemoryBuffer, std::__1::default_delete<llvm::MemoryBuffer>>, llvm::raw_ostream&)>::callback_fn<mlir::MlirOptMain(llvm::raw_ostream&, std::__1::unique_ptr<llvm::MemoryBuffer, std::__1::default_delete<llvm::MemoryBuffer>>, mlir::DialectRegistry&, mlir::MlirOptMainConfig const&)::$_0>(long, std::__1::unique_ptr<llvm::MemoryBuffer, std::__1::default_delete<llvm::MemoryBuffer>>, llvm::raw_ostream&) MlirOptMain.cpp:0:0
#25 0x0000558405278722 mlir::splitAndProcessBuffer(std::__1::unique_ptr<llvm::MemoryBuffer, std::__1::default_delete<llvm::MemoryBuffer>>, llvm::function_ref<llvm::LogicalResult (std::__1::unique_ptr<llvm::MemoryBuffer, std::__1::default_delete<llvm::MemoryBuffer>>, llvm::raw_ostream&)>, llvm::raw_ostream&, llvm::StringRef, llvm::StringRef) (/user/fschneider/.local/bin/mlir-opt+0x58d6722)
#26 0x00005584051e1658 mlir::MlirOptMain(llvm::raw_ostream&, std::__1::unique_ptr<llvm::MemoryBuffer, std::__1::default_delete<llvm::MemoryBuffer>>, mlir::DialectRegistry&, mlir::MlirOptMainConfig const&) (/user/fschneider/.local/bin/mlir-opt+0x583f658)
#27 0x00005584051e18e7 mlir::MlirOptMain(int, char**, llvm::StringRef, llvm::StringRef, mlir::DialectRegistry&) (/user/fschneider/.local/bin/mlir-opt+0x583f8e7)
#28 0x00005584051e1b0a mlir::MlirOptMain(int, char**, llvm::StringRef, mlir::DialectRegistry&) (/user/fschneider/.local/bin/mlir-opt+0x583fb0a)
#29 0x00005584028e6fa7 main (/user/fschneider/.local/bin/mlir-opt+0x2f44fa7)
#30 0x00007fa812a3feb0 __libc_start_call_main (/lib64/libc.so.6+0x3feb0)
#31 0x00007fa812a3ff60 __libc_start_main@GLIBC_2.2.5 (/lib64/libc.so.6+0x3ff60)
#32 0x00005584028e6be5 _start (/user/fschneider/.local/bin/mlir-opt+0x2f44be5)
[1]    3032759 IOT instruction (core dumped)  ~/.local/bin/mlir-opt --transform-interpreter dw1_crash.mlir
```

_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to