[Mlir-commits] [mlir] [mlir][tosa]: Add SLICE_SHAPE folder (PR #186997)
Luke Hutton
llvmlistbot at llvm.org
Tue Mar 17 06:03:27 PDT 2026
================
@@ -1469,4 +1469,16 @@ func.func @test_concat_shape_total_rank9_shapes() -> !tosa.shape<9> {
return %abc : !tosa.shape<9>
}
+
+// -----
+
+// CHECK-LABEL: @test_slice_shape
+// CHECK: tosa.const_shape {values = dense<[3, 4, 5, 6]> : tensor<4xindex>} : () -> !tosa.shape<4>
+func.func @test_slice_shape() -> !tosa.shape<4> {
+ %a = tosa.const_shape {values = dense<[1, 2, 3, 4, 5, 6]> : tensor<6xindex>} : () -> !tosa.shape<6>
+ %b = "tosa.const"() {values = dense<2> : tensor<1xi32>} : () -> tensor<1xi32>
+ %c = "tosa.const"() {values = dense<4> : tensor<1xi32>} : () -> tensor<1xi32>
+ %d = tosa.slice_shape %a, %b, %c : (!tosa.shape<6>, tensor<1xi32>, tensor<1xi32>) -> !tosa.shape<4>
+ return %d : !tosa.shape<4>
+}
----------------
lhutton1 wrote:
nit: It would be nice to add some test cases for the negative cases e.g. no fold on start < 0, size <= 0, start + size > input size
https://github.com/llvm/llvm-project/pull/186997
More information about the Mlir-commits
mailing list