Issue 128804
Summary [MLIR] Assertion `getImpl() && "Uninitialized SparseTensorEncodingAttr"' failed.
Labels mlir
Assignees
Reporter RiRi114
    Test on commit:0f9720a6

steps to reproduce:
`mlir-opt  temp.mlir    -sparse-tensor-codegen `

test case:
```mlir
#sparse = #sparse_tensor.encoding<{ map = (d0, d1) -> (d0 : dense, d1 : compressed) }>
func.func @sparse_tensor_demo(%arg0: tensor<128x64xf32, #sparse>) -> tensor<128x64xf32> {
  %0 = sparse_tensor.convert %arg0 : tensor<128x64xf32, #sparse> to tensor<128x64xf32>
  %1 = linalg.generic {
    indexing_maps = [
      affine_map<(i, j) -> (i, j)>,  // input
      affine_map<(i, j) -> (i, j)>   // output
    ],
    iterator_types = ["parallel", "parallel"]
  }
  ins(%arg0: tensor<128x64xf32, #sparse>)
  outs(%0: tensor<128x64xf32>) {
    ^bb(%a: f32, %b: f32):
      %sum = arith.addf %a, %b : f32
      linalg.yield %sum : f32
  } -> tensor<128x64xf32>
  
  return %1 : tensor<128x64xf32>
}
```

crash trace:
```
mlir-opt: /home/fuzzing/llvm-project/mlir/lib/Dialect/SparseTensor/IR/SparseTensorDialect.cpp:462: bool mlir::sparse_tensor::SparseTensorEncodingAttr::isSlice() const: Assertion `getImpl() && "Uninitialized SparseTensorEncodingAttr"' failed.
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
Stack dump:
0.      Program arguments: /home/fuzzing/llvm-project/build/bin/mlir-opt temp.mlir -sparse-tensor-codegen
 #0 0x000000000113ce77 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/home/fuzzing/llvm-project/build/bin/mlir-opt+0x113ce77)
 #1 0x000000000113aa0e llvm::sys::RunSignalHandlers() (/home/fuzzing/llvm-project/build/bin/mlir-opt+0x113aa0e)
 #2 0x000000000113d855 SignalHandler(int, siginfo_t*, void*) Signals.cpp:0:0
 #3 0x00007c3974382520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)
 #4 0x00007c39743d69fc pthread_kill (/lib/x86_64-linux-gnu/libc.so.6+0x969fc)
 #5 0x00007c3974382476 gsignal (/lib/x86_64-linux-gnu/libc.so.6+0x42476)
 #6 0x00007c39743687f3 abort (/lib/x86_64-linux-gnu/libc.so.6+0x287f3)
 #7 0x00007c397436871b (/lib/x86_64-linux-gnu/libc.so.6+0x2871b)
 #8 0x00007c3974379e96 (/lib/x86_64-linux-gnu/libc.so.6+0x39e96)
 #9 0x00000000031b9ae2 (/home/fuzzing/llvm-project/build/bin/mlir-opt+0x31b9ae2)
#10 0x000000000331e647 (anonymous namespace)::SparseConvertConverter::matchAndRewrite(mlir::sparse_tensor::ConvertOp, mlir::sparse_tensor::ConvertOpGenericAdaptor<llvm::ArrayRef<mlir::ValueRange> >, mlir::ConversionPatternRewriter&) const SparseTensorCodegen.cpp:0:0
#11 0x000000000331e31b mlir::OpConversionPattern<mlir::sparse_tensor::ConvertOp>::matchAndRewrite(mlir::Operation*, llvm::ArrayRef<mlir::ValueRange>, mlir::ConversionPatternRewriter&) const (/home/fuzzing/llvm-project/build/bin/mlir-opt+0x331e31b)
#12 0x00000000042a5af6 mlir::ConversionPattern::matchAndRewrite(mlir::Operation*, mlir::PatternRewriter&) const (/home/fuzzing/llvm-project/build/bin/mlir-opt+0x42a5af6)
#13 0x0000000006a1e891 void llvm::function_ref<void ()>::callback_fn<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&)>)::$_2>(long) PatternApplicator.cpp:0:0
#14 0x0000000006a1b28f 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&)>) (/home/fuzzing/llvm-project/build/bin/mlir-opt+0x6a1b28f)
#15 0x00000000042a6bb2 (anonymous namespace)::OperationLegalizer::legalize(mlir::Operation*, mlir::ConversionPatternRewriter&) DialectConversion.cpp:0:0
#16 0x00000000042a5c27 mlir::OperationConverter::convert(mlir::ConversionPatternRewriter&, mlir::Operation*) (/home/fuzzing/llvm-project/build/bin/mlir-opt+0x42a5c27)
#17 0x00000000042a6dcf mlir::OperationConverter::convertOperations(llvm::ArrayRef<mlir::Operation*>) (/home/fuzzing/llvm-project/build/bin/mlir-opt+0x42a6dcf)
#18 0x00000000042ad1eb mlir::applyPartialConversion(mlir::Operation*, mlir::ConversionTarget const&, mlir::FrozenRewritePatternSet const&, mlir::ConversionConfig) (/home/fuzzing/llvm-project/build/bin/mlir-opt+0x42ad1eb)
#19 0x000000000326b18b (anonymous namespace)::SparseTensorCodegenPass::runOnOperation() SparseTensorPasses.cpp:0:0
#20 0x00000000042452f7 mlir::detail::OpToOpPassAdaptor::run(mlir::Pass*, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int) (/home/fuzzing/llvm-project/build/bin/mlir-opt+0x42452f7)
#21 0x0000000004245b61 mlir::detail::OpToOpPassAdaptor::runPipeline(mlir::OpPassManager&, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int, mlir::PassInstrumentor*, mlir::PassInstrumentation::PipelineParentInfo const*) (/home/fuzzing/llvm-project/build/bin/mlir-opt+0x4245b61)
#22 0x000000000424825b mlir::PassManager::run(mlir::Operation*) (/home/fuzzing/llvm-project/build/bin/mlir-opt+0x424825b)
#23 0x00000000042408af performActions(llvm::raw_ostream&, std::shared_ptr<llvm::SourceMgr> const&, mlir::MLIRContext*, mlir::MlirOptMainConfig const&) MlirOptMain.cpp:0:0
#24 0x0000000004240503 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&)::$_3>(long, std::unique_ptr<llvm::MemoryBuffer, std::default_delete<llvm::MemoryBuffer> >, llvm::raw_ostream&) MlirOptMain.cpp:0:0
#25 0x00000000042ec4e8 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) (/home/fuzzing/llvm-project/build/bin/mlir-opt+0x42ec4e8)
#26 0x000000000423a151 mlir::MlirOptMain(llvm::raw_ostream&, std::unique_ptr<llvm::MemoryBuffer, std::default_delete<llvm::MemoryBuffer> >, mlir::DialectRegistry&, mlir::MlirOptMainConfig const&) (/home/fuzzing/llvm-project/build/bin/mlir-opt+0x423a151)
#27 0x000000000423a403 mlir::MlirOptMain(int, char**, llvm::StringRef, llvm::StringRef, mlir::DialectRegistry&) (/home/fuzzing/llvm-project/build/bin/mlir-opt+0x423a403)
#28 0x000000000423a612 mlir::MlirOptMain(int, char**, llvm::StringRef, mlir::DialectRegistry&) (/home/fuzzing/llvm-project/build/bin/mlir-opt+0x423a612)
#29 0x000000000111a8d7 main (/home/fuzzing/llvm-project/build/bin/mlir-opt+0x111a8d7)
#30 0x00007c3974369d90 (/lib/x86_64-linux-gnu/libc.so.6+0x29d90)
#31 0x00007c3974369e40 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x29e40)
#32 0x000000000111a435 _start (/home/fuzzing/llvm-project/build/bin/mlir-opt+0x111a435)
Aborted (core dumped)
```
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to