| Issue |
64622
|
| Summary |
[mlir][linalg] --linalg-fuse-elementwise-ops crashed with assertion failure "rhs >= 1"
|
| Labels |
new issue
|
| Assignees |
|
| Reporter |
wangzhiyingh
|
git version: c7b537bf0923df05254f9fa4722b298eb8f4790d
system: `Ubuntu 20.04.6 LTS (Focal Fossa)`
reproduced with:`mlir-opt --linalg-fuse-elementwise-ops a.mlir`
a.mlir:
```
#map = affine_map<(d0)[s0] -> (d0 mod s0)>
#map1 = affine_map<(d0)[s0] -> (d0 floordiv s0)>
#set = affine_set<() : (-1 >= 0, -88 >= 0, 0 >= 0, 39 >= 0)>
module {
func.func @func1(%arg0: f32, %arg1: memref<32xf16>) {
%c32 = arith.constant 32 : index
%idx0 = index.constant 0
%c0 = arith.constant 0 : index
%alloc = memref.alloc() : memref<26x26x1xi16>
%alloc_20 = memref.alloc(%idx0, %idx0) : memref<?x?x32xi1>
%9 = affine.if #set() -> memref<26x26x1xi16> {
affine.yield %alloc : memref<26x26x1xi16>
} else {
%22 = index.divu %idx0, %idx0
%23 = index.maxs %22, %22
%alloc_23 = memref.alloc(%23, %23) : memref<?x?x32x32xi1>
affine.for %arg2 = 0 to 0 {
%24 = affine.apply #map(%arg2)[%c32]
%25 = affine.apply #map1(%arg2)[%c32]
%26 = affine.apply #map(%25)[%c32]
%27 = affine.apply #map1(%25)[%c32]
%28 = affine.apply #map(%27)[%c0]
%29 = affine.apply #map1(%27)[%c0]
%30 = affine.load %alloc_20[%29, %28, %26] : memref<?x?x32xi1>
affine.store %30, %alloc_23[%29, %28, %26, %24] : memref<?x?x32x32xi1>
}
affine.yield %alloc : memref<26x26x1xi16>
}
return
}
}
```
trace:
```
mlir-opt: /data/bin/llvm-project/mlir/include/mlir/Support/MathExtras.h:46: int64_t mlir::mod(int64_t, int64_t): Assertion `rhs >= 1' 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 --linalg-fuse-elementwise-ops bug1.mlir
#0 0x0000555b65f26a2f llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/data/bin/llvm-project/build/bin/mlir-opt+0x14a8a2f)
#1 0x0000555b65f23cb4 SignalHandler(int) Signals.cpp:0:0
#2 0x00007f4c9cd90420 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x14420)
#3 0x00007f4c9c87b00b raise (/lib/x86_64-linux-gnu/libc.so.6+0x4300b)
#4 0x00007f4c9c85a859 abort (/lib/x86_64-linux-gnu/libc.so.6+0x22859)
#5 0x00007f4c9c85a729 (/lib/x86_64-linux-gnu/libc.so.6+0x22729)
#6 0x00007f4c9c86bfd6 (/lib/x86_64-linux-gnu/libc.so.6+0x33fd6)
#7 0x0000555b688e1732 mlir::AffineMap::partialConstantFold(llvm::ArrayRef<mlir::Attribute>, llvm::SmallVectorImpl<long>*) const (/data/bin/llvm-project/build/bin/mlir-opt+0x3e63732)
#8 0x0000555b688e186b mlir::AffineMap::constantFold(llvm::ArrayRef<mlir::Attribute>, llvm::SmallVectorImpl<mlir::Attribute>&) const (/data/bin/llvm-project/build/bin/mlir-opt+0x3e6386b)
#9 0x0000555b65fee362 mlir::affine::AffineApplyOp::fold(mlir::affine::AffineApplyOpGenericAdaptor<llvm::ArrayRef<mlir::Attribute>>) (/data/bin/llvm-project/build/bin/mlir-opt+0x1570362)
#10 0x0000555b65fee4dd mlir::LogicalResult llvm::detail::UniqueFunctionBase<mlir::LogicalResult, mlir::Operation*, llvm::ArrayRef<mlir::Attribute>, llvm::SmallVectorImpl<mlir::OpFoldResult>&>::CallImpl<mlir::Op<mlir::affine::AffineApplyOp, mlir::OpTrait::ZeroRegions, mlir::OpTrait::OneResult, mlir::OpTrait::OneTypedResult<mlir::IndexType>::Impl, mlir::OpTrait::ZeroSuccessors, mlir::OpTrait::VariadicOperands, mlir::OpTrait::OpInvariants, mlir::BytecodeOpInterface::Trait, mlir::ConditionallySpeculatable::Trait, mlir::OpTrait::AlwaysSpeculatableImplTrait, mlir::MemoryEffectOpInterface::Trait>::getFoldHookFn()::'lambda'(mlir::Operation*, llvm::ArrayRef<mlir::Attribute>, llvm::SmallVectorImpl<mlir::OpFoldResult>&) const>(void*, mlir::Operation*, llvm::ArrayRef<mlir::Attribute>, llvm::SmallVectorImpl<mlir::OpFoldResult>&) (/data/bin/llvm-project/build/bin/mlir-opt+0x15704dd)
#11 0x0000555b66022996 mlir::RegisteredOperationName::Model<mlir::affine::AffineApplyOp>::foldHook(mlir::Operation*, llvm::ArrayRef<mlir::Attribute>, llvm::SmallVectorImpl<mlir::OpFoldResult>&) (/data/bin/llvm-project/build/bin/mlir-opt+0x15a4996)
#12 0x0000555b689ef1e2 mlir::Operation::fold(llvm::ArrayRef<mlir::Attribute>, llvm::SmallVectorImpl<mlir::OpFoldResult>&) (/data/bin/llvm-project/build/bin/mlir-opt+0x3f711e2)
#13 0x0000555b689ef520 mlir::Operation::fold(llvm::SmallVectorImpl<mlir::OpFoldResult>&) (/data/bin/llvm-project/build/bin/mlir-opt+0x3f71520)
#14 0x0000555b688941b2 mlir::OperationFolder::tryToFold(mlir::Operation*, bool*) (/data/bin/llvm-project/build/bin/mlir-opt+0x3e161b2)
#15 0x0000555b68897788 (anonymous namespace)::GreedyPatternRewriteDriver::processWorklist() GreedyPatternRewriteDriver.cpp:0:0
#16 0x0000555b6889bb4b mlir::applyPatternsAndFoldGreedily(mlir::Region&, mlir::FrozenRewritePatternSet const&, mlir::GreedyRewriteConfig, bool*) (/data/bin/llvm-project/build/bin/mlir-opt+0x3e1db4b)
#17 0x0000555b66a27302 (anonymous namespace)::LinalgElementwiseOpFusionPass::runOnOperation() ElementwiseOpFusion.cpp:0:0
#18 0x0000555b687eb01e mlir::detail::OpToOpPassAdaptor::run(mlir::Pass*, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int) (/data/bin/llvm-project/build/bin/mlir-opt+0x3d6d01e)
#19 0x0000555b687eb4fa 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+0x3d6d4fa)
#20 0x0000555b687ebd01 mlir::PassManager::run(mlir::Operation*) (/data/bin/llvm-project/build/bin/mlir-opt+0x3d6dd01)
#21 0x0000555b687dc1ab performActions(llvm::raw_ostream&, std::shared_ptr<llvm::SourceMgr> const&, mlir::MLIRContext*, mlir::MlirOptMainConfig const&) MlirOptMain.cpp:0:0
#22 0x0000555b687dd664 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
#23 0x0000555b687dd814 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
#24 0x0000555b688d1404 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+0x3e53404)
#25 0x0000555b687d6c37 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+0x3d58c37)
#26 0x0000555b687ddb3b mlir::MlirOptMain(int, char**, llvm::StringRef, mlir::DialectRegistry&) (/data/bin/llvm-project/build/bin/mlir-opt+0x3d5fb3b)
#27 0x0000555b65e60f2b main (/data/bin/llvm-project/build/bin/mlir-opt+0x13e2f2b)
#28 0x00007f4c9c85c083 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x24083)
#29 0x0000555b65ef841e _start (/data/bin/llvm-project/build/bin/mlir-opt+0x147a41e)
Aborted (core dumped)
```
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs