Issue 202787
Summary [mlir][sparsetensor] mlir-opt reaches unreachable code at CodegenUtils.cpp:138.
Labels
Assignees
Reporter Aran-414
    git version: d33b8093ce336b92d01f55033aed7021f5244eec

MLIR Program:
```mlir
#map = affine_map<(d0) -> (0, d0)>
#map1 = affine_map<(d0) -> (d0)>
#sparse = #sparse_tensor.encoding<{ map = (d0) -> (d0 : compressed) }>
module {
  func.func @main(%arg0: tensor<1x77xi1>, %arg1: tensor<1x77xi1>) -> tensor<77xi1, #sparse> {
    %0 = tensor.empty() : tensor<77xi1, #sparse>
    %1 = linalg.generic {indexing_maps = [#map, #map, #map1], iterator_types = ["parallel"]} ins(%arg0, %arg1 : tensor<1x77xi1>, tensor<1x77xi1>) outs(%0 : tensor<77xi1, #sparse>) {
 ^bb0(%in: i1, %in_0: i1, %out: i1):
      %2 = arith.addi %in, %in_0 : i1
 linalg.yield %2 : i1
    } -> tensor<77xi1, #sparse>
    return %1 : tensor<77xi1, #sparse>
  }
}
```

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

StackTrace:
```
Unknown primary type
UNREACHABLE executed at /data2/dependency/dev/llvm-project/mlir/lib/Dialect/SparseTensor/Transforms/Utils/CodegenUtils.cpp:138!
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-conversion a.mlir
 #0 0x000055f14b223bcf llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/data2/dependency/dev/llvm-project/build/bin/mlir-opt+0x25ccbcf)
 #1 0x000055f14b22029c llvm::sys::RunSignalHandlers() (/data2/dependency/dev/llvm-project/build/bin/mlir-opt+0x25c929c)
 #2 0x000055f14b220437 SignalHandler(int, siginfo_t*, void*) Signals.cpp:0:0
 #3 0x00007ff771414420 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x14420)
 #4 0x00007ff770eff00b raise (/lib/x86_64-linux-gnu/libc.so.6+0x4300b)
 #5 0x00007ff770ede859 abort (/lib/x86_64-linux-gnu/libc.so.6+0x22859)
 #6 0x000055f14b200cbe (/data2/dependency/dev/llvm-project/build/bin/mlir-opt+0x25a9cbe)
 #7 0x000055f14bfe279e mlir::sparse_tensor::primaryTypeEncoding(mlir::Type) (/data2/dependency/dev/llvm-project/build/bin/mlir-opt+0x338b79e)
 #8 0x000055f14c059b96 (anonymous namespace)::NewCallParams::genBuffers(mlir::sparse_tensor::SparseTensorType, llvm::ArrayRef<mlir::Value>, mlir::Value) SparseTensorConversion.cpp:0:0
 #9 0x000055f14c0605a4 (anonymous namespace)::SparseTensorEmptyConverter::matchAndRewrite(mlir::tensor::EmptyOp, mlir::tensor::EmptyOpAdaptor, mlir::ConversionPatternRewriter&) const SparseTensorConversion.cpp:0:0
#10 0x000055f14c055317 llvm::LogicalResult mlir::ConversionPattern::dispatchTo1To1<mlir::OpConversionPattern<mlir::tensor::EmptyOp>, mlir::tensor::EmptyOp>(mlir::OpConversionPattern<mlir::tensor::EmptyOp> const&, mlir::tensor::EmptyOp, mlir::tensor::EmptyOp::GenericAdaptor<llvm::ArrayRef<mlir::ValueRange>>, mlir::ConversionPatternRewriter&) (/data2/dependency/dev/llvm-project/build/bin/mlir-opt+0x33fe317)
#11 0x000055f14c055409 mlir::OpConversionPattern<mlir::tensor::EmptyOp>::matchAndRewrite(mlir::Operation*, llvm::ArrayRef<mlir::ValueRange>, mlir::ConversionPatternRewriter&) const (/data2/dependency/dev/llvm-project/build/bin/mlir-opt+0x33fe409)
#12 0x000055f153f04368 mlir::ConversionPattern::matchAndRewrite(mlir::Operation*, mlir::PatternRewriter&) const (/data2/dependency/dev/llvm-project/build/bin/mlir-opt+0xb2ad368)
#13 0x000055f153f4b232 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
#14 0x000055f153f4c728 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+0xb2f5728)
#15 0x000055f153efef2b (anonymous namespace)::OperationLegalizer::legalize(mlir::Operation*) DialectConversion.cpp:0:0
#16 0x000055f153eff426 mlir::OperationConverter::convert(mlir::Operation*, bool) (/data2/dependency/dev/llvm-project/build/bin/mlir-opt+0xb2a8426)
#17 0x000055f153f0a42a mlir::OperationConverter::applyConversion(llvm::ArrayRef<mlir::Operation*>) (/data2/dependency/dev/llvm-project/build/bin/mlir-opt+0xb2b342a)
#18 0x000055f153f0bd18 applyConversion(llvm::ArrayRef<mlir::Operation*>, mlir::ConversionTarget const&, mlir::FrozenRewritePatternSet const&, mlir::ConversionConfig, (anonymous namespace)::OpConversionMode) DialectConversion.cpp:0:0
#19 0x000055f153f0bef6 mlir::applyPartialConversion(mlir::Operation*, mlir::ConversionTarget const&, mlir::FrozenRewritePatternSet const&, mlir::ConversionConfig) (/data2/dependency/dev/llvm-project/build/bin/mlir-opt+0xb2b4ef6)
#20 0x000055f14bfa65c7 (anonymous namespace)::SparseTensorConversionPass::runOnOperation() SparseTensorPasses.cpp:0:0
#21 0x000055f153fb7f01 mlir::detail::OpToOpPassAdaptor::run(mlir::Pass*, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int) (/data2/dependency/dev/llvm-project/build/bin/mlir-opt+0xb360f01)
#22 0x000055f153fb8290 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+0xb361290)
#23 0x000055f153fba344 mlir::PassManager::runPasses(mlir::Operation*, mlir::AnalysisManager) (/data2/dependency/dev/llvm-project/build/bin/mlir-opt+0xb363344)
#24 0x000055f153fbb3d1 mlir::PassManager::run(mlir::Operation*) (/data2/dependency/dev/llvm-project/build/bin/mlir-opt+0xb3643d1)
#25 0x000055f14b2eb3cb performActions(llvm::raw_ostream&, std::shared_ptr<llvm::SourceMgr> const&, mlir::MLIRContext*, mlir::MlirOptMainConfig const&) MlirOptMain.cpp:0:0
#26 0x000055f14b2ebe73 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
#27 0x000055f14b2ec0fb 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
#28 0x000055f154396e45 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+0xb73fe45)
#29 0x000055f14b2e1f54 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
#30 0x000055f14b2ec617 mlir::MlirOptMain(int, char**, llvm::StringRef, llvm::StringRef, mlir::DialectRegistry&) (/data2/dependency/dev/llvm-project/build/bin/mlir-opt+0x2695617)
#31 0x000055f14b2ec853 mlir::MlirOptMain(int, char**, llvm::StringRef, mlir::DialectRegistry&) (/data2/dependency/dev/llvm-project/build/bin/mlir-opt+0x2695853)
#32 0x000055f14b121adc main (/data2/dependency/dev/llvm-project/build/bin/mlir-opt+0x24caadc)
#33 0x00007ff770ee0083 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x24083)
#34 0x000055f14b2000ce _start (/data2/dependency/dev/llvm-project/build/bin/mlir-opt+0x25a90ce)
Aborted (core dumped)
```
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to