| Issue |
177820
|
| Summary |
mlir-opt --sparse-tensor-codegen crashes on ConvertOp with uninitialized SparseTensorEncodingAttr
|
| Labels |
new issue
|
| Assignees |
|
| Reporter |
Subway2023
|
# Description
Running mlir-opt --sparse-tensor-codegen on a module containing a sparse_tensor.convert op crashes with the following assertion
# Reproduce
mlir-opt version: 22.1.0-rc1
location: If the **sparse_tensor.convert** is commented out, the crash no longer occurs
```
module {
func.func @main() {
%0 = gpu.cluster_dim x
%1 = shape.const_witness true
%2 = tensor.generate %0 {
^bb0(%arg0: index):
%3 = arith.index_cast %arg0 : index to i32
%4 = arith.sitofp %3 : i32 to f64
tensor.yield %4 : f64
} : tensor<?xf64>
%3 = sparse_tensor.convert %2 : tensor<?xf64> to tensor<?xf64, #sparse_tensor.encoding<{ map = (d0) -> (d0 : dense) }>>
return
}
}
```
```
mlir-opt --sparse-tensor-codegen test.mlir
```
```
mlir-opt: /mnt/sdd1/mlir/tool/llvm-project-llvmorg-22.1.0-rc1/mlir/lib/Dialect/SparseTensor/IR/SparseTensorDialect.cpp:346: mlir::sparse_tensor::SparseTensorEncodingAttr mlir::sparse_tensor::SparseTensorEncodingAttr::withBitWidths(unsigned int, unsigned int) const: Assertion `getImpl() && "Uninitialized SparseTensorEncodingAttr"' 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: /mnt/sdd1/sbw/mlir/tool/llvmorg-22.1.0-install/bin/mlir-opt --sparse-tensor-codegen /mnt/sdd1/sbw/mlir/data/genProgram_0103/031546_2122/mlir_steps/031546_2122_5.mlir
#0 0x0000599e9491ce32 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/mnt/sdd1/sbw/mlir/tool/llvmorg-22.1.0-install/bin/mlir-opt+0x252fe32)
#1 0x0000599e949195af llvm::sys::RunSignalHandlers() (/mnt/sdd1/sbw/mlir/tool/llvmorg-22.1.0-install/bin/mlir-opt+0x252c5af)
#2 0x0000599e949196fc SignalHandler(int, siginfo_t*, void*) Signals.cpp:0:0
#3 0x0000770952445330 (/lib/x86_64-linux-gnu/libc.so.6+0x45330)
#4 0x000077095249eb2c __pthread_kill_implementation ./nptl/pthread_kill.c:44:76
#5 0x000077095249eb2c __pthread_kill_internal ./nptl/pthread_kill.c:78:10
#6 0x000077095249eb2c pthread_kill ./nptl/pthread_kill.c:89:10
#7 0x000077095244527e raise ./signal/../sysdeps/posix/raise.c:27:6
#8 0x00007709524288ff abort ./stdlib/abort.c:81:7
#9 0x000077095242881b _nl_load_domain ./intl/loadmsgcat.c:1177:9
#10 0x000077095243b517 (/lib/x86_64-linux-gnu/libc.so.6+0x3b517)
#11 0x0000599e9ad650d6 (/mnt/sdd1/sbw/mlir/tool/llvmorg-22.1.0-install/bin/mlir-opt+0x89780d6)
#12 0x0000599e95611f7e (anonymous namespace)::SparseConvertConverter::matchAndRewrite(mlir::sparse_tensor::ConvertOp, mlir::sparse_tensor::ConvertOpGenericAdaptor<llvm::ArrayRef<mlir::ValueRange>>, mlir::ConversionPatternRewriter&) const SparseTensorCodegen.cpp:0:0
#13 0x0000599e956073ac mlir::OpConversionPattern<mlir::sparse_tensor::ConvertOp>::matchAndRewrite(mlir::Operation*, llvm::ArrayRef<mlir::ValueRange>, mlir::ConversionPatternRewriter&) const (/mnt/sdd1/sbw/mlir/tool/llvmorg-22.1.0-install/bin/mlir-opt+0x321a3ac)
#14 0x0000599e9c0fa32e mlir::ConversionPattern::matchAndRewrite(mlir::Operation*, mlir::PatternRewriter&) const (/mnt/sdd1/sbw/mlir/tool/llvmorg-22.1.0-install/bin/mlir-opt+0x9d0d32e)
#15 0x0000599e9c147e03 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
#16 0x0000599e9c1493af 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&)>) (/mnt/sdd1/sbw/mlir/tool/llvmorg-22.1.0-install/bin/mlir-opt+0x9d5c3af)
#17 0x0000599e9c0f547c (anonymous namespace)::OperationLegalizer::legalize(mlir::Operation*) DialectConversion.cpp:0:0
#18 0x0000599e9c0f5944 mlir::OperationConverter::convert(mlir::Operation*, bool) (/mnt/sdd1/sbw/mlir/tool/llvmorg-22.1.0-install/bin/mlir-opt+0x9d08944)
#19 0x0000599e9c0feb16 mlir::OperationConverter::applyConversion(llvm::ArrayRef<mlir::Operation*>) (/mnt/sdd1/sbw/mlir/tool/llvmorg-22.1.0-install/bin/mlir-opt+0x9d11b16)
#20 0x0000599e9c1012ab applyConversion(llvm::ArrayRef<mlir::Operation*>, mlir::ConversionTarget const&, mlir::FrozenRewritePatternSet const&, mlir::ConversionConfig, (anonymous namespace)::OpConversionMode) DialectConversion.cpp:0:0
#21 0x0000599e9c10144f mlir::applyPartialConversion(mlir::Operation*, mlir::ConversionTarget const&, mlir::FrozenRewritePatternSet const&, mlir::ConversionConfig) (/mnt/sdd1/sbw/mlir/tool/llvmorg-22.1.0-install/bin/mlir-opt+0x9d1444f)
#22 0x0000599e9556a8f8 (anonymous namespace)::SparseTensorCodegenPass::runOnOperation() SparseTensorPasses.cpp:0:0
#23 0x0000599e9c1bc756 mlir::detail::OpToOpPassAdaptor::run(mlir::Pass*, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int) (/mnt/sdd1/sbw/mlir/tool/llvmorg-22.1.0-install/bin/mlir-opt+0x9dcf756)
#24 0x0000599e9c1bca8e mlir::detail::OpToOpPassAdaptor::runPipeline(mlir::OpPassManager&, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int, mlir::PassInstrumentor*, mlir::PassInstrumentation::PipelineParentInfo const*) (/mnt/sdd1/sbw/mlir/tool/llvmorg-22.1.0-install/bin/mlir-opt+0x9dcfa8e)
#25 0x0000599e9c1bd1e2 mlir::PassManager::runPasses(mlir::Operation*, mlir::AnalysisManager) (/mnt/sdd1/sbw/mlir/tool/llvmorg-22.1.0-install/bin/mlir-opt+0x9dd01e2)
#26 0x0000599e9c1be400 mlir::PassManager::run(mlir::Operation*) (/mnt/sdd1/sbw/mlir/tool/llvmorg-22.1.0-install/bin/mlir-opt+0x9dd1400)
#27 0x0000599e949e3767 performActions(llvm::raw_ostream&, std::shared_ptr<llvm::SourceMgr> const&, mlir::MLIRContext*, mlir::MlirOptMainConfig const&) MlirOptMain.cpp:0:0
#28 0x0000599e949e44ea 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
#29 0x0000599e9c58c731 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) (/mnt/sdd1/sbw/mlir/tool/llvmorg-22.1.0-install/bin/mlir-opt+0xa19f731)
#30 0x0000599e949db8d0 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
#31 0x0000599e949e4b70 mlir::MlirOptMain(int, char**, llvm::StringRef, llvm::StringRef, mlir::DialectRegistry&) (/mnt/sdd1/sbw/mlir/tool/llvmorg-22.1.0-install/bin/mlir-opt+0x25f7b70)
#32 0x0000599e949e4da9 mlir::MlirOptMain(int, char**, llvm::StringRef, mlir::DialectRegistry&) (/mnt/sdd1/sbw/mlir/tool/llvmorg-22.1.0-install/bin/mlir-opt+0x25f7da9)
#33 0x0000599e94816023 main (/mnt/sdd1/sbw/mlir/tool/llvmorg-22.1.0-install/bin/mlir-opt+0x2429023)
#34 0x000077095242a1ca __libc_start_call_main ./csu/../sysdeps/nptl/libc_start_call_main.h:74:3
#35 0x000077095242a28b call_init ./csu/../csu/libc-start.c:128:20
#36 0x000077095242a28b __libc_start_main ./csu/../csu/libc-start.c:347:5
#37 0x0000599e948fb405 _start (/mnt/sdd1/sbw/mlir/tool/llvmorg-22.1.0-install/bin/mlir-opt+0x250e405)
Aborted (core dumped)
```
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs