Skip to content

[MLIR]Affine-data-copy-generate triggers segmentation fault #61167

Closed
@BealZephyr

Description

@BealZephyr

Commit: fd37b4b

Steps to reproduce:

mlir-opt -affine-data-copy-generate="generate-dma=false fast-mem-space=0 skip-non-unit-stride-loops"  test.mlir

Test case:

module {
  func.func @main(%3:memref<480xi1>) {
    %false = arith.constant false
    %4 = memref.alloc() {alignment = 128 : i64} : memref<i1>
    affine.store %false, %4[] : memref<i1>
    %5 = memref.alloc() {alignment = 128 : i64} : memref<i1>
    memref.copy %4, %5 : memref<i1> to memref<i1>
    affine.for %arg0 = 0 to 480 {
      %11 = affine.load %3[%arg0] : memref<480xi1>
      %12 = affine.load %5[] : memref<i1>
      %13 = arith.cmpi slt, %11, %12 : i1
      %14 = arith.select %13, %11, %12 : i1
      affine.store %14, %5[] : memref<i1>
    }
    return
  }
}

Crash trace:

PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
Stack dump:
0.	Program arguments: llvm-project-fd37b4b38d77a0b788695d839ee2b8c07732fb5d/build/bin/mlir-opt test.mlir "-affine-data-copy-generate=generate-dma=false fast-mem-space=0 skip-non-unit-stride-loops"
 #0 0x0000563d20ae38ba llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (llvm-project-fd37b4b38d77a0b788695d839ee2b8c07732fb5d/build/bin/mlir-opt+0x2188ba)
 #1 0x0000563d20ae0ecc SignalHandler(int) Signals.cpp:0:0
 #2 0x00007f7bde0dd980 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x12980)
 #3 0x0000563d223c739b mlir::detail::walk(mlir::Operation*, llvm::function_ref<void (mlir::Operation*)>, mlir::WalkOrder) (llvm-project-fd37b4b38d77a0b788695d839ee2b8c07732fb5d/build/bin/mlir-opt+0x1afc39b)
 #4 0x0000563d20b7dfad (anonymous namespace)::AffineDataCopyGeneration::runOnOperation() AffineDataCopyGeneration.cpp:0:0
 #5 0x0000563d22225369 mlir::detail::OpToOpPassAdaptor::run(mlir::Pass*, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int) (llvm-project-fd37b4b38d77a0b788695d839ee2b8c07732fb5d/build/bin/mlir-opt+0x195a369)
 #6 0x0000563d22225670 mlir::detail::OpToOpPassAdaptor::runPipeline(mlir::OpPassManager&, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int, mlir::PassInstrumentor*, mlir::PassInstrumentation::PipelineParentInfo const*) (llvm-project-fd37b4b38d77a0b788695d839ee2b8c07732fb5d/build/bin/mlir-opt+0x195a670)
 #7 0x0000563d222259b0 mlir::detail::OpToOpPassAdaptor::runOnOperationAsyncImpl(bool)::'lambda'(mlir::detail::OpToOpPassAdaptor::runOnOperationAsyncImpl(bool)::OpPMInfo&)::operator()(mlir::detail::OpToOpPassAdaptor::runOnOperationAsyncImpl(bool)::OpPMInfo&) const Pass.cpp:0:0
 #8 0x0000563d222244d5 mlir::detail::OpToOpPassAdaptor::runOnOperationAsyncImpl(bool) (llvm-project-fd37b4b38d77a0b788695d839ee2b8c07732fb5d/build/bin/mlir-opt+0x19594d5)
 #9 0x0000563d222252da mlir::detail::OpToOpPassAdaptor::run(mlir::Pass*, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int) (llvm-project-fd37b4b38d77a0b788695d839ee2b8c07732fb5d/build/bin/mlir-opt+0x195a2da)
#10 0x0000563d222260f9 mlir::detail::OpToOpPassAdaptor::runPipeline(mlir::OpPassManager&, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int, mlir::PassInstrumentor*, mlir::PassInstrumentation::PipelineParentInfo const*) (.constprop.488) Pass.cpp:0:0
#11 0x0000563d2222682d mlir::PassManager::run(mlir::Operation*) (llvm-project-fd37b4b38d77a0b788695d839ee2b8c07732fb5d/build/bin/mlir-opt+0x195b82d)
#12 0x0000563d2221850b performActions(llvm::raw_ostream&, bool, bool, std::shared_ptr<llvm::SourceMgr> const&, mlir::MLIRContext*, llvm::function_ref<mlir::LogicalResult (mlir::PassManager&)>, bool, bool) (.constprop.274) MlirOptMain.cpp:0:0
#13 0x0000563d22218c08 processBuffer(llvm::raw_ostream&, std::unique_ptr<llvm::MemoryBuffer, std::default_delete<llvm::MemoryBuffer>>, bool, bool, bool, bool, bool, bool, llvm::function_ref<mlir::LogicalResult (mlir::PassManager&)>, mlir::DialectRegistry&, llvm::ThreadPool*) MlirOptMain.cpp:0:0
#14 0x0000563d2221900f mlir::LogicalResult llvm::function_ref<mlir::LogicalResult (std::unique_ptr<llvm::MemoryBuffer, std::default_delete<llvm::MemoryBuffer>>, llvm::raw_ostream&)>::callback_fn<mlir::MlirOptMain(llvm::raw_ostream&, std::unique_ptr<llvm::MemoryBuffer, std::default_delete<llvm::MemoryBuffer>>, llvm::function_ref<mlir::LogicalResult (mlir::PassManager&)>, mlir::DialectRegistry&, bool, bool, bool, bool, bool, bool, bool)::'lambda'(std::unique_ptr<llvm::MemoryBuffer, std::default_delete<llvm::MemoryBuffer>>, llvm::raw_ostream&)>(long, std::unique_ptr<llvm::MemoryBuffer, std::default_delete<llvm::MemoryBuffer>>, llvm::raw_ostream&) MlirOptMain.cpp:0:0
#15 0x0000563d222dd340 mlir::splitAndProcessBuffer(std::unique_ptr<llvm::MemoryBuffer, std::default_delete<llvm::MemoryBuffer>>, llvm::function_ref<mlir::LogicalResult (std::unique_ptr<llvm::MemoryBuffer, std::default_delete<llvm::MemoryBuffer>>, llvm::raw_ostream&)>, llvm::raw_ostream&, bool, bool) (llvm-project-fd37b4b38d77a0b788695d839ee2b8c07732fb5d/build/bin/mlir-opt+0x1a12340)
#16 0x0000563d22217956 mlir::MlirOptMain(llvm::raw_ostream&, std::unique_ptr<llvm::MemoryBuffer, std::default_delete<llvm::MemoryBuffer>>, mlir::PassPipelineCLParser const&, mlir::DialectRegistry&, bool, bool, bool, bool, bool, bool, bool, bool) (llvm-project-fd37b4b38d77a0b788695d839ee2b8c07732fb5d/build/bin/mlir-opt+0x194c956)
#17 0x0000563d2221944b mlir::MlirOptMain(int, char**, llvm::StringRef, mlir::DialectRegistry&, bool) (llvm-project-fd37b4b38d77a0b788695d839ee2b8c07732fb5d/build/bin/mlir-opt+0x194e44b)
#18 0x0000563d20ab0430 main (llvm-project-fd37b4b38d77a0b788695d839ee2b8c07732fb5d/build/bin/mlir-opt+0x1e5430)
#19 0x00007f7bdd1b8c87 __libc_start_main /build/glibc-CVJwZb/glibc-2.27/csu/../csu/libc-start.c:344:0
#20 0x0000563d20ac2eaa _start (llvm-project-fd37b4b38d77a0b788695d839ee2b8c07732fb5d/build/bin/mlir-opt+0x1f7eaa)
Segmentation fault (core dumped)

Metadata

Metadata

Assignees

Labels

crashPrefer [crash-on-valid] or [crash-on-invalid]mlir:affine

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions