Issue 173568
Summary mlir-opt crashes in mlir/lib/IR/AffineMap.cpp:787
Labels mlir, crash, generated by fuzzer
Assignees
Reporter Emilyaxe
    When running opt on the following IR, mlir-opt crashes. 

version 2c02e4c7909a

test.mlir

```
#map = affine_map<(d0, d1) -> (d0 * 128 + d1)>
#map1 = affine_map<()[s0] -> (s0 ceildiv 128)>
#map2 = affine_map<(d0, d1, d2) -> (d0 mod 128, (d1 ceildiv 128) + d2, d1 floordiv 128)>
module {
  func.func @test_subi_tensor(%arg0: tensor<8x8xi64>, %arg1: tensor<8x8xi64>) -> tensor<8x8xi64> {
    %0 = linalg.generic {indexing_maps = [#map, #map1, #map2], iterator_types = ["parallel", "parallel", "reduction"]} ins(%arg0, %arg1 : tensor<8x8xi64>, tensor<8x8xi64>) outs(%arg0 : tensor<8x8xi64>) {
 ^bb0(%in: i64, %in_0: i64, %out: i64):
      %1 = arith.subi %in, %in_0 : i64
      linalg.yield %1 : i64
    } -> tensor<8x8xi64>
    return %0 : tensor<8x8xi64>
  }
}

```


commads:

mlir-opt test.mlir

stacktrace

```
mlir-opt: llvm-project/mlir/lib/IR/AffineMap.cpp:787: AffineMap mlir::inversePermutation(AffineMap): Assertion `map.getNumSymbols() == 0 && "expected map without symbols"' 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: ./build/bin/mlir-opt test.mlir
 #0 0x00005581b377e358 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (./build/bin/mlir-opt+0x1e97358)
 #1 0x00005581b377ba15 llvm::sys::RunSignalHandlers() (./build/bin/mlir-opt+0x1e94a15)
 #2 0x00005581b377f396 SignalHandler(int, siginfo_t*, void*) Signals.cpp:0:0
 #3 0x00007fd1e7b37420 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x14420)
 #4 0x00007fd1e719000b raise /build/glibc-B3wQXB/glibc-2.31/signal/../sysdeps/unix/sysv/linux/raise.c:51:1
 #5 0x00007fd1e716f859 abort /build/glibc-B3wQXB/glibc-2.31/stdlib/abort.c:81:7
 #6 0x00007fd1e716f729 get_sysdep_segment_value /build/glibc-B3wQXB/glibc-2.31/intl/loadmsgcat.c:509:8
 #7 0x00007fd1e716f729 _nl_load_domain /build/glibc-B3wQXB/glibc-2.31/intl/loadmsgcat.c:970:34
 #8 0x00007fd1e7180fd6 (/lib/x86_64-linux-gnu/libc.so.6+0x33fd6)
 #9 0x00005581bc031341 (./build/bin/mlir-opt+0xa74a341)
#10 0x00005581ba690e4d mlir::detail::IndexingMapOpInterfaceInterfaceTraits::Model<mlir::linalg::GenericOp>::getShapesToLoopsMap(mlir::detail::IndexingMapOpInterfaceInterfaceTraits::Concept const*, mlir::Operation*) (./build/bin/mlir-opt+0x8da9e4d)
#11 0x00005581bac6971c mlir::IndexingMapOpInterface::verifyImpl() (./build/bin/mlir-opt+0x938271c)
#12 0x00005581ba38966e mlir::linalg::detail::verifyStructuredOpInterface(mlir::Operation*) (./build/bin/mlir-opt+0x8aa266e)
#13 0x00005581ba696688 mlir::Op<mlir::linalg::GenericOp, mlir::OpTrait::OneRegion, mlir::OpTrait::VariadicResults, mlir::OpTrait::ZeroSuccessors, mlir::OpTrait::VariadicOperands, mlir::OpTrait::SingleBlock, mlir::OpTrait::SingleBlockImplicitTerminator<mlir::linalg::YieldOp>::Impl, mlir::OpTrait::AttrSizedOperandSegments, mlir::OpTrait::OpInvariants, mlir::BytecodeOpInterface::Trait, mlir::MemoryEffectOpInterface::Trait, mlir::ConditionallySpeculatable::Trait, mlir::OpTrait::HasRecursiveMemoryEffects, mlir::DestinationStyleOpInterface::Trait, mlir::IndexingMapOpInterface::Trait, mlir::linalg::LinalgOp::Trait, mlir::ReifyRankedShapedTypeOpInterface::Trait, mlir::OpAsmOpInterface::Trait>::verifyRegionInvariants(mlir::Operation*) (./build/bin/mlir-opt+0x8daf688)
#14 0x00005581ba68fb2e mlir::RegisteredOperationName::Model<mlir::linalg::GenericOp>::verifyRegionInvariants(mlir::Operation*) (./build/bin/mlir-opt+0x8da8b2e)
#15 0x00005581bc142af1 (anonymous namespace)::OperationVerifier::verifyOpAndDominance(mlir::Operation&) Verifier.cpp:0:0
#16 0x00005581bc142c50 (anonymous namespace)::OperationVerifier::verifyOpAndDominance(mlir::Operation&) Verifier.cpp:0:0
#17 0x00005581bc142c50 (anonymous namespace)::OperationVerifier::verifyOpAndDominance(mlir::Operation&) Verifier.cpp:0:0
#18 0x00005581bc142146 mlir::verify(mlir::Operation*, bool) (./build/bin/mlir-opt+0xa85b146)
#19 0x00005581ba7e2df5 mlir::parseAsmSourceFile(llvm::SourceMgr const&, mlir::Block*, mlir::ParserConfig const&, mlir::AsmParserState*, mlir::AsmParserCodeCompleteContext*) (./build/bin/mlir-opt+0x8efbdf5)
#20 0x00005581ba7c74d3 mlir::parseSourceFile(std::shared_ptr<llvm::SourceMgr> const&, mlir::Block*, mlir::ParserConfig const&, mlir::LocationAttr*) (./build/bin/mlir-opt+0x8ee04d3)
#21 0x00005581b3822afe mlir::parseSourceFileForTool(std::shared_ptr<llvm::SourceMgr> const&, mlir::ParserConfig const&, bool) (./build/bin/mlir-opt+0x1f3bafe)
#22 0x00005581b3821827 performActions(llvm::raw_ostream&, std::shared_ptr<llvm::SourceMgr> const&, mlir::MLIRContext*, mlir::MlirOptMainConfig const&) MlirOptMain.cpp:0:0
#23 0x00005581b38215a6 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&)::$_0>(long, std::unique_ptr<llvm::MemoryBuffer, std::default_delete<llvm::MemoryBuffer>>, llvm::MemoryBufferRef const&, llvm::raw_ostream&) MlirOptMain.cpp:0:0
#24 0x00005581bc153855 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) (./build/bin/mlir-opt+0xa86c855)
#25 0x00005581b3817166 mlir::MlirOptMain(llvm::raw_ostream&, std::unique_ptr<llvm::MemoryBuffer, std::default_delete<llvm::MemoryBuffer>>, mlir::DialectRegistry&, mlir::MlirOptMainConfig const&) (./build/bin/mlir-opt+0x1f30166)
#26 0x00005581b38174a2 mlir::MlirOptMain(int, char**, llvm::StringRef, llvm::StringRef, mlir::DialectRegistry&) (./build/bin/mlir-opt+0x1f304a2)
#27 0x00005581b3817805 mlir::MlirOptMain(int, char**, llvm::StringRef, mlir::DialectRegistry&) (./build/bin/mlir-opt+0x1f30805)
#28 0x00005581b37649b3 main (./build/bin/mlir-opt+0x1e7d9b3)
#29 0x00007fd1e7171083 __libc_start_main /build/glibc-B3wQXB/glibc-2.31/csu/../csu/libc-start.c:342:3
#30 0x00005581b37644ee _start (./build/bin/mlir-opt+0x1e7d4ee)
```

_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to