Issue 61530
Summary [MLIR]`-sparse-compiler` triggers Assertion Failure `t < numTensors && i < numLoops && lvl < lvlToLoop[t].size() && isValidDLT(dlt)'
Labels new issue
Assignees
Reporter BealZephyr
    Test on commit: https://github.com/llvm/llvm-project/commit/8d2885c2ef98b81927c1f816691ec4e77cfc7f3f

steps to reproduce:
```
mlir-opt -linalg-fold-unit-extent-dims=fold-one-trip-loops-only -sparse-compiler=enable-amx=true test.mlir
```

test case:
```
#map = affine_map<(d0, d1) -> (d0, d1)>
#map1 = affine_map<(d0, d1) -> (d1)>
module {
  func.func @main(%8:tensor<1x77xi1>,%arg9: tensor<1x77xi1>) -> tensor<1x77xi1> {
 %9 = tensor.empty() : tensor<1x77xi1>
    %10 = linalg.generic {indexing_maps = [#map, #map, #map], iterator_types = ["parallel", "parallel"]} ins(%8, %arg9 : tensor<1x77xi1>, tensor<1x77xi1>) outs(%9 : tensor<1x77xi1>) {
    ^bb0(%in: i1, %in_0: i1, %out: i1):
      %11 = arith.addi %in, %in_0 : i1
      linalg.yield %11 : i1
    } -> tensor<1x77xi1>
    return %10 : tensor<1x77xi1>
 }
}
```
crash trace:
```
mlir-opt: /home/ty/llvm-project/mlir/include/mlir/Dialect/SparseTensor/Utils/Merger.h:430: void mlir::sparse_tensor::Merger::setLevelAndType(mlir::sparse_tensor::TensorId, mlir::sparse_tensor::LoopId, mlir::sparse_tensor::Level, mlir::sparse_tensor::DimLevelType): Assertion `t < numTensors && i < numLoops && lvl < lvlToLoop[t].size() && isValidDLT(dlt)' 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/ty/llvm-project/build/bin/mlir-opt -linalg-fold-unit-extent-dims=fold-one-trip-loops-only -sparse-compiler=enable-amx=true test.mlir
 #0 0x00005625f8bc94ea llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/home/ty/llvm-project/build/bin/mlir-opt+0x2244ea)
 #1 0x00005625f8bc677c SignalHandler(int) Signals.cpp:0:0
 #2 0x00007f15ba937980 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x12980)
 #3 0x00007f15b9a2fe87 raise /build/glibc-CVJwZb/glibc-2.27/signal/../sysdeps/unix/sysv/linux/raise.c:51:0
 #4 0x00007f15b9a317f1 abort /build/glibc-CVJwZb/glibc-2.27/stdlib/abort.c:81:0
 #5 0x00007f15b9a213fa __assert_fail_base /build/glibc-CVJwZb/glibc-2.27/assert/assert.c:89:0
 #6 0x00007f15b9a21472 (/lib/x86_64-linux-gnu/libc.so.6+0x30472)
 #7 0x00005625f982ab4e (/home/ty/llvm-project/build/bin/mlir-opt+0xe85b4e)
 #8 0x00005625f982b731 findAffine(mlir::sparse_tensor::Merger&, unsigned int, unsigned long, mlir::AffineExpr, mlir::sparse_tensor::DimLevelType, unsigned int&, bool) Sparsification.cpp:0:0
 #9 0x00005625f9834093 (anonymous namespace)::GenericOpSparsifier::matchAndRewrite(mlir::linalg::GenericOp, mlir::PatternRewriter&) const Sparsification.cpp:0:0
#10 0x00005625f90deb97 mlir::detail::OpOrInterfaceRewritePatternBase<mlir::linalg::GenericOp>::matchAndRewrite(mlir::Operation*, mlir::PatternRewriter&) const (/home/ty/llvm-project/build/bin/mlir-opt+0x739b97)
#11 0x00005625fa87ca49 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&)>) (/home/ty/llvm-project/build/bin/mlir-opt+0x1ed7a49)
#12 0x00005625fa522a2d (anonymous namespace)::GreedyPatternRewriteDriver::processWorklist() GreedyPatternRewriteDriver.cpp:0:0
#13 0x00005625fa525d3a mlir::applyPatternsAndFoldGreedily(mlir::Region&, mlir::FrozenRewritePatternSet const&, mlir::GreedyRewriteConfig) (/home/ty/llvm-project/build/bin/mlir-opt+0x1b80d3a)
#14 0x00005625f9802ea9 (anonymous namespace)::SparsificationPass::runOnOperation() SparseTensorPasses.cpp:0:0
#15 0x00005625fa491fe9 mlir::detail::OpToOpPassAdaptor::run(mlir::Pass*, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int) (/home/ty/llvm-project/build/bin/mlir-opt+0x1aecfe9)
#16 0x00005625fa49230a mlir::detail::OpToOpPassAdaptor::runPipeline(mlir::OpPassManager&, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int, mlir::PassInstrumentor*, mlir::PassInstrumentation::PipelineParentInfo const*) (/home/ty/llvm-project/build/bin/mlir-opt+0x1aed30a)
#17 0x00005625fa492cd4 mlir::LogicalResult llvm::function_ref<mlir::LogicalResult (mlir::OpPassManager&, mlir::Operation*)>::callback_fn<mlir::detail::OpToOpPassAdaptor::run(mlir::Pass*, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int)::'lambda'(mlir::OpPassManager&, mlir::Operation*)>(long, mlir::OpPassManager&, mlir::Operation*) Pass.cpp:0:0
#18 0x00005625fa648b57 mlir::sparse_tensor::SparsificationAndBufferizationPass::runOnOperation() (/home/ty/llvm-project/build/bin/mlir-opt+0x1ca3b57)
#19 0x00005625fa491fe9 mlir::detail::OpToOpPassAdaptor::run(mlir::Pass*, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int) (/home/ty/llvm-project/build/bin/mlir-opt+0x1aecfe9)
#20 0x00005625fa492e43 mlir::detail::OpToOpPassAdaptor::runPipeline(mlir::OpPassManager&, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int, mlir::PassInstrumentor*, mlir::PassInstrumentation::PipelineParentInfo const*) (.constprop.495) Pass.cpp:0:0
#21 0x00005625fa49352d mlir::PassManager::run(mlir::Operation*) (/home/ty/llvm-project/build/bin/mlir-opt+0x1aee52d)
#22 0x00005625fa486453 performActions(llvm::raw_ostream&, std::shared_ptr<llvm::SourceMgr> const&, mlir::MLIRContext*, mlir::MlirOptMainConfig const&) MlirOptMain.cpp:0:0
#23 0x00005625fa486b89 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
#24 0x00005625fa486eb1 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
#25 0x00005625fa551ce0 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) (/home/ty/llvm-project/build/bin/mlir-opt+0x1bacce0)
#26 0x00005625fa483b93 mlir::MlirOptMain(llvm::raw_ostream&, std::unique_ptr<llvm::MemoryBuffer, std::default_delete<llvm::MemoryBuffer>>, mlir::DialectRegistry&, mlir::MlirOptMainConfig const&) (/home/ty/llvm-project/build/bin/mlir-opt+0x1adeb93)
#27 0x00005625fa4872a6 mlir::MlirOptMain(int, char**, llvm::StringRef, mlir::DialectRegistry&, bool) (/home/ty/llvm-project/build/bin/mlir-opt+0x1ae22a6)
#28 0x00005625f8b95650 main (/home/ty/llvm-project/build/bin/mlir-opt+0x1f0650)
#29 0x00007f15b9a12c87 __libc_start_main /build/glibc-CVJwZb/glibc-2.27/csu/../csu/libc-start.c:344:0
#30 0x00005625f8ba84aa _start (/home/ty/llvm-project/build/bin/mlir-opt+0x2034aa)
```
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to