Issue |
120189
|
Summary |
[Mlir][affine] --affine-loop-fusion="fusion-compute-tolerance=0" crashes in Utils.cpp:293: mlir::presburger::mergeLocalVars
|
Labels |
mlir
|
Assignees |
|
Reporter |
Emilyaxe
|
git version: b3d2548d5b04
system: `Ubuntu 18.04.6 LTS`
reproduce with: `/data/szy/MLIR/llvm-debug/llvm-project/build/bin/mlir-opt a.mlir --affine-loop-fusion="fusion-compute-tolerance=0"`
a.mlir:
```
#map = affine_map<()[s0, s1] -> (s0 * 23 + s1)>
module {
func.func @func1(%arg0: memref<1x23x26xi32, strided<[?, ?, ?], offset: ?>>) -> () {
%cst = arith.constant 63.9809875 : f32
%cst_0 = arith.constant 1.19825836E-6 : f32
%cst_1 = arith.constant 1.18534706E-4 : f32
%cst_2 = arith.constant 0.00226843474 : f32
%cst_3 = arith.constant 0.00489352504 : f32
%cst_4 = arith.constant -2.76076837E-16 : f32
%cst_5 = arith.constant 2.00018794E-13 : f32
%cst_6 = arith.constant -8.60467184E-11 : f32
%cst_7 = arith.constant 5.12229725E-8 : f32
%cst_8 = arith.constant 1.48572235E-5 : f32
%cst_9 = arith.constant 6.37261954E-4 : f32
%cst_10 = arith.constant 0.00489352457 : f32
%cst_11 = arith.constant 7.99881172 : f32
%cst_12 = arith.constant 0.000000e+00 : f32
%alloc = memref.alloc() {alignment = 64 : i64} : memref<23x26xf32>
affine.for %arg1 = 0 to 23 {
affine.for %arg2 = 0 to 26 {
%0 = math.fma %cst, %cst_4, %cst_5 : f32
%1 = math.fma %cst, %0, %cst_6 : f32
%2 = math.fma %cst, %1, %cst_7 : f32
%3 = math.fma %cst, %2, %cst_8 : f32
%4 = math.fma %cst, %3, %cst_9 : f32
%5 = math.fma %cst, %4, %cst_10 : f32
%6 = arith.mulf %5, %cst_11 : f32
%7 = math.fma %cst, %cst_0, %cst_1 : f32
%8 = math.fma %cst, %7, %cst_2 : f32
%9 = math.fma %cst, %8, %cst_3 : f32
%10 = arith.divf %6, %9 : f32
affine.store %10, %alloc[%arg1, %arg2] : memref<23x26xf32>
}
}
%alloc_13 = memref.alloc() {alignment = 64 : i64} : memref<1x26xf32>
affine.for %arg1 = 0 to 1 {
affine.for %arg2 = 0 to 23 {
affine.for %arg3 = 0 to 26 {
%0 = affine.apply #map()[%arg1, %arg2]
%1 = affine.load %alloc[%0, %arg3] : memref<23x26xf32>
%2 = affine.load %alloc_13[%arg1, %arg3] : memref<1x26xf32>
%3 = arith.addf %1, %2 : f32
affine.store %3, %alloc_13[%arg1, %arg3] : memref<1x26xf32>
}
}
}
return
}
}
```
stack trace:
```
mlir-opt: /data/szy/MLIR/llvm-debug/llvm-project/mlir/lib/Analysis/Presburger/Utils.cpp:293: void mlir::presburger::mergeLocalVars(IntegerRelation &, IntegerRelation &, llvm::function_ref<bool (unsigned int, unsigned int)>): Assertion `relA.getSpace().isCompatible(relB.getSpace()) && "Spaces should be compatible."' 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/szy/MLIR/llvm-debug/llvm-project/build/bin/mlir-opt a.mlir --affine-loop-fusion=fusion-compute-tolerance=0
#0 0x0000563e79ba6919 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) /data/szy/MLIR/llvm-debug/llvm-project/llvm/lib/Support/Unix/Signals.inc:723:11
#1 0x0000563e79ba6dcb PrintStackTraceSignalHandler(void*) /data/szy/MLIR/llvm-debug/llvm-project/llvm/lib/Support/Unix/Signals.inc:798:1
#2 0x0000563e79ba4fff llvm::sys::RunSignalHandlers() /data/szy/MLIR/llvm-debug/llvm-project/llvm/lib/Support/Signals.cpp:105:5
#3 0x0000563e79ba749e SignalHandler(int) /data/szy/MLIR/llvm-debug/llvm-project/llvm/lib/Support/Unix/Signals.inc:413:1
#4 0x00007ff5ee152420 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x14420)
#5 0x00007ff5ed78f00b raise /build/glibc-LcI20x/glibc-2.31/signal/../sysdeps/unix/sysv/linux/raise.c:51:1
#6 0x00007ff5ed76e859 abort /build/glibc-LcI20x/glibc-2.31/stdlib/abort.c:81:7
#7 0x00007ff5ed76e729 get_sysdep_segment_value /build/glibc-LcI20x/glibc-2.31/intl/loadmsgcat.c:509:8
#8 0x00007ff5ed76e729 _nl_load_domain /build/glibc-LcI20x/glibc-2.31/intl/loadmsgcat.c:970:34
#9 0x00007ff5ed77ffd6 (/lib/x86_64-linux-gnu/libc.so.6+0x33fd6)
#10 0x0000563e83959bdb mlir::presburger::mergeLocalVars(mlir::presburger::IntegerRelation&, mlir::presburger::IntegerRelation&, llvm::function_ref<bool (unsigned int, unsigned int)>) /data/szy/MLIR/llvm-debug/llvm-project/mlir/lib/Analysis/Presburger/Utils.cpp:298:25
#11 0x0000563e838bbf77 mlir::presburger::IntegerRelation::mergeLocalVars(mlir::presburger::IntegerRelation&) /data/szy/MLIR/llvm-debug/llvm-project/mlir/lib/Analysis/Presburger/IntegerRelation.cpp:1384:10
#12 0x0000563e7ea6fc50 mlir::affine::MemRefAccess::getAccessRelation(mlir::presburger::IntegerRelation&) const /data/szy/MLIR/llvm-debug/llvm-project/mlir/lib/Dialect/Affine/Analysis/AffineAnalysis.cpp:497:3
#13 0x0000563e7ea6edca mlir::affine::checkMemrefAccessDependence(mlir::affine::MemRefAccess const&, mlir::affine::MemRefAccess const&, unsigned int, mlir::affine::FlatAffineValueConstraints*, llvm::SmallVector<mlir::affine::DependenceComponent, 2u>*, bool) /data/szy/MLIR/llvm-debug/llvm-project/mlir/lib/Dialect/Affine/Analysis/AffineAnalysis.cpp:637:24
#14 0x0000563e7ea6eaca mlir::affine::isLoopMemoryParallel(mlir::affine::AffineForOp) /data/szy/MLIR/llvm-debug/llvm-project/mlir/lib/Dialect/Affine/Analysis/AffineAnalysis.cpp:179:11
#15 0x0000563e7ea6e905 mlir::affine::isLoopParallel(mlir::affine::AffineForOp, llvm::SmallVectorImpl<mlir::affine::LoopReduction>*) /data/szy/MLIR/llvm-debug/llvm-project/mlir/lib/Dialect/Affine/Analysis/AffineAnalysis.cpp:120:3
#16 0x0000563e7ea8771a mlir::affine::isLoopParallelAndContainsReduction(mlir::affine::AffineForOp) /data/szy/MLIR/llvm-debug/llvm-project/mlir/lib/Dialect/Affine/Analysis/Utils.cpp:1964:7
#17 0x0000563e79e29b8c mlir::affine::fuseLoops(mlir::affine::AffineForOp, mlir::affine::AffineForOp, mlir::affine::ComputationSliceState const&, bool) /data/szy/MLIR/llvm-debug/llvm-project/mlir/lib/Dialect/Affine/Utils/LoopFusionUtils.cpp:461:51
#18 0x0000563e79dc901d (anonymous namespace)::GreedyFusion::performFusionsIntoDest(unsigned int, unsigned int) /data/szy/MLIR/llvm-debug/llvm-project/mlir/lib/Dialect/Affine/Transforms/LoopFusion.cpp:988:24
#19 0x0000563e79dc8267 (anonymous namespace)::GreedyFusion::fuseProducerConsumerNodes(unsigned int) /data/szy/MLIR/llvm-debug/llvm-project/mlir/lib/Dialect/Affine/Transforms/LoopFusion.cpp:1064:5
#20 0x0000563e79dc817e (anonymous namespace)::GreedyFusion::runGreedyFusion() /data/szy/MLIR/llvm-debug/llvm-project/mlir/lib/Dialect/Affine/Transforms/LoopFusion.cpp:754:5
#21 0x0000563e79dc8047 (anonymous namespace)::LoopFusion::runOnBlock(mlir::Block*) /data/szy/MLIR/llvm-debug/llvm-project/mlir/lib/Dialect/Affine/Transforms/LoopFusion.cpp:0:12
#22 0x0000563e79dc7e41 (anonymous namespace)::LoopFusion::runOnOperation()::$_0::operator()(mlir::Operation*) const /data/szy/MLIR/llvm-debug/llvm-project/mlir/lib/Dialect/Affine/Transforms/LoopFusion.cpp:1399:7
#23 0x0000563e79dc7d3d void llvm::function_ref<void (mlir::Operation*)>::callback_fn<(anonymous namespace)::LoopFusion::runOnOperation()::$_0>(long, mlir::Operation*) /data/szy/MLIR/llvm-debug/llvm-project/llvm/include/llvm/ADT/STLFunctionalExtras.h:46:5
#24 0x0000563e79daa5c1 llvm::function_ref<void (mlir::Operation*)>::operator()(mlir::Operation*) const /data/szy/MLIR/llvm-debug/llvm-project/llvm/include/llvm/ADT/STLFunctionalExtras.h:69:5
#25 0x0000563e79daa592 void mlir::detail::walk<mlir::ForwardIterator>(mlir::Operation*, llvm::function_ref<void (mlir::Operation*)>, mlir::WalkOrder) /data/szy/MLIR/llvm-debug/llvm-project/mlir/include/mlir/IR/Visitors.h:187:1
#26 0x0000563e79daa54e void mlir::detail::walk<mlir::ForwardIterator>(mlir::Operation*, llvm::function_ref<void (mlir::Operation*)>, mlir::WalkOrder) /data/szy/MLIR/llvm-debug/llvm-project/mlir/include/mlir/IR/Visitors.h:179:27
#27 0x0000563e79dc7ce2 std::enable_if<llvm::is_one_of<mlir::Operation*, mlir::Operation*, mlir::Region*, mlir::Block*>::value, void>::type mlir::detail::walk<(mlir::WalkOrder)1, mlir::ForwardIterator, (anonymous namespace)::LoopFusion::runOnOperation()::$_0, mlir::Operation*, void>(mlir::Operation*, (anonymous namespace)::LoopFusion::runOnOperation()::$_0&&) /data/szy/MLIR/llvm-debug/llvm-project/mlir/include/mlir/IR/Visitors.h:312:3
#28 0x0000563e79dc7c8d std::enable_if<llvm::function_traits<std::decay<(anonymous namespace)::LoopFusion::runOnOperation()::$_0>::type>::num_args == 1, void>::type mlir::Operation::walk<(mlir::WalkOrder)1, mlir::ForwardIterator, (anonymous namespace)::LoopFusion::runOnOperation()::$_0, void>((anonymous namespace)::LoopFusion::runOnOperation()::$_0&&) /data/szy/MLIR/llvm-debug/llvm-project/mlir/include/mlir/IR/Operation.h:794:5
#29 0x0000563e79dc79fd (anonymous namespace)::LoopFusion::runOnOperation() /data/szy/MLIR/llvm-debug/llvm-project/mlir/lib/Dialect/Affine/Transforms/LoopFusion.cpp:1406:1
#30 0x0000563e7eaf9c04 mlir::detail::OpToOpPassAdaptor::run(mlir::Pass*, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int)::$_1::operator()() const /data/szy/MLIR/llvm-debug/llvm-project/mlir/lib/Pass/Pass.cpp:0:17
#31 0x0000563e7eaf9ba5 void llvm::function_ref<void ()>::callback_fn<mlir::detail::OpToOpPassAdaptor::run(mlir::Pass*, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int)::$_1>(long) /data/szy/MLIR/llvm-debug/llvm-project/llvm/include/llvm/ADT/STLFunctionalExtras.h:46:5
#32 0x0000563e79bca9d9 llvm::function_ref<void ()>::operator()() const /data/szy/MLIR/llvm-debug/llvm-project/llvm/include/llvm/ADT/STLFunctionalExtras.h:69:5
#33 0x0000563e7eafc96b void mlir::MLIRContext::executeAction<mlir::PassExecutionAction, mlir::Pass&>(llvm::function_ref<void ()>, llvm::ArrayRef<mlir::IRUnit>, mlir::Pass&) /data/szy/MLIR/llvm-debug/llvm-project/mlir/include/mlir/IR/MLIRContext.h:281:3
#34 0x0000563e7eaf57e7 mlir::detail::OpToOpPassAdaptor::run(mlir::Pass*, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int) /data/szy/MLIR/llvm-debug/llvm-project/mlir/lib/Pass/Pass.cpp:532:17
#35 0x0000563e7eaf5d07 mlir::detail::OpToOpPassAdaptor::runPipeline(mlir::OpPassManager&, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int, mlir::PassInstrumentor*, mlir::PassInstrumentation::PipelineParentInfo const*) /data/szy/MLIR/llvm-debug/llvm-project/mlir/lib/Pass/Pass.cpp:592:16
#36 0x0000563e7eaf7618 mlir::PassManager::runPasses(mlir::Operation*, mlir::AnalysisManager) /data/szy/MLIR/llvm-debug/llvm-project/mlir/lib/Pass/Pass.cpp:905:10
#37 0x0000563e7eaf754d mlir::PassManager::run(mlir::Operation*) /data/szy/MLIR/llvm-debug/llvm-project/mlir/lib/Pass/Pass.cpp:885:60
#38 0x0000563e7eae8d65 performActions(llvm::raw_ostream&, std::shared_ptr<llvm::SourceMgr> const&, mlir::MLIRContext*, mlir::MlirOptMainConfig const&) /data/szy/MLIR/llvm-debug/llvm-project/mlir/lib/Tools/mlir-opt/MlirOptMain.cpp:474:17
#39 0x0000563e7eae8956 processBuffer(llvm::raw_ostream&, std::unique_ptr<llvm::MemoryBuffer, std::default_delete<llvm::MemoryBuffer>>, mlir::MlirOptMainConfig const&, mlir::DialectRegistry&, llvm::ThreadPoolInterface*) /data/szy/MLIR/llvm-debug/llvm-project/mlir/lib/Tools/mlir-opt/MlirOptMain.cpp:542:12
#40 0x0000563e7eae871c mlir::MlirOptMain(llvm::raw_ostream&, std::unique_ptr<llvm::MemoryBuffer, std::default_delete<llvm::MemoryBuffer>>, mlir::DialectRegistry&, mlir::MlirOptMainConfig const&)::$_0::operator()(std::unique_ptr<llvm::MemoryBuffer, std::default_delete<llvm::MemoryBuffer>>, llvm::raw_ostream&) const /data/szy/MLIR/llvm-debug/llvm-project/mlir/lib/Tools/mlir-opt/MlirOptMain.cpp:625:12
#41 0x0000563e7eae86b6 llvm::LogicalResult llvm::function_ref<llvm::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&)::$_0>(long, std::unique_ptr<llvm::MemoryBuffer, std::default_delete<llvm::MemoryBuffer>>, llvm::raw_ostream&) /data/szy/MLIR/llvm-debug/llvm-project/llvm/include/llvm/ADT/STLFunctionalExtras.h:46:12
#42 0x0000563e7ec68062 llvm::function_ref<llvm::LogicalResult (std::unique_ptr<llvm::MemoryBuffer, std::default_delete<llvm::MemoryBuffer>>, llvm::raw_ostream&)>::operator()(std::unique_ptr<llvm::MemoryBuffer, std::default_delete<llvm::MemoryBuffer>>, llvm::raw_ostream&) const /data/szy/MLIR/llvm-debug/llvm-project/llvm/include/llvm/ADT/STLFunctionalExtras.h:69:12
#43 0x0000563e7ec67675 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::raw_ostream&)>, llvm::raw_ostream&, llvm::StringRef, llvm::StringRef) /data/szy/MLIR/llvm-debug/llvm-project/mlir/lib/Support/ToolUtilities.cpp:27:12
#44 0x0000563e7eae5203 mlir::MlirOptMain(llvm::raw_ostream&, std::unique_ptr<llvm::MemoryBuffer, std::default_delete<llvm::MemoryBuffer>>, mlir::DialectRegistry&, mlir::MlirOptMainConfig const&) /data/szy/MLIR/llvm-debug/llvm-project/mlir/lib/Tools/mlir-opt/MlirOptMain.cpp:628:10
#45 0x0000563e7eae55a5 mlir::MlirOptMain(int, char**, llvm::StringRef, llvm::StringRef, mlir::DialectRegistry&) /data/szy/MLIR/llvm-debug/llvm-project/mlir/lib/Tools/mlir-opt/MlirOptMain.cpp:669:14
#46 0x0000563e7eae5778 mlir::MlirOptMain(int, char**, llvm::StringRef, mlir::DialectRegistry&) /data/szy/MLIR/llvm-debug/llvm-project/mlir/lib/Tools/mlir-opt/MlirOptMain.cpp:685:10
#47 0x0000563e79b2ff63 main /data/szy/MLIR/llvm-debug/llvm-project/mlir/tools/mlir-opt/mlir-opt.cpp:325:33
#48 0x00007ff5ed770083 __libc_start_main /build/glibc-LcI20x/glibc-2.31/csu/../csu/libc-start.c:342:3
#49 0x0000563e79b2fb6e _start (/data/szy/MLIR/llvm-debug/llvm-project/build/bin/mlir-opt+0x2713b6e)
```
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs