Issue 53048
Summary Assertion with
Labels new issue
Assignees
Reporter cathyzhyi
    With the following IR
```
func @forward(%arg0: !torch.vtensor<[5,4,3,3,1],f32> loc(unknown), %arg1: !torch.vtensor<[?,3,1,2],f32> loc(unknown)) -> !torch.vtensor<[5,?,3,3,2],f32> {
  %0 = torch.aten.mul.Tensor %arg0, %arg1 : !torch.vtensor<[5,4,3,3,1],f32>, !torch.vtensor<[?,3,1,2],f32> -> !torch.vtensor<[5,?,3,3,2],f32>
  return %0 : !torch.vtensor<[5,?,3,3,2],f32>
}
```
Tosa backend would generate
```
func @forward(%arg0: tensor<5x4x3x3x1xf32> loc(unknown), %arg1: tensor<?x3x1x2xf32> loc(unknown)) -> tensor<5x?x3x3x2xf32> {
  %0 = "tosa.mul"(%arg0, %arg1) {shift = 0 : i32} : (tensor<5x4x3x3x1xf32>, tensor<?x3x1x2xf32>) -> tensor<5x?x3x3x2xf32>
  return %0 : tensor<5x?x3x3x2xf32>
}
```
`mlir-opt -tosa-to-linalg tosa.mlir` would crash with assert `const T &llvm::ArrayRef<long>::operator[](size_t) const [T = long]: Assertion Index < Length && "Invalid index!"' failed.`
backtrace:
```
#10 0x0000000000793f39 llvm::ArrayRef<long>::operator[](unsigned long) const llvm/include/llvm/ADT/ArrayRef.h:0:7
#11 0x000000000201ed4a findIntermediateShape(llvm::ArrayRef<long>, llvm::ArrayRef<long>, llvm::SmallVector<long, 6u>&, bool) llvm-project/mlir/lib/Conversion/TosaToLinalg/TosaToLinalg.cpp:941:20
#12 0x0000000002020f59 (anonymous namespace)::ReshapeConverterCollapseExpand::matchAndRewrite(mlir::tosa::ReshapeOp, mlir::tosa::ReshapeOpAdaptor, mlir::ConversionPatternRewriter&) const llvm-project/mlir/lib/Conversion/TosaToLinalg/TosaToLinalg.cpp:1137:9
#13 0x0000000002042500 mlir::OpConversionPattern<mlir::tosa::ReshapeOp>::matchAndRewrite(mlir::Operation*, llvm::ArrayRef<mlir::Value>, mlir::ConversionPatternRewriter&) const llvm-project/mlir/include/mlir/Transforms/DialectConversion.h:424:12
#14 0x0000000002a1bcc3 mlir::ConversionPattern::matchAndRewrite(mlir::Operation*, mlir::PatternRewriter&) const llvm-project/mlir/lib/Transforms/Utils/DialectConversion.cpp:1701:10
```
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to