Skip to content

Convert tensor to SPIRV pass invoke 'dyn_cast' on a non-existent value. #59496

@Colloportus0

Description

@Colloportus0

MLIR built at commit a1bd85c
Reproduced with:
mlir-opt --convert-tensor-to-spirv temp.mlir

temp.mlir:

module {
  func.func @func1() {
    %cst = arith.constant dense<1668977777> : vector<4xi32>
    %38 = llvm.intr.matrix.transpose %cst {columns = 2 : i32, rows = 2 : i32} : vector<4xi32> into vector<4xi32>
    %39 = llvm.mlir.constant(0 : index) : i64
    %40 = llvm.extractelement %38[%39 : i64] : vector<4xi32>
    %41 = arith.extsi %40 : i32 to i64
    return 
  }
}

trace:

Assertion failed: (detail::isPresent(Val) && "dyn_cast on a non-existent value"), function dyn_cast, file Casting.h, line 648.
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 --convert-tensor-to-spirv 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                 0x00000001035dde70 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) + 72
1  mlir-opt                 0x00000001035de38c PrintStackTraceSignalHandler(void*) + 28
2  mlir-opt                 0x00000001035dc43c llvm::sys::RunSignalHandlers() + 148
3  mlir-opt                 0x00000001035dfff8 SignalHandler(int) + 252
4  libsystem_platform.dylib 0x000000019970d4c4 _sigtramp + 56
5  libsystem_pthread.dylib  0x00000001996f5ee0 pthread_kill + 288
6  libsystem_c.dylib        0x0000000199630340 abort + 168
7  libsystem_c.dylib        0x000000019962f754 err + 0
8  mlir-opt                 0x000000010635fc10 decltype(auto) llvm::dyn_cast<mlir::IntegerType, mlir::Type>(mlir::Type const&) + 96
9  mlir-opt                 0x000000010635fa74 mlir::IntegerType mlir::Type::dyn_cast<mlir::IntegerType>() const + 24
10 mlir-opt                 0x00000001078048a0 mlir::Type::isInteger(unsigned int) const + 28
11 mlir-opt                 0x000000010604d0c4 isBoolScalarOrVector(mlir::Type) + 32
12 mlir-opt                 0x0000000106063a38 (anonymous namespace)::TypeCastingOpPattern<mlir::arith::ExtSIOp, mlir::spirv::SConvertOp>::matchAndRewrite(mlir::arith::ExtSIOp, mlir::arith::ExtSIOpAdaptor, mlir::ConversionPatternRewriter&) const + 272
13 mlir-opt                 0x00000001039ed508 mlir::OpConversionPattern<mlir::arith::ExtSIOp>::matchAndRewrite(mlir::Operation*, llvm::ArrayRef<mlir::Value>, mlir::ConversionPatternRewriter&) const + 192
14 mlir-opt                 0x0000000107481548 mlir::ConversionPattern::matchAndRewrite(mlir::Operation*, mlir::PatternRewriter&) const + 368
15 mlir-opt                 0x0000000108178e94 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&)>) + 1356
16 mlir-opt                 0x00000001074a24a4 (anonymous namespace)::OperationLegalizer::legalizeWithPattern(mlir::Operation*, mlir::ConversionPatternRewriter&) + 328
17 mlir-opt                 0x00000001074a1bf8 (anonymous namespace)::OperationLegalizer::legalize(mlir::Operation*, mlir::ConversionPatternRewriter&) + 996
18 mlir-opt                 0x00000001074a11e8 (anonymous namespace)::OperationConverter::convert(mlir::ConversionPatternRewriter&, mlir::Operation*) + 64
19 mlir-opt                 0x00000001074856a4 (anonymous namespace)::OperationConverter::convertOperations(llvm::ArrayRef<mlir::Operation*>, llvm::function_ref<void (mlir::Diagnostic&)>) + 568
20 mlir-opt                 0x00000001074853d4 mlir::applyPartialConversion(llvm::ArrayRef<mlir::Operation*>, mlir::ConversionTarget&, mlir::FrozenRewritePatternSet const&, llvm::DenseSet<mlir::Operation*, llvm::DenseMapInfo<mlir::Operation*, void>>*) + 124
21 mlir-opt                 0x00000001074858c8 mlir::applyPartialConversion(mlir::Operation*, mlir::ConversionTarget&, mlir::FrozenRewritePatternSet const&, llvm::DenseSet<mlir::Operation*, llvm::DenseMapInfo<mlir::Operation*, void>>*) + 72
22 mlir-opt                 0x00000001066e8ef0 (anonymous namespace)::ConvertTensorToSPIRVPass::runOnOperation() + 364
23 mlir-opt                 0x0000000107344ddc mlir::detail::OpToOpPassAdaptor::run(mlir::Pass*, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int) + 512
24 mlir-opt                 0x00000001073454ac mlir::detail::OpToOpPassAdaptor::runPipeline(mlir::OpPassManager&, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int, mlir::PassInstrumentor*, mlir::PassInstrumentation::PipelineParentInfo const*) + 364
25 mlir-opt                 0x00000001073476f0 mlir::PassManager::runPasses(mlir::Operation*, mlir::AnalysisManager) + 108
26 mlir-opt                 0x00000001073474c8 mlir::PassManager::run(mlir::Operation*) + 864
27 mlir-opt                 0x000000010732b2b4 performActions(llvm::raw_ostream&, bool, bool, std::__1::shared_ptr<llvm::SourceMgr> const&, mlir::MLIRContext*, llvm::function_ref<mlir::LogicalResult (mlir::PassManager&)>, bool, bool) + 560
28 mlir-opt                 0x000000010732ae04 processBuffer(llvm::raw_ostream&, std::__1::unique_ptr<llvm::MemoryBuffer, std::__1::default_delete<llvm::MemoryBuffer>>, bool, bool, bool, bool, bool, bool, llvm::function_ref<mlir::LogicalResult (mlir::PassManager&)>, mlir::DialectRegistry&, llvm::ThreadPool*) + 524
29 mlir-opt                 0x000000010732abb0 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, bool)::$_0::operator()(std::__1::unique_ptr<llvm::MemoryBuffer, std::__1::default_delete<llvm::MemoryBuffer>>, llvm::raw_ostream&) const + 204
30 mlir-opt                 0x000000010732aac4 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, bool)::$_0>(long, std::__1::unique_ptr<llvm::MemoryBuffer, std::__1::default_delete<llvm::MemoryBuffer>>, llvm::raw_ostream&) + 80
31 mlir-opt                 0x0000000107537590 llvm::function_ref<mlir::LogicalResult (std::__1::unique_ptr<llvm::MemoryBuffer, std::__1::default_delete<llvm::MemoryBuffer>>, llvm::raw_ostream&)>::operator()(std::__1::unique_ptr<llvm::MemoryBuffer, std::__1::default_delete<llvm::MemoryBuffer>>, llvm::raw_ostream&) const + 96
32 mlir-opt                 0x0000000107537074 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) + 128
33 mlir-opt                 0x0000000107328504 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, bool) + 320
34 mlir-opt                 0x000000010732870c mlir::MlirOptMain(llvm::raw_ostream&, std::__1::unique_ptr<llvm::MemoryBuffer, std::__1::default_delete<llvm::MemoryBuffer>>, mlir::PassPipelineCLParser const&, mlir::DialectRegistry&, bool, bool, bool, bool, bool, bool, bool, bool) + 296
35 mlir-opt                 0x00000001073292d0 mlir::MlirOptMain(int, char**, llvm::StringRef, mlir::DialectRegistry&, bool) + 2912
36 mlir-opt                 0x0000000102df3f44 main + 148
37 dyld                     0x000000012132d088 start + 516 

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions