llvm-project
llvm-project copied to clipboard
mlir-opt --arith-expand crashed
The mlir-opt --arith-expand temp.mlir
crashed with the following backtrace.
Assertion failed: (isIntOrFloat() && "only integers and floats have a bitwidth"), function getIntOrFloatBitWidth, file Types.cpp, line 92.
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 --arith-expand 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 0x00000001047896e8 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) + 56
1 mlir-opt 0x0000000104788694 llvm::sys::RunSignalHandlers() + 112
2 mlir-opt 0x0000000104789d80 SignalHandler(int) + 344
3 libsystem_platform.dylib 0x00000001aae114c4 _sigtramp + 56
4 libsystem_pthread.dylib 0x00000001aadf9ee0 pthread_kill + 288
5 libsystem_c.dylib 0x00000001aad34340 abort + 168
6 libsystem_c.dylib 0x00000001aad33754 err + 0
7 mlir-opt 0x00000001066977a0 mlir::TypeRange::TypeRange(llvm::ArrayRef<mlir::Type>) (.cold.1) + 0
8 mlir-opt 0x00000001053d0c30 mlir::Type::getIntOrFloatBitWidth() const + 152
9 mlir-opt 0x000000010535a328 mlir::Builder::getIntegerAttr(mlir::Type, long long) + 68
10 mlir-opt 0x00000001048635dc (anonymous namespace)::CeilDivSIOpConverter::matchAndRewrite(mlir::arith::CeilDivSIOp, mlir::PatternRewriter&) const + 92
11 mlir-opt 0x0000000106330560 mlir::PatternApplicator::matchAndRewrite(mlir::Operation*, mlir::PatternRewriter&, llvm::function_ref<bool (mlir::Pattern const&)>, llvm::function_ref<void (mlir::Pattern const&)>, llvm::function_ref<mlir::LogicalResult (mlir::Pattern const&)>) + 1236
12 mlir-opt 0x0000000105314fe8 (anonymous namespace)::OperationLegalizer::legalize(mlir::Operation*, mlir::ConversionPatternRewriter&) + 1948
13 mlir-opt 0x000000010530eae0 (anonymous namespace)::OperationConverter::convertOperations(llvm::ArrayRef<mlir::Operation*>, llvm::function_ref<void (mlir::Diagnostic&)>) + 936
14 mlir-opt 0x0000000105310c08 mlir::applyPartialConversion(mlir::Operation*, mlir::ConversionTarget&, mlir::FrozenRewritePatternSet const&, llvm::DenseSet<mlir::Operation*, llvm::DenseMapInfo<mlir::Operation*, void> >*) + 80
15 mlir-opt 0x0000000104865450 (anonymous namespace)::ArithmeticExpandOpsPass::runOnOperation() + 512
16 mlir-opt 0x00000001052d9ea4 mlir::detail::OpToOpPassAdaptor::run(mlir::Pass*, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int) + 376
17 mlir-opt 0x00000001052da424 mlir::detail::OpToOpPassAdaptor::runPipeline(llvm::iterator_range<llvm::pointee_iterator<std::__1::unique_ptr<mlir::Pass, std::__1::default_delete<mlir::Pass> >*, mlir::Pass> >, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int, mlir::PassInstrumentor*, mlir::PassInstrumentation::PipelineParentInfo const*) + 120
18 mlir-opt 0x00000001052dde50 auto mlir::detail::OpToOpPassAdaptor::runOnOperationAsyncImpl(bool)::$_8::operator()<std::__1::pair<mlir::Operation*, mlir::AnalysisManager> >(std::__1::pair<mlir::Operation*, mlir::AnalysisManager>&) const + 344
19 mlir-opt 0x00000001052dd980 mlir::LogicalResult mlir::failableParallelForEach<std::__1::__wrap_iter<std::__1::pair<mlir::Operation*, mlir::AnalysisManager>*>, mlir::detail::OpToOpPassAdaptor::runOnOperationAsyncImpl(bool)::$_8&>(mlir::MLIRContext*, std::__1::__wrap_iter<std::__1::pair<mlir::Operation*, mlir::AnalysisManager>*>, std::__1::__wrap_iter<std::__1::pair<mlir::Operation*, mlir::AnalysisManager>*>, mlir::detail::OpToOpPassAdaptor::runOnOperationAsyncImpl(bool)::$_8&) + 136
20 mlir-opt 0x00000001052daeac mlir::detail::OpToOpPassAdaptor::runOnOperationAsyncImpl(bool) + 996
21 mlir-opt 0x00000001052d9fbc mlir::detail::OpToOpPassAdaptor::run(mlir::Pass*, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int) + 656
22 mlir-opt 0x00000001052da424 mlir::detail::OpToOpPassAdaptor::runPipeline(llvm::iterator_range<llvm::pointee_iterator<std::__1::unique_ptr<mlir::Pass, std::__1::default_delete<mlir::Pass> >*, mlir::Pass> >, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int, mlir::PassInstrumentor*, mlir::PassInstrumentation::PipelineParentInfo const*) + 120
23 mlir-opt 0x00000001052db974 mlir::PassManager::run(mlir::Operation*) + 640
24 mlir-opt 0x00000001052b50f8 performActions(llvm::raw_ostream&, bool, bool, llvm::SourceMgr&, mlir::MLIRContext*, llvm::function_ref<mlir::LogicalResult (mlir::PassManager&)>) + 468
25 mlir-opt 0x00000001052b3324 processBuffer(llvm::raw_ostream&, std::__1::unique_ptr<llvm::MemoryBuffer, std::__1::default_delete<llvm::MemoryBuffer> >, bool, bool, bool, bool, llvm::function_ref<mlir::LogicalResult (mlir::PassManager&)>, mlir::DialectRegistry&, llvm::ThreadPool*) + 568
26 mlir-opt 0x00000001052b30a4 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) + 284
27 mlir-opt 0x00000001052b3c9c mlir::MlirOptMain(int, char**, llvm::StringRef, mlir::DialectRegistry&, bool) + 2180
28 mlir-opt 0x000000010455a618 main + 220
29 dyld 0x000000010a1d9088 start + 516
The temp.mlir
is attached here. I was planed to reduce the file through mlir-reduce
, however, mlir-reduce
crashed. The detail please refered to this issue
@llvm/issue-subscribers-mlir
You seem to be using an old version of MLIR (your .mlir file can't be parsed right now because it predates the split of the func dialect).
Do you have a way to reproduce this at HEAD?
You seem to be using an old version of MLIR (your .mlir file can't be parsed right now because it predates the split of the func dialect).
Yeah, I built mlir from the source code of tag llvmorg-14.0.6. I'll try to reproduce it at HEAD.
yes, it can be reproduced at HEAD. The new mlir file generated with HEAD version still crashed with largely the same crash traces:
Stack dump:
0. Program arguments: bin/mlir-opt --arith-expand 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 0x00000001003791d4 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) + 56
1 mlir-opt 0x000000010037822c llvm::sys::RunSignalHandlers() + 112
2 mlir-opt 0x000000010037986c SignalHandler(int) + 344
3 libsystem_platform.dylib 0x00000001aae114c4 _sigtramp + 56
4 libsystem_pthread.dylib 0x00000001aadf9ee0 pthread_kill + 288
5 libsystem_c.dylib 0x00000001aad34340 abort + 168
6 libsystem_c.dylib 0x00000001aad33754 err + 0
7 mlir-opt 0x0000000101947c20 mlir::TypeRange::TypeRange(llvm::ArrayRef<mlir::Type>) (.cold.1) + 0
8 mlir-opt 0x00000001013bf308 mlir::Type::getIntOrFloatBitWidth() const + 288
9 mlir-opt 0x0000000101333834 mlir::Builder::getIntegerAttr(mlir::Type, long long) + 68
10 mlir-opt 0x0000000100496780 (anonymous namespace)::CeilDivSIOpConverter::matchAndRewrite(mlir::arith::CeilDivSIOp, mlir::PatternRewriter&) const + 88
11 mlir-opt 0x0000000101516428 mlir::PatternApplicator::matchAndRewrite(mlir::Operation*, mlir::PatternRewriter&, llvm::function_ref<bool (mlir::Pattern const&)>, llvm::function_ref<void (mlir::Pattern const&)>, llvm::function_ref<mlir::LogicalResult (mlir::Pattern const&)>) + 1400
12 mlir-opt 0x00000001012e6ce0 (anonymous namespace)::OperationLegalizer::legalize(mlir::Operation*, mlir::ConversionPatternRewriter&) + 1948
13 mlir-opt 0x00000001012e02a4 (anonymous namespace)::OperationConverter::convertOperations(llvm::ArrayRef<mlir::Operation*>, llvm::function_ref<void (mlir::Diagnostic&)>) + 924
14 mlir-opt 0x00000001012e24c0 mlir::applyPartialConversion(mlir::Operation*, mlir::ConversionTarget&, mlir::FrozenRewritePatternSet const&, llvm::DenseSet<mlir::Operation*, llvm::DenseMapInfo<mlir::Operation*, void>>*) + 80
15 mlir-opt 0x0000000100498454 (anonymous namespace)::ArithmeticExpandOpsPass::runOnOperation() + 484
16 mlir-opt 0x00000001012a68c0 mlir::detail::OpToOpPassAdaptor::run(mlir::Pass*, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int) + 408
17 mlir-opt 0x00000001012a6e08 mlir::detail::OpToOpPassAdaptor::runPipeline(mlir::OpPassManager&, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int, mlir::PassInstrumentor*, mlir::PassInstrumentation::PipelineParentInfo const*) + 320
18 mlir-opt 0x00000001012a84d4 mlir::PassManager::run(mlir::Operation*) + 744
19 mlir-opt 0x00000001012a236c performActions(llvm::raw_ostream&, bool, bool, llvm::SourceMgr&, mlir::MLIRContext*, llvm::function_ref<mlir::LogicalResult (mlir::PassManager&)>, bool) + 528
20 mlir-opt 0x00000001012a1edc 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)::$_0>(long, std::__1::unique_ptr<llvm::MemoryBuffer, std::__1::default_delete<llvm::MemoryBuffer>>, llvm::raw_ostream&) + 620
21 mlir-opt 0x000000010130a4b4 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) + 656
22 mlir-opt 0x00000001012a04fc 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) + 200
23 mlir-opt 0x00000001012a09a4 mlir::MlirOptMain(int, char**, llvm::StringRef, mlir::DialectRegistry&, bool) + 1132
24 mlir-opt 0x00000001002199ac main + 100
25 dyld 0x00000001042c1088 start + 516
Which revision did you use? (your IR file has an op that was renamed on 10/4).
Updated for current HEAD: temp_head.mlir.txt
The latest commit in the log is .
commit 7b7d3b20ffec9f0af0534178117a7e0c250f6a79 (origin/main, origin/HEAD) Author: Nikita Popov [email protected] Date: Tue Oct 11 09:53:08 2022 +0200
[AsmParser] Remove some redundant checks for align attributes
The verifier already has a more general check that the attribute is
legal for the position it is used in.
BTW, what does 'renamed' mean?
Updated for current HEAD: temp_head.mlir.txt
For your provided file, some op is unknown.
error: custom op 'tensor.empty' is unknown
%0 = tensor.empty() : tensor<4xf32>
I was referring to https://github.com/llvm/llvm-project/commit/81ca5aa452400843235e058bc9c83fe71eccd593
You likely built before this commit (I updated your file to make it work past it)
This pass is written in a way that does not support tensor types, it has this helper:
/// Create an integer or index constant.
static Value createConst(Location loc, Type type, int value,
PatternRewriter &rewriter) {
return rewriter.create<arith::ConstantOp>(
loc, rewriter.getIntegerAttr(type, value));
}
Here it assumes everything can be a scalar.
I'm hesitant to try to fix this because the current wisdom seems to deprecate the support of tensors in the arith
dialect entirely.
I see, so the operation like %601 = arith.maxsi %103, %284 : tensor<4x4xi32>
is also not supported at HEAD? Because now I rerun --arith-expand on your provided file. This time it crashes with largely the same crash info instead of unknown tensor.empty op.
Updated for current HEAD: temp_head.mlir.txt
This file does not crash anymore on current main
(17a58b3ca7ec1) with mlir-opt --arith-expand temp_head.mlir.txt
nor mlir-opt temp_head.mlir.txt
.
I'll close this issue. Feel free to reopen if necessary.