Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crash when using --pass-pipeline="builtin.module(func.func(tosa-to-linalg))" #92064

Open
wangyongj1a opened this issue May 14, 2024 · 1 comment · May be fixed by #93432
Open

Crash when using --pass-pipeline="builtin.module(func.func(tosa-to-linalg))" #92064

wangyongj1a opened this issue May 14, 2024 · 1 comment · May be fixed by #93432
Labels
crash Prefer [crash-on-valid] or [crash-on-invalid] mlir

Comments

@wangyongj1a
Copy link

I have the following MLIR program:
test.mlir:

module {
  func.func nested @func1() {
    %33 = tensor.empty() : tensor<1x1x1xi1>
    %output_real, %output_imag = "tosa.rfft2d"(%33) : (tensor<1x1x1xi1>) -> (tensor<1x1x1xi1>, tensor<1x1x1xi1>)
    return
  }
}

The above MLIR program will cause a crash when using the following command:

mlir-opt --pass-pipeline="builtin.module(func.func(tosa-to-linalg))" test.mlir

And the crash backtrace is:

mlir-opt: /data/tmp/v0514/llvm-project/llvm/include/llvm/Support/Casting.h:566: decltype(auto) llvm::cast(const From&) [with To = mlir::FloatType; From = mlir::Type]: Assertion `isa<To>(Val) && "cast<Ty>() argument of incompatible type!"' 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/tmp/v0514/llvm-project/build/bin/mlir-opt --pass-pipeline=builtin.module(func.func(tosa-to-linalg)) test.mlir
 #0 0x0000556fdf39c6ef llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/data/tmp/v0514/llvm-project/build/bin/mlir-opt+0x15946ef)
 #1 0x0000556fdf399744 SignalHandler(int) Signals.cpp:0:0
 #2 0x00007fa27c8c7420 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x14420)
 #3 0x00007fa27c39400b raise (/lib/x86_64-linux-gnu/libc.so.6+0x4300b)
 #4 0x00007fa27c373859 abort (/lib/x86_64-linux-gnu/libc.so.6+0x22859)
 #5 0x00007fa27c373729 (/lib/x86_64-linux-gnu/libc.so.6+0x22729)
 #6 0x00007fa27c384fd6 (/lib/x86_64-linux-gnu/libc.so.6+0x33fd6)
 #7 0x0000556fe1bf7a2e (anonymous namespace)::RFFT2dConverter::matchAndRewrite(mlir::tosa::RFFT2dOp, mlir::PatternRewriter&) const TosaToLinalg.cpp:0:0
 #8 0x0000556fe1bc552f mlir::detail::OpOrInterfaceRewritePatternBase<mlir::tosa::RFFT2dOp>::matchAndRewrite(mlir::Operation*, mlir::PatternRewriter&) const (/data/tmp/v0514/llvm-project/build/bin/mlir-opt+0x3dbd52f)
 #9 0x0000556fe52d41a8 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&)>) (/data/tmp/v0514/llvm-project/build/bin/mlir-opt+0x74cc1a8)
#10 0x0000556fe23ab396 (anonymous namespace)::OperationLegalizer::legalize(mlir::Operation*, mlir::ConversionPatternRewriter&) DialectConversion.cpp:0:0
#11 0x0000556fe23acb9e mlir::OperationConverter::convert(mlir::ConversionPatternRewriter&, mlir::Operation*) (/data/tmp/v0514/llvm-project/build/bin/mlir-opt+0x45a4b9e)
#12 0x0000556fe23b289b mlir::OperationConverter::convertOperations(llvm::ArrayRef<mlir::Operation*>) (/data/tmp/v0514/llvm-project/build/bin/mlir-opt+0x45aa89b)
#13 0x0000556fe23b2eed mlir::applyFullConversion(mlir::Operation*, mlir::ConversionTarget const&, mlir::FrozenRewritePatternSet const&, mlir::ConversionConfig) (/data/tmp/v0514/llvm-project/build/bin/mlir-opt+0x45aaeed)
#14 0x0000556fe1bba34d (anonymous namespace)::TosaToLinalg::runOnOperation() TosaToLinalgPass.cpp:0:0
#15 0x0000556fe230d881 mlir::detail::OpToOpPassAdaptor::run(mlir::Pass*, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int) (/data/tmp/v0514/llvm-project/build/bin/mlir-opt+0x4505881)
#16 0x0000556fe230dd6a mlir::detail::OpToOpPassAdaptor::runPipeline(mlir::OpPassManager&, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int, mlir::PassInstrumentor*, mlir::PassInstrumentation::PipelineParentInfo const*) (/data/tmp/v0514/llvm-project/build/bin/mlir-opt+0x4505d6a)
#17 0x0000556fe230e6fc mlir::detail::OpToOpPassAdaptor::runOnOperationAsyncImpl(bool)::'lambda'(mlir::detail::OpToOpPassAdaptor::runOnOperationAsyncImpl(bool)::OpPMInfo&)::operator()(mlir::detail::OpToOpPassAdaptor::runOnOperationAsyncImpl(bool)::OpPMInfo&) const Pass.cpp:0:0
#18 0x0000556fe230cdd5 mlir::detail::OpToOpPassAdaptor::runOnOperationAsyncImpl(bool) (/data/tmp/v0514/llvm-project/build/bin/mlir-opt+0x4504dd5)
#19 0x0000556fe230d606 mlir::detail::OpToOpPassAdaptor::run(mlir::Pass*, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int) (/data/tmp/v0514/llvm-project/build/bin/mlir-opt+0x4505606)
#20 0x0000556fe230dd6a mlir::detail::OpToOpPassAdaptor::runPipeline(mlir::OpPassManager&, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int, mlir::PassInstrumentor*, mlir::PassInstrumentation::PipelineParentInfo const*) (/data/tmp/v0514/llvm-project/build/bin/mlir-opt+0x4505d6a)
#21 0x0000556fe230e524 mlir::PassManager::run(mlir::Operation*) (/data/tmp/v0514/llvm-project/build/bin/mlir-opt+0x4506524)
#22 0x0000556fe22ff9ab performActions(llvm::raw_ostream&, std::shared_ptr<llvm::SourceMgr> const&, mlir::MLIRContext*, mlir::MlirOptMainConfig const&) MlirOptMain.cpp:0:0
#23 0x0000556fe2300364 processBuffer(llvm::raw_ostream&, std::unique_ptr<llvm::MemoryBuffer, std::default_delete<llvm::MemoryBuffer>>, mlir::MlirOptMainConfig const&, mlir::DialectRegistry&, llvm::ThreadPoolInterface*) MlirOptMain.cpp:0:0
#24 0x0000556fe2300514 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
#25 0x0000556fe2405d6e 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&, llvm::StringRef, llvm::StringRef) (/data/tmp/v0514/llvm-project/build/bin/mlir-opt+0x45fdd6e)
#26 0x0000556fe22f8114 mlir::MlirOptMain(llvm::raw_ostream&, std::unique_ptr<llvm::MemoryBuffer, std::default_delete<llvm::MemoryBuffer>>, mlir::DialectRegistry&, mlir::MlirOptMainConfig const&) (/data/tmp/v0514/llvm-project/build/bin/mlir-opt+0x44f0114)
#27 0x0000556fe230066c mlir::MlirOptMain(int, char**, llvm::StringRef, llvm::StringRef, mlir::DialectRegistry&) (/data/tmp/v0514/llvm-project/build/bin/mlir-opt+0x44f866c)
#28 0x0000556fe2300b36 mlir::MlirOptMain(int, char**, llvm::StringRef, mlir::DialectRegistry&) (/data/tmp/v0514/llvm-project/build/bin/mlir-opt+0x44f8b36)
#29 0x0000556fdf2bc3fb main (/data/tmp/v0514/llvm-project/build/bin/mlir-opt+0x14b43fb)
#30 0x00007fa27c375083 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x24083)
#31 0x0000556fdf36b73e _start (/data/tmp/v0514/llvm-project/build/bin/mlir-opt+0x156373e)
Aborted (core dumped)

My git version is 4c79d38.

@EugeneZelenko EugeneZelenko added mlir crash Prefer [crash-on-valid] or [crash-on-invalid] and removed new issue labels May 14, 2024
@llvmbot
Copy link
Collaborator

llvmbot commented May 14, 2024

@llvm/issue-subscribers-mlir

Author: None (wangyongj1a)

I have the following MLIR program: test.mlir: ``` module { func.func nested @func1() { %33 = tensor.empty() : tensor<1x1x1xi1> %output_real, %output_imag = "tosa.rfft2d"(%33) : (tensor<1x1x1xi1>) -> (tensor<1x1x1xi1>, tensor<1x1x1xi1>) return } } ``` The above MLIR program will cause a crash when using the following command: ``` mlir-opt --pass-pipeline="builtin.module(func.func(tosa-to-linalg))" test.mlir ``` And the crash backtrace is: ``` mlir-opt: /data/tmp/v0514/llvm-project/llvm/include/llvm/Support/Casting.h:566: decltype(auto) llvm::cast(const From&) [with To = mlir::FloatType; From = mlir::Type]: Assertion `isa<To>(Val) && "cast<Ty>() argument of incompatible type!"' 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/tmp/v0514/llvm-project/build/bin/mlir-opt --pass-pipeline=builtin.module(func.func(tosa-to-linalg)) test.mlir #0 0x0000556fdf39c6ef llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/data/tmp/v0514/llvm-project/build/bin/mlir-opt+0x15946ef) #1 0x0000556fdf399744 SignalHandler(int) Signals.cpp:0:0 #2 0x00007fa27c8c7420 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x14420) #3 0x00007fa27c39400b raise (/lib/x86_64-linux-gnu/libc.so.6+0x4300b) #4 0x00007fa27c373859 abort (/lib/x86_64-linux-gnu/libc.so.6+0x22859) #5 0x00007fa27c373729 (/lib/x86_64-linux-gnu/libc.so.6+0x22729) #6 0x00007fa27c384fd6 (/lib/x86_64-linux-gnu/libc.so.6+0x33fd6) #7 0x0000556fe1bf7a2e (anonymous namespace)::RFFT2dConverter::matchAndRewrite(mlir::tosa::RFFT2dOp, mlir::PatternRewriter&) const TosaToLinalg.cpp:0:0 #8 0x0000556fe1bc552f mlir::detail::OpOrInterfaceRewritePatternBase<mlir::tosa::RFFT2dOp>::matchAndRewrite(mlir::Operation*, mlir::PatternRewriter&) const (/data/tmp/v0514/llvm-project/build/bin/mlir-opt+0x3dbd52f) #9 0x0000556fe52d41a8 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&)>) (/data/tmp/v0514/llvm-project/build/bin/mlir-opt+0x74cc1a8) #10 0x0000556fe23ab396 (anonymous namespace)::OperationLegalizer::legalize(mlir::Operation*, mlir::ConversionPatternRewriter&) DialectConversion.cpp:0:0 #11 0x0000556fe23acb9e mlir::OperationConverter::convert(mlir::ConversionPatternRewriter&, mlir::Operation*) (/data/tmp/v0514/llvm-project/build/bin/mlir-opt+0x45a4b9e) #12 0x0000556fe23b289b mlir::OperationConverter::convertOperations(llvm::ArrayRef<mlir::Operation*>) (/data/tmp/v0514/llvm-project/build/bin/mlir-opt+0x45aa89b) #13 0x0000556fe23b2eed mlir::applyFullConversion(mlir::Operation*, mlir::ConversionTarget const&, mlir::FrozenRewritePatternSet const&, mlir::ConversionConfig) (/data/tmp/v0514/llvm-project/build/bin/mlir-opt+0x45aaeed) #14 0x0000556fe1bba34d (anonymous namespace)::TosaToLinalg::runOnOperation() TosaToLinalgPass.cpp:0:0 #15 0x0000556fe230d881 mlir::detail::OpToOpPassAdaptor::run(mlir::Pass*, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int) (/data/tmp/v0514/llvm-project/build/bin/mlir-opt+0x4505881) #16 0x0000556fe230dd6a mlir::detail::OpToOpPassAdaptor::runPipeline(mlir::OpPassManager&, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int, mlir::PassInstrumentor*, mlir::PassInstrumentation::PipelineParentInfo const*) (/data/tmp/v0514/llvm-project/build/bin/mlir-opt+0x4505d6a) #17 0x0000556fe230e6fc mlir::detail::OpToOpPassAdaptor::runOnOperationAsyncImpl(bool)::'lambda'(mlir::detail::OpToOpPassAdaptor::runOnOperationAsyncImpl(bool)::OpPMInfo&)::operator()(mlir::detail::OpToOpPassAdaptor::runOnOperationAsyncImpl(bool)::OpPMInfo&) const Pass.cpp:0:0 #18 0x0000556fe230cdd5 mlir::detail::OpToOpPassAdaptor::runOnOperationAsyncImpl(bool) (/data/tmp/v0514/llvm-project/build/bin/mlir-opt+0x4504dd5) #19 0x0000556fe230d606 mlir::detail::OpToOpPassAdaptor::run(mlir::Pass*, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int) (/data/tmp/v0514/llvm-project/build/bin/mlir-opt+0x4505606) #20 0x0000556fe230dd6a mlir::detail::OpToOpPassAdaptor::runPipeline(mlir::OpPassManager&, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int, mlir::PassInstrumentor*, mlir::PassInstrumentation::PipelineParentInfo const*) (/data/tmp/v0514/llvm-project/build/bin/mlir-opt+0x4505d6a) #21 0x0000556fe230e524 mlir::PassManager::run(mlir::Operation*) (/data/tmp/v0514/llvm-project/build/bin/mlir-opt+0x4506524) #22 0x0000556fe22ff9ab performActions(llvm::raw_ostream&, std::shared_ptr<llvm::SourceMgr> const&, mlir::MLIRContext*, mlir::MlirOptMainConfig const&) MlirOptMain.cpp:0:0 #23 0x0000556fe2300364 processBuffer(llvm::raw_ostream&, std::unique_ptr<llvm::MemoryBuffer, std::default_delete<llvm::MemoryBuffer>>, mlir::MlirOptMainConfig const&, mlir::DialectRegistry&, llvm::ThreadPoolInterface*) MlirOptMain.cpp:0:0 #24 0x0000556fe2300514 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 #25 0x0000556fe2405d6e 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&, llvm::StringRef, llvm::StringRef) (/data/tmp/v0514/llvm-project/build/bin/mlir-opt+0x45fdd6e) #26 0x0000556fe22f8114 mlir::MlirOptMain(llvm::raw_ostream&, std::unique_ptr<llvm::MemoryBuffer, std::default_delete<llvm::MemoryBuffer>>, mlir::DialectRegistry&, mlir::MlirOptMainConfig const&) (/data/tmp/v0514/llvm-project/build/bin/mlir-opt+0x44f0114) #27 0x0000556fe230066c mlir::MlirOptMain(int, char**, llvm::StringRef, llvm::StringRef, mlir::DialectRegistry&) (/data/tmp/v0514/llvm-project/build/bin/mlir-opt+0x44f866c) #28 0x0000556fe2300b36 mlir::MlirOptMain(int, char**, llvm::StringRef, mlir::DialectRegistry&) (/data/tmp/v0514/llvm-project/build/bin/mlir-opt+0x44f8b36) #29 0x0000556fdf2bc3fb main (/data/tmp/v0514/llvm-project/build/bin/mlir-opt+0x14b43fb) #30 0x00007fa27c375083 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x24083) #31 0x0000556fdf36b73e _start (/data/tmp/v0514/llvm-project/build/bin/mlir-opt+0x156373e) Aborted (core dumped) ``` My git version is 4c79d38.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
crash Prefer [crash-on-valid] or [crash-on-invalid] mlir
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants