Skip to content

[mlir] -lower-host-to-llvm crashes #108161

@anonymoususer-12

Description

@anonymoususer-12

git version: 761bf33

system: Ubuntu 18.04.6 LTS

reproduce with: mlir-opt -lower-host-to-llvm a.mlir

a.mlir:

func.func private @struct_missing_member_semantic(!spirv.struct<(!spirv.matrix<3 x vector<3xf32>> [0])>) -> ()

stack trace:

unhandled SPIR-V type
UNREACHABLE executed at /data/szy/MLIR/llvm-release/llvm-project/mlir/lib/Dialect/SPIRV/Utils/LayoutUtils.cpp:102!
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-release/llvm-project/build/bin/mlir-opt -lower-host-to-llvm a.mlir
 #0 0x0000565425a4d128 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/data/szy/MLIR/llvm-release/llvm-project/build/bin/mlir-opt+0x10d7128)
 #1 0x0000565425a4ac3e llvm::sys::RunSignalHandlers() (/data/szy/MLIR/llvm-release/llvm-project/build/bin/mlir-opt+0x10d4c3e)
 #2 0x0000565425a4dabd SignalHandler(int) Signals.cpp:0:0
 #3 0x00007f949f882420 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x14420)
 #4 0x00007f949eebf00b raise /build/glibc-LcI20x/glibc-2.31/signal/../sysdeps/unix/sysv/linux/raise.c:51:1
 #5 0x00007f949ee9e859 abort /build/glibc-LcI20x/glibc-2.31/stdlib/abort.c:81:7
 #6 0x0000565425a6d18f (/data/szy/MLIR/llvm-release/llvm-project/build/bin/mlir-opt+0x10f718f)
 #7 0x0000565427c9c153 (/data/szy/MLIR/llvm-release/llvm-project/build/bin/mlir-opt+0x3326153)
 #8 0x0000565427c9ba6a mlir::VulkanLayoutUtils::decorateType(mlir::spirv::StructType, unsigned long&, unsigned long&) (/data/szy/MLIR/llvm-release/llvm-project/build/bin/mlir-opt+0x3325a6a)
 #9 0x0000565427c9b963 mlir::VulkanLayoutUtils::decorateType(mlir::spirv::StructType) (/data/szy/MLIR/llvm-release/llvm-project/build/bin/mlir-opt+0x3325963)
#10 0x00005654284c2f2e std::_Function_handler<std::optional<llvm::LogicalResult> (mlir::Type, llvm::SmallVectorImpl<mlir::Type>&), std::enable_if<std::is_invocable_v<mlir::populateSPIRVToLLVMTypeConversion(mlir::LLVMTypeConverter&, mlir::spirv::ClientAPI)::$_3, mlir::spirv::StructType, llvm::SmallVectorImpl<mlir::Type>&>, std::function<std::optional<llvm::LogicalResult> (mlir::Type, llvm::SmallVectorImpl<mlir::Type>&)>>::type mlir::TypeConverter::wrapCallback<mlir::spirv::StructType, std::enable_if<std::is_invocable_v<mlir::populateSPIRVToLLVMTypeConversion(mlir::LLVMTypeConverter&, mlir::spirv::ClientAPI)::$_3, mlir::spirv::StructType>, std::function<std::optional<llvm::LogicalResult> (mlir::Type, llvm::SmallVectorImpl<mlir::Type>&)>>::type mlir::TypeConverter::wrapCallback<mlir::spirv::StructType, mlir::populateSPIRVToLLVMTypeConversion(mlir::LLVMTypeConverter&, mlir::spirv::ClientAPI)::$_3>(mlir::populateSPIRVToLLVMTypeConversion(mlir::LLVMTypeConverter&, mlir::spirv::ClientAPI)::$_3&&) const::'lambda'(mlir::spirv::StructType, llvm::SmallVectorImpl<mlir::Type>&)>(mlir::populateSPIRVToLLVMTypeConversion(mlir::LLVMTypeConverter&, mlir::spirv::ClientAPI)::$_3&&) const::'lambda'(mlir::Type, llvm::SmallVectorImpl<mlir::Type>&)>::_M_invoke(std::_Any_data const&, mlir::Type&&, llvm::SmallVectorImpl<mlir::Type>&) SPIRVToLLVM.cpp:0:0
#11 0x0000565428b990f0 mlir::TypeConverter::convertType(mlir::Type, llvm::SmallVectorImpl<mlir::Type>&) const (/data/szy/MLIR/llvm-release/llvm-project/build/bin/mlir-opt+0x42230f0)
#12 0x0000565428b9acf7 mlir::TypeConverter::convertType(mlir::Type) const (/data/szy/MLIR/llvm-release/llvm-project/build/bin/mlir-opt+0x4224cf7)
#13 0x0000565428362198 mlir::structFuncArgTypeConverter(mlir::LLVMTypeConverter const&, mlir::Type, llvm::SmallVectorImpl<mlir::Type>&) (/data/szy/MLIR/llvm-release/llvm-project/build/bin/mlir-opt+0x39ec198)
#14 0x0000565428361e68 mlir::LLVMTypeConverter::convertFunctionSignatureImpl(mlir::FunctionType, bool, bool, mlir::TypeConverter::SignatureConversion&, llvm::SmallVectorImpl<std::optional<mlir::NamedAttribute>>*) const (/data/szy/MLIR/llvm-release/llvm-project/build/bin/mlir-opt+0x39ebe68)
#15 0x0000565428362736 mlir::LLVMTypeConverter::convertFunctionSignature(mlir::FunctionOpInterface, bool, bool, mlir::TypeConverter::SignatureConversion&, llvm::SmallVectorImpl<std::optional<mlir::NamedAttribute>>&) const (/data/szy/MLIR/llvm-release/llvm-project/build/bin/mlir-opt+0x39ec736)
#16 0x00005654282683d2 mlir::convertFuncOpToLLVMFuncOp(mlir::FunctionOpInterface, mlir::ConversionPatternRewriter&, mlir::LLVMTypeConverter const&) (/data/szy/MLIR/llvm-release/llvm-project/build/bin/mlir-opt+0x38f23d2)
#17 0x000056542826f795 (anonymous namespace)::FuncOpConversion::matchAndRewrite(mlir::func::FuncOp, mlir::func::FuncOpAdaptor, mlir::ConversionPatternRewriter&) const FuncToLLVM.cpp:0:0
#18 0x000056542826f5f8 mlir::ConvertOpToLLVMPattern<mlir::func::FuncOp>::matchAndRewrite(mlir::Operation*, llvm::ArrayRef<mlir::Value>, mlir::ConversionPatternRewriter&) const (/data/szy/MLIR/llvm-release/llvm-project/build/bin/mlir-opt+0x38f95f8)
#19 0x0000565428b9db11 mlir::ConversionPattern::matchAndRewrite(mlir::Operation*, mlir::PatternRewriter&) const (/data/szy/MLIR/llvm-release/llvm-project/build/bin/mlir-opt+0x4227b11)
#20 0x000056542b528c91 void llvm::function_ref<void ()>::callback_fn<mlir::PatternApplicator::matchAndRewrite(mlir::Operation*, mlir::PatternRewriter&, llvm::function_ref<bool (mlir::Pattern const&)>, llvm::function_ref<void (mlir::Pattern const&)>, llvm::function_ref<llvm::LogicalResult (mlir::Pattern const&)>)::$_0>(long) PatternApplicator.cpp:0:0
#21 0x000056542b52594b mlir::PatternApplicator::matchAndRewrite(mlir::Operation*, mlir::PatternRewriter&, llvm::function_ref<bool (mlir::Pattern const&)>, llvm::function_ref<void (mlir::Pattern const&)>, llvm::function_ref<llvm::LogicalResult (mlir::Pattern const&)>) (/data/szy/MLIR/llvm-release/llvm-project/build/bin/mlir-opt+0x6baf94b)
#22 0x0000565428b9eb53 (anonymous namespace)::OperationLegalizer::legalize(mlir::Operation*, mlir::ConversionPatternRewriter&) DialectConversion.cpp:0:0
#23 0x0000565428b9dbb7 mlir::OperationConverter::convert(mlir::ConversionPatternRewriter&, mlir::Operation*) (/data/szy/MLIR/llvm-release/llvm-project/build/bin/mlir-opt+0x4227bb7)
#24 0x0000565428b9ed7f mlir::OperationConverter::convertOperations(llvm::ArrayRef<mlir::Operation*>) (/data/szy/MLIR/llvm-release/llvm-project/build/bin/mlir-opt+0x4228d7f)
#25 0x0000565428ba696b mlir::applyPartialConversion(mlir::Operation*, mlir::ConversionTarget const&, mlir::FrozenRewritePatternSet const&, mlir::ConversionConfig) (/data/szy/MLIR/llvm-release/llvm-project/build/bin/mlir-opt+0x423096b)
#26 0x00005654284ab829 (anonymous namespace)::LowerHostCodeToLLVM::runOnOperation() ConvertLaunchFuncToLLVMCalls.cpp:0:0
#27 0x0000565428b3f2d6 mlir::detail::OpToOpPassAdaptor::run(mlir::Pass*, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int) (/data/szy/MLIR/llvm-release/llvm-project/build/bin/mlir-opt+0x41c92d6)
#28 0x0000565428b3fc40 mlir::detail::OpToOpPassAdaptor::runPipeline(mlir::OpPassManager&, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int, mlir::PassInstrumentor*, mlir::PassInstrumentation::PipelineParentInfo const*) (/data/szy/MLIR/llvm-release/llvm-project/build/bin/mlir-opt+0x41c9c40)
#29 0x0000565428b42282 mlir::PassManager::run(mlir::Operation*) (/data/szy/MLIR/llvm-release/llvm-project/build/bin/mlir-opt+0x41cc282)
#30 0x0000565428b3aab1 performActions(llvm::raw_ostream&, std::shared_ptr<llvm::SourceMgr> const&, mlir::MLIRContext*, mlir::MlirOptMainConfig const&) MlirOptMain.cpp:0:0
#31 0x0000565428b3a70b 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&) MlirOptMain.cpp:0:0
#32 0x0000565428be73a5 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-release/llvm-project/build/bin/mlir-opt+0x42713a5)
#33 0x0000565428b35b35 mlir::MlirOptMain(llvm::raw_ostream&, std::unique_ptr<llvm::MemoryBuffer, std::default_delete<llvm::MemoryBuffer>>, mlir::DialectRegistry&, mlir::MlirOptMainConfig const&) (/data/szy/MLIR/llvm-release/llvm-project/build/bin/mlir-opt+0x41bfb35)
#34 0x0000565428b35ddf mlir::MlirOptMain(int, char**, llvm::StringRef, llvm::StringRef, mlir::DialectRegistry&) (/data/szy/MLIR/llvm-release/llvm-project/build/bin/mlir-opt+0x41bfddf)
#35 0x0000565428b3610e mlir::MlirOptMain(int, char**, llvm::StringRef, mlir::DialectRegistry&) (/data/szy/MLIR/llvm-release/llvm-project/build/bin/mlir-opt+0x41c010e)
#36 0x0000565425a2dd67 main (/data/szy/MLIR/llvm-release/llvm-project/build/bin/mlir-opt+0x10b7d67)
#37 0x00007f949eea0083 __libc_start_main /build/glibc-LcI20x/glibc-2.31/csu/../csu/libc-start.c:342:3
#38 0x0000565425a2d8ee _start (/data/szy/MLIR/llvm-release/llvm-project/build/bin/mlir-opt+0x10b78ee)

Metadata

Metadata

Assignees

No one assigned

    Labels

    crashPrefer [crash-on-valid] or [crash-on-invalid]mlir:spirv

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions