Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[mlir] LLVM legalize for export Pass : "Building op llvm.br but it isn't registered in this MLIRContext" #59462

Closed
Colloportus0 opened this issue Dec 12, 2022 · 1 comment
Labels
crash Prefer [crash-on-valid] or [crash-on-invalid] mlir

Comments

@Colloportus0
Copy link

MLIR built at commit fd71692
Reproduced with:
mlir-opt --llvm-legalize-for-export temp.mlir

temp.mlir:

module {
  func.func @func1(%arg0: tensor<16x14xi1>) {
    %c14 = arith.constant 14 : index
    %alloc_8 = memref.alloc() : memref<16xf32>
    %alloc_14 = memref.alloc() : memref<1xi1>
    %alloc_21 = memref.alloc() : memref<16xf32>
    %19 = affine.load %alloc_14[%c14] : memref<1xi1>
    cf.cond_br %19, ^bb40(%alloc_8 : memref<16xf32>), ^bb40(%alloc_21 : memref<16xf32>)
  ^bb40(%47: memref<16xf32>):  // 2 preds: ^bb39, ^bb39
    return
  }
}

trace:

LLVM ERROR: Building op `llvm.br` 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 --llvm-legalize-for-export 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                 0x00000001028e9e70 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) + 72
1  mlir-opt                 0x00000001028ea38c PrintStackTraceSignalHandler(void*) + 28
2  mlir-opt                 0x00000001028e843c llvm::sys::RunSignalHandlers() + 148
3  mlir-opt                 0x00000001028ebff8 SignalHandler(int) + 252
4  libsystem_platform.dylib 0x000000019970d4c4 _sigtramp + 56
5  libsystem_pthread.dylib  0x00000001996f5ee0 pthread_kill + 288
6  libsystem_c.dylib        0x0000000199630340 abort + 168
7  mlir-opt                 0x0000000102768478 llvm::report_fatal_error(llvm::Twine const&, bool) + 356
8  mlir-opt                 0x000000010547c3b0 mlir::RegisteredOperationName mlir::OpBuilder::getCheckRegisteredInfo<mlir::LLVM::BrOp>(mlir::MLIRContext*) + 196
9  mlir-opt                 0x00000001038865c4 mlir::LLVM::BrOp mlir::OpBuilder::create<mlir::LLVM::BrOp, llvm::MutableArrayRef<mlir::BlockArgument>, mlir::Block* const&>(mlir::Location, llvm::MutableArrayRef<mlir::BlockArgument>&&, mlir::Block* const&) + 88
10 mlir-opt                 0x0000000103885a78 ensureDistinctSuccessors(mlir::Block&) + 720
11 mlir-opt                 0x0000000103885470 mlir::LLVM::ensureDistinctSuccessors(mlir::Operation*)::$_0::operator()(mlir::Operation*) const + 232
12 mlir-opt                 0x000000010388537c void llvm::function_ref<void (mlir::Operation*)>::callback_fn<mlir::LLVM::ensureDistinctSuccessors(mlir::Operation*)::$_0>(long, mlir::Operation*) + 52
13 mlir-opt                 0x00000001067dfd48 llvm::function_ref<void (mlir::Operation*)>::operator()(mlir::Operation*) const + 68
14 mlir-opt                 0x0000000106b26bec mlir::detail::walk(mlir::Operation*, llvm::function_ref<void (mlir::Operation*)>, mlir::WalkOrder) + 404
15 mlir-opt                 0x0000000106b26b9c mlir::detail::walk(mlir::Operation*, llvm::function_ref<void (mlir::Operation*)>, mlir::WalkOrder) + 324
16 mlir-opt                 0x00000001038852b0 std::__1::enable_if<llvm::is_one_of<mlir::Operation*, mlir::Operation*, mlir::Region*, mlir::Block*>::value, void>::type mlir::detail::walk<(mlir::WalkOrder)1, mlir::LLVM::ensureDistinctSuccessors(mlir::Operation*)::$_0, mlir::Operation*, void>(mlir::Operation*, mlir::LLVM::ensureDistinctSuccessors(mlir::Operation*)::$_0&&) + 68
17 mlir-opt                 0x0000000103885174 std::__1::enable_if<llvm::function_traits<std::__1::decay<mlir::LLVM::ensureDistinctSuccessors(mlir::Operation*)::$_0>::type>::num_args == 1, void>::type mlir::Operation::walk<(mlir::WalkOrder)1, mlir::LLVM::ensureDistinctSuccessors(mlir::Operation*)::$_0, void>(mlir::LLVM::ensureDistinctSuccessors(mlir::Operation*)::$_0&&) + 48
18 mlir-opt                 0x0000000103885138 mlir::LLVM::ensureDistinctSuccessors(mlir::Operation*) + 28
19 mlir-opt                 0x0000000103888fbc (anonymous namespace)::LegalizeForExportPass::runOnOperation() + 28
20 mlir-opt                 0x0000000106650ddc mlir::detail::OpToOpPassAdaptor::run(mlir::Pass*, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int) + 512
21 mlir-opt                 0x00000001066514ac mlir::detail::OpToOpPassAdaptor::runPipeline(mlir::OpPassManager&, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int, mlir::PassInstrumentor*, mlir::PassInstrumentation::PipelineParentInfo const*) + 364
22 mlir-opt                 0x00000001066536f0 mlir::PassManager::runPasses(mlir::Operation*, mlir::AnalysisManager) + 108
23 mlir-opt                 0x00000001066534c8 mlir::PassManager::run(mlir::Operation*) + 864
24 mlir-opt                 0x00000001066372b4 performActions(llvm::raw_ostream&, bool, bool, std::__1::shared_ptr<llvm::SourceMgr> const&, mlir::MLIRContext*, llvm::function_ref<mlir::LogicalResult (mlir::PassManager&)>, bool, bool) + 560
25 mlir-opt                 0x0000000106636e04 processBuffer(llvm::raw_ostream&, std::__1::unique_ptr<llvm::MemoryBuffer, std::__1::default_delete<llvm::MemoryBuffer>>, bool, bool, bool, bool, bool, bool, llvm::function_ref<mlir::LogicalResult (mlir::PassManager&)>, mlir::DialectRegistry&, llvm::ThreadPool*) + 524
26 mlir-opt                 0x0000000106636bb0 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::operator()(std::__1::unique_ptr<llvm::MemoryBuffer, std::__1::default_delete<llvm::MemoryBuffer>>, llvm::raw_ostream&) const + 204
27 mlir-opt                 0x0000000106636ac4 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&) + 80
28 mlir-opt                 0x0000000106843590 llvm::function_ref<mlir::LogicalResult (std::__1::unique_ptr<llvm::MemoryBuffer, std::__1::default_delete<llvm::MemoryBuffer>>, llvm::raw_ostream&)>::operator()(std::__1::unique_ptr<llvm::MemoryBuffer, std::__1::default_delete<llvm::MemoryBuffer>>, llvm::raw_ostream&) const + 96
29 mlir-opt                 0x0000000106843074 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) + 128
30 mlir-opt                 0x0000000106634504 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) + 320
31 mlir-opt                 0x000000010663470c mlir::MlirOptMain(llvm::raw_ostream&, std::__1::unique_ptr<llvm::MemoryBuffer, std::__1::default_delete<llvm::MemoryBuffer>>, mlir::PassPipelineCLParser const&, mlir::DialectRegistry&, bool, bool, bool, bool, bool, bool, bool, bool) + 296
32 mlir-opt                 0x00000001066352d0 mlir::MlirOptMain(int, char**, llvm::StringRef, mlir::DialectRegistry&, bool) + 2912
33 mlir-opt                 0x00000001020fff44 main + 148
34 dyld                     0x00000001202c1088 start + 516
@EugeneZelenko EugeneZelenko added mlir crash Prefer [crash-on-valid] or [crash-on-invalid] and removed new issue labels Dec 12, 2022
@llvmbot
Copy link
Collaborator

llvmbot commented Dec 12, 2022

@llvm/issue-subscribers-mlir

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
crash Prefer [crash-on-valid] or [crash-on-invalid] mlir
Projects
None yet
Development

No branches or pull requests

3 participants