llvm-project icon indicating copy to clipboard operation
llvm-project copied to clipboard

[mlir] Convert-openacc-to-scf triggers crashes in OperationLegalizer

Open CelestineSmith opened this issue 3 years ago • 4 comments

Hi, I was trying mlir-opt --convert-openacc-to-scf on the following temp.mlir.

It crashed, the log is as follows:

Assertion failed: ((replacedRoot() || updatedRootInPlace()) && "expected pattern to replace the root operation"), function legalizePatternResult, file DialectConversion.cpp, line 2036.
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 --convert-openacc-to-scf 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                 0x00000001003b05bc llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) + 56
1  mlir-opt                 0x00000001003af624 llvm::sys::RunSignalHandlers() + 112
2  mlir-opt                 0x00000001003b0c54 SignalHandler(int) + 344
3  libsystem_platform.dylib 0x00000001a56894c4 _sigtramp + 56
4  libsystem_pthread.dylib  0x00000001a5671ee0 pthread_kill + 288
5  libsystem_c.dylib        0x00000001a55ac340 abort + 168
6  libsystem_c.dylib        0x00000001a55ab754 err + 0
7  mlir-opt                 0x0000000101ce7198 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&) (.cold.2) + 0
8  mlir-opt                 0x00000001015fed88 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&) + 184
9  mlir-opt                 0x000000010184fa78 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&)>) + 1096
10 mlir-opt                 0x00000001015fd4b0 (anonymous namespace)::OperationLegalizer::legalize(mlir::Operation*, mlir::ConversionPatternRewriter&) + 1948
11 mlir-opt                 0x00000001015f6b1c (anonymous namespace)::OperationConverter::convertOperations(llvm::ArrayRef<mlir::Operation*>, llvm::function_ref<void (mlir::Diagnostic&)>) + 928
12 mlir-opt                 0x00000001015f8d18 mlir::applyPartialConversion(mlir::Operation*, mlir::ConversionTarget&, mlir::FrozenRewritePatternSet const&, llvm::DenseSet<mlir::Operation*, llvm::DenseMapInfo<mlir::Operation*, void>>*) + 80
13 mlir-opt                 0x000000010127f674 (anonymous namespace)::ConvertOpenACCToSCFPass::runOnOperation() + 820
14 mlir-opt                 0x00000001015bb4dc mlir::detail::OpToOpPassAdaptor::run(mlir::Pass*, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int) + 420
15 mlir-opt                 0x00000001015bba0c mlir::detail::OpToOpPassAdaptor::runPipeline(mlir::OpPassManager&, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int, mlir::PassInstrumentor*, mlir::PassInstrumentation::PipelineParentInfo const*) + 320
16 mlir-opt                 0x00000001015bd388 mlir::PassManager::run(mlir::Operation*) + 1148
17 mlir-opt                 0x00000001015b6840 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
18 mlir-opt                 0x00000001015b6410 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
19 mlir-opt                 0x000000010162102c 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
20 mlir-opt                 0x00000001015b4838 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
21 mlir-opt                 0x00000001015b4d2c mlir::MlirOptMain(int, char**, llvm::StringRef, mlir::DialectRegistry&, bool) + 1208
22 mlir-opt                 0x00000001002530a0 main + 108
23 dyld                     0x0000000104c9d088 start + 516

Building commit: db6961db

CelestineSmith avatar Jan 16 '23 03:01 CelestineSmith

@llvm/issue-subscribers-mlir

llvmbot avatar Jan 16 '23 04:01 llvmbot

Cannot find the temp.mlir :(

python3kgae avatar Jan 21 '23 05:01 python3kgae

func.func @func(%arg0: memref<10xf32, #spirv.storage_class<StorageBuffer>>) {
  %true = arith.constant true
  acc.update if(%true) host(%arg0 : memref<10xf32, #spirv.storage_class<StorageBuffer>>)
  return
}

Sorry for that

CelestineSmith avatar Jan 21 '23 08:01 CelestineSmith

Created PR https://reviews.llvm.org/D142286

python3kgae avatar Jan 21 '23 16:01 python3kgae