llvm-project icon indicating copy to clipboard operation
llvm-project copied to clipboard

[MLIR] Crash in `FloorDivSIOp` lowering due to unsupported type in `SPIR-V` ConstantOp::getZero

Open frida-albrecht opened this issue 3 weeks ago • 3 comments

The --convert-tensor-to-spirv pass crashes with an UNREACHABLE error when lowering an arith.floordivsi operation on tensor types.

test commit: 5fe5e53

test case:

module {
  func.func @main(%arg0: tensor<4x4x4x3xf32>, %arg1: i64, %arg2: tensor<3x3x1x3xi16>) -> tensor<4x4x4x3xf80> {
    %0 = arith.remui %arg2, %arg2 : tensor<3x3x1x3xi16>
    %1 = arith.scaling_extf %arg0, %arg0 : tensor<4x4x4x3xf32>, tensor<4x4x4x3xf32> to tensor<4x4x4x3xf64>
    %2 = arith.maxsi %arg2, %0 : tensor<3x3x1x3xi16>
    %3 = arith.maxui %2, %0 : tensor<3x3x1x3xi16>
    %4 = arith.floordivsi %2, %3 : tensor<3x3x1x3xi16>
    %5 = arith.extf %1 : tensor<4x4x4x3xf64> to tensor<4x4x4x3xf80>
    return %5 : tensor<4x4x4x3xf80>
  }
}

Step to reproduce:

mlir-opt test.mlir --convert-tensor-to-spirv

Crash backtrace:

unimplemented types for ConstantOp::getZero()
UNREACHABLE executed at /home/llvm-project/llvm-project-latest/mlir/lib/Dialect/SPIRV/IR/SPIRVOps.cpp:740!
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace and instructions to reproduce the bug.
Stack dump:
0.      Program arguments: mlir-opt test.mlir --convert-tensor-to-spirv
 #0 0x00005642f589c949 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/home/llvm-project/llvm-project-latest/build/bin/mlir-opt+0x1fe3949)
 #1 0x00005642f589914c llvm::sys::RunSignalHandlers() (/home/llvm-project/llvm-project-latest/build/bin/mlir-opt+0x1fe014c)
 #2 0x00005642f58992b6 SignalHandler(int, siginfo_t*, void*) Signals.cpp:0:0
 #3 0x00007ff2f9d06520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)
 #4 0x00007ff2f9d5a9bc pthread_kill (/lib/x86_64-linux-gnu/libc.so.6+0x969bc)
 #5 0x00007ff2f9d06476 gsignal (/lib/x86_64-linux-gnu/libc.so.6+0x42476)
 #6 0x00007ff2f9cec7f3 abort (/lib/x86_64-linux-gnu/libc.so.6+0x287f3)
 #7 0x00005642f587d0ce (/home/llvm-project/llvm-project-latest/build/bin/mlir-opt+0x1fc40ce)
 #8 0x00005642fabdd7c2 mlir::spirv::ConstantOp::getZero(mlir::Type, mlir::Location, mlir::OpBuilder&) (/home/llvm-project/llvm-project-latest/build/bin/mlir-opt+0x73247c2)
 #9 0x00005642fa389991 (anonymous namespace)::FloorDivSIOpPattern::matchAndRewrite(mlir::arith::FloorDivSIOp, mlir::arith::FloorDivSIOpAdaptor, mlir::ConversionPatternRewriter&) const ArithToSPIRV.cpp:0:0
#10 0x00005642fa396687 llvm::LogicalResult mlir::ConversionPattern::dispatchTo1To1<mlir::OpConversionPattern<mlir::arith::FloorDivSIOp>, mlir::arith::FloorDivSIOp>(mlir::OpConversionPattern<mlir::arith::FloorDivSIOp> const&, mlir::arith::FloorDivSIOp, mlir::arith::FloorDivSIOp::GenericAdaptor<llvm::ArrayRef<mlir::ValueRange>>, mlir::ConversionPatternRewriter&) (/home/llvm-project/llvm-project-latest/build/bin/mlir-opt+0x6add687)
#11 0x00005642fa396861 mlir::OpConversionPattern<mlir::arith::FloorDivSIOp>::matchAndRewrite(mlir::Operation*, llvm::ArrayRef<mlir::ValueRange>, mlir::ConversionPatternRewriter&) const (/home/llvm-project/llvm-project-latest/build/bin/mlir-opt+0x6add861)
#12 0x00005642fe0663bf mlir::ConversionPattern::matchAndRewrite(mlir::Operation*, mlir::PatternRewriter&) const (/home/llvm-project/llvm-project-latest/build/bin/mlir-opt+0xa7ad3bf)
#13 0x00005642fe0b3f1c 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&)>)::'lambda'()::operator()() const PatternApplicator.cpp:0:0
#14 0x00005642fe0b55fa 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&)>) (/home/llvm-project/llvm-project-latest/build/bin/mlir-opt+0xa7fc5fa)
#15 0x00005642fe0600eb (anonymous namespace)::OperationLegalizer::legalize(mlir::Operation*) DialectConversion.cpp:0:0
#16 0x00005642fe0605a4 mlir::OperationConverter::convert(mlir::Operation*, bool) (/home/llvm-project/llvm-project-latest/build/bin/mlir-opt+0xa7a75a4)
#17 0x00005642fe06aa86 mlir::OperationConverter::applyConversion(llvm::ArrayRef<mlir::Operation*>) (/home/llvm-project/llvm-project-latest/build/bin/mlir-opt+0xa7b1a86)
#18 0x00005642fe06c0bf applyConversion(llvm::ArrayRef<mlir::Operation*>, mlir::ConversionTarget const&, mlir::FrozenRewritePatternSet const&, mlir::ConversionConfig, (anonymous namespace)::OpConversionMode) DialectConversion.cpp:0:0
#19 0x00005642fe06c276 mlir::applyPartialConversion(mlir::Operation*, mlir::ConversionTarget const&, mlir::FrozenRewritePatternSet const&, mlir::ConversionConfig) (/home/llvm-project/llvm-project-latest/build/bin/mlir-opt+0xa7b3276)
#20 0x00005642fa372b95 (anonymous namespace)::ConvertTensorToSPIRVPass::runOnOperation() TensorToSPIRVPass.cpp:0:0
#21 0x00005642fe11bf49 mlir::detail::OpToOpPassAdaptor::run(mlir::Pass*, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int) (/home/llvm-project/llvm-project-latest/build/bin/mlir-opt+0xa862f49)
#22 0x00005642fe11c224 mlir::detail::OpToOpPassAdaptor::runPipeline(mlir::OpPassManager&, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int, mlir::PassInstrumentor*, mlir::PassInstrumentation::PipelineParentInfo const*) (/home/llvm-project/llvm-project-latest/build/bin/mlir-opt+0xa863224)
#23 0x00005642fe11de72 mlir::PassManager::runPasses(mlir::Operation*, mlir::AnalysisManager) (/home/llvm-project/llvm-project-latest/build/bin/mlir-opt+0xa864e72)
#24 0x00005642fe11ee49 mlir::PassManager::run(mlir::Operation*) (/home/llvm-project/llvm-project-latest/build/bin/mlir-opt+0xa865e49)
#25 0x00005642f5966ea6 performActions(llvm::raw_ostream&, std::shared_ptr<llvm::SourceMgr> const&, mlir::MLIRContext*, mlir::MlirOptMainConfig const&) MlirOptMain.cpp:0:0
#26 0x00005642f596845e processBuffer(llvm::raw_ostream&, std::unique_ptr<llvm::MemoryBuffer, std::default_delete<llvm::MemoryBuffer>>, llvm::MemoryBufferRef, mlir::MlirOptMainConfig const&, mlir::DialectRegistry&, mlir::SourceMgrDiagnosticVerifierHandler*, llvm::ThreadPoolInterface*) MlirOptMain.cpp:0:0
#27 0x00005642f59686a1 llvm::LogicalResult llvm::function_ref<llvm::LogicalResult (std::unique_ptr<llvm::MemoryBuffer, std::default_delete<llvm::MemoryBuffer>>, llvm::MemoryBufferRef const&, 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::MemoryBufferRef, llvm::raw_ostream&)>(long, std::unique_ptr<llvm::MemoryBuffer, std::default_delete<llvm::MemoryBuffer>>, llvm::MemoryBufferRef const&, llvm::raw_ostream&) MlirOptMain.cpp:0:0
#28 0x00005642fe44ef2d 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::MemoryBufferRef const&, llvm::raw_ostream&)>, llvm::raw_ostream&, llvm::StringRef, llvm::StringRef) (/home/llvm-project/llvm-project-latest/build/bin/mlir-opt+0xab95f2d)
#29 0x00005642f596239a mlir::MlirOptMain(llvm::raw_ostream&, std::unique_ptr<llvm::MemoryBuffer, std::default_delete<llvm::MemoryBuffer>>, mlir::DialectRegistry&, mlir::MlirOptMainConfig const&) (.part.0) MlirOptMain.cpp:0:0
#30 0x00005642f5968ce1 mlir::MlirOptMain(int, char**, llvm::StringRef, llvm::StringRef, mlir::DialectRegistry&) (/home/llvm-project/llvm-project-latest/build/bin/mlir-opt+0x20afce1)
#31 0x00005642f5968f34 mlir::MlirOptMain(int, char**, llvm::StringRef, mlir::DialectRegistry&) (/home/llvm-project/llvm-project-latest/build/bin/mlir-opt+0x20aff34)
#32 0x00005642f5840d8c main (/home/llvm-project/llvm-project-latest/build/bin/mlir-opt+0x1f87d8c)
#33 0x00007ff2f9cedd90 (/lib/x86_64-linux-gnu/libc.so.6+0x29d90)
#34 0x00007ff2f9cede40 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x29e40)
#35 0x00005642f587c1e5 _start (/home/llvm-project/llvm-project-latest/build/bin/mlir-opt+0x1fc31e5)
Aborted (core dumped)

frida-albrecht avatar Nov 09 '26 07:11 frida-albrecht

@llvm/issue-subscribers-mlir

Author: frida-albrecht

The `--convert-tensor-to-spirv` pass crashes with an UNREACHABLE error when lowering an `arith.floordivsi` operation on tensor types.

test commit: 5fe5e53

test case:

module {
  func.func @<!-- -->main(%arg0: tensor&lt;4x4x4x3xf32&gt;, %arg1: i64, %arg2: tensor&lt;3x3x1x3xi16&gt;) -&gt; tensor&lt;4x4x4x3xf80&gt; {
    %0 = arith.remui %arg2, %arg2 : tensor&lt;3x3x1x3xi16&gt;
    %1 = arith.scaling_extf %arg0, %arg0 : tensor&lt;4x4x4x3xf32&gt;, tensor&lt;4x4x4x3xf32&gt; to tensor&lt;4x4x4x3xf64&gt;
    %2 = arith.maxsi %arg2, %0 : tensor&lt;3x3x1x3xi16&gt;
    %3 = arith.maxui %2, %0 : tensor&lt;3x3x1x3xi16&gt;
    %4 = arith.floordivsi %2, %3 : tensor&lt;3x3x1x3xi16&gt;
    %5 = arith.extf %1 : tensor&lt;4x4x4x3xf64&gt; to tensor&lt;4x4x4x3xf80&gt;
    return %5 : tensor&lt;4x4x4x3xf80&gt;
  }
}

Step to reproduce:

mlir-opt test.mlir --convert-tensor-to-spirv

Crash backtrace:

unimplemented types for ConstantOp::getZero()
UNREACHABLE executed at /home/llvm-project/llvm-project-latest/mlir/lib/Dialect/SPIRV/IR/SPIRVOps.cpp:740!
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace and instructions to reproduce the bug.
Stack dump:
0.      Program arguments: mlir-opt test.mlir --convert-tensor-to-spirv
 #<!-- -->0 0x00005642f589c949 llvm::sys::PrintStackTrace(llvm::raw_ostream&amp;, int) (/home/llvm-project/llvm-project-latest/build/bin/mlir-opt+0x1fe3949)
 #<!-- -->1 0x00005642f589914c llvm::sys::RunSignalHandlers() (/home/llvm-project/llvm-project-latest/build/bin/mlir-opt+0x1fe014c)
 #<!-- -->2 0x00005642f58992b6 SignalHandler(int, siginfo_t*, void*) Signals.cpp:0:0
 #<!-- -->3 0x00007ff2f9d06520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)
 #<!-- -->4 0x00007ff2f9d5a9bc pthread_kill (/lib/x86_64-linux-gnu/libc.so.6+0x969bc)
 #<!-- -->5 0x00007ff2f9d06476 gsignal (/lib/x86_64-linux-gnu/libc.so.6+0x42476)
 #<!-- -->6 0x00007ff2f9cec7f3 abort (/lib/x86_64-linux-gnu/libc.so.6+0x287f3)
 #<!-- -->7 0x00005642f587d0ce (/home/llvm-project/llvm-project-latest/build/bin/mlir-opt+0x1fc40ce)
 #<!-- -->8 0x00005642fabdd7c2 mlir::spirv::ConstantOp::getZero(mlir::Type, mlir::Location, mlir::OpBuilder&amp;) (/home/llvm-project/llvm-project-latest/build/bin/mlir-opt+0x73247c2)
 #<!-- -->9 0x00005642fa389991 (anonymous namespace)::FloorDivSIOpPattern::matchAndRewrite(mlir::arith::FloorDivSIOp, mlir::arith::FloorDivSIOpAdaptor, mlir::ConversionPatternRewriter&amp;) const ArithToSPIRV.cpp:0:0
#<!-- -->10 0x00005642fa396687 llvm::LogicalResult mlir::ConversionPattern::dispatchTo1To1&lt;mlir::OpConversionPattern&lt;mlir::arith::FloorDivSIOp&gt;, mlir::arith::FloorDivSIOp&gt;(mlir::OpConversionPattern&lt;mlir::arith::FloorDivSIOp&gt; const&amp;, mlir::arith::FloorDivSIOp, mlir::arith::FloorDivSIOp::GenericAdaptor&lt;llvm::ArrayRef&lt;mlir::ValueRange&gt;&gt;, mlir::ConversionPatternRewriter&amp;) (/home/llvm-project/llvm-project-latest/build/bin/mlir-opt+0x6add687)
#<!-- -->11 0x00005642fa396861 mlir::OpConversionPattern&lt;mlir::arith::FloorDivSIOp&gt;::matchAndRewrite(mlir::Operation*, llvm::ArrayRef&lt;mlir::ValueRange&gt;, mlir::ConversionPatternRewriter&amp;) const (/home/llvm-project/llvm-project-latest/build/bin/mlir-opt+0x6add861)
#<!-- -->12 0x00005642fe0663bf mlir::ConversionPattern::matchAndRewrite(mlir::Operation*, mlir::PatternRewriter&amp;) const (/home/llvm-project/llvm-project-latest/build/bin/mlir-opt+0xa7ad3bf)
#<!-- -->13 0x00005642fe0b3f1c mlir::PatternApplicator::matchAndRewrite(mlir::Operation*, mlir::PatternRewriter&amp;, llvm::function_ref&lt;bool (mlir::Pattern const&amp;)&gt;, llvm::function_ref&lt;void (mlir::Pattern const&amp;)&gt;, llvm::function_ref&lt;llvm::LogicalResult (mlir::Pattern const&amp;)&gt;)::'lambda'()::operator()() const PatternApplicator.cpp:0:0
#<!-- -->14 0x00005642fe0b55fa mlir::PatternApplicator::matchAndRewrite(mlir::Operation*, mlir::PatternRewriter&amp;, llvm::function_ref&lt;bool (mlir::Pattern const&amp;)&gt;, llvm::function_ref&lt;void (mlir::Pattern const&amp;)&gt;, llvm::function_ref&lt;llvm::LogicalResult (mlir::Pattern const&amp;)&gt;) (/home/llvm-project/llvm-project-latest/build/bin/mlir-opt+0xa7fc5fa)
#<!-- -->15 0x00005642fe0600eb (anonymous namespace)::OperationLegalizer::legalize(mlir::Operation*) DialectConversion.cpp:0:0
#<!-- -->16 0x00005642fe0605a4 mlir::OperationConverter::convert(mlir::Operation*, bool) (/home/llvm-project/llvm-project-latest/build/bin/mlir-opt+0xa7a75a4)
#<!-- -->17 0x00005642fe06aa86 mlir::OperationConverter::applyConversion(llvm::ArrayRef&lt;mlir::Operation*&gt;) (/home/llvm-project/llvm-project-latest/build/bin/mlir-opt+0xa7b1a86)
#<!-- -->18 0x00005642fe06c0bf applyConversion(llvm::ArrayRef&lt;mlir::Operation*&gt;, mlir::ConversionTarget const&amp;, mlir::FrozenRewritePatternSet const&amp;, mlir::ConversionConfig, (anonymous namespace)::OpConversionMode) DialectConversion.cpp:0:0
#<!-- -->19 0x00005642fe06c276 mlir::applyPartialConversion(mlir::Operation*, mlir::ConversionTarget const&amp;, mlir::FrozenRewritePatternSet const&amp;, mlir::ConversionConfig) (/home/llvm-project/llvm-project-latest/build/bin/mlir-opt+0xa7b3276)
#<!-- -->20 0x00005642fa372b95 (anonymous namespace)::ConvertTensorToSPIRVPass::runOnOperation() TensorToSPIRVPass.cpp:0:0
#<!-- -->21 0x00005642fe11bf49 mlir::detail::OpToOpPassAdaptor::run(mlir::Pass*, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int) (/home/llvm-project/llvm-project-latest/build/bin/mlir-opt+0xa862f49)
#<!-- -->22 0x00005642fe11c224 mlir::detail::OpToOpPassAdaptor::runPipeline(mlir::OpPassManager&amp;, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int, mlir::PassInstrumentor*, mlir::PassInstrumentation::PipelineParentInfo const*) (/home/llvm-project/llvm-project-latest/build/bin/mlir-opt+0xa863224)
#<!-- -->23 0x00005642fe11de72 mlir::PassManager::runPasses(mlir::Operation*, mlir::AnalysisManager) (/home/llvm-project/llvm-project-latest/build/bin/mlir-opt+0xa864e72)
#<!-- -->24 0x00005642fe11ee49 mlir::PassManager::run(mlir::Operation*) (/home/llvm-project/llvm-project-latest/build/bin/mlir-opt+0xa865e49)
#<!-- -->25 0x00005642f5966ea6 performActions(llvm::raw_ostream&amp;, std::shared_ptr&lt;llvm::SourceMgr&gt; const&amp;, mlir::MLIRContext*, mlir::MlirOptMainConfig const&amp;) MlirOptMain.cpp:0:0
#<!-- -->26 0x00005642f596845e processBuffer(llvm::raw_ostream&amp;, std::unique_ptr&lt;llvm::MemoryBuffer, std::default_delete&lt;llvm::MemoryBuffer&gt;&gt;, llvm::MemoryBufferRef, mlir::MlirOptMainConfig const&amp;, mlir::DialectRegistry&amp;, mlir::SourceMgrDiagnosticVerifierHandler*, llvm::ThreadPoolInterface*) MlirOptMain.cpp:0:0
#<!-- -->27 0x00005642f59686a1 llvm::LogicalResult llvm::function_ref&lt;llvm::LogicalResult (std::unique_ptr&lt;llvm::MemoryBuffer, std::default_delete&lt;llvm::MemoryBuffer&gt;&gt;, llvm::MemoryBufferRef const&amp;, llvm::raw_ostream&amp;)&gt;::callback_fn&lt;mlir::MlirOptMain(llvm::raw_ostream&amp;, std::unique_ptr&lt;llvm::MemoryBuffer, std::default_delete&lt;llvm::MemoryBuffer&gt;&gt;, mlir::DialectRegistry&amp;, mlir::MlirOptMainConfig const&amp;)::'lambda'(std::unique_ptr&lt;llvm::MemoryBuffer, std::default_delete&lt;llvm::MemoryBuffer&gt;&gt;, llvm::MemoryBufferRef, llvm::raw_ostream&amp;)&gt;(long, std::unique_ptr&lt;llvm::MemoryBuffer, std::default_delete&lt;llvm::MemoryBuffer&gt;&gt;, llvm::MemoryBufferRef const&amp;, llvm::raw_ostream&amp;) MlirOptMain.cpp:0:0
#<!-- -->28 0x00005642fe44ef2d mlir::splitAndProcessBuffer(std::unique_ptr&lt;llvm::MemoryBuffer, std::default_delete&lt;llvm::MemoryBuffer&gt;&gt;, llvm::function_ref&lt;llvm::LogicalResult (std::unique_ptr&lt;llvm::MemoryBuffer, std::default_delete&lt;llvm::MemoryBuffer&gt;&gt;, llvm::MemoryBufferRef const&amp;, llvm::raw_ostream&amp;)&gt;, llvm::raw_ostream&amp;, llvm::StringRef, llvm::StringRef) (/home/llvm-project/llvm-project-latest/build/bin/mlir-opt+0xab95f2d)
#<!-- -->29 0x00005642f596239a mlir::MlirOptMain(llvm::raw_ostream&amp;, std::unique_ptr&lt;llvm::MemoryBuffer, std::default_delete&lt;llvm::MemoryBuffer&gt;&gt;, mlir::DialectRegistry&amp;, mlir::MlirOptMainConfig const&amp;) (.part.0) MlirOptMain.cpp:0:0
#<!-- -->30 0x00005642f5968ce1 mlir::MlirOptMain(int, char**, llvm::StringRef, llvm::StringRef, mlir::DialectRegistry&amp;) (/home/llvm-project/llvm-project-latest/build/bin/mlir-opt+0x20afce1)
#<!-- -->31 0x00005642f5968f34 mlir::MlirOptMain(int, char**, llvm::StringRef, mlir::DialectRegistry&amp;) (/home/llvm-project/llvm-project-latest/build/bin/mlir-opt+0x20aff34)
#<!-- -->32 0x00005642f5840d8c main (/home/llvm-project/llvm-project-latest/build/bin/mlir-opt+0x1f87d8c)
#<!-- -->33 0x00007ff2f9cedd90 (/lib/x86_64-linux-gnu/libc.so.6+0x29d90)
#<!-- -->34 0x00007ff2f9cede40 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x29e40)
#<!-- -->35 0x00005642f587c1e5 _start (/home/llvm-project/llvm-project-latest/build/bin/mlir-opt+0x1fc31e5)
Aborted (core dumped)

This issue appears to be similar to #239598. Both crashes occur during SPIR-V conversion when handling tensor operations, and both involve unsupported types in spirv::ConstantOp (getZero() in this issue and getOne() in #239598). They may share a common underlying issue in the SPIR-V conversion patterns.

frida-albrecht avatar Nov 09 '26 07:11 frida-albrecht

@llvm/issue-subscribers-mlir-spirv

Author: frida-albrecht

The `--convert-tensor-to-spirv` pass crashes with an UNREACHABLE error when lowering an `arith.floordivsi` operation on tensor types.

test commit: 5fe5e53

test case:

module {
  func.func @<!-- -->main(%arg0: tensor&lt;4x4x4x3xf32&gt;, %arg1: i64, %arg2: tensor&lt;3x3x1x3xi16&gt;) -&gt; tensor&lt;4x4x4x3xf80&gt; {
    %0 = arith.remui %arg2, %arg2 : tensor&lt;3x3x1x3xi16&gt;
    %1 = arith.scaling_extf %arg0, %arg0 : tensor&lt;4x4x4x3xf32&gt;, tensor&lt;4x4x4x3xf32&gt; to tensor&lt;4x4x4x3xf64&gt;
    %2 = arith.maxsi %arg2, %0 : tensor&lt;3x3x1x3xi16&gt;
    %3 = arith.maxui %2, %0 : tensor&lt;3x3x1x3xi16&gt;
    %4 = arith.floordivsi %2, %3 : tensor&lt;3x3x1x3xi16&gt;
    %5 = arith.extf %1 : tensor&lt;4x4x4x3xf64&gt; to tensor&lt;4x4x4x3xf80&gt;
    return %5 : tensor&lt;4x4x4x3xf80&gt;
  }
}

Step to reproduce:

mlir-opt test.mlir --convert-tensor-to-spirv

Crash backtrace:

unimplemented types for ConstantOp::getZero()
UNREACHABLE executed at /home/llvm-project/llvm-project-latest/mlir/lib/Dialect/SPIRV/IR/SPIRVOps.cpp:740!
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace and instructions to reproduce the bug.
Stack dump:
0.      Program arguments: mlir-opt test.mlir --convert-tensor-to-spirv
 #<!-- -->0 0x00005642f589c949 llvm::sys::PrintStackTrace(llvm::raw_ostream&amp;, int) (/home/llvm-project/llvm-project-latest/build/bin/mlir-opt+0x1fe3949)
 #<!-- -->1 0x00005642f589914c llvm::sys::RunSignalHandlers() (/home/llvm-project/llvm-project-latest/build/bin/mlir-opt+0x1fe014c)
 #<!-- -->2 0x00005642f58992b6 SignalHandler(int, siginfo_t*, void*) Signals.cpp:0:0
 #<!-- -->3 0x00007ff2f9d06520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)
 #<!-- -->4 0x00007ff2f9d5a9bc pthread_kill (/lib/x86_64-linux-gnu/libc.so.6+0x969bc)
 #<!-- -->5 0x00007ff2f9d06476 gsignal (/lib/x86_64-linux-gnu/libc.so.6+0x42476)
 #<!-- -->6 0x00007ff2f9cec7f3 abort (/lib/x86_64-linux-gnu/libc.so.6+0x287f3)
 #<!-- -->7 0x00005642f587d0ce (/home/llvm-project/llvm-project-latest/build/bin/mlir-opt+0x1fc40ce)
 #<!-- -->8 0x00005642fabdd7c2 mlir::spirv::ConstantOp::getZero(mlir::Type, mlir::Location, mlir::OpBuilder&amp;) (/home/llvm-project/llvm-project-latest/build/bin/mlir-opt+0x73247c2)
 #<!-- -->9 0x00005642fa389991 (anonymous namespace)::FloorDivSIOpPattern::matchAndRewrite(mlir::arith::FloorDivSIOp, mlir::arith::FloorDivSIOpAdaptor, mlir::ConversionPatternRewriter&amp;) const ArithToSPIRV.cpp:0:0
#<!-- -->10 0x00005642fa396687 llvm::LogicalResult mlir::ConversionPattern::dispatchTo1To1&lt;mlir::OpConversionPattern&lt;mlir::arith::FloorDivSIOp&gt;, mlir::arith::FloorDivSIOp&gt;(mlir::OpConversionPattern&lt;mlir::arith::FloorDivSIOp&gt; const&amp;, mlir::arith::FloorDivSIOp, mlir::arith::FloorDivSIOp::GenericAdaptor&lt;llvm::ArrayRef&lt;mlir::ValueRange&gt;&gt;, mlir::ConversionPatternRewriter&amp;) (/home/llvm-project/llvm-project-latest/build/bin/mlir-opt+0x6add687)
#<!-- -->11 0x00005642fa396861 mlir::OpConversionPattern&lt;mlir::arith::FloorDivSIOp&gt;::matchAndRewrite(mlir::Operation*, llvm::ArrayRef&lt;mlir::ValueRange&gt;, mlir::ConversionPatternRewriter&amp;) const (/home/llvm-project/llvm-project-latest/build/bin/mlir-opt+0x6add861)
#<!-- -->12 0x00005642fe0663bf mlir::ConversionPattern::matchAndRewrite(mlir::Operation*, mlir::PatternRewriter&amp;) const (/home/llvm-project/llvm-project-latest/build/bin/mlir-opt+0xa7ad3bf)
#<!-- -->13 0x00005642fe0b3f1c mlir::PatternApplicator::matchAndRewrite(mlir::Operation*, mlir::PatternRewriter&amp;, llvm::function_ref&lt;bool (mlir::Pattern const&amp;)&gt;, llvm::function_ref&lt;void (mlir::Pattern const&amp;)&gt;, llvm::function_ref&lt;llvm::LogicalResult (mlir::Pattern const&amp;)&gt;)::'lambda'()::operator()() const PatternApplicator.cpp:0:0
#<!-- -->14 0x00005642fe0b55fa mlir::PatternApplicator::matchAndRewrite(mlir::Operation*, mlir::PatternRewriter&amp;, llvm::function_ref&lt;bool (mlir::Pattern const&amp;)&gt;, llvm::function_ref&lt;void (mlir::Pattern const&amp;)&gt;, llvm::function_ref&lt;llvm::LogicalResult (mlir::Pattern const&amp;)&gt;) (/home/llvm-project/llvm-project-latest/build/bin/mlir-opt+0xa7fc5fa)
#<!-- -->15 0x00005642fe0600eb (anonymous namespace)::OperationLegalizer::legalize(mlir::Operation*) DialectConversion.cpp:0:0
#<!-- -->16 0x00005642fe0605a4 mlir::OperationConverter::convert(mlir::Operation*, bool) (/home/llvm-project/llvm-project-latest/build/bin/mlir-opt+0xa7a75a4)
#<!-- -->17 0x00005642fe06aa86 mlir::OperationConverter::applyConversion(llvm::ArrayRef&lt;mlir::Operation*&gt;) (/home/llvm-project/llvm-project-latest/build/bin/mlir-opt+0xa7b1a86)
#<!-- -->18 0x00005642fe06c0bf applyConversion(llvm::ArrayRef&lt;mlir::Operation*&gt;, mlir::ConversionTarget const&amp;, mlir::FrozenRewritePatternSet const&amp;, mlir::ConversionConfig, (anonymous namespace)::OpConversionMode) DialectConversion.cpp:0:0
#<!-- -->19 0x00005642fe06c276 mlir::applyPartialConversion(mlir::Operation*, mlir::ConversionTarget const&amp;, mlir::FrozenRewritePatternSet const&amp;, mlir::ConversionConfig) (/home/llvm-project/llvm-project-latest/build/bin/mlir-opt+0xa7b3276)
#<!-- -->20 0x00005642fa372b95 (anonymous namespace)::ConvertTensorToSPIRVPass::runOnOperation() TensorToSPIRVPass.cpp:0:0
#<!-- -->21 0x00005642fe11bf49 mlir::detail::OpToOpPassAdaptor::run(mlir::Pass*, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int) (/home/llvm-project/llvm-project-latest/build/bin/mlir-opt+0xa862f49)
#<!-- -->22 0x00005642fe11c224 mlir::detail::OpToOpPassAdaptor::runPipeline(mlir::OpPassManager&amp;, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int, mlir::PassInstrumentor*, mlir::PassInstrumentation::PipelineParentInfo const*) (/home/llvm-project/llvm-project-latest/build/bin/mlir-opt+0xa863224)
#<!-- -->23 0x00005642fe11de72 mlir::PassManager::runPasses(mlir::Operation*, mlir::AnalysisManager) (/home/llvm-project/llvm-project-latest/build/bin/mlir-opt+0xa864e72)
#<!-- -->24 0x00005642fe11ee49 mlir::PassManager::run(mlir::Operation*) (/home/llvm-project/llvm-project-latest/build/bin/mlir-opt+0xa865e49)
#<!-- -->25 0x00005642f5966ea6 performActions(llvm::raw_ostream&amp;, std::shared_ptr&lt;llvm::SourceMgr&gt; const&amp;, mlir::MLIRContext*, mlir::MlirOptMainConfig const&amp;) MlirOptMain.cpp:0:0
#<!-- -->26 0x00005642f596845e processBuffer(llvm::raw_ostream&amp;, std::unique_ptr&lt;llvm::MemoryBuffer, std::default_delete&lt;llvm::MemoryBuffer&gt;&gt;, llvm::MemoryBufferRef, mlir::MlirOptMainConfig const&amp;, mlir::DialectRegistry&amp;, mlir::SourceMgrDiagnosticVerifierHandler*, llvm::ThreadPoolInterface*) MlirOptMain.cpp:0:0
#<!-- -->27 0x00005642f59686a1 llvm::LogicalResult llvm::function_ref&lt;llvm::LogicalResult (std::unique_ptr&lt;llvm::MemoryBuffer, std::default_delete&lt;llvm::MemoryBuffer&gt;&gt;, llvm::MemoryBufferRef const&amp;, llvm::raw_ostream&amp;)&gt;::callback_fn&lt;mlir::MlirOptMain(llvm::raw_ostream&amp;, std::unique_ptr&lt;llvm::MemoryBuffer, std::default_delete&lt;llvm::MemoryBuffer&gt;&gt;, mlir::DialectRegistry&amp;, mlir::MlirOptMainConfig const&amp;)::'lambda'(std::unique_ptr&lt;llvm::MemoryBuffer, std::default_delete&lt;llvm::MemoryBuffer&gt;&gt;, llvm::MemoryBufferRef, llvm::raw_ostream&amp;)&gt;(long, std::unique_ptr&lt;llvm::MemoryBuffer, std::default_delete&lt;llvm::MemoryBuffer&gt;&gt;, llvm::MemoryBufferRef const&amp;, llvm::raw_ostream&amp;) MlirOptMain.cpp:0:0
#<!-- -->28 0x00005642fe44ef2d mlir::splitAndProcessBuffer(std::unique_ptr&lt;llvm::MemoryBuffer, std::default_delete&lt;llvm::MemoryBuffer&gt;&gt;, llvm::function_ref&lt;llvm::LogicalResult (std::unique_ptr&lt;llvm::MemoryBuffer, std::default_delete&lt;llvm::MemoryBuffer&gt;&gt;, llvm::MemoryBufferRef const&amp;, llvm::raw_ostream&amp;)&gt;, llvm::raw_ostream&amp;, llvm::StringRef, llvm::StringRef) (/home/llvm-project/llvm-project-latest/build/bin/mlir-opt+0xab95f2d)
#<!-- -->29 0x00005642f596239a mlir::MlirOptMain(llvm::raw_ostream&amp;, std::unique_ptr&lt;llvm::MemoryBuffer, std::default_delete&lt;llvm::MemoryBuffer&gt;&gt;, mlir::DialectRegistry&amp;, mlir::MlirOptMainConfig const&amp;) (.part.0) MlirOptMain.cpp:0:0
#<!-- -->30 0x00005642f5968ce1 mlir::MlirOptMain(int, char**, llvm::StringRef, llvm::StringRef, mlir::DialectRegistry&amp;) (/home/llvm-project/llvm-project-latest/build/bin/mlir-opt+0x20afce1)
#<!-- -->31 0x00005642f5968f34 mlir::MlirOptMain(int, char**, llvm::StringRef, mlir::DialectRegistry&amp;) (/home/llvm-project/llvm-project-latest/build/bin/mlir-opt+0x20aff34)
#<!-- -->32 0x00005642f5840d8c main (/home/llvm-project/llvm-project-latest/build/bin/mlir-opt+0x1f87d8c)
#<!-- -->33 0x00007ff2f9cedd90 (/lib/x86_64-linux-gnu/libc.so.6+0x29d90)
#<!-- -->34 0x00007ff2f9cede40 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x29e40)
#<!-- -->35 0x00005642f587c1e5 _start (/home/llvm-project/llvm-project-latest/build/bin/mlir-opt+0x1fc31e5)
Aborted (core dumped)