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]-pass-pipeline="builtin.module(func.func(convert-affine-for-to-gpu{gpu-block-dims=1 gpu-thread-dims=0}))" triggers Assertion Failure `use_empty() && "Cannot destroy a value that still has uses!"' #116044

Open
xisang0 opened this issue Nov 13, 2024 · 0 comments
Labels
crash Prefer [crash-on-valid] or [crash-on-invalid] mlir

Comments

@xisang0
Copy link

xisang0 commented Nov 13, 2024

Test on commit: 38fffa6
steps to reproduce:

mlir-opt test.mlir -pass-pipeline="builtin.module(func.func(convert-affine-for-to-gpu{gpu-block-dims=1 gpu-thread-dims=0}))"

test case:

module {
  func.func @main() {
    %alloca = memref.alloca() : memref<1024xf32>
    %c10 = arith.constant 10 : index
    %cst = arith.constant 0.000000e+00 : f32
    %1 = affine.for %arg0 = 0 to %c10 iter_args(%arg1 = %cst) -> (f32) {
      %6 = affine.load %alloca[%arg0] : memref<1024xf32>
      %7 = arith.addf %arg1, %6 : f32
      affine.yield %7 : f32
    }
    return
  }
}

crash trace:

mlir-opt: /home/workdir/llvm-project-19/mlir/include/mlir/IR/UseDefLists.h:198: mlir::IRObjectWithUseList<mlir::OpOperand>::~IRObjectWithUseList() [OperandType = mlir::OpOperand]: Assertion `use_empty() && "Cannot destroy a value that still has uses!"' failed.
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 /home/workdir/test.mlir "-pass-pipeline=builtin.module(func.func(convert-affine-for-to-gpu{gpu-block-dims=1 gpu-thread-dims=0}))"
 #0 0x000055f467484258 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (./mlir-opt+0x1068258)
 #1 0x000055f467481d7e llvm::sys::RunSignalHandlers() (./mlir-opt+0x1065d7e)
 #2 0x000055f467484c68 SignalHandler(int) Signals.cpp:0:0
 #3 0x000073597db55520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)
 #4 0x000073597dba99fc pthread_kill (/lib/x86_64-linux-gnu/libc.so.6+0x969fc)
 #5 0x000073597db55476 gsignal (/lib/x86_64-linux-gnu/libc.so.6+0x42476)
 #6 0x000073597db3b7f3 abort (/lib/x86_64-linux-gnu/libc.so.6+0x287f3)
 #7 0x000073597db3b71b (/lib/x86_64-linux-gnu/libc.so.6+0x2871b)
 #8 0x000073597db4ce96 (/lib/x86_64-linux-gnu/libc.so.6+0x39e96)
 #9 0x000055f46a7973a7 mlir::Block::~Block() (./mlir-opt+0x437b3a7)
#10 0x000055f46a86b0a6 llvm::iplist_impl<llvm::simple_ilist<mlir::Block>, llvm::ilist_traits<mlir::Block>>::erase(llvm::ilist_iterator<llvm::ilist_detail::node_options<mlir::Block, true, false, void, false, void>, false, false>) (./mlir-opt+0x444f0a6)
#11 0x000055f46a869b9b mlir::Region::~Region() (./mlir-opt+0x444db9b)
#12 0x000055f46a8565a8 mlir::Operation::~Operation() (./mlir-opt+0x443a5a8)
#13 0x000055f46a85e7f2 llvm::iplist_impl<llvm::simple_ilist<mlir::Operation>, llvm::ilist_traits<mlir::Operation>>::erase(llvm::ilist_iterator<llvm::ilist_detail::node_options<mlir::Operation, true, false, void, false, void>, false, false>) (./mlir-opt+0x44427f2)
#14 0x000055f469fe3691 mlir::convertAffineLoopNestToGPULaunch(mlir::affine::AffineForOp, unsigned int, unsigned int) (./mlir-opt+0x3bc7691)
#15 0x000055f469fe1f01 (anonymous namespace)::ForLoopMapper::runOnOperation() SCFToGPUPass.cpp:0:0
#16 0x000055f46a6b7b1f mlir::detail::OpToOpPassAdaptor::run(mlir::Pass*, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int) (./mlir-opt+0x429bb1f)
#17 0x000055f46a6b8302 mlir::detail::OpToOpPassAdaptor::runPipeline(mlir::OpPassManager&, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int, mlir::PassInstrumentor*, mlir::PassInstrumentation::PipelineParentInfo const*) (./mlir-opt+0x429c302)
#18 0x000055f46a6bda1e auto void mlir::parallelForEach<__gnu_cxx::__normal_iterator<mlir::detail::OpToOpPassAdaptor::runOnOperationAsyncImpl(bool)::OpPMInfo*, std::vector<mlir::detail::OpToOpPassAdaptor::runOnOperationAsyncImpl(bool)::OpPMInfo, std::allocator<mlir::detail::OpToOpPassAdaptor::runOnOperationAsyncImpl(bool)::OpPMInfo>>>, mlir::detail::OpToOpPassAdaptor::runOnOperationAsyncImpl(bool)::$_0>(mlir::MLIRContext*, __gnu_cxx::__normal_iterator<mlir::detail::OpToOpPassAdaptor::runOnOperationAsyncImpl(bool)::OpPMInfo*, std::vector<mlir::detail::OpToOpPassAdaptor::runOnOperationAsyncImpl(bool)::OpPMInfo, std::allocator<mlir::detail::OpToOpPassAdaptor::runOnOperationAsyncImpl(bool)::OpPMInfo>>>, __gnu_cxx::__normal_iterator<mlir::detail::OpToOpPassAdaptor::runOnOperationAsyncImpl(bool)::OpPMInfo*, std::vector<mlir::detail::OpToOpPassAdaptor::runOnOperationAsyncImpl(bool)::OpPMInfo, std::allocator<mlir::detail::OpToOpPassAdaptor::runOnOperationAsyncImpl(bool)::OpPMInfo>>>, mlir::detail::OpToOpPassAdaptor::runOnOperationAsyncImpl(bool)::$_0&&)::'lambda'(__gnu_cxx::__normal_iterator<mlir::detail::OpToOpPassAdaptor::runOnOperationAsyncImpl(bool)::OpPMInfo*, std::vector<mlir::detail::OpToOpPassAdaptor::runOnOperationAsyncImpl(bool)::OpPMInfo, std::allocator<mlir::detail::OpToOpPassAdaptor::runOnOperationAsyncImpl(bool)::OpPMInfo>>>&&)::operator()<mlir::detail::OpToOpPassAdaptor::runOnOperationAsyncImpl(bool)::OpPMInfo&>(__gnu_cxx::__normal_iterator<mlir::detail::OpToOpPassAdaptor::runOnOperationAsyncImpl(bool)::OpPMInfo*, std::vector<mlir::detail::OpToOpPassAdaptor::runOnOperationAsyncImpl(bool)::OpPMInfo, std::allocator<mlir::detail::OpToOpPassAdaptor::runOnOperationAsyncImpl(bool)::OpPMInfo>>>&&) const Pass.cpp:0:0
#19 0x000055f46a6b9b0b mlir::detail::OpToOpPassAdaptor::runOnOperationAsyncImpl(bool) (./mlir-opt+0x429db0b)
#20 0x000055f46a6b7c7c mlir::detail::OpToOpPassAdaptor::run(mlir::Pass*, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int) (./mlir-opt+0x429bc7c)
#21 0x000055f46a6b8302 mlir::detail::OpToOpPassAdaptor::runPipeline(mlir::OpPassManager&, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int, mlir::PassInstrumentor*, mlir::PassInstrumentation::PipelineParentInfo const*) (./mlir-opt+0x429c302)
#22 0x000055f46a6baaae mlir::PassManager::run(mlir::Operation*) (./mlir-opt+0x429eaae)
#23 0x000055f46a6b35d2 performActions(llvm::raw_ostream&, std::shared_ptr<llvm::SourceMgr> const&, mlir::MLIRContext*, mlir::MlirOptMainConfig const&) MlirOptMain.cpp:0:0
#24 0x000055f46a6b323b llvm::LogicalResult llvm::function_ref<llvm::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>>, mlir::DialectRegistry&, mlir::MlirOptMainConfig const&)::$_0>(long, std::unique_ptr<llvm::MemoryBuffer, std::default_delete<llvm::MemoryBuffer>>, llvm::raw_ostream&) MlirOptMain.cpp:0:0
#25 0x000055f46a75cf25 mlir::splitAndProcessBuffer(std::unique_ptr<llvm::MemoryBuffer, std::default_delete<llvm::MemoryBuffer>>, llvm::function_ref<llvm::LogicalResult (std::unique_ptr<llvm::MemoryBuffer, std::default_delete<llvm::MemoryBuffer>>, llvm::raw_ostream&)>, llvm::raw_ostream&, llvm::StringRef, llvm::StringRef) (./mlir-opt+0x4340f25)
#26 0x000055f46a6ae432 mlir::MlirOptMain(llvm::raw_ostream&, std::unique_ptr<llvm::MemoryBuffer, std::default_delete<llvm::MemoryBuffer>>, mlir::DialectRegistry&, mlir::MlirOptMainConfig const&) (./mlir-opt+0x4292432)
#27 0x000055f46a6ae6e3 mlir::MlirOptMain(int, char**, llvm::StringRef, llvm::StringRef, mlir::DialectRegistry&) (./mlir-opt+0x42926e3)
#28 0x000055f46a6ae8f2 mlir::MlirOptMain(int, char**, llvm::StringRef, mlir::DialectRegistry&) (./mlir-opt+0x42928f2)
#29 0x000055f467463477 main (./mlir-opt+0x1047477)
#30 0x000073597db3cd90 (/lib/x86_64-linux-gnu/libc.so.6+0x29d90)
#31 0x000073597db3ce40 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x29e40)
#32 0x000055f467462fe5 _start (./mlir-opt+0x1046fe5)
Aborted (core dumped)
@github-actions github-actions bot added the mlir label Nov 13, 2024
@EugeneZelenko EugeneZelenko added the crash Prefer [crash-on-valid] or [crash-on-invalid] label Nov 13, 2024
@xisang0 xisang0 changed the title [MLIR]-pass-pipeline="builtin.module(func.func(convert-affine-for-to-gpu{gpu-block-dims=1 gpu-thread-dims=0}))" triggers Assertion Failure `use_empty() && "Cannot destroy a value that still has uses!"' [MLIR]-pass-pipeline="builtin.module(func.func(convert-affine-for-to-gpu{gpu-block-dims=1 gpu-thread-dims=0}))" triggers Assertion Failure `use_empty() && "Cannot destroy a value that still has uses!"' Nov 15, 2024
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

2 participants