Skip to content

[mlir] Affine-loop-unroll Pass crashes with error message "expected 'from' to be contained within the map" #59234

@Colloportus0

Description

@Colloportus0

MLIR built at commit 9e5fa4b4
Reproduced with:
mlir-opt --affine-loop-unroll temp.mlir

temp.mlir:

module {
  func.func @func1() {
    %true_4 = arith.constant true
    %c1 = arith.constant 1 : index
    %103 = affine.for %arg2 = 0 to 40 iter_args(%arg3 = %true_4) -> (i1) {
      %324 = affine.max affine_map<(d0) -> (-d0 + 64, (d0 floordiv 8) ceildiv 64, -d0 - 16, d0 * -64)>(%c1)
      affine.yield %true_4 : i1
    }
    return
  }
}

trace:

Assertion failed: (result && "expected 'from' to be contained within the map"), function lookupImpl, file BlockAndValueMapping.h, line 82.
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 --affine-loop-unroll temp.mlir
Stack dump without symbol names (ensure you have llvm-symbolizer in your PATH or set the environment var `LLVM_SYMBOLIZER_PATH` to point to it):
0  mlir-opt                 0x0000000103746f48 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) + 72
1  mlir-opt                 0x0000000103747464 PrintStackTraceSignalHandler(void*) + 28
2  mlir-opt                 0x0000000103745574 llvm::sys::RunSignalHandlers() + 148
3  mlir-opt                 0x0000000103748d34 SignalHandler(int) + 252
4  libsystem_platform.dylib 0x00000001966754c4 _sigtramp + 56
5  libsystem_pthread.dylib  0x000000019665dee0 pthread_kill + 288
6  libsystem_c.dylib        0x0000000196598340 abort + 168
7  libsystem_c.dylib        0x0000000196597754 err + 0
8  mlir-opt                 0x000000010380f868 mlir::Value mlir::BlockAndValueMapping::lookupImpl<mlir::Value>(mlir::Value) const + 128
9  mlir-opt                 0x000000010380f798 mlir::BlockAndValueMapping::lookup(mlir::Value) const + 40
10 mlir-opt                 0x0000000103947c34 generateUnrolledLoop(mlir::Block*, mlir::Value, unsigned long long, llvm::function_ref<mlir::Value (unsigned int, mlir::Value, mlir::OpBuilder)>, llvm::function_ref<void (unsigned int, mlir::Operation*, mlir::OpBuilder)>, mlir::ValueRange, mlir::ValueRange) + 608
11 mlir-opt                 0x00000001039473e0 mlir::loopUnrollByFactor(mlir::AffineForOp, unsigned long long, llvm::function_ref<void (unsigned int, mlir::Operation*, mlir::OpBuilder)>, bool) + 1096
12 mlir-opt                 0x00000001038e1b94 (anonymous namespace)::LoopUnroll::runOnAffineForOp(mlir::AffineForOp) + 332
13 mlir-opt                 0x00000001038d9664 (anonymous namespace)::LoopUnroll::runOnOperation() + 532
14 mlir-opt                 0x0000000107387070 mlir::detail::OpToOpPassAdaptor::run(mlir::Pass*, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int) + 512
15 mlir-opt                 0x0000000107387740 mlir::detail::OpToOpPassAdaptor::runPipeline(mlir::OpPassManager&, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int, mlir::PassInstrumentor*, mlir::PassInstrumentation::PipelineParentInfo const*) + 364
16 mlir-opt                 0x000000010739aaa8 mlir::detail::OpToOpPassAdaptor::runOnOperationAsyncImpl(bool)::$_14::operator()(mlir::detail::OpToOpPassAdaptor::runOnOperationAsyncImpl(bool)::OpPMInfo&) const + 240
17 mlir-opt                 0x000000010739a770 mlir::LogicalResult mlir::failableParallelForEach<std::__1::__wrap_iter<mlir::detail::OpToOpPassAdaptor::runOnOperationAsyncImpl(bool)::OpPMInfo*>, mlir::detail::OpToOpPassAdaptor::runOnOperationAsyncImpl(bool)::$_14&>(mlir::MLIRContext*, std::__1::__wrap_iter<mlir::detail::OpToOpPassAdaptor::runOnOperationAsyncImpl(bool)::OpPMInfo*>, std::__1::__wrap_iter<mlir::detail::OpToOpPassAdaptor::runOnOperationAsyncImpl(bool)::OpPMInfo*>, mlir::detail::OpToOpPassAdaptor::runOnOperationAsyncImpl(bool)::$_14&) + 180
18 mlir-opt                 0x00000001073890b0 mlir::LogicalResult mlir::failableParallelForEach<std::__1::vector<mlir::detail::OpToOpPassAdaptor::runOnOperationAsyncImpl(bool)::OpPMInfo, std::__1::allocator<mlir::detail::OpToOpPassAdaptor::runOnOperationAsyncImpl(bool)::OpPMInfo>>&, mlir::detail::OpToOpPassAdaptor::runOnOperationAsyncImpl(bool)::$_14&>(mlir::MLIRContext*, std::__1::vector<mlir::detail::OpToOpPassAdaptor::runOnOperationAsyncImpl(bool)::OpPMInfo, std::__1::allocator<mlir::detail::OpToOpPassAdaptor::runOnOperationAsyncImpl(bool)::OpPMInfo>>&, mlir::detail::OpToOpPassAdaptor::runOnOperationAsyncImpl(bool)::$_14&) + 84
19 mlir-opt                 0x0000000107388458 mlir::detail::OpToOpPassAdaptor::runOnOperationAsyncImpl(bool) + 984
20 mlir-opt                 0x000000010738735c mlir::detail::OpToOpPassAdaptor::runOnOperation(bool) + 68
21 mlir-opt                 0x0000000107387058 mlir::detail::OpToOpPassAdaptor::run(mlir::Pass*, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int) + 488
22 mlir-opt                 0x0000000107387740 mlir::detail::OpToOpPassAdaptor::runPipeline(mlir::OpPassManager&, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int, mlir::PassInstrumentor*, mlir::PassInstrumentation::PipelineParentInfo const*) + 364
23 mlir-opt                 0x0000000107389984 mlir::PassManager::runPasses(mlir::Operation*, mlir::AnalysisManager) + 108
24 mlir-opt                 0x000000010738975c mlir::PassManager::run(mlir::Operation*) + 864
25 mlir-opt                 0x000000010736ea34 performActions(llvm::raw_ostream&, bool, bool, llvm::SourceMgr&, mlir::MLIRContext*, llvm::function_ref<mlir::LogicalResult (mlir::PassManager&)>, bool, bool) + 560
26 mlir-opt                 0x000000010736e5c8 processBuffer(llvm::raw_ostream&, std::__1::unique_ptr<llvm::MemoryBuffer, std::__1::default_delete<llvm::MemoryBuffer>>, bool, bool, bool, bool, bool, bool, llvm::function_ref<mlir::LogicalResult (mlir::PassManager&)>, mlir::DialectRegistry&, llvm::ThreadPool*) + 496
27 mlir-opt                 0x000000010736e390 mlir::MlirOptMain(llvm::raw_ostream&, std::__1::unique_ptr<llvm::MemoryBuffer, std::__1::default_delete<llvm::MemoryBuffer>>, llvm::function_ref<mlir::LogicalResult (mlir::PassManager&)>, mlir::DialectRegistry&, bool, bool, bool, bool, bool, bool, bool)::$_0::operator()(std::__1::unique_ptr<llvm::MemoryBuffer, std::__1::default_delete<llvm::MemoryBuffer>>, llvm::raw_ostream&) const + 204
28 mlir-opt                 0x000000010736e2a4 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>>, llvm::function_ref<mlir::LogicalResult (mlir::PassManager&)>, mlir::DialectRegistry&, bool, bool, bool, bool, bool, bool, bool)::$_0>(long, std::__1::unique_ptr<llvm::MemoryBuffer, std::__1::default_delete<llvm::MemoryBuffer>>, llvm::raw_ostream&) + 80
29 mlir-opt                 0x0000000107579774 llvm::function_ref<mlir::LogicalResult (std::__1::unique_ptr<llvm::MemoryBuffer, std::__1::default_delete<llvm::MemoryBuffer>>, llvm::raw_ostream&)>::operator()(std::__1::unique_ptr<llvm::MemoryBuffer, std::__1::default_delete<llvm::MemoryBuffer>>, llvm::raw_ostream&) const + 96
30 mlir-opt                 0x0000000107579258 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) + 128
31 mlir-opt                 0x000000010736bce4 mlir::MlirOptMain(llvm::raw_ostream&, std::__1::unique_ptr<llvm::MemoryBuffer, std::__1::default_delete<llvm::MemoryBuffer>>, llvm::function_ref<mlir::LogicalResult (mlir::PassManager&)>, mlir::DialectRegistry&, bool, bool, bool, bool, bool, bool, bool) + 320
32 mlir-opt                 0x000000010736beec mlir::MlirOptMain(llvm::raw_ostream&, std::__1::unique_ptr<llvm::MemoryBuffer, std::__1::default_delete<llvm::MemoryBuffer>>, mlir::PassPipelineCLParser const&, mlir::DialectRegistry&, bool, bool, bool, bool, bool, bool, bool, bool) + 296
33 mlir-opt                 0x000000010736cab0 mlir::MlirOptMain(int, char**, llvm::StringRef, mlir::DialectRegistry&, bool) + 2912
34 mlir-opt                 0x0000000102f65484 main + 148
35 dyld                     0x0000000120c21088 start + 516

Metadata

Metadata

Assignees

No one assigned

    Labels

    crashPrefer [crash-on-valid] or [crash-on-invalid]mlir:affine

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions