<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/60070>60070</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[mlir] GPU-to-LLVM Pass crashes due to unregistered dialect "Building op `memref.load` but it isn't registered in this MLIRContex"
</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/cb37cf6161
Reproduced with:
`mlir-opt --gpu-to-llvm temp.mlir`
temp.mlir:
```
func.func @func(%arg0: index, %arg1: memref<f32>) {
%cst = arith.constant 0.000000e+00 : f32
vector.warp_execute_on_lane_0(%arg0)[32] {
%1 = vector.transfer_read %arg1[], %cst : memref<f32>, vector<f32>
%2 = vector.extractelement %1[] : vector<f32>
}
return
}
```
trace:
```console
LLVM ERROR: Building op `memref.load` but it isn't registered in this MLIRContext: the dialect may not be loaded or this operation isn't registered by the dialect. See also https://mlir.llvm.org/getting_started/Faq/#registered-loaded-dependent-whats-up-with-dialects-management
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 --gpu-to-llvm 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 0x0000000100a3b7f4 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) + 56
1 mlir-opt 0x0000000100a3a85c llvm::sys::RunSignalHandlers() + 112
2 mlir-opt 0x0000000100a3be8c SignalHandler(int) + 344
3 libsystem_platform.dylib 0x00000001aad414c4 _sigtramp + 56
4 libsystem_pthread.dylib 0x00000001aad29ee0 pthread_kill + 288
5 libsystem_c.dylib 0x00000001aac64340 abort + 168
6 mlir-opt 0x0000000100a0243c llvm::report_fatal_error(llvm::Twine const&, bool) + 468
7 mlir-opt 0x0000000101aad4d0 mlir::memref::LoadOp mlir::OpBuilder::create<mlir::memref::LoadOp, mlir::detail::TypedValue<mlir::MemRefType>, mlir::OperandRange>(mlir::Location, mlir::detail::TypedValue<mlir::MemRefType>&&, mlir::OperandRange&&) + 480
8 mlir-opt 0x0000000101aad288 VectorLoadToMemrefLoadLowering::matchAndRewrite(mlir::vector::LoadOp, mlir::PatternRewriter&) const + 208
9 mlir-opt 0x00000001022e5700 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
10 mlir-opt 0x000000010208ca34 (anonymous namespace)::OperationLegalizer::legalize(mlir::Operation*, mlir::ConversionPatternRewriter&) + 1948
11 mlir-opt 0x000000010208e5fc mlir::LogicalResult llvm::function_ref<mlir::LogicalResult (mlir::Pattern const&)>::callback_fn<(anonymous namespace)::OperationLegalizer::legalizeWithPattern(mlir::Operation*, mlir::ConversionPatternRewriter&)::$_20>(long, mlir::Pattern const&) + 932
12 mlir-opt 0x00000001022e55a8 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&)>) + 1076
13 mlir-opt 0x000000010208ca34 (anonymous namespace)::OperationLegalizer::legalize(mlir::Operation*, mlir::ConversionPatternRewriter&) + 1948
14 mlir-opt 0x00000001020861ac (anonymous namespace)::OperationConverter::convertOperations(llvm::ArrayRef<mlir::Operation*>, llvm::function_ref<void (mlir::Diagnostic&)>) + 936
15 mlir-opt 0x000000010208829c mlir::applyPartialConversion(mlir::Operation*, mlir::ConversionTarget&, mlir::FrozenRewritePatternSet const&, llvm::DenseSet<mlir::Operation*, llvm::DenseMapInfo<mlir::Operation*, void>>*) + 80
16 mlir-opt 0x0000000101b88694 (anonymous namespace)::GpuToLLVMConversionPass::runOnOperation() + 544
17 mlir-opt 0x000000010204abf8 mlir::detail::OpToOpPassAdaptor::run(mlir::Pass*, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int) + 428
18 mlir-opt 0x000000010204b128 mlir::detail::OpToOpPassAdaptor::runPipeline(mlir::OpPassManager&, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int, mlir::PassInstrumentor*, mlir::PassInstrumentation::PipelineParentInfo const*) + 320
19 mlir-opt 0x000000010204caa4 mlir::PassManager::run(mlir::Operation*) + 1148
20 mlir-opt 0x0000000102045e68 performActions(llvm::raw_ostream&, bool, bool, std::__1::shared_ptr<llvm::SourceMgr> const&, mlir::MLIRContext*, llvm::function_ref<mlir::LogicalResult (mlir::PassManager&)>, bool, bool) + 504
21 mlir-opt 0x0000000102045a38 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
22 mlir-opt 0x00000001020b0fac 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
23 mlir-opt 0x0000000102043e60 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
24 mlir-opt 0x0000000102044354 mlir::MlirOptMain(int, char**, llvm::StringRef, mlir::DialectRegistry&, bool) + 1208
25 mlir-opt 0x00000001008de2b8 main + 108
26 dyld 0x0000000105849088 start + 516
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzsWUtv4zgS_jXKhbBBUZItH3JwXjMNJEjgZGexezFKUlnmDkVqSCppz69fkJJs-dXjnu4BehfTaMS2SNbjq6-KRRGM4aVEvA6SmyC5u4LGrpW-vlVCqFpp2xh6lalic_30-GlBsoYLS8CSXFUVt2RtbW2CaB6wh4A9lNyum2ycqypgD0K89x-jWqv_YG4D9tCuc1-yaJqvJuEkDOhdQOcLrLUqmhwL8sHtOojmpB0IJrQSXI9UbQkZjcq6GVk1cmKJxaoeu8FgQrvJ_u_ueTTfCmn_d0JXjczH7g8JYuo-A5YGLAFdUqeZywI_B-yWtM9C96zCSuMqiG5XEQui-4DNSDC96eQRNzM3lgTRHQHN7XqcK2ksSEvomPp_GLAbSomT5US0694xt0qPP0DXS_yMeWNxqeRSgMQlHRjFZkFyE7EguXNae6VebeiVdoKsBmlWqJcaodia70Pb-dNaecKf207G7tFQCxtqwc9WQ25RYIXSeiNaHV7ygZgdRNO7_qtG22jZxWZ6Rw6i1E3roqkhx-NIOnyVQNLNenz85YncLxbPC2fCTcNFwWVJVE0cgbyvY6GgcBzIGku4JdzIgE0t0VhyY1FjQbgkds0NcWS_VdLiZ-vE2TWSgoPA3JIKNkQqSzIkTh4WROl2kapRg-VKnpKcbYZSxuQVkYAw6iCFHGvHjtxjpUuXUmgtl-XSWNAWi4A9PMBvfmq0Ez5qDRkVWKMsUNrRxxqsGTX1yOXSqFNqRhVIKH3MWtBeHu_nr_fENJlLZiBZUxKNLu2JPbTsguTmxjRoAvZAQDosc9EU6N3ON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