<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/64273>64273</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[mlir] `IRPrinterInstrumentation::runAfterPassFailed` crashed with segmentation fault
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
Colloportus0
</td>
</tr>
</table>
<pre>
MLIR built at commit b4c54b20
Reproduced with:
`mlir-opt --shape-to-shape-lowering --convert-bufferization-to-memref --mlir-print-ir-after-failure temp.mlir`
temp.mlir:
``` milr module {
func.func nested @func1(%arg0: tensor<13xf32>, %arg1: memref<?x10x19xi16>, %arg2: i32) -> tensor<13x10x19xi16> {
%c399409779_i64 = arith.constant 399409779 : i64
%cst = arith.constant 1.78212314E+9 : f32
%c335554098_i64 = arith.constant 335554098 : i64
%true = arith.constant true
%c0 = arith.constant 0 : index
%c2 = arith.constant 2 : index
%8 = tensor.empty() : tensor<13x10x19xi16>
%alloc = memref.alloc() : memref<13xi1>
%alloc_5 = memref.alloc(%c0) : memref<?xi64>
%alloc_12 = memref.alloc() : memref<13xf16>
%16 = index.xor %c2, %c2
%26 = bufferization.clone %alloc_12 : memref<13xf16> to memref<13xf16>
scf.execute_region {
%130 = vector.load %alloc_5[%c0] : memref<?xi64>, vector<13x10x19xi64>
%131 = scf.parallel (%arg3, %arg4) = (%c0, %c2) to (%c0, %c2) step (%c2, %c2) init (%130) -> vector<13x10x19xi64> {
%152 = vector.broadcast %c399409779_i64 : i64 to vector<13x19xi64>
%153 = vector.broadcast %true : i1 to vector<13x10x19xi1>
%154 = vector.mask %153 { vector.multi_reduction <minui>, %130, %152 [1] : vector<13x10x19xi64> to vector<13x19xi64> } : vector<13x10x19xi1> -> vector<13x19xi64>
%163 = vector.broadcast %c399409779_i64 : i64 to vector<13x10x19xi64>
scf.reduce(%163) : vector<13x10x19xi64> {
^bb0(%arg5: vector<13x10x19xi64>, %arg6: vector<13x10x19xi64>):
%171 = vector.broadcast %c335554098_i64 : i64 to vector<13x10x19xi64>
scf.reduce.return %171 : vector<13x10x19xi64>
}
scf.yield
}
%132 = memref.load %26[%c2] : memref<13xf16>
scf.yield
}
%86 = bufferization.to_tensor %alloc : memref<13xi1>
return %8 : tensor<13x10x19xi16>
}
}
```
trace:
```console
temp.mlir:32:11: error: failed to legalize operation 'bufferization.to_tensor' that was explicitly marked illegal
%86 = bufferization.to_tensor %alloc : memref<13xi1>
^
temp.mlir:32:11: note: see current operation: %13 = "bufferization.to_tensor"(%7) : (memref<13xi1>) -> tensor<13xi1>
// -----// IR Dump After ConvertBufferizationToMemRef Failed (convert-bufferization-to-memref) //----- //
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 --shape-to-shape-lowering --convert-bufferization-to-memref --mlir-print-ir-after-failure temp.mlir
#0 0x0000000104d18548 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/workspace/bin/mlir-opt+0x1002f8548)
#1 0x0000000104d167e4 llvm::sys::RunSignalHandlers() (/workspace/bin/mlir-opt+0x1002f67e4)
#2 0x0000000104d18bf4 SignalHandler(int) (/workspace/bin/mlir-opt+0x1002f8bf4)
#3 0x00000001a46cd4c4 (/usr/lib/system/libsystem_platform.dylib+0x1803414c4)
#4 0x0000000107439cac (anonymous namespace)::DummyAliasOperationPrinter::printGenericOp(mlir::Operation*, bool) (/workspace/bin/mlir-opt+0x102a19cac)
#5 0x000000010743b9b4 (anonymous namespace)::DummyAliasOperationPrinter::print(mlir::Block*, bool, bool) (/workspace/bin/mlir-opt+0x102a1b9b4)
#6 0x0000000107439e84 (anonymous namespace)::DummyAliasOperationPrinter::printRegion(mlir::Region&, bool, bool, bool) (/workspace/bin/mlir-opt+0x102a19e84)
#7 0x0000000107439c80 (anonymous namespace)::DummyAliasOperationPrinter::printGenericOp(mlir::Operation*, bool) (/workspace/bin/mlir-opt+0x102a19c80)
#8 0x000000010743b9b4 (anonymous namespace)::DummyAliasOperationPrinter::print(mlir::Block*, bool, bool) (/workspace/bin/mlir-opt+0x102a1b9b4)
#9 0x0000000107439e84 (anonymous namespace)::DummyAliasOperationPrinter::printRegion(mlir::Region&, bool, bool, bool) (/workspace/bin/mlir-opt+0x102a19e84)
#10 0x0000000107439c80 (anonymous namespace)::DummyAliasOperationPrinter::printGenericOp(mlir::Operation*, bool) (/workspace/bin/mlir-opt+0x102a19c80)
#11 0x000000010743b9b4 (anonymous namespace)::DummyAliasOperationPrinter::print(mlir::Block*, bool, bool) (/workspace/bin/mlir-opt+0x102a1b9b4)
#12 0x0000000107439e84 (anonymous namespace)::DummyAliasOperationPrinter::printRegion(mlir::Region&, bool, bool, bool) (/workspace/bin/mlir-opt+0x102a19e84)
#13 0x0000000107439c80 (anonymous namespace)::DummyAliasOperationPrinter::printGenericOp(mlir::Operation*, bool) (/workspace/bin/mlir-opt+0x102a19c80)
#14 0x000000010743b9b4 (anonymous namespace)::DummyAliasOperationPrinter::print(mlir::Block*, bool, bool) (/workspace/bin/mlir-opt+0x102a1b9b4)
#15 0x0000000107439e84 (anonymous namespace)::DummyAliasOperationPrinter::printRegion(mlir::Region&, bool, bool, bool) (/workspace/bin/mlir-opt+0x102a19e84)
#16 0x0000000107439c80 (anonymous namespace)::DummyAliasOperationPrinter::printGenericOp(mlir::Operation*, bool) (/workspace/bin/mlir-opt+0x102a19c80)
#17 0x000000010743b9b4 (anonymous namespace)::DummyAliasOperationPrinter::print(mlir::Block*, bool, bool) (/workspace/bin/mlir-opt+0x102a1b9b4)
#18 0x0000000107439e84 (anonymous namespace)::DummyAliasOperationPrinter::printRegion(mlir::Region&, bool, bool, bool) (/workspace/bin/mlir-opt+0x102a19e84)
#19 0x0000000107439c80 (anonymous namespace)::DummyAliasOperationPrinter::printGenericOp(mlir::Operation*, bool) (/workspace/bin/mlir-opt+0x102a19c80)
#20 0x0000000107433880 mlir::detail::AsmStateImpl::initializeAliases(mlir::Operation*) (/workspace/bin/mlir-opt+0x102a13880)
#21 0x0000000107432900 mlir::Operation::print(llvm::raw_ostream&, mlir::AsmState&) (/workspace/bin/mlir-opt+0x102a12900)
#22 0x0000000107432658 mlir::Operation::print(llvm::raw_ostream&, mlir::OpPrintingFlags const&) (/workspace/bin/mlir-opt+0x102a12658)
#23 0x000000010739f0a0 void llvm::function_ref<void (llvm::raw_ostream&)>::callback_fn<(anonymous namespace)::IRPrinterInstrumentation::runAfterPassFailed(mlir::Pass*, mlir::Operation*)::$_2>(long, llvm::raw_ostream&) (/workspace/bin/mlir-opt+0x10297f0a0)
#24 0x000000010739f2c4 (anonymous namespace)::BasicIRPrinterConfig::printAfterIfEnabled(mlir::Pass*, mlir::Operation*, llvm::function_ref<void (llvm::raw_ostream&)>) (/workspace/bin/mlir-opt+0x10297f2c4)
#25 0x000000010739e144 (anonymous namespace)::IRPrinterInstrumentation::runAfterPassFailed(mlir::Pass*, mlir::Operation*) (/workspace/bin/mlir-opt+0x10297e144)
#26 0x00000001073a2058 mlir::detail::OpToOpPassAdaptor::run(mlir::Pass*, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int) (/workspace/bin/mlir-opt+0x102982058)
#27 0x00000001073a2524 mlir::detail::OpToOpPassAdaptor::runPipeline(mlir::OpPassManager&, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int, mlir::PassInstrumentor*, mlir::PassInstrumentation::PipelineParentInfo const*) (/workspace/bin/mlir-opt+0x102982524)
#28 0x00000001073a43bc mlir::PassManager::run(mlir::Operation*) (/workspace/bin/mlir-opt+0x1029843bc)
#29 0x000000010739c808 performActions(llvm::raw_ostream&, std::__1::shared_ptr<llvm::SourceMgr> const&, mlir::MLIRContext*, mlir::MlirOptMainConfig const&) (/workspace/bin/mlir-opt+0x10297c808)
#30 0x000000010739bd30 mlir::LogicalResult llvm::function_ref<mlir::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&)::$_1>(long, std::__1::unique_ptr<llvm::MemoryBuffer, std::__1::default_delete<llvm::MemoryBuffer>>, llvm::raw_ostream&) (/workspace/bin/mlir-opt+0x10297bd30)
#31 0x000000010741abe0 mlir::splitAndProcessBuffer(std::__1::unique_ptr<llvm::MemoryBuffer, std::__1::default_delete<llvm::MemoryBuffer>>, llvm::function_ref<mlir::LogicalResult (std::__1::unique_ptr<llvm::MemoryBuffer, std::__1::default_delete<llvm::MemoryBuffer>>, llvm::raw_ostream&)>, llvm::raw_ostream&, bool, bool) (/workspace/bin/mlir-opt+0x1029fabe0)
#32 0x00000001073966e4 mlir::MlirOptMain(llvm::raw_ostream&, std::__1::unique_ptr<llvm::MemoryBuffer, std::__1::default_delete<llvm::MemoryBuffer>>, mlir::DialectRegistry&, mlir::MlirOptMainConfig const&) (/workspace/bin/mlir-opt+0x1029766e4)
#33 0x0000000107396b54 mlir::MlirOptMain(int, char**, llvm::StringRef, mlir::DialectRegistry&) (/workspace/bin/mlir-opt+0x102976b54)
#34 0x0000000104a2358c main (/workspace/bin/mlir-opt+0x10000358c)
#35 0x0000000110341088
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzcWl1T5KoW_TX4QnVXQr4ffGhbvdeqsbSc895FCGm5EsgFMqPn19-C9EdIp1vbM_fUcawpJwbYe-3FYm9IgrVma0HpJUiuQHJ9gTvzLNXlUnIuW6lMp4OLUlZvl_ff7p5g2TFuIDaQyKZhBsIyJklcogAE1yBYPNFWyaojtII_mXkG0QLCvgWkQcOZmsnWwNlMP-OWzozcXHD5kyom1nA2I1L8oMrMyq6uqWJ_YsOksD0b2ihaw9nMmWkVE2bG1AzXhqpZjRnvFIWGNu3cdgDpBlH_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