Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[mlir] test-match-reduction failed with assertion failure "Invalid index!" #64071

Open
Colloportus0 opened this issue Jul 24, 2023 · 1 comment
Labels
crash Prefer [crash-on-valid] or [crash-on-invalid] mlir

Comments

@Colloportus0
Copy link

MLIR built at commit 585cbe3
Reproduced with:
mlir-opt -pass-pipeline='builtin.module(func.func(test-match-reduction))' temp.mlir

temp.mlir:

module { 
  func.func @func2(%arg0: tensor<?x?x?xi1>, %arg1: tensor<5x5xi32>) {
    %c9777_i16 = arith.constant 9777 : i16
    %c-3527_i16 = arith.constant -3527 : i16
    %c2 = arith.constant 2 : index 
    %18 = index.ceildivu %c2, %c2
    %28 = index.ceildivu %c2, %c2
    %43 = index.sizeof
    %46 = index.divs %c2, %c2
    %92 = affine.apply affine_map<(d0, d1, d2, d3) -> (d0 - 16)>(%46, %28, %c2, %43)
    scf.index_switch %92 
    default {
      %136 = scf.index_switch %c2 -> memref<23x8xi1> 
      default {
        %147 = tensor.empty() : tensor<7xi16>
        %148 = tensor.empty() : tensor<i16>
        %149 = linalg.dot ins(%147, %147 : tensor<7xi16>, tensor<7xi16>) outs(%148 : tensor<i16>) -> tensor<i16>
        %alloc_37 = memref.alloc() : memref<23x8xi1>
        scf.yield %alloc_37 : memref<23x8xi1>
      }
    } 
    return
  }
}

trace:

Assertion failed: (Index < this->size() && "Invalid index!"), function operator[], file ArrayRef.h, line 441.
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
Stack dump:
0.	Program arguments: mlir-opt -pass-pipeline=builtin.module(func.func(test-match-reduction)) temp.mlir
 #0 0x00000001030ecf18 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/workspace/build/bin/mlir-opt+0x1002f8f18)
 #1 0x00000001030eb1b4 llvm::sys::RunSignalHandlers() (/workspace/build/bin/mlir-opt+0x1002f71b4)
 #2 0x00000001030ed5c4 SignalHandler(int) (/workspace/build/bin/mlir-opt+0x1002f95c4)
 #3 0x00000001be7894c4 (/usr/lib/system/libsystem_platform.dylib+0x1803414c4)
 #4 0x00000001be771ee0 (/usr/lib/system/libsystem_pthread.dylib+0x180329ee0)
 #5 0x00000001be6ac340 (/usr/lib/system/libsystem_c.dylib+0x180264340)
 #6 0x00000001be6ab754 (/usr/lib/system/libsystem_c.dylib+0x180263754)
 #7 0x000000010769f674 mlir::matchReduction(llvm::ArrayRef<mlir::BlockArgument>, unsigned int, llvm::SmallVectorImpl<mlir::Operation*>&) (.cold.5) (/workspace/build/bin/mlir-opt+0x1048ab674)
 #8 0x000000010571f824 mlir::matchReduction(llvm::ArrayRef<mlir::BlockArgument>, unsigned int, llvm::SmallVectorImpl<mlir::Operation*>&) (/workspace/build/bin/mlir-opt+0x10292b824)
 #9 0x000000010523a7c4 void llvm::function_ref<void (mlir::Operation*)>::callback_fn<(anonymous namespace)::TestMatchReductionPass::runOnOperation()::'lambda'(mlir::Operation*)>(long, mlir::Operation*) (/workspace/build/bin/mlir-opt+0x1024467c4)
#10 0x000000010348a2b8 void mlir::detail::walk<mlir::ForwardIterator>(mlir::Operation*, llvm::function_ref<void (mlir::Operation*)>, mlir::WalkOrder) (/workspace/build/bin/mlir-opt+0x1006962b8)
#11 0x000000010348a32c void mlir::detail::walk<mlir::ForwardIterator>(mlir::Operation*, llvm::function_ref<void (mlir::Operation*)>, mlir::WalkOrder) (/workspace/build/bin/mlir-opt+0x10069632c)
#12 0x000000010348a32c void mlir::detail::walk<mlir::ForwardIterator>(mlir::Operation*, llvm::function_ref<void (mlir::Operation*)>, mlir::WalkOrder) (/workspace/build/bin/mlir-opt+0x10069632c)
#13 0x000000010348a32c void mlir::detail::walk<mlir::ForwardIterator>(mlir::Operation*, llvm::function_ref<void (mlir::Operation*)>, mlir::WalkOrder) (/workspace/build/bin/mlir-opt+0x10069632c)
#14 0x000000010523a5c8 (anonymous namespace)::TestMatchReductionPass::runOnOperation() (/workspace/build/bin/mlir-opt+0x1024465c8)
#15 0x000000010573c2a8 mlir::detail::OpToOpPassAdaptor::run(mlir::Pass*, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int) (/workspace/build/bin/mlir-opt+0x1029482a8)
#16 0x000000010573c998 mlir::detail::OpToOpPassAdaptor::runPipeline(mlir::OpPassManager&, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int, mlir::PassInstrumentor*, mlir::PassInstrumentation::PipelineParentInfo const*) (/workspace/build/bin/mlir-opt+0x102948998)
#17 0x000000010573da4c mlir::detail::OpToOpPassAdaptor::runOnOperationAsyncImpl(bool) (/workspace/build/bin/mlir-opt+0x102949a4c)
#18 0x000000010573c404 mlir::detail::OpToOpPassAdaptor::run(mlir::Pass*, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int) (/workspace/build/bin/mlir-opt+0x102948404)
#19 0x000000010573c998 mlir::detail::OpToOpPassAdaptor::runPipeline(mlir::OpPassManager&, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int, mlir::PassInstrumentor*, mlir::PassInstrumentation::PipelineParentInfo const*) (/workspace/build/bin/mlir-opt+0x102948998)
#20 0x000000010573e82c mlir::PassManager::run(mlir::Operation*) (/workspace/build/bin/mlir-opt+0x10294a82c)
#21 0x0000000105736d14 performActions(llvm::raw_ostream&, std::__1::shared_ptr<llvm::SourceMgr> const&, mlir::MLIRContext*, mlir::MlirOptMainConfig const&) (/workspace/build/bin/mlir-opt+0x102942d14)
#22 0x0000000105736368 mlir::LogicalResult llvm::function_ref<mlir::LogicalResult (std::__1::unique_ptr<llvm::MemoryBuffer, std::__1::default_delete<llvm::MemoryBuffer>>, llvm::raw_ostream&)>::callback_fn<mlir::MlirOptMain(llvm::raw_ostream&, std::__1::unique_ptr<llvm::MemoryBuffer, std::__1::default_delete<llvm::MemoryBuffer>>, mlir::DialectRegistry&, mlir::MlirOptMainConfig const&)::$_1>(long, std::__1::unique_ptr<llvm::MemoryBuffer, std::__1::default_delete<llvm::MemoryBuffer>>, llvm::raw_ostream&) (/workspace/build/bin/mlir-opt+0x102942368)
#23 0x00000001057b434c mlir::splitAndProcessBuffer(std::__1::unique_ptr<llvm::MemoryBuffer, std::__1::default_delete<llvm::MemoryBuffer>>, llvm::function_ref<mlir::LogicalResult (std::__1::unique_ptr<llvm::MemoryBuffer, std::__1::default_delete<llvm::MemoryBuffer>>, llvm::raw_ostream&)>, llvm::raw_ostream&, bool, bool) (/workspace/build/bin/mlir-opt+0x1029c034c)
#24 0x0000000105730d1c mlir::MlirOptMain(llvm::raw_ostream&, std::__1::unique_ptr<llvm::MemoryBuffer, std::__1::default_delete<llvm::MemoryBuffer>>, mlir::DialectRegistry&, mlir::MlirOptMainConfig const&) (/workspace/build/bin/mlir-opt+0x10293cd1c)
#25 0x000000010573118c mlir::MlirOptMain(int, char**, llvm::StringRef, mlir::DialectRegistry&) (/workspace/build/bin/mlir-opt+0x10293d18c)
#26 0x0000000102df7510 main (/workspace/build/bin/mlir-opt+0x100003510)
#27 0x000000010e5e9088 
@EugeneZelenko EugeneZelenko added mlir crash Prefer [crash-on-valid] or [crash-on-invalid] and removed new issue labels Jul 24, 2023
@llvmbot
Copy link
Collaborator

llvmbot commented Jul 24, 2023

@llvm/issue-subscribers-mlir

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
crash Prefer [crash-on-valid] or [crash-on-invalid] mlir
Projects
None yet
Development

No branches or pull requests

3 participants