| Issue |
75770
|
| Summary |
[mlir] --convert-tensor-to-spirv crashed in "mlir::affine::AffineForOp::fold" with assertion failure "lhs.isSymbolicOrConstant() || rhs.isSymbolicOrConstant()".
|
| Labels |
|
| Assignees |
|
| Reporter |
anonymousMCS
|
git version: 0ca95b269ff90afb706e2cf4c4a59d7c3afe6c65
system: ```Ubuntu 20.04.6 LTS (Focal Fossa)```
reproduced with: ```mlir-opt --convert-tensor-to-spirv a.mlir```
a.mlir:
```
#map7 = affine_map<(d0)[s0] -> (d0 * s0)>
#map9 = affine_map<()[s0, s1, s2] -> (((s0 * (s1 * (s0 * s2))) floordiv 4) * 4)>
#map10 = affine_map<()[s0, s1] -> (s1 * s0)>
func.func private @func2() {
%10 = arith.constant 15 : i64
// If the following line is changed to "%36 = arith.constant 15 : index", the crash will disappear.
// Maybe the crash is caused by "builtin.unrealized_conversion_cast".
%36 = builtin.unrealized_conversion_cast %10 : i64 to index
%145 = affine.apply #map7(%36)[%36]
%147 = affine.apply #map7(%36)[%145]
affine.for %arg0 = #map9()[%36, %145, %36] to #map10()[%36, %147] {
}
return
}
```
trace:
```
mlir-opt: /data/bin/llvm-project/mlir/lib/IR/AffineExpr.cpp:762: mlir::AffineExpr simplifyMul(mlir::AffineExpr, mlir::AffineExpr): Assertion `lhs.isSymbolicOrConstant() || rhs.isSymbolicOrConstant()' 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 --convert-tensor-to-spirv a.mlir
#0 0x000055f70c5f1ccf llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/data/bin/llvm-project/build/bin/mlir-opt+0x1676ccf)
#1 0x000055f70c5eed24 SignalHandler(int) Signals.cpp:0:0
#2 0x00007f2fa4b0c420 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x14420)
#3 0x00007f2fa45f700b raise (/lib/x86_64-linux-gnu/libc.so.6+0x4300b)
#4 0x00007f2fa45d6859 abort (/lib/x86_64-linux-gnu/libc.so.6+0x22859)
#5 0x00007f2fa45d6729 (/lib/x86_64-linux-gnu/libc.so.6+0x22729)
#6 0x00007f2fa45e7fd6 (/lib/x86_64-linux-gnu/libc.so.6+0x33fd6)
#7 0x000055f70f3cb1ab mlir::AffineExpr::operator*(mlir::AffineExpr) const (/data/bin/llvm-project/build/bin/mlir-opt+0x44501ab)
#8 0x000055f70f3cc30a mlir::AffineExpr::replace(llvm::DenseMap<mlir::AffineExpr, mlir::AffineExpr, llvm::DenseMapInfo<mlir::AffineExpr, void>, llvm::detail::DenseMapPair<mlir::AffineExpr, mlir::AffineExpr>> const&) const (/data/bin/llvm-project/build/bin/mlir-opt+0x445130a)
#9 0x000055f70f3cc1ef mlir::AffineExpr::replace(llvm::DenseMap<mlir::AffineExpr, mlir::AffineExpr, llvm::DenseMapInfo<mlir::AffineExpr, void>, llvm::detail::DenseMapPair<mlir::AffineExpr, mlir::AffineExpr>> const&) const (/data/bin/llvm-project/build/bin/mlir-opt+0x44511ef)
#10 0x000055f70f3cc52f mlir::AffineExpr::replace(mlir::AffineExpr, mlir::AffineExpr) const (/data/bin/llvm-project/build/bin/mlir-opt+0x445152f)
#11 0x000055f70f3d73c6 mlir::AffineMap::replace(mlir::AffineExpr, mlir::AffineExpr, unsigned int, unsigned int) const (/data/bin/llvm-project/build/bin/mlir-opt+0x445c3c6)
#12 0x000055f70c6e8543 composeAffineMapAndOperands(mlir::AffineMap*, llvm::SmallVectorImpl<mlir::Value>*) (.part.0) AffineOps.cpp:0:0
#13 0x000055f70c6e9e59 mlir::affine::AffineForOp::fold(mlir::affine::AffineForOpGenericAdaptor<llvm::ArrayRef<mlir::Attribute>>, llvm::SmallVectorImpl<mlir::OpFoldResult>&) (/data/bin/llvm-project/build/bin/mlir-opt+0x176ee59)
#14 0x000055f70c6ea272 mlir::LogicalResult llvm::detail::UniqueFunctionBase<mlir::LogicalResult, mlir::Operation*, llvm::ArrayRef<mlir::Attribute>, llvm::SmallVectorImpl<mlir::OpFoldResult>&>::CallImpl<mlir::Op<mlir::affine::AffineForOp, mlir::OpTrait::OneRegion, mlir::OpTrait::VariadicResults, mlir::OpTrait::ZeroSuccessors, mlir::OpTrait::VariadicOperands, mlir::OpTrait::AttrSizedOperandSegments, mlir::OpTrait::SingleBlock, mlir::OpTrait::SingleBlockImplicitTerminator<mlir::affine::AffineYieldOp>::Impl, mlir::OpTrait::OpInvariants, mlir::BytecodeOpInterface::Trait, mlir::OpTrait::AutomaticAllocationScope, mlir::ConditionallySpeculatable::Trait, mlir::OpTrait::HasRecursiveMemoryEffects, mlir::LoopLikeOpInterface::Trait, mlir::RegionBranchOpInterface::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+0x176f272)
#15 0x000055f70c6f9dc6 mlir::RegisteredOperationName::Model<mlir::affine::AffineForOp>::foldHook(mlir::Operation*, llvm::ArrayRef<mlir::Attribute>, llvm::SmallVectorImpl<mlir::OpFoldResult>&) (/data/bin/llvm-project/build/bin/mlir-opt+0x177edc6)
#16 0x000055f70f4e1fe2 mlir::Operation::fold(llvm::ArrayRef<mlir::Attribute>, llvm::SmallVectorImpl<mlir::OpFoldResult>&) (/data/bin/llvm-project/build/bin/mlir-opt+0x4566fe2)
#17 0x000055f70f4e2328 mlir::Operation::fold(llvm::SmallVectorImpl<mlir::OpFoldResult>&) (/data/bin/llvm-project/build/bin/mlir-opt+0x4567328)
#18 0x000055f70f4116fa mlir::OpBuilder::tryFold(mlir::Operation*, llvm::SmallVectorImpl<mlir::Value>&) (/data/bin/llvm-project/build/bin/mlir-opt+0x44966fa)
#19 0x000055f70f37c62b (anonymous namespace)::OperationLegalizer::legalize(mlir::Operation*, mlir::ConversionPatternRewriter&) DialectConversion.cpp:0:0
#20 0x000055f70f37d0e7 (anonymous namespace)::OperationConverter::convertOperations(llvm::ArrayRef<mlir::Operation*>, llvm::function_ref<void (mlir::Diagnostic&)>) DialectConversion.cpp:0:0
#21 0x000055f70f37f554 mlir::applyPartialConversion(mlir::Operation*, mlir::ConversionTarget const&, mlir::FrozenRewritePatternSet const&, llvm::DenseSet<mlir::Operation*, llvm::DenseMapInfo<mlir::Operation*, void>>*) (/data/bin/llvm-project/build/bin/mlir-opt+0x4404554)
#22 0x000055f70ebd8783 (anonymous namespace)::ConvertTensorToSPIRVPass::runOnOperation() TensorToSPIRVPass.cpp:0:0
#23 0x000055f70f2d4d6e mlir::detail::OpToOpPassAdaptor::run(mlir::Pass*, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int) (/data/bin/llvm-project/build/bin/mlir-opt+0x4359d6e)
#24 0x000055f70f2d524a 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+0x435a24a)
#25 0x000055f70f2d5a14 mlir::PassManager::run(mlir::Operation*) (/data/bin/llvm-project/build/bin/mlir-opt+0x435aa14)
#26 0x000055f70f2c68f3 performActions(llvm::raw_ostream&, std::shared_ptr<llvm::SourceMgr> const&, mlir::MLIRContext*, mlir::MlirOptMainConfig const&) MlirOptMain.cpp:0:0
#27 0x000055f70f2c7dc4 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
#28 0x000055f70f2c7f74 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
#29 0x000055f70f3c7364 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+0x444c364)
#30 0x000055f70f2c07d7 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+0x43457d7)
#31 0x000055f70f2c80c1 mlir::MlirOptMain(int, char**, llvm::StringRef, llvm::StringRef, mlir::DialectRegistry&) (/data/bin/llvm-project/build/bin/mlir-opt+0x434d0c1)
#32 0x000055f70f2c8526 mlir::MlirOptMain(int, char**, llvm::StringRef, mlir::DialectRegistry&) (/data/bin/llvm-project/build/bin/mlir-opt+0x434d526)
#33 0x000055f70c5282b3 main (/data/bin/llvm-project/build/bin/mlir-opt+0x15ad2b3)
#34 0x00007f2fa45d8083 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x24083)
#35 0x000055f70c5c123e _start (/data/bin/llvm-project/build/bin/mlir-opt+0x164623e)
Aborted (core dumped)
```
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs