Issue |
128323
|
Summary |
[MLIR]`-transform-interpreter` triggers Assertion Failure `op->use_empty() && "expected 'op' to have no uses"'
|
Labels |
mlir
|
Assignees |
|
Reporter |
xisang0
|
Test on commit: https://github.com/llvm/llvm-project/commit/a9882bda96228ca23e166a817f93a7dbc99763cb
steps to reproduce:
```
mlir-opt test.mlir -transform-interpreter
```
test case:
```
module attributes {transform.with_named_sequence} {
func.func @test_const_i64(%arg0: index) -> tensor<4xi64> {
%cst = arith.constant dense<[3, 0, 1, 2]> : tensor<4xi64>
return %cst : tensor<4xi64>
}
transform.named_sequence @__transform_main(%arg1: !transform.any_op) {
%f = transform.structured.match ops{["arith.constant"]} in %arg1 : (!transform.any_op) -> !transform.any_op
transform.foreach %f : !transform.any_op {
^bb2(%arg2: !transform.any_op):
transform.test_emit_remark_and_erase_operand %arg2, "erasing" : !transform.any_op
}
transform.yield
}
}
```
crash trace:
```
mlir-opt: /home/workdir/llvm-project-19/mlir/lib/IR/PatternMatch.cpp:162: virtual void mlir::RewriterBase::eraseOp(Operation *): Assertion `op->use_empty() && "expected 'op' to have no uses"' failed.
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
Stack dump:
0. Program arguments: ./mlir-opt /home/workdir/test.mlir -transform-interpreter
#0 0x00005d5be60ee998 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (./mlir-opt+0x108a998)
#1 0x00005d5be60ec4be llvm::sys::RunSignalHandlers() (./mlir-opt+0x10884be)
#2 0x00005d5be60ef3a8 SignalHandler(int) Signals.cpp:0:0
#3 0x00007b687cf0a520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)
#4 0x00007b687cf5e9fc pthread_kill (/lib/x86_64-linux-gnu/libc.so.6+0x969fc)
#5 0x00007b687cf0a476 gsignal (/lib/x86_64-linux-gnu/libc.so.6+0x42476)
#6 0x00007b687cef07f3 abort (/lib/x86_64-linux-gnu/libc.so.6+0x287f3)
#7 0x00007b687cef071b (/lib/x86_64-linux-gnu/libc.so.6+0x2871b)
#8 0x00007b687cf01e96 (/lib/x86_64-linux-gnu/libc.so.6+0x39e96)
#9 0x00005d5be956ecbf (./mlir-opt+0x450acbf)
#10 0x00005d5be92f0807 mlir::test::TestEmitRemarkAndEraseOperandOp::apply(mlir::transform::TransformRewriter&, mlir::transform::TransformResults&, mlir::transform::TransformState&) (./mlir-opt+0x428c807)
#11 0x00005d5be932e0ae mlir::transform::detail::TransformOpInterfaceInterfaceTraits::Model<mlir::test::TestEmitRemarkAndEraseOperandOp>::apply(mlir::transform::detail::TransformOpInterfaceInterfaceTraits::Concept const*, mlir::Operation*, mlir::transform::TransformRewriter&, mlir::transform::TransformResults&, mlir::transform::TransformState&) (./mlir-opt+0x42ca0ae)
#12 0x00005d5beb42fdb3 mlir::transform::TransformState::applyTransform(mlir::transform::TransformOpInterface) (./mlir-opt+0x63cbdb3)
#13 0x00005d5be87b0fa0 mlir::transform::ForeachOp::apply(mlir::transform::TransformRewriter&, mlir::transform::TransformResults&, mlir::transform::TransformState&) (./mlir-opt+0x374cfa0)
#14 0x00005d5be874a081 mlir::transform::detail::TransformOpInterfaceInterfaceTraits::Model<mlir::transform::ForeachOp>::apply(mlir::transform::detail::TransformOpInterfaceInterfaceTraits::Concept const*, mlir::Operation*, mlir::transform::TransformRewriter&, mlir::transform::TransformResults&, mlir::transform::TransformState&) (./mlir-opt+0x36e6081)
#15 0x00005d5beb42fdb3 mlir::transform::TransformState::applyTransform(mlir::transform::TransformOpInterface) (./mlir-opt+0x63cbdb3)
#16 0x00005d5be87b5df2 applySequenceBlock(mlir::Block&, mlir::transform::FailurePropagationMode, mlir::transform::TransformState&, mlir::transform::TransformResults&) TransformOps.cpp:0:0
#17 0x00005d5be87b9aaf mlir::transform::NamedSequenceOp::apply(mlir::transform::TransformRewriter&, mlir::transform::TransformResults&, mlir::transform::TransformState&) (./mlir-opt+0x3755aaf)
#18 0x00005d5be8760dc1 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&) (./mlir-opt+0x36fcdc1)
#19 0x00005d5beb42fdb3 mlir::transform::TransformState::applyTransform(mlir::transform::TransformOpInterface) (./mlir-opt+0x63cbdb3)
#20 0x00005d5beb43bf1e mlir::transform::applyTransforms(mlir::Operation*, mlir::transform::TransformOpInterface, mlir::RaggedArray<llvm::PointerUnion<mlir::Operation*, mlir::Attribute, mlir::Value>> const&, mlir::transform::TransformOptions const&, bool, llvm::function_ref<void (mlir::transform::TransformState&)>, llvm::function_ref<llvm::LogicalResult (mlir::transform::TransformState&)>) (./mlir-opt+0x63d7f1e)
#21 0x00005d5be87ec526 mlir::transform::applyTransformNamedSequence(mlir::RaggedArray<llvm::PointerUnion<mlir::Operation*, mlir::Attribute, mlir::Value>>, mlir::transform::TransformOpInterface, mlir::ModuleOp, mlir::transform::TransformOptions const&) (./mlir-opt+0x3788526)
#22 0x00005d5be87e7831 (anonymous namespace)::InterpreterPass::runOnOperation() InterpreterPass.cpp:0:0
#23 0x00005d5be93bf3bf mlir::detail::OpToOpPassAdaptor::run(mlir::Pass*, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int) (./mlir-opt+0x435b3bf)
#24 0x00005d5be93bfba2 mlir::detail::OpToOpPassAdaptor::runPipeline(mlir::OpPassManager&, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int, mlir::PassInstrumentor*, mlir::PassInstrumentation::PipelineParentInfo const*) (./mlir-opt+0x435bba2)
#25 0x00005d5be93c234e mlir::PassManager::run(mlir::Operation*) (./mlir-opt+0x435e34e)
#26 0x00005d5be93bae6b performActions(llvm::raw_ostream&, std::shared_ptr<llvm::SourceMgr> const&, mlir::MLIRContext*, mlir::MlirOptMainConfig const&) MlirOptMain.cpp:0:0
#27 0x00005d5be93baacb llvm::LogicalResult llvm::function_ref<llvm::LogicalResult (std::unique_ptr<llvm::MemoryBuffer, std::default_delete<llvm::MemoryBuffer>>, llvm::raw_ostream&)>::callback_fn<mlir::MlirOptMain(llvm::raw_ostream&, std::unique_ptr<llvm::MemoryBuffer, std::default_delete<llvm::MemoryBuffer>>, mlir::DialectRegistry&, mlir::MlirOptMainConfig const&)::$_0>(long, std::unique_ptr<llvm::MemoryBuffer, std::default_delete<llvm::MemoryBuffer>>, llvm::raw_ostream&) MlirOptMain.cpp:0:0
#28 0x00005d5be9463df5 mlir::splitAndProcessBuffer(std::unique_ptr<llvm::MemoryBuffer, std::default_delete<llvm::MemoryBuffer>>, llvm::function_ref<llvm::LogicalResult (std::unique_ptr<llvm::MemoryBuffer, std::default_delete<llvm::MemoryBuffer>>, llvm::raw_ostream&)>, llvm::raw_ostream&, llvm::StringRef, llvm::StringRef) (./mlir-opt+0x43ffdf5)
#29 0x00005d5be93b59b2 mlir::MlirOptMain(llvm::raw_ostream&, std::unique_ptr<llvm::MemoryBuffer, std::default_delete<llvm::MemoryBuffer>>, mlir::DialectRegistry&, mlir::MlirOptMainConfig const&) (./mlir-opt+0x43519b2)
#30 0x00005d5be93b5c63 mlir::MlirOptMain(int, char**, llvm::StringRef, llvm::StringRef, mlir::DialectRegistry&) (./mlir-opt+0x4351c63)
#31 0x00005d5be93b5e72 mlir::MlirOptMain(int, char**, llvm::StringRef, mlir::DialectRegistry&) (./mlir-opt+0x4351e72)
#32 0x00005d5be60cdc27 main (./mlir-opt+0x1069c27)
#33 0x00007b687cef1d90 (/lib/x86_64-linux-gnu/libc.so.6+0x29d90)
#34 0x00007b687cef1e40 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x29e40)
#35 0x00005d5be60cd795 _start (./mlir-opt+0x1069795)
Aborted (core dumped)
```
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs