[Mlir-commits] [mlir] [mlir][tosa] Add mod_shape op (PR #170343)

Sayan Saha llvmlistbot at llvm.org
Thu Jan 8 10:58:00 PST 2026


================
@@ -1690,3 +1690,13 @@ func.func @test_dim(%arg0: tensor<1x2x3x4x5x6x7x8xi32>) -> !tosa.shape<1> {
   %0 = tosa.dim %arg0 {axis = 2 : i32} : (tensor<1x2x3x4x5x6x7x8xi32>) -> !tosa.shape<1>
   return %0 : !tosa.shape<1>
 }
+
+// -----
+
+func.func @test_mod_shape_invalid_rank() -> !tosa.shape<9> {
+  %a = tosa.const_shape {values = dense<[1, 2, 3, 4, 5, 6, 7, 8, 9]> : tensor<9xindex>} : () -> !tosa.shape<9>
+  %b = tosa.const_shape {values = dense<[1, 2, 3, 4, 5, 6, 7, 8, 9]> : tensor<9xindex>} : () -> !tosa.shape<9>
+  // expected-error at +1 {{'tosa.mod_shape' op failed shape type level check: '!tosa.shape<9>' exceeds MAX_RANK}}
----------------
sahas3 wrote:

Should a LIT test be added to check for failure if ranks of the operands are different?

https://github.com/llvm/llvm-project/pull/170343


More information about the Mlir-commits mailing list