<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/60725>60725</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[mlir] Linalg-Generalize-Named-Op Pass violates Assertion "incorrect # of replacement values"
</td>
</tr>
<tr>
<th>Labels</th>
<td>
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
Colloportus0
</td>
</tr>
</table>
<pre>
MLIR built at commit https://github.com/llvm/llvm-project/commit/4b815d84
Reproduced with:
`mlir-opt --linalg-generalize-named-ops temp.mlir`
temp.mlir:
``` milr
module {
func.func private @func1( ) {
%0 = tensor.empty() : tensor<3x13xf32>
%alloc_1161 = memref.alloc() : memref<14xi32>
%20 = tensor.empty() : tensor<i32>
%21 = linalg.dot ins(%alloc_1161, %alloc_1161 : memref<14xi32>, memref<14xi32>) outs(%20 : tensor<i32>) -> tensor<i32>
bufferization.dealloc_tensor %21 : tensor<i32>
return
}
}
```
trace:
```console
Assertion failed: (op->getNumResults() == newValues.size() && "incorrect # of replacement values"), function replaceOp, file PatternMatch.cpp, line 266.
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 --linalg-generalize-named-ops temp.mlir
Stack dump without symbol names (ensure you have llvm-symbolizer in your PATH or set the environment var `LLVM_SYMBOLIZER_PATH` to point to it):
0 mlir-opt 0x0000000104a66650 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) + 56
1 mlir-opt 0x0000000104a656b8 llvm::sys::RunSignalHandlers() + 112
2 mlir-opt 0x0000000104a66ce8 SignalHandler(int) + 344
3 libsystem_platform.dylib 0x00000001b36554c4 _sigtramp + 56
4 libsystem_pthread.dylib 0x00000001b363dee0 pthread_kill + 288
5 libsystem_c.dylib 0x00000001b3578340 abort + 168
6 libsystem_c.dylib 0x00000001b3577754 err + 0
7 mlir-opt 0x00000001068cfd34 mlir::RewriterBase::eraseOp(mlir::Operation*) (.cold.1) + 0
8 mlir-opt 0x0000000106268f1c mlir::RewriterBase::eraseOp(mlir::Operation*) + 0
9 mlir-opt 0x000000010509f184 mlir::linalg::generalizeNamedOp(mlir::RewriterBase&, mlir::linalg::LinalgOp) + 840
10 mlir-opt 0x000000010509fa6c mlir::linalg::LinalgGeneralizationPattern::matchAndRewrite(mlir::linalg::LinalgOp, mlir::PatternRewriter&) const + 16
11 mlir-opt 0x00000001063efaf0 mlir::PatternApplicator::matchAndRewrite(mlir::Operation*, mlir::PatternRewriter&, llvm::function_ref<bool (mlir::Pattern const&)>, llvm::function_ref<void (mlir::Pattern const&)>, llvm::function_ref<mlir::LogicalResult (mlir::Pattern const&)>) + 1420
12 mlir-opt 0x000000010619e3d8 (anonymous namespace)::GreedyPatternRewriteDriver::processWorklist() + 2432
13 mlir-opt 0x000000010619ba30 mlir::applyPatternsAndFoldGreedily(mlir::Region&, mlir::FrozenRewritePatternSet const&, mlir::GreedyRewriteConfig) + 1516
14 mlir-opt 0x000000010509fcac (anonymous namespace)::LinalgGeneralizationPass::runOnOperation() + 296
15 mlir-opt 0x000000010614d28c mlir::detail::OpToOpPassAdaptor::run(mlir::Pass*, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int) + 428
16 mlir-opt 0x000000010614d7bc mlir::detail::OpToOpPassAdaptor::runPipeline(mlir::OpPassManager&, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int, mlir::PassInstrumentor*, mlir::PassInstrumentation::PipelineParentInfo const*) + 320
17 mlir-opt 0x0000000106151824 mlir::detail::OpToOpPassAdaptor::runOnOperationAsyncImpl(bool)::$_14::operator()(mlir::detail::OpToOpPassAdaptor::runOnOperationAsyncImpl(bool)::OpPMInfo&) const + 176
18 mlir-opt 0x00000001061516a0 mlir::LogicalResult mlir::failableParallelForEach<std::__1::__wrap_iter<mlir::detail::OpToOpPassAdaptor::runOnOperationAsyncImpl(bool)::OpPMInfo*>, mlir::detail::OpToOpPassAdaptor::runOnOperationAsyncImpl(bool)::$_14&>(mlir::MLIRContext*, std::__1::__wrap_iter<mlir::detail::OpToOpPassAdaptor::runOnOperationAsyncImpl(bool)::OpPMInfo*>, std::__1::__wrap_iter<mlir::detail::OpToOpPassAdaptor::runOnOperationAsyncImpl(bool)::OpPMInfo*>, mlir::detail::OpToOpPassAdaptor::runOnOperationAsyncImpl(bool)::$_14&) + 360
19 mlir-opt 0x000000010614e484 mlir::detail::OpToOpPassAdaptor::runOnOperationAsyncImpl(bool) + 1396
20 mlir-opt 0x000000010614d3bc mlir::detail::OpToOpPassAdaptor::run(mlir::Pass*, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int) + 732
21 mlir-opt 0x000000010614d7bc mlir::detail::OpToOpPassAdaptor::runPipeline(mlir::OpPassManager&, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int, mlir::PassInstrumentor*, mlir::PassInstrumentation::PipelineParentInfo const*) + 320
22 mlir-opt 0x000000010614f12c mlir::PassManager::run(mlir::Operation*) + 1148
23 mlir-opt 0x00000001061484fc performActions(llvm::raw_ostream&, bool, bool, std::__1::shared_ptr<llvm::SourceMgr> const&, mlir::MLIRContext*, llvm::function_ref<mlir::LogicalResult (mlir::PassManager&)>, bool, bool) + 476
24 mlir-opt 0x00000001061480e8 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>>, llvm::function_ref<mlir::LogicalResult (mlir::PassManager&)>, mlir::DialectRegistry&, bool, bool, bool, bool, bool, bool, bool)::$_0>(long, std::__1::unique_ptr<llvm::MemoryBuffer, std::__1::default_delete<llvm::MemoryBuffer>>, llvm::raw_ostream&) + 704
25 mlir-opt 0x00000001061b2708 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) + 656
26 mlir-opt 0x0000000106146510 mlir::MlirOptMain(llvm::raw_ostream&, std::__1::unique_ptr<llvm::MemoryBuffer, std::__1::default_delete<llvm::MemoryBuffer>>, llvm::function_ref<mlir::LogicalResult (mlir::PassManager&)>, mlir::DialectRegistry&, bool, bool, bool, bool, bool, bool, bool) + 216
27 mlir-opt 0x0000000106146a04 mlir::MlirOptMain(int, char**, llvm::StringRef, mlir::DialectRegistry&, bool) + 1208
28 mlir-opt 0x0000000104905e70 main + 108
29 dyld 0x0000000109cd9088 start + 516
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzsWltv2zgW_jXMCxFDoi6WHvLg3GYCxJMgKWax-2JQ0pHNLUVqSSqt--sXJCVbvjVup10UiwmKSJHOOfzO_ZAq1ZotBcAVSq5RcntBO7OS6upGci5bqUyng4tCVuur-ePDCy46xg2mBpeyaZjBK2NajaIZIveI3C-ZWXXFpJQNIvecvw2Xy1bJf0NpELn3fIjcx0UWJlUWo-AWBbMXaJWsuhIq_ImZFYpm2L9AadBwpi5la_DlJWeC8uXlEgQoytkXuBS0gepSthobaNqJpUVp0PO639vn0Wwj0__DDeOqX6iRVccBo-m1_xvjuhPlxP7CrWJv1ABGcWD_DhHJMCI5ttR4IMcYkSTAKLrFBoSWagJNa9aIZJbUauQfo-gm-hxGn-uIoOhuYEckoZzLchGGaeiENNAoqCfu6UiIf4yimzD-zHZEeATkPAiedZfTr-ttPKmkwUxoxzuChsjNAdZjoCzdsac5lp3ppTqoh5hIji-tWsexFl1dg2JfqGFSTCrwSDztRosDoSMbKTCdEnhj-OltHxWbm90gGeh8MClawmEglVJoyWEQOtMalMWHa8o4VC6cSSZbq9cSzB9d8wK6470hrGturek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