Issue 178214
Summary mlir-opt --convert-arith-to-spirv crashes on arith.trunci of tensor<1xi32> to tensor<1xi16>
Labels new issue
Assignees
Reporter mlirBug
    mlir-opt version: 22.1.0-rc1

The crash is triggered while lowering an `arith.trunci` operation from tensor<1xi32> to tensor<1xi16>. During pattern rewriting, the pass attempts to create a SPIR-V BitwiseAndOp and fails internally, causing a hard abort.

```
mlir-opt --convert-arith-to-spirv test.mlir
```
```
module {
  func.func @main() {
    %0 = mpi.comm_world : !mpi.comm
    %1 = gpu.block_dim  x
 smt.solver(%0, %1) : (!mpi.comm, index) -> () {
      ^bb0(%arg0: !mpi.comm, %arg1: index):
      smt.yield
    }
    %2 = tensor.from_elements %1 : tensor<1xindex>
    %3 = arith.index_cast %2 : tensor<1xindex> to tensor<1xi32>
    %4 = arith.trunci %3 : tensor<1xi32> to tensor<1xi16>
 return
  }
}
```
```
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: llvmorg-22.1.0-install/bin/mlir-opt --convert-arith-to-spirv test.mlir
 #0 0x00006551a8c7be32 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (llvmorg-22.1.0-install/bin/mlir-opt+0x252fe32)
 #1 0x00006551a8c785af llvm::sys::RunSignalHandlers() (llvmorg-22.1.0-install/bin/mlir-opt+0x252c5af)
 #2 0x00006551a8c786fc SignalHandler(int, siginfo_t*, void*) Signals.cpp:0:0
 #3 0x000077d77bc45330 (/lib/x86_64-linux-gnu/libc.so.6+0x45330)
 #4 0x00006551b08960f4 mlir::detail::OperandStorage::OperandStorage(mlir::Operation*, mlir::OpOperand*, mlir::ValueRange) (llvmorg-22.1.0-install/bin/mlir-opt+0xa14a0f4)
 #5 0x00006551b0886ce4 mlir::Operation::create(mlir::Location, mlir::OperationName, mlir::TypeRange, mlir::ValueRange, mlir::DictionaryAttr, mlir::OpaqueProperties, mlir::BlockRange, unsigned int) (llvmorg-22.1.0-install/bin/mlir-opt+0xa13ace4)
 #6 0x00006551b088722a mlir::Operation::create(mlir::Location, mlir::OperationName, mlir::TypeRange, mlir::ValueRange, mlir::NamedAttrList&&, mlir::OpaqueProperties, mlir::BlockRange, mlir::RegionRange) (llvmorg-22.1.0-install/bin/mlir-opt+0xa13b22a)
 #7 0x00006551b088790c mlir::Operation::create(mlir::OperationState const&) (llvmorg-22.1.0-install/bin/mlir-opt+0xa13b90c)
 #8 0x00006551b07c76c3 mlir::OpBuilder::create(mlir::OperationState const&) (llvmorg-22.1.0-install/bin/mlir-opt+0xa07b6c3)
 #9 0x00006551acbd017f mlir::spirv::BitwiseAndOp::create(mlir::OpBuilder&, mlir::Location, mlir::Type, mlir::Value, mlir::Value) (llvmorg-22.1.0-install/bin/mlir-opt+0x648417f)
#10 0x00006551ac51b304 (anonymous namespace)::TruncIPattern::matchAndRewrite(mlir::arith::TruncIOp, mlir::arith::TruncIOpAdaptor, mlir::ConversionPatternRewriter&) const ArithToSPIRV.cpp:0:0

```
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to