Issue 203225
Summary [mlir][sparse_tensor] mlir-opt crashes at ArrayRef.h:247 with assertion `Index < Length && "Invalid index!"' failed.
Labels mlir
Assignees
Reporter Aran-414
    git version: e6db723ce7b1e43327d265081f7e5818194569a0

MLIR Program:
```mlir
#sparse = #sparse_tensor.encoding<{ map = (d0, d1) -> (d0 floordiv 2 : dense, d1 floordiv 2 : compressed, d0 mod 2 : dense, d1 mod 2 : dense) }>
module {
  func.func @sparse_assemble_reinterpret_map(%arg0: tensor<?xf64>, %arg1: tensor<?xindex>, %arg2: tensor<?xindex>) -> tensor<2x4xf64, #sparse> {
    %0 = sparse_tensor.assemble (%arg1, %arg2), %arg0 : (tensor<?xindex>, tensor<?xindex>), tensor<?xf64> to tensor<2x4xf64, #sparse>
    return %0 : tensor<2x4xf64, #sparse>
  }
}
```

Reproduce Command: `mlir-opt -sparse-tensor-codegen a.mlir`

StackTrace:
```
mlir-opt: /data2/dependency/dev/llvm-project/llvm/include/llvm/ADT/ArrayRef.h:247: const T& llvm::ArrayRef<T>::operator[](size_t) const [with T = long int; size_t = long unsigned int]: Assertion `Index < Length && "Invalid index!"' failed.
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace and instructions to reproduce the bug.
Stack dump:
0.      Program arguments: /data2/dependency/dev/llvm-project/build/bin/mlir-opt -sparse-tensor-codegen a.mlir
 #0 0x000055b1cfd06dbf llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/data2/dependency/dev/llvm-project/build/bin/mlir-opt+0x25d9dbf)
 #1 0x000055b1cfd0348c llvm::sys::RunSignalHandlers() (/data2/dependency/dev/llvm-project/build/bin/mlir-opt+0x25d648c)
 #2 0x000055b1cfd03627 SignalHandler(int, siginfo_t*, void*) Signals.cpp:0:0
 #3 0x00007fa40034d420 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x14420)
 #4 0x00007fa3ffe3800b raise (/lib/x86_64-linux-gnu/libc.so.6+0x4300b)
 #5 0x00007fa3ffe17859 abort (/lib/x86_64-linux-gnu/libc.so.6+0x22859)
 #6 0x00007fa3ffe17729 (/lib/x86_64-linux-gnu/libc.so.6+0x22729)
 #7 0x00007fa3ffe28fd6 (/lib/x86_64-linux-gnu/libc.so.6+0x33fd6)
 #8 0x000055b1d0b30920 (anonymous namespace)::SparseAssembleOpConverter::matchAndRewrite(mlir::sparse_tensor::AssembleOp, mlir::sparse_tensor::AssembleOpAdaptor, mlir::ConversionPatternRewriter&) const SparseTensorCodegen.cpp:0:0
 #9 0x000055b1d0b388c7 llvm::LogicalResult mlir::ConversionPattern::dispatchTo1To1<mlir::OpConversionPattern<mlir::sparse_tensor::AssembleOp>, mlir::sparse_tensor::AssembleOp>(mlir::OpConversionPattern<mlir::sparse_tensor::AssembleOp> const&, mlir::sparse_tensor::AssembleOp, mlir::sparse_tensor::AssembleOp::GenericAdaptor<llvm::ArrayRef<mlir::ValueRange>>, mlir::ConversionPatternRewriter&) (/data2/dependency/dev/llvm-project/build/bin/mlir-opt+0x340b8c7)
#10 0x000055b1d0b389b9 mlir::OpConversionPattern<mlir::sparse_tensor::AssembleOp>::matchAndRewrite(mlir::Operation*, llvm::ArrayRef<mlir::ValueRange>, mlir::ConversionPatternRewriter&) const (/data2/dependency/dev/llvm-project/build/bin/mlir-opt+0x340b9b9)
#11 0x000055b1d8a123e8 mlir::ConversionPattern::matchAndRewrite(mlir::Operation*, mlir::PatternRewriter&) const (/data2/dependency/dev/llvm-project/build/bin/mlir-opt+0xb2e53e8)
#12 0x000055b1d8a59142 mlir::PatternApplicator::matchAndRewrite(mlir::Operation*, mlir::PatternRewriter&, llvm::function_ref<bool (mlir::Pattern const&)>, llvm::function_ref<void (mlir::Pattern const&)>, llvm::function_ref<llvm::LogicalResult (mlir::Pattern const&)>)::'lambda'()::operator()() const PatternApplicator.cpp:0:0
#13 0x000055b1d8a5a638 mlir::PatternApplicator::matchAndRewrite(mlir::Operation*, mlir::PatternRewriter&, llvm::function_ref<bool (mlir::Pattern const&)>, llvm::function_ref<void (mlir::Pattern const&)>, llvm::function_ref<llvm::LogicalResult (mlir::Pattern const&)>) (/data2/dependency/dev/llvm-project/build/bin/mlir-opt+0xb32d638)
#14 0x000055b1d8a0cfab (anonymous namespace)::OperationLegalizer::legalize(mlir::Operation*) DialectConversion.cpp:0:0
#15 0x000055b1d8a0d4a6 mlir::OperationConverter::convert(mlir::Operation*, bool) (/data2/dependency/dev/llvm-project/build/bin/mlir-opt+0xb2e04a6)
#16 0x000055b1d8a184aa mlir::OperationConverter::applyConversion(llvm::ArrayRef<mlir::Operation*>) (/data2/dependency/dev/llvm-project/build/bin/mlir-opt+0xb2eb4aa)
#17 0x000055b1d8a19da8 applyConversion(llvm::ArrayRef<mlir::Operation*>, mlir::ConversionTarget const&, mlir::FrozenRewritePatternSet const&, mlir::ConversionConfig, (anonymous namespace)::OpConversionMode) DialectConversion.cpp:0:0
#18 0x000055b1d8a19f86 mlir::applyPartialConversion(mlir::Operation*, mlir::ConversionTarget const&, mlir::FrozenRewritePatternSet const&, mlir::ConversionConfig) (/data2/dependency/dev/llvm-project/build/bin/mlir-opt+0xb2ecf86)
#19 0x000055b1d0a8a395 (anonymous namespace)::SparseTensorCodegenPass::runOnOperation() SparseTensorPasses.cpp:0:0
#20 0x000055b1d8ac5861 mlir::detail::OpToOpPassAdaptor::run(mlir::Pass*, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int) (/data2/dependency/dev/llvm-project/build/bin/mlir-opt+0xb398861)
#21 0x000055b1d8ac5bf0 mlir::detail::OpToOpPassAdaptor::runPipeline(mlir::OpPassManager&, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int, mlir::PassInstrumentor*, mlir::PassInstrumentation::PipelineParentInfo const*) (/data2/dependency/dev/llvm-project/build/bin/mlir-opt+0xb398bf0)
#22 0x000055b1d8ac7ca4 mlir::PassManager::runPasses(mlir::Operation*, mlir::AnalysisManager) (/data2/dependency/dev/llvm-project/build/bin/mlir-opt+0xb39aca4)
#23 0x000055b1d8ac8d31 mlir::PassManager::run(mlir::Operation*) (/data2/dependency/dev/llvm-project/build/bin/mlir-opt+0xb39bd31)
#24 0x000055b1cfdcd9ab performActions(llvm::raw_ostream&, std::shared_ptr<llvm::SourceMgr> const&, mlir::MLIRContext*, mlir::MlirOptMainConfig const&) MlirOptMain.cpp:0:0
#25 0x000055b1cfdce453 processBuffer(llvm::raw_ostream&, std::unique_ptr<llvm::MemoryBuffer, std::default_delete<llvm::MemoryBuffer>>, llvm::MemoryBufferRef, mlir::MlirOptMainConfig const&, mlir::DialectRegistry&, mlir::SourceMgrDiagnosticVerifierHandler*, llvm::ThreadPoolInterface*) MlirOptMain.cpp:0:0
#26 0x000055b1cfdce6db llvm::LogicalResult llvm::function_ref<llvm::LogicalResult (std::unique_ptr<llvm::MemoryBuffer, std::default_delete<llvm::MemoryBuffer>>, llvm::MemoryBufferRef const&, 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&)::'lambda'(std::unique_ptr<llvm::MemoryBuffer, std::default_delete<llvm::MemoryBuffer>>, llvm::MemoryBufferRef, llvm::raw_ostream&)>(long, std::unique_ptr<llvm::MemoryBuffer, std::default_delete<llvm::MemoryBuffer>>, llvm::MemoryBufferRef const&, llvm::raw_ostream&) MlirOptMain.cpp:0:0
#27 0x000055b1d8ea2a15 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::MemoryBufferRef const&, llvm::raw_ostream&)>, llvm::raw_ostream&, llvm::StringRef, llvm::StringRef) (/data2/dependency/dev/llvm-project/build/bin/mlir-opt+0xb775a15)
#28 0x000055b1cfdc4384 mlir::MlirOptMain(llvm::raw_ostream&, std::unique_ptr<llvm::MemoryBuffer, std::default_delete<llvm::MemoryBuffer>>, mlir::DialectRegistry&, mlir::MlirOptMainConfig const&) (.part.0) MlirOptMain.cpp:0:0
#29 0x000055b1cfdcebf7 mlir::MlirOptMain(int, char**, llvm::StringRef, llvm::StringRef, mlir::DialectRegistry&) (/data2/dependency/dev/llvm-project/build/bin/mlir-opt+0x26a1bf7)
#30 0x000055b1cfdcee33 mlir::MlirOptMain(int, char**, llvm::StringRef, mlir::DialectRegistry&) (/data2/dependency/dev/llvm-project/build/bin/mlir-opt+0x26a1e33)
#31 0x000055b1cfc04abc main (/data2/dependency/dev/llvm-project/build/bin/mlir-opt+0x24d7abc)
#32 0x00007fa3ffe19083 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x24083)
#33 0x000055b1cfce32be _start (/data2/dependency/dev/llvm-project/build/bin/mlir-opt+0x25b62be)
Aborted (core dumped)
```
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to