| Issue |
74227
|
| Summary |
[mlir] --sparsification crashed with assertion failure.
|
| Labels |
mlir
|
| Assignees |
|
| Reporter |
anonymousMCS
|
git version: e9c6f3f5e7e23b23de4eeaa182ebfcb7d2188495
system: ```Ubuntu 20.04.6 LTS (Focal Fossa)```
reproduced with: ```mlir-opt --sparsification a.mlir```
a.mlir:
```
func.func private @func2() {
%false = arith.constant false
// Though this line is not used, the crash will disappear if delete this line.
%c2105432605_i64 = arith.constant 2105432605 : i64
%false_7 = arith.constant false
%c0 = arith.constant 0 : index
%c1 = arith.constant 1 : index
%c4 = arith.constant 4 : index
%c7 = arith.constant 7 : index
%c8 = arith.constant 8 : index
%c11 = arith.constant 11 : index
%c12 = arith.constant 12 : index
%c21 = arith.constant 21 : index
%c27 = arith.constant 27 : index
%alloc_22 = memref.alloc(%c21) {alignment = 64 : i64} : memref<?x5xf32>
%14 = bufferization.to_tensor %alloc_22 : memref<?x5xf32>
%alloc_34 = memref.alloc() : memref<20x5x5xi1>
%16 = index.shrs %c1, %c27
%c0_i32 = arith.constant 0 : i32
%23 = arith.ceildivsi %false, %false_7 : i1
%28 = index.maxu %16, %c4
%40 = index.maxs %c7, %c12
%c2105432605_i64_55 = arith.constant 2105432605 : i64
%57 = index.add %c11, %c0
%c1_68 = arith.constant 1 : index
%71 = index.shru %28, %c8
%alloc_72 = memref.alloc() {alignment = 64 : i64} : memref<20x5x5xi1>
%72 = bufferization.to_tensor %alloc_72 : memref<20x5x5xi1>
%76 = index.add %c1_68, %71
%alloc_75 = memref.alloc() {alignment = 64 : i64} : memref<20x5x5xi1>
%c20_77 = arith.constant 20 : index
%c5_79 = arith.constant 5 : index
%c5_81 = arith.constant 5 : index
%77 = arith.index_cast %c0_i32 : i32 to index
%subview = memref.subview %alloc_75[%57, %77, %c0] [%40, %c1, %c5_81] [%c1, %c1, %c1] : memref<20x5x5xi1> to memref<?x?x?xi1, strided<[?, ?, ?], offset: ?>>
%78 = scf.for %arg0 = %c0 to %c20_77 step %40 iter_args(%arg1 = %72) -> (tensor<20x5x5xi1>) {
%119 = scf.for %arg2 = %c0 to %c5_79 step %c1 iter_args(%arg3 = %arg1) -> (tensor<20x5x5xi1>) {
%subview_102 = memref.subview %alloc_75[%arg0, %arg2, %c0] [%16, %57, %c5_81] [%76, %c1, %c1] : memref<20x5x5xi1> to memref<?x?x?xi1, strided<[?, ?, ?], offset: ?>>
%alloc_103 = memref.alloc() {alignment = 64 : i64} : memref<20x5x5xi1>
memref.copy %subview_102, %subview : memref<?x?x?xi1, strided<[?, ?, ?], offset: ?>> to memref<?x?x?xi1, strided<[?, ?, ?], offset: ?>>
%122 = bufferization.to_tensor %alloc_103 : memref<20x5x5xi1>
scf.yield %122 : tensor<20x5x5xi1>
}
scf.yield %119 : tensor<20x5x5xi1>
}
vector.warp_execute_on_lane_0(%c1_68)[32] {
%mapped_108 = linalg.map ins(%78, %alloc_34, %78 : tensor<20x5x5xi1>, memref<20x5x5xi1>, tensor<20x5x5xi1>) outs(%78 : tensor<20x5x5xi1>)
(%in: i1, %in_109: i1, %in_110: i1) {
%alloc_119 = memref.alloc() {alignment = 64 : i64} : memref<13x26x13xi64>
memref.store %c2105432605_i64_55, %alloc_119[%c21, %c1, %c12] : memref<13x26x13xi64>
linalg.yield %23 : i1
}
}
return
}
```
trace:
```
mlir-opt: /data/bin/llvm-project/llvm/include/llvm/ADT/SmallVector.h:294: T& llvm::SmallVectorTemplateCommon<T, <template-parameter-1-2> >::operator[](llvm::SmallVectorTemplateCommon<T, <template-parameter-1-2> >::size_type) [with T = mlir::Value; <template-parameter-1-2> = void; llvm::SmallVectorTemplateCommon<T, <template-parameter-1-2> >::reference = mlir::Value&; llvm::SmallVectorTemplateCommon<T, <template-parameter-1-2> >::size_type = long unsigned int]: Assertion `idx < size()' failed.
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
Stack dump:
0. Program arguments: /data/bin/llvm-project/build/bin/mlir-opt --sparsification a.mlir
#0 0x00005577cebbee8f llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/data/bin/llvm-project/build/bin/mlir-opt+0x1640e8f)
#1 0x00005577cebbbee4 SignalHandler(int) Signals.cpp:0:0
#2 0x00007f914fc4d420 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x14420)
#3 0x00007f914f73800b raise (/lib/x86_64-linux-gnu/libc.so.6+0x4300b)
#4 0x00007f914f717859 abort (/lib/x86_64-linux-gnu/libc.so.6+0x22859)
#5 0x00007f914f717729 (/lib/x86_64-linux-gnu/libc.so.6+0x22729)
#6 0x00007f914f728fd6 (/lib/x86_64-linux-gnu/libc.so.6+0x33fd6)
#7 0x00005577d0240b58 (/data/bin/llvm-project/build/bin/mlir-opt+0x2cc2b58)
#8 0x00005577d1a4db8a mlir::RewriterBase::replaceOpWithIf(mlir::Operation*, mlir::ValueRange, bool*, llvm::unique_function<bool (mlir::OpOperand&) const>) (/data/bin/llvm-project/build/bin/mlir-opt+0x44cfb8a)
#9 0x00005577d027fe09 (anonymous namespace)::LastTensorLoadCanonicalization::matchAndRewrite(mlir::scf::ForOp, mlir::PatternRewriter&) const SCF.cpp:0:0
#10 0x00005577d4573038 mlir::PatternApplicator::matchAndRewrite(mlir::Operation*, mlir::PatternRewriter&, llvm::function_ref<bool (mlir::Pattern const&)>, llvm::function_ref<void (mlir::Pattern const&)>, llvm::function_ref<mlir::LogicalResult (mlir::Pattern const&)>) (/data/bin/llvm-project/build/bin/mlir-opt+0x6ff5038)
#11 0x00005577d18e81cc (anonymous namespace)::GreedyPatternRewriteDriver::processWorklist() GreedyPatternRewriteDriver.cpp:0:0
#12 0x00005577d18ec63b mlir::applyPatternsAndFoldGreedily(mlir::Region&, mlir::FrozenRewritePatternSet const&, mlir::GreedyRewriteConfig, bool*) (/data/bin/llvm-project/build/bin/mlir-opt+0x436e63b)
#13 0x00005577d044a7ba mlir::applyPatternsAndFoldGreedily(mlir::Operation*, mlir::FrozenRewritePatternSet const&, mlir::GreedyRewriteConfig, bool*) (.constprop.0) SparseTensorPasses.cpp:0:0
#14 0x00005577d044f108 (anonymous namespace)::SparsificationPass::runOnOperation() SparseTensorPasses.cpp:0:0
#15 0x00005577d183285e mlir::detail::OpToOpPassAdaptor::run(mlir::Pass*, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int) (/data/bin/llvm-project/build/bin/mlir-opt+0x42b485e)
#16 0x00005577d1832d3a mlir::detail::OpToOpPassAdaptor::runPipeline(mlir::OpPassManager&, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int, mlir::PassInstrumentor*, mlir::PassInstrumentation::PipelineParentInfo const*) (/data/bin/llvm-project/build/bin/mlir-opt+0x42b4d3a)
#17 0x00005577d1833564 mlir::PassManager::run(mlir::Operation*) (/data/bin/llvm-project/build/bin/mlir-opt+0x42b5564)
#18 0x00005577d18242d3 performActions(llvm::raw_ostream&, std::shared_ptr<llvm::SourceMgr> const&, mlir::MLIRContext*, mlir::MlirOptMainConfig const&) MlirOptMain.cpp:0:0
#19 0x00005577d18257a4 processBuffer(llvm::raw_ostream&, std::unique_ptr<llvm::MemoryBuffer, std::default_delete<llvm::MemoryBuffer>>, mlir::MlirOptMainConfig const&, mlir::DialectRegistry&, llvm::ThreadPool*) MlirOptMain.cpp:0:0
#20 0x00005577d1825954 mlir::LogicalResult llvm::function_ref<mlir::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&)::'lambda'(std::unique_ptr<llvm::MemoryBuffer, std::default_delete<llvm::MemoryBuffer>>, llvm::raw_ostream&)>(long, std::unique_ptr<llvm::MemoryBuffer, std::default_delete<llvm::MemoryBuffer>>, llvm::raw_ostream&) MlirOptMain.cpp:0:0
#21 0x00005577d1924c44 mlir::splitAndProcessBuffer(std::unique_ptr<llvm::MemoryBuffer, std::default_delete<llvm::MemoryBuffer>>, llvm::function_ref<mlir::LogicalResult (std::unique_ptr<llvm::MemoryBuffer, std::default_delete<llvm::MemoryBuffer>>, llvm::raw_ostream&)>, llvm::raw_ostream&, bool, bool) (/data/bin/llvm-project/build/bin/mlir-opt+0x43a6c44)
#22 0x00005577d181e1b7 mlir::MlirOptMain(llvm::raw_ostream&, std::unique_ptr<llvm::MemoryBuffer, std::default_delete<llvm::MemoryBuffer>>, mlir::DialectRegistry&, mlir::MlirOptMainConfig const&) (/data/bin/llvm-project/build/bin/mlir-opt+0x42a01b7)
#23 0x00005577d1825aa1 mlir::MlirOptMain(int, char**, llvm::StringRef, llvm::StringRef, mlir::DialectRegistry&) (/data/bin/llvm-project/build/bin/mlir-opt+0x42a7aa1)
#24 0x00005577d1825f06 mlir::MlirOptMain(int, char**, llvm::StringRef, mlir::DialectRegistry&) (/data/bin/llvm-project/build/bin/mlir-opt+0x42a7f06)
#25 0x00005577ceaf650b main (/data/bin/llvm-project/build/bin/mlir-opt+0x157850b)
#26 0x00007f914f719083 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x24083)
#27 0x00005577ceb8f1ee _start (/data/bin/llvm-project/build/bin/mlir-opt+0x16111ee)
Aborted (core dumped)
```
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs