diff --git a/mlir/test/Dialect/Linalg/sparse_1d.mlir b/mlir/test/Dialect/Linalg/sparse_1d.mlir --- a/mlir/test/Dialect/Linalg/sparse_1d.mlir +++ b/mlir/test/Dialect/Linalg/sparse_1d.mlir @@ -16,25 +16,26 @@ // CHECK-LABEL: func @add_d( // CHECK-SAME: %[[VAL_0:.*]]: tensor<32xf32>, -// CHECK-SAME: %[[VAL_1:.*]]: f32) -> tensor<32xf32> { -// CHECK: %[[VAL_2:.*]] = constant 32 : index -// CHECK: %[[VAL_3:.*]] = constant 0 : index -// CHECK: %[[VAL_4:.*]] = constant 1 : index -// CHECK: %[[VAL_5:.*]] = alloca() : memref<32xf32> +// CHECK-SAME: %[[VAL_1:.*]]: f32, +// CHECK-SAME: %[[VAL_2:.*]]: tensor<32xf32>) -> tensor<32xf32> { +// CHECK: %[[VAL_3:.*]] = constant 32 : index +// CHECK: %[[VAL_4:.*]] = constant 0 : index +// CHECK: %[[VAL_5:.*]] = constant 1 : index // CHECK: %[[VAL_6:.*]] = alloca() : memref<32xf32> -// CHECK: scf.for %[[VAL_7:.*]] = %[[VAL_3]] to %[[VAL_2]] step %[[VAL_4]] { -// CHECK: %[[VAL_8:.*]] = load %[[VAL_5]]{{\[}}%[[VAL_7]]] : memref<32xf32> -// CHECK: %[[VAL_9:.*]] = addf %[[VAL_8]], %[[VAL_1]] : f32 -// CHECK: store %[[VAL_9]], %[[VAL_6]]{{\[}}%[[VAL_7]]] : memref<32xf32> +// CHECK: %[[VAL_7:.*]] = alloca() : memref<32xf32> +// CHECK: scf.for %[[VAL_8:.*]] = %[[VAL_4]] to %[[VAL_3]] step %[[VAL_5]] { +// CHECK: %[[VAL_9:.*]] = load %[[VAL_6]]{{\[}}%[[VAL_8]]] : memref<32xf32> +// CHECK: %[[VAL_10:.*]] = addf %[[VAL_9]], %[[VAL_1]] : f32 +// CHECK: store %[[VAL_10]], %[[VAL_7]]{{\[}}%[[VAL_8]]] : memref<32xf32> // CHECK: } -// CHECK: %[[VAL_10:.*]] = tensor_load %[[VAL_6]] : memref<32xf32> -// CHECK: return %[[VAL_10]] : tensor<32xf32> +// CHECK: %[[VAL_11:.*]] = tensor_load %[[VAL_7]] : memref<32xf32> +// CHECK: return %[[VAL_11]] : tensor<32xf32> // CHECK: } -func @add_d(%arga: tensor<32xf32>, %argb: f32) -> tensor<32xf32> { +func @add_d(%arga: tensor<32xf32>, %argb: f32, %argx: tensor<32xf32>) -> tensor<32xf32> { %0 = linalg.generic #trait_d ins(%arga: tensor<32xf32>) - outs(%arga: tensor<32xf32>) { - ^bb(%a: f32, %s : f32): + outs(%argx: tensor<32xf32>) { + ^bb(%a: f32, %x : f32): %0 = addf %a, %argb : f32 linalg.yield %0 : f32 } -> tensor<32xf32> @@ -43,25 +44,26 @@ // CHECK-LABEL: func @mul_d( // CHECK-SAME: %[[VAL_0:.*]]: tensor<32xf32>, -// CHECK-SAME: %[[VAL_1:.*]]: f32) -> tensor<32xf32> { -// CHECK: %[[VAL_2:.*]] = constant 32 : index -// CHECK: %[[VAL_3:.*]] = constant 0 : index -// CHECK: %[[VAL_4:.*]] = constant 1 : index -// CHECK: %[[VAL_5:.*]] = alloca() : memref<32xf32> +// CHECK-SAME: %[[VAL_1:.*]]: f32, +// CHECK-SAME: %[[VAL_2:.*]]: tensor<32xf32>) -> tensor<32xf32> { +// CHECK: %[[VAL_3:.*]] = constant 32 : index +// CHECK: %[[VAL_4:.*]] = constant 0 : index +// CHECK: %[[VAL_5:.*]] = constant 1 : index // CHECK: %[[VAL_6:.*]] = alloca() : memref<32xf32> -// CHECK: scf.for %[[VAL_7:.*]] = %[[VAL_3]] to %[[VAL_2]] step %[[VAL_4]] { -// CHECK: %[[VAL_8:.*]] = load %[[VAL_5]]{{\[}}%[[VAL_7]]] : memref<32xf32> -// CHECK: %[[VAL_9:.*]] = mulf %[[VAL_8]], %[[VAL_1]] : f32 -// CHECK: store %[[VAL_9]], %[[VAL_6]]{{\[}}%[[VAL_7]]] : memref<32xf32> +// CHECK: %[[VAL_7:.*]] = alloca() : memref<32xf32> +// CHECK: scf.for %[[VAL_8:.*]] = %[[VAL_4]] to %[[VAL_3]] step %[[VAL_5]] { +// CHECK: %[[VAL_9:.*]] = load %[[VAL_6]]{{\[}}%[[VAL_8]]] : memref<32xf32> +// CHECK: %[[VAL_10:.*]] = mulf %[[VAL_9]], %[[VAL_1]] : f32 +// CHECK: store %[[VAL_10]], %[[VAL_7]]{{\[}}%[[VAL_8]]] : memref<32xf32> // CHECK: } -// CHECK: %[[VAL_10:.*]] = tensor_load %[[VAL_6]] : memref<32xf32> -// CHECK: return %[[VAL_10]] : tensor<32xf32> +// CHECK: %[[VAL_11:.*]] = tensor_load %[[VAL_7]] : memref<32xf32> +// CHECK: return %[[VAL_11]] : tensor<32xf32> // CHECK: } -func @mul_d(%arga: tensor<32xf32>, %argb: f32) -> tensor<32xf32> { +func @mul_d(%arga: tensor<32xf32>, %argb: f32, %argx: tensor<32xf32>) -> tensor<32xf32> { %0 = linalg.generic #trait_d ins(%arga: tensor<32xf32>) - outs(%arga: tensor<32xf32>) { - ^bb(%a: f32, %s : f32): + outs(%argx: tensor<32xf32>) { + ^bb(%a: f32, %x : f32): %0 = mulf %a, %argb : f32 linalg.yield %0 : f32 } -> tensor<32xf32> @@ -83,52 +85,53 @@ // CHECK-LABEL: func @add_s( // CHECK-SAME: %[[VAL_0:.*]]: tensor<32xf32>, -// CHECK-SAME: %[[VAL_1:.*]]: f32) -> tensor<32xf32> { -// CHECK: %[[VAL_2:.*]] = constant 999 : index -// CHECK: %[[VAL_3:.*]] = constant 32 : index -// CHECK: %[[VAL_4:.*]] = constant 0 : index -// CHECK: %[[VAL_5:.*]] = constant true -// CHECK: %[[VAL_6:.*]] = constant 1 : index -// CHECK: %[[VAL_7:.*]] = alloca(%[[VAL_2]]) : memref -// CHECK: %[[VAL_8:.*]] = alloca(%[[VAL_2]]) : memref -// CHECK: %[[VAL_9:.*]] = alloca(%[[VAL_2]]) : memref -// CHECK: %[[VAL_10:.*]] = alloca() : memref<32xf32> -// CHECK: %[[VAL_11:.*]] = load %[[VAL_7]]{{\[}}%[[VAL_4]]] : memref -// CHECK: %[[VAL_12:.*]] = load %[[VAL_7]]{{\[}}%[[VAL_6]]] : memref -// CHECK: %[[VAL_13:.*]]:2 = scf.while (%[[VAL_14:.*]] = %[[VAL_11]], %[[VAL_15:.*]] = %[[VAL_4]]) : (index, index) -> (index, index) { -// CHECK: %[[VAL_16:.*]] = cmpi ult, %[[VAL_14]], %[[VAL_12]] : index -// CHECK: scf.condition(%[[VAL_16]]) %[[VAL_14]], %[[VAL_15]] : index, index +// CHECK-SAME: %[[VAL_1:.*]]: f32, +// CHECK-SAME: %[[VAL_2:.*]]: tensor<32xf32>) -> tensor<32xf32> { +// CHECK: %[[VAL_3:.*]] = constant 999 : index +// CHECK: %[[VAL_4:.*]] = constant 32 : index +// CHECK: %[[VAL_5:.*]] = constant 0 : index +// CHECK: %[[VAL_6:.*]] = constant true +// CHECK: %[[VAL_7:.*]] = constant 1 : index +// CHECK: %[[VAL_8:.*]] = alloca(%[[VAL_3]]) : memref +// CHECK: %[[VAL_9:.*]] = alloca(%[[VAL_3]]) : memref +// CHECK: %[[VAL_10:.*]] = alloca(%[[VAL_3]]) : memref +// CHECK: %[[VAL_11:.*]] = alloca() : memref<32xf32> +// CHECK: %[[VAL_12:.*]] = load %[[VAL_8]]{{\[}}%[[VAL_5]]] : memref +// CHECK: %[[VAL_13:.*]] = load %[[VAL_8]]{{\[}}%[[VAL_7]]] : memref +// CHECK: %[[VAL_14:.*]]:2 = scf.while (%[[VAL_15:.*]] = %[[VAL_12]], %[[VAL_16:.*]] = %[[VAL_5]]) : (index, index) -> (index, index) { +// CHECK: %[[VAL_17:.*]] = cmpi ult, %[[VAL_15]], %[[VAL_13]] : index +// CHECK: scf.condition(%[[VAL_17]]) %[[VAL_15]], %[[VAL_16]] : index, index // CHECK: } do { -// CHECK: ^bb0(%[[VAL_17:.*]]: index, %[[VAL_18:.*]]: index): -// CHECK: %[[VAL_19:.*]] = load %[[VAL_8]]{{\[}}%[[VAL_17]]] : memref -// CHECK: %[[VAL_20:.*]] = cmpi eq, %[[VAL_19]], %[[VAL_18]] : index -// CHECK: scf.if %[[VAL_20]] { -// CHECK: %[[VAL_21:.*]] = load %[[VAL_9]]{{\[}}%[[VAL_17]]] : memref -// CHECK: %[[VAL_22:.*]] = addf %[[VAL_21]], %[[VAL_1]] : f32 -// CHECK: store %[[VAL_22]], %[[VAL_10]]{{\[}}%[[VAL_18]]] : memref<32xf32> +// CHECK: ^bb0(%[[VAL_18:.*]]: index, %[[VAL_19:.*]]: index): +// CHECK: %[[VAL_20:.*]] = load %[[VAL_9]]{{\[}}%[[VAL_18]]] : memref +// CHECK: %[[VAL_21:.*]] = cmpi eq, %[[VAL_20]], %[[VAL_19]] : index +// CHECK: scf.if %[[VAL_21]] { +// CHECK: %[[VAL_22:.*]] = load %[[VAL_10]]{{\[}}%[[VAL_18]]] : memref +// CHECK: %[[VAL_23:.*]] = addf %[[VAL_22]], %[[VAL_1]] : f32 +// CHECK: store %[[VAL_23]], %[[VAL_11]]{{\[}}%[[VAL_19]]] : memref<32xf32> // CHECK: } else { -// CHECK: scf.if %[[VAL_5]] { -// CHECK: store %[[VAL_1]], %[[VAL_10]]{{\[}}%[[VAL_18]]] : memref<32xf32> +// CHECK: scf.if %[[VAL_6]] { +// CHECK: store %[[VAL_1]], %[[VAL_11]]{{\[}}%[[VAL_19]]] : memref<32xf32> // CHECK: } else { // CHECK: } // CHECK: } -// CHECK: %[[VAL_23:.*]] = cmpi eq, %[[VAL_19]], %[[VAL_18]] : index -// CHECK: %[[VAL_24:.*]] = addi %[[VAL_17]], %[[VAL_6]] : index -// CHECK: %[[VAL_25:.*]] = select %[[VAL_23]], %[[VAL_24]], %[[VAL_17]] : index -// CHECK: %[[VAL_26:.*]] = addi %[[VAL_18]], %[[VAL_6]] : index -// CHECK: scf.yield %[[VAL_25]], %[[VAL_26]] : index, index +// CHECK: %[[VAL_24:.*]] = cmpi eq, %[[VAL_20]], %[[VAL_19]] : index +// CHECK: %[[VAL_25:.*]] = addi %[[VAL_18]], %[[VAL_7]] : index +// CHECK: %[[VAL_26:.*]] = select %[[VAL_24]], %[[VAL_25]], %[[VAL_18]] : index +// CHECK: %[[VAL_27:.*]] = addi %[[VAL_19]], %[[VAL_7]] : index +// CHECK: scf.yield %[[VAL_26]], %[[VAL_27]] : index, index // CHECK: } -// CHECK: scf.for %[[VAL_27:.*]] = %[[VAL_28:.*]]#1 to %[[VAL_3]] step %[[VAL_6]] { -// CHECK: store %[[VAL_1]], %[[VAL_10]]{{\[}}%[[VAL_27]]] : memref<32xf32> +// CHECK: scf.for %[[VAL_28:.*]] = %[[VAL_29:.*]]#1 to %[[VAL_4]] step %[[VAL_7]] { +// CHECK: store %[[VAL_1]], %[[VAL_11]]{{\[}}%[[VAL_28]]] : memref<32xf32> // CHECK: } -// CHECK: %[[VAL_29:.*]] = tensor_load %[[VAL_10]] : memref<32xf32> -// CHECK: return %[[VAL_29]] : tensor<32xf32> +// CHECK: %[[VAL_30:.*]] = tensor_load %[[VAL_11]] : memref<32xf32> +// CHECK: return %[[VAL_30]] : tensor<32xf32> // CHECK: } -func @add_s(%arga: tensor<32xf32>, %argb: f32) -> tensor<32xf32> { +func @add_s(%arga: tensor<32xf32>, %argb: f32, %argx: tensor<32xf32>) -> tensor<32xf32> { %0 = linalg.generic #trait_s ins(%arga: tensor<32xf32>) - outs(%arga: tensor<32xf32>) { - ^bb(%a: f32, %s : f32): + outs(%argx: tensor<32xf32>) { + ^bb(%a: f32, %x : f32): %0 = addf %a, %argb : f32 linalg.yield %0 : f32 } -> tensor<32xf32> @@ -136,35 +139,36 @@ } // CHECK-LABEL: func @repeated_add_s( -// CHECK-SAME: %[[VAL_0:.*]]: tensor<32xf32>) -> tensor<32xf32> { -// CHECK: %[[VAL_1:.*]] = constant 999 : index -// CHECK: %[[VAL_2:.*]] = constant 0 : index -// CHECK: %[[VAL_3:.*]] = constant 1 : index -// CHECK: %[[VAL_4:.*]] = alloca(%[[VAL_1]]) : memref -// CHECK: %[[VAL_5:.*]] = alloca(%[[VAL_1]]) : memref -// CHECK: %[[VAL_6:.*]] = alloca(%[[VAL_1]]) : memref -// CHECK: %[[VAL_7:.*]] = alloca() : memref<32xf32> -// CHECK: %[[VAL_8:.*]] = load %[[VAL_4]]{{\[}}%[[VAL_2]]] : memref -// CHECK: %[[VAL_9:.*]] = load %[[VAL_4]]{{\[}}%[[VAL_3]]] : memref -// CHECK: scf.for %[[VAL_10:.*]] = %[[VAL_8]] to %[[VAL_9]] step %[[VAL_3]] { -// CHECK: %[[VAL_11:.*]] = load %[[VAL_5]]{{\[}}%[[VAL_10]]] : memref -// CHECK: %[[VAL_12:.*]] = load %[[VAL_6]]{{\[}}%[[VAL_10]]] : memref -// CHECK: %[[VAL_13:.*]] = load %[[VAL_6]]{{\[}}%[[VAL_10]]] : memref -// CHECK: %[[VAL_14:.*]] = addf %[[VAL_12]], %[[VAL_13]] : f32 -// CHECK: %[[VAL_15:.*]] = load %[[VAL_6]]{{\[}}%[[VAL_10]]] : memref -// CHECK: %[[VAL_16:.*]] = load %[[VAL_6]]{{\[}}%[[VAL_10]]] : memref -// CHECK: %[[VAL_17:.*]] = addf %[[VAL_15]], %[[VAL_16]] : f32 -// CHECK: %[[VAL_18:.*]] = addf %[[VAL_14]], %[[VAL_17]] : f32 -// CHECK: store %[[VAL_18]], %[[VAL_7]]{{\[}}%[[VAL_11]]] : memref<32xf32> +// CHECK-SAME: %[[VAL_0:.*]]: tensor<32xf32>, +// CHECK-SAME: %[[VAL_1:.*]]: tensor<32xf32>) -> tensor<32xf32> { +// CHECK: %[[VAL_2:.*]] = constant 999 : index +// CHECK: %[[VAL_3:.*]] = constant 0 : index +// CHECK: %[[VAL_4:.*]] = constant 1 : index +// CHECK: %[[VAL_5:.*]] = alloca(%[[VAL_2]]) : memref +// CHECK: %[[VAL_6:.*]] = alloca(%[[VAL_2]]) : memref +// CHECK: %[[VAL_7:.*]] = alloca(%[[VAL_2]]) : memref +// CHECK: %[[VAL_8:.*]] = alloca() : memref<32xf32> +// CHECK: %[[VAL_9:.*]] = load %[[VAL_5]]{{\[}}%[[VAL_3]]] : memref +// CHECK: %[[VAL_10:.*]] = load %[[VAL_5]]{{\[}}%[[VAL_4]]] : memref +// CHECK: scf.for %[[VAL_11:.*]] = %[[VAL_9]] to %[[VAL_10]] step %[[VAL_4]] { +// CHECK: %[[VAL_12:.*]] = load %[[VAL_6]]{{\[}}%[[VAL_11]]] : memref +// CHECK: %[[VAL_13:.*]] = load %[[VAL_7]]{{\[}}%[[VAL_11]]] : memref +// CHECK: %[[VAL_14:.*]] = load %[[VAL_7]]{{\[}}%[[VAL_11]]] : memref +// CHECK: %[[VAL_15:.*]] = addf %[[VAL_13]], %[[VAL_14]] : f32 +// CHECK: %[[VAL_16:.*]] = load %[[VAL_7]]{{\[}}%[[VAL_11]]] : memref +// CHECK: %[[VAL_17:.*]] = load %[[VAL_7]]{{\[}}%[[VAL_11]]] : memref +// CHECK: %[[VAL_18:.*]] = addf %[[VAL_16]], %[[VAL_17]] : f32 +// CHECK: %[[VAL_19:.*]] = addf %[[VAL_15]], %[[VAL_18]] : f32 +// CHECK: store %[[VAL_19]], %[[VAL_8]]{{\[}}%[[VAL_12]]] : memref<32xf32> // CHECK: } -// CHECK: %[[VAL_19:.*]] = tensor_load %[[VAL_7]] : memref<32xf32> -// CHECK: return %[[VAL_19]] : tensor<32xf32> +// CHECK: %[[VAL_20:.*]] = tensor_load %[[VAL_8]] : memref<32xf32> +// CHECK: return %[[VAL_20]] : tensor<32xf32> // CHECK: } -func @repeated_add_s(%arga: tensor<32xf32>) -> tensor<32xf32> { +func @repeated_add_s(%arga: tensor<32xf32>, %argx: tensor<32xf32>) -> tensor<32xf32> { %0 = linalg.generic #trait_s ins(%arga: tensor<32xf32>) - outs(%arga: tensor<32xf32>) { - ^bb(%a: f32, %s : f32): + outs(%argx: tensor<32xf32>) { + ^bb(%a: f32, %x : f32): %0 = addf %a, %a : f32 // same tensor %1 = addf %a, %a : f32 // should yield %2 = addf %0, %1 : f32 // one guard @@ -175,30 +179,31 @@ // CHECK-LABEL: func @mul_s( // CHECK-SAME: %[[VAL_0:.*]]: tensor<32xf32>, -// CHECK-SAME: %[[VAL_1:.*]]: f32) -> tensor<32xf32> { -// CHECK: %[[VAL_2:.*]] = constant 999 : index -// CHECK: %[[VAL_3:.*]] = constant 0 : index -// CHECK: %[[VAL_4:.*]] = constant 1 : index -// CHECK: %[[VAL_5:.*]] = alloca(%[[VAL_2]]) : memref -// CHECK: %[[VAL_6:.*]] = alloca(%[[VAL_2]]) : memref -// CHECK: %[[VAL_7:.*]] = alloca(%[[VAL_2]]) : memref -// CHECK: %[[VAL_8:.*]] = alloca() : memref<32xf32> -// CHECK: %[[VAL_9:.*]] = load %[[VAL_5]]{{\[}}%[[VAL_3]]] : memref -// CHECK: %[[VAL_10:.*]] = load %[[VAL_5]]{{\[}}%[[VAL_4]]] : memref -// CHECK: scf.for %[[VAL_11:.*]] = %[[VAL_9]] to %[[VAL_10]] step %[[VAL_4]] { -// CHECK: %[[VAL_12:.*]] = load %[[VAL_6]]{{\[}}%[[VAL_11]]] : memref -// CHECK: %[[VAL_13:.*]] = load %[[VAL_7]]{{\[}}%[[VAL_11]]] : memref -// CHECK: %[[VAL_14:.*]] = mulf %[[VAL_13]], %[[VAL_1]] : f32 -// CHECK: store %[[VAL_14]], %[[VAL_8]]{{\[}}%[[VAL_12]]] : memref<32xf32> +// CHECK-SAME: %[[VAL_1:.*]]: f32, +// CHECK-SAME: %[[VAL_2:.*]]: tensor<32xf32>) -> tensor<32xf32> { +// CHECK: %[[VAL_3:.*]] = constant 999 : index +// CHECK: %[[VAL_4:.*]] = constant 0 : index +// CHECK: %[[VAL_5:.*]] = constant 1 : index +// CHECK: %[[VAL_6:.*]] = alloca(%[[VAL_3]]) : memref +// CHECK: %[[VAL_7:.*]] = alloca(%[[VAL_3]]) : memref +// CHECK: %[[VAL_8:.*]] = alloca(%[[VAL_3]]) : memref +// CHECK: %[[VAL_9:.*]] = alloca() : memref<32xf32> +// CHECK: %[[VAL_10:.*]] = load %[[VAL_6]]{{\[}}%[[VAL_4]]] : memref +// CHECK: %[[VAL_11:.*]] = load %[[VAL_6]]{{\[}}%[[VAL_5]]] : memref +// CHECK: scf.for %[[VAL_12:.*]] = %[[VAL_10]] to %[[VAL_11]] step %[[VAL_5]] { +// CHECK: %[[VAL_13:.*]] = load %[[VAL_7]]{{\[}}%[[VAL_12]]] : memref +// CHECK: %[[VAL_14:.*]] = load %[[VAL_8]]{{\[}}%[[VAL_12]]] : memref +// CHECK: %[[VAL_15:.*]] = mulf %[[VAL_14]], %[[VAL_1]] : f32 +// CHECK: store %[[VAL_15]], %[[VAL_9]]{{\[}}%[[VAL_13]]] : memref<32xf32> // CHECK: } -// CHECK: %[[VAL_15:.*]] = tensor_load %[[VAL_8]] : memref<32xf32> -// CHECK: return %[[VAL_15]] : tensor<32xf32> +// CHECK: %[[VAL_16:.*]] = tensor_load %[[VAL_9]] : memref<32xf32> +// CHECK: return %[[VAL_16]] : tensor<32xf32> // CHECK: } -func @mul_s(%arga: tensor<32xf32>, %argb: f32) -> tensor<32xf32> { +func @mul_s(%arga: tensor<32xf32>, %argb: f32, %argx: tensor<32xf32>) -> tensor<32xf32> { %0 = linalg.generic #trait_s ins(%arga: tensor<32xf32>) - outs(%arga: tensor<32xf32>) { - ^bb(%a: f32, %s : f32): + outs(%argx: tensor<32xf32>) { + ^bb(%a: f32, %x : f32): %0 = mulf %a, %argb : f32 linalg.yield %0 : f32 } -> tensor<32xf32> @@ -221,28 +226,29 @@ } // CHECK-LABEL: func @add_dd( -// CHECK-SAME: %[[VAL_0:.*]]: tensor<32xf32>, -// CHECK-SAME: %[[VAL_1:.*]]: tensor<32xf32>) -> tensor<32xf32> { -// CHECK: %[[VAL_2:.*]] = constant 32 : index -// CHECK: %[[VAL_3:.*]] = constant 0 : index -// CHECK: %[[VAL_4:.*]] = constant 1 : index -// CHECK: %[[VAL_5:.*]] = alloca() : memref<32xf32> +// CHECK-SAME: %[[VAL_0:.*0]]: tensor<32xf32>, +// CHECK-SAME: %[[VAL_1:.*1]]: tensor<32xf32>, +// CHECK-SAME: %[[VAL_2:.*2]]: tensor<32xf32>) -> tensor<32xf32> { +// CHECK: %[[VAL_3:.*]] = constant 32 : index +// CHECK: %[[VAL_4:.*]] = constant 0 : index +// CHECK: %[[VAL_5:.*]] = constant 1 : index // CHECK: %[[VAL_6:.*]] = alloca() : memref<32xf32> // CHECK: %[[VAL_7:.*]] = alloca() : memref<32xf32> -// CHECK: scf.for %[[VAL_8:.*]] = %[[VAL_3]] to %[[VAL_2]] step %[[VAL_4]] { -// CHECK: %[[VAL_9:.*]] = load %[[VAL_5]]{{\[}}%[[VAL_8]]] : memref<32xf32> -// CHECK: %[[VAL_10:.*]] = load %[[VAL_6]]{{\[}}%[[VAL_8]]] : memref<32xf32> -// CHECK: %[[VAL_11:.*]] = addf %[[VAL_9]], %[[VAL_10]] : f32 -// CHECK: store %[[VAL_11]], %[[VAL_7]]{{\[}}%[[VAL_8]]] : memref<32xf32> +// CHECK: %[[VAL_8:.*]] = alloca() : memref<32xf32> +// CHECK: scf.for %[[VAL_9:.*]] = %[[VAL_4]] to %[[VAL_3]] step %[[VAL_5]] { +// CHECK: %[[VAL_10:.*]] = load %[[VAL_6]]{{\[}}%[[VAL_9]]] : memref<32xf32> +// CHECK: %[[VAL_11:.*]] = load %[[VAL_7]]{{\[}}%[[VAL_9]]] : memref<32xf32> +// CHECK: %[[VAL_12:.*]] = addf %[[VAL_10]], %[[VAL_11]] : f32 +// CHECK: store %[[VAL_12]], %[[VAL_8]]{{\[}}%[[VAL_9]]] : memref<32xf32> // CHECK: } -// CHECK: %[[VAL_12:.*]] = tensor_load %[[VAL_7]] : memref<32xf32> -// CHECK: return %[[VAL_12]] : tensor<32xf32> +// CHECK: %[[VAL_13:.*]] = tensor_load %[[VAL_8]] : memref<32xf32> +// CHECK: return %[[VAL_13]] : tensor<32xf32> // CHECK: } -func @add_dd(%arga: tensor<32xf32>, %argb: tensor<32xf32>) -> tensor<32xf32> { +func @add_dd(%arga: tensor<32xf32>, %argb: tensor<32xf32>, %argx: tensor<32xf32>) -> tensor<32xf32> { %0 = linalg.generic #trait_dd ins(%arga, %argb: tensor<32xf32>, tensor<32xf32>) - outs(%arga : tensor<32xf32>) { - ^bb(%a: f32, %b: f32, %s : f32): + outs(%argx : tensor<32xf32>) { + ^bb(%a: f32, %b: f32, %x : f32): %0 = addf %a, %b : f32 linalg.yield %0 : f32 } -> tensor<32xf32> @@ -250,28 +256,29 @@ } // CHECK-LABEL: func @mul_dd( -// CHECK-SAME: %[[VAL_0:.*]]: tensor<32xf32>, -// CHECK-SAME: %[[VAL_1:.*]]: tensor<32xf32>) -> tensor<32xf32> { -// CHECK: %[[VAL_2:.*]] = constant 32 : index -// CHECK: %[[VAL_3:.*]] = constant 0 : index -// CHECK: %[[VAL_4:.*]] = constant 1 : index -// CHECK: %[[VAL_5:.*]] = alloca() : memref<32xf32> +// CHECK-SAME: %[[VAL_0:.*0]]: tensor<32xf32>, +// CHECK-SAME: %[[VAL_1:.*1]]: tensor<32xf32>, +// CHECK-SAME: %[[VAL_2:.*2]]: tensor<32xf32>) -> tensor<32xf32> { +// CHECK: %[[VAL_3:.*]] = constant 32 : index +// CHECK: %[[VAL_4:.*]] = constant 0 : index +// CHECK: %[[VAL_5:.*]] = constant 1 : index // CHECK: %[[VAL_6:.*]] = alloca() : memref<32xf32> // CHECK: %[[VAL_7:.*]] = alloca() : memref<32xf32> -// CHECK: scf.for %[[VAL_8:.*]] = %[[VAL_3]] to %[[VAL_2]] step %[[VAL_4]] { -// CHECK: %[[VAL_9:.*]] = load %[[VAL_5]]{{\[}}%[[VAL_8]]] : memref<32xf32> -// CHECK: %[[VAL_10:.*]] = load %[[VAL_6]]{{\[}}%[[VAL_8]]] : memref<32xf32> -// CHECK: %[[VAL_11:.*]] = mulf %[[VAL_9]], %[[VAL_10]] : f32 -// CHECK: store %[[VAL_11]], %[[VAL_7]]{{\[}}%[[VAL_8]]] : memref<32xf32> +// CHECK: %[[VAL_8:.*]] = alloca() : memref<32xf32> +// CHECK: scf.for %[[VAL_9:.*]] = %[[VAL_4]] to %[[VAL_3]] step %[[VAL_5]] { +// CHECK: %[[VAL_10:.*]] = load %[[VAL_6]]{{\[}}%[[VAL_9]]] : memref<32xf32> +// CHECK: %[[VAL_11:.*]] = load %[[VAL_7]]{{\[}}%[[VAL_9]]] : memref<32xf32> +// CHECK: %[[VAL_12:.*]] = mulf %[[VAL_10]], %[[VAL_11]] : f32 +// CHECK: store %[[VAL_12]], %[[VAL_8]]{{\[}}%[[VAL_9]]] : memref<32xf32> // CHECK: } -// CHECK: %[[VAL_12:.*]] = tensor_load %[[VAL_7]] : memref<32xf32> -// CHECK: return %[[VAL_12]] : tensor<32xf32> +// CHECK: %[[VAL_13:.*]] = tensor_load %[[VAL_8]] : memref<32xf32> +// CHECK: return %[[VAL_13]] : tensor<32xf32> // CHECK: } -func @mul_dd(%arga: tensor<32xf32>, %argb: tensor<32xf32>) -> tensor<32xf32> { +func @mul_dd(%arga: tensor<32xf32>, %argb: tensor<32xf32>, %argx: tensor<32xf32>) -> tensor<32xf32> { %0 = linalg.generic #trait_dd ins(%arga, %argb: tensor<32xf32>, tensor<32xf32>) - outs(%arga : tensor<32xf32>) { - ^bb(%a: f32, %b: f32, %s : f32): + outs(%argx : tensor<32xf32>) { + ^bb(%a: f32, %b: f32, %x : f32): %0 = mulf %a, %b : f32 linalg.yield %0 : f32 } -> tensor<32xf32> @@ -294,57 +301,58 @@ } // CHECK-LABEL: func @add_ds( -// CHECK-SAME: %[[VAL_0:.*]]: tensor<32xf32>, -// CHECK-SAME: %[[VAL_1:.*]]: tensor<32xf32>) -> tensor<32xf32> { -// CHECK: %[[VAL_2:.*]] = constant 999 : index -// CHECK: %[[VAL_3:.*]] = constant 32 : index -// CHECK: %[[VAL_4:.*]] = constant 0 : index -// CHECK: %[[VAL_5:.*]] = constant true -// CHECK: %[[VAL_6:.*]] = constant 1 : index -// CHECK: %[[VAL_7:.*]] = alloca() : memref<32xf32> -// CHECK: %[[VAL_8:.*]] = alloca(%[[VAL_2]]) : memref -// CHECK: %[[VAL_9:.*]] = alloca(%[[VAL_2]]) : memref -// CHECK: %[[VAL_10:.*]] = alloca(%[[VAL_2]]) : memref -// CHECK: %[[VAL_11:.*]] = alloca() : memref<32xf32> -// CHECK: %[[VAL_12:.*]] = load %[[VAL_8]]{{\[}}%[[VAL_4]]] : memref -// CHECK: %[[VAL_13:.*]] = load %[[VAL_8]]{{\[}}%[[VAL_6]]] : memref -// CHECK: %[[VAL_14:.*]]:2 = scf.while (%[[VAL_15:.*]] = %[[VAL_12]], %[[VAL_16:.*]] = %[[VAL_4]]) : (index, index) -> (index, index) { -// CHECK: %[[VAL_17:.*]] = cmpi ult, %[[VAL_15]], %[[VAL_13]] : index -// CHECK: scf.condition(%[[VAL_17]]) %[[VAL_15]], %[[VAL_16]] : index, index +// CHECK-SAME: %[[VAL_0:.*0]]: tensor<32xf32>, +// CHECK-SAME: %[[VAL_1:.*1]]: tensor<32xf32>, +// CHECK-SAME: %[[VAL_2:.*2]]: tensor<32xf32>) -> tensor<32xf32> { +// CHECK: %[[VAL_3:.*]] = constant 999 : index +// CHECK: %[[VAL_4:.*]] = constant 32 : index +// CHECK: %[[VAL_5:.*]] = constant 0 : index +// CHECK: %[[VAL_6:.*]] = constant true +// CHECK: %[[VAL_7:.*]] = constant 1 : index +// CHECK: %[[VAL_8:.*]] = alloca() : memref<32xf32> +// CHECK: %[[VAL_9:.*]] = alloca(%[[VAL_3]]) : memref +// CHECK: %[[VAL_10:.*]] = alloca(%[[VAL_3]]) : memref +// CHECK: %[[VAL_11:.*]] = alloca(%[[VAL_3]]) : memref +// CHECK: %[[VAL_12:.*]] = alloca() : memref<32xf32> +// CHECK: %[[VAL_13:.*]] = load %[[VAL_9]]{{\[}}%[[VAL_5]]] : memref +// CHECK: %[[VAL_14:.*]] = load %[[VAL_9]]{{\[}}%[[VAL_7]]] : memref +// CHECK: %[[VAL_15:.*]]:2 = scf.while (%[[VAL_16:.*]] = %[[VAL_13]], %[[VAL_17:.*]] = %[[VAL_5]]) : (index, index) -> (index, index) { +// CHECK: %[[VAL_18:.*]] = cmpi ult, %[[VAL_16]], %[[VAL_14]] : index +// CHECK: scf.condition(%[[VAL_18]]) %[[VAL_16]], %[[VAL_17]] : index, index // CHECK: } do { -// CHECK: ^bb0(%[[VAL_18:.*]]: index, %[[VAL_19:.*]]: index): -// CHECK: %[[VAL_20:.*]] = load %[[VAL_9]]{{\[}}%[[VAL_18]]] : memref -// CHECK: %[[VAL_21:.*]] = cmpi eq, %[[VAL_20]], %[[VAL_19]] : index -// CHECK: scf.if %[[VAL_21]] { -// CHECK: %[[VAL_22:.*]] = load %[[VAL_7]]{{\[}}%[[VAL_19]]] : memref<32xf32> -// CHECK: %[[VAL_23:.*]] = load %[[VAL_10]]{{\[}}%[[VAL_18]]] : memref -// CHECK: %[[VAL_24:.*]] = addf %[[VAL_22]], %[[VAL_23]] : f32 -// CHECK: store %[[VAL_24]], %[[VAL_11]]{{\[}}%[[VAL_19]]] : memref<32xf32> +// CHECK: ^bb0(%[[VAL_19:.*]]: index, %[[VAL_20:.*]]: index): +// CHECK: %[[VAL_21:.*]] = load %[[VAL_10]]{{\[}}%[[VAL_19]]] : memref +// CHECK: %[[VAL_22:.*]] = cmpi eq, %[[VAL_21]], %[[VAL_20]] : index +// CHECK: scf.if %[[VAL_22]] { +// CHECK: %[[VAL_23:.*]] = load %[[VAL_8]]{{\[}}%[[VAL_20]]] : memref<32xf32> +// CHECK: %[[VAL_24:.*]] = load %[[VAL_11]]{{\[}}%[[VAL_19]]] : memref +// CHECK: %[[VAL_25:.*]] = addf %[[VAL_23]], %[[VAL_24]] : f32 +// CHECK: store %[[VAL_25]], %[[VAL_12]]{{\[}}%[[VAL_20]]] : memref<32xf32> // CHECK: } else { -// CHECK: scf.if %[[VAL_5]] { -// CHECK: %[[VAL_25:.*]] = load %[[VAL_7]]{{\[}}%[[VAL_19]]] : memref<32xf32> -// CHECK: store %[[VAL_25]], %[[VAL_11]]{{\[}}%[[VAL_19]]] : memref<32xf32> +// CHECK: scf.if %[[VAL_6]] { +// CHECK: %[[VAL_26:.*]] = load %[[VAL_8]]{{\[}}%[[VAL_20]]] : memref<32xf32> +// CHECK: store %[[VAL_26]], %[[VAL_12]]{{\[}}%[[VAL_20]]] : memref<32xf32> // CHECK: } else { // CHECK: } // CHECK: } -// CHECK: %[[VAL_26:.*]] = cmpi eq, %[[VAL_20]], %[[VAL_19]] : index -// CHECK: %[[VAL_27:.*]] = addi %[[VAL_18]], %[[VAL_6]] : index -// CHECK: %[[VAL_28:.*]] = select %[[VAL_26]], %[[VAL_27]], %[[VAL_18]] : index -// CHECK: %[[VAL_29:.*]] = addi %[[VAL_19]], %[[VAL_6]] : index -// CHECK: scf.yield %[[VAL_28]], %[[VAL_29]] : index, index +// CHECK: %[[VAL_27:.*]] = cmpi eq, %[[VAL_21]], %[[VAL_20]] : index +// CHECK: %[[VAL_28:.*]] = addi %[[VAL_19]], %[[VAL_7]] : index +// CHECK: %[[VAL_29:.*]] = select %[[VAL_27]], %[[VAL_28]], %[[VAL_19]] : index +// CHECK: %[[VAL_30:.*]] = addi %[[VAL_20]], %[[VAL_7]] : index +// CHECK: scf.yield %[[VAL_29]], %[[VAL_30]] : index, index // CHECK: } -// CHECK: scf.for %[[VAL_30:.*]] = %[[VAL_31:.*]]#1 to %[[VAL_3]] step %[[VAL_6]] { -// CHECK: %[[VAL_32:.*]] = load %[[VAL_7]]{{\[}}%[[VAL_30]]] : memref<32xf32> -// CHECK: store %[[VAL_32]], %[[VAL_11]]{{\[}}%[[VAL_30]]] : memref<32xf32> +// CHECK: scf.for %[[VAL_31:.*]] = %[[VAL_32:.*]]#1 to %[[VAL_4]] step %[[VAL_7]] { +// CHECK: %[[VAL_33:.*]] = load %[[VAL_8]]{{\[}}%[[VAL_31]]] : memref<32xf32> +// CHECK: store %[[VAL_33]], %[[VAL_12]]{{\[}}%[[VAL_31]]] : memref<32xf32> // CHECK: } -// CHECK: %[[VAL_33:.*]] = tensor_load %[[VAL_11]] : memref<32xf32> -// CHECK: return %[[VAL_33]] : tensor<32xf32> +// CHECK: %[[VAL_34:.*]] = tensor_load %[[VAL_12]] : memref<32xf32> +// CHECK: return %[[VAL_34]] : tensor<32xf32> // CHECK: } -func @add_ds(%arga: tensor<32xf32>, %argb: tensor<32xf32>) -> tensor<32xf32> { +func @add_ds(%arga: tensor<32xf32>, %argb: tensor<32xf32>, %argx: tensor<32xf32>) -> tensor<32xf32> { %0 = linalg.generic #trait_ds ins(%arga, %argb: tensor<32xf32>, tensor<32xf32>) - outs(%arga : tensor<32xf32>) { - ^bb(%a: f32, %b: f32, %s : f32): + outs(%argx : tensor<32xf32>) { + ^bb(%a: f32, %b: f32, %x : f32): %0 = addf %a, %b : f32 linalg.yield %0 : f32 } -> tensor<32xf32> @@ -352,33 +360,34 @@ } // CHECK-LABEL: func @mul_ds( -// CHECK-SAME: %[[VAL_0:.*]]: tensor<32xf32>, -// CHECK-SAME: %[[VAL_1:.*]]: tensor<32xf32>) -> tensor<32xf32> { -// CHECK: %[[VAL_2:.*]] = constant 999 : index -// CHECK: %[[VAL_3:.*]] = constant 0 : index -// CHECK: %[[VAL_4:.*]] = constant 1 : index -// CHECK: %[[VAL_5:.*]] = alloca() : memref<32xf32> -// CHECK: %[[VAL_6:.*]] = alloca(%[[VAL_2]]) : memref -// CHECK: %[[VAL_7:.*]] = alloca(%[[VAL_2]]) : memref -// CHECK: %[[VAL_8:.*]] = alloca(%[[VAL_2]]) : memref -// CHECK: %[[VAL_9:.*]] = alloca() : memref<32xf32> -// CHECK: %[[VAL_10:.*]] = load %[[VAL_6]]{{\[}}%[[VAL_3]]] : memref -// CHECK: %[[VAL_11:.*]] = load %[[VAL_6]]{{\[}}%[[VAL_4]]] : memref -// CHECK: scf.for %[[VAL_12:.*]] = %[[VAL_10]] to %[[VAL_11]] step %[[VAL_4]] { -// CHECK: %[[VAL_13:.*]] = load %[[VAL_7]]{{\[}}%[[VAL_12]]] : memref -// CHECK: %[[VAL_14:.*]] = load %[[VAL_5]]{{\[}}%[[VAL_13]]] : memref<32xf32> -// CHECK: %[[VAL_15:.*]] = load %[[VAL_8]]{{\[}}%[[VAL_12]]] : memref -// CHECK: %[[VAL_16:.*]] = mulf %[[VAL_14]], %[[VAL_15]] : f32 -// CHECK: store %[[VAL_16]], %[[VAL_9]]{{\[}}%[[VAL_13]]] : memref<32xf32> +// CHECK-SAME: %[[VAL_0:.*0]]: tensor<32xf32>, +// CHECK-SAME: %[[VAL_1:.*1]]: tensor<32xf32>, +// CHECK-SAME: %[[VAL_2:.*2]]: tensor<32xf32>) -> tensor<32xf32> { +// CHECK: %[[VAL_3:.*]] = constant 999 : index +// CHECK: %[[VAL_4:.*]] = constant 0 : index +// CHECK: %[[VAL_5:.*]] = constant 1 : index +// CHECK: %[[VAL_6:.*]] = alloca() : memref<32xf32> +// CHECK: %[[VAL_7:.*]] = alloca(%[[VAL_3]]) : memref +// CHECK: %[[VAL_8:.*]] = alloca(%[[VAL_3]]) : memref +// CHECK: %[[VAL_9:.*]] = alloca(%[[VAL_3]]) : memref +// CHECK: %[[VAL_10:.*]] = alloca() : memref<32xf32> +// CHECK: %[[VAL_11:.*]] = load %[[VAL_7]]{{\[}}%[[VAL_4]]] : memref +// CHECK: %[[VAL_12:.*]] = load %[[VAL_7]]{{\[}}%[[VAL_5]]] : memref +// CHECK: scf.for %[[VAL_13:.*]] = %[[VAL_11]] to %[[VAL_12]] step %[[VAL_5]] { +// CHECK: %[[VAL_14:.*]] = load %[[VAL_8]]{{\[}}%[[VAL_13]]] : memref +// CHECK: %[[VAL_15:.*]] = load %[[VAL_6]]{{\[}}%[[VAL_14]]] : memref<32xf32> +// CHECK: %[[VAL_16:.*]] = load %[[VAL_9]]{{\[}}%[[VAL_13]]] : memref +// CHECK: %[[VAL_17:.*]] = mulf %[[VAL_15]], %[[VAL_16]] : f32 +// CHECK: store %[[VAL_17]], %[[VAL_10]]{{\[}}%[[VAL_14]]] : memref<32xf32> // CHECK: } -// CHECK: %[[VAL_17:.*]] = tensor_load %[[VAL_9]] : memref<32xf32> -// CHECK: return %[[VAL_17]] : tensor<32xf32> +// CHECK: %[[VAL_18:.*]] = tensor_load %[[VAL_10]] : memref<32xf32> +// CHECK: return %[[VAL_18]] : tensor<32xf32> // CHECK: } -func @mul_ds(%arga: tensor<32xf32>, %argb: tensor<32xf32>) -> tensor<32xf32> { +func @mul_ds(%arga: tensor<32xf32>, %argb: tensor<32xf32>, %argx: tensor<32xf32>) -> tensor<32xf32> { %0 = linalg.generic #trait_ds ins(%arga, %argb: tensor<32xf32>, tensor<32xf32>) - outs(%arga : tensor<32xf32>) { - ^bb(%a: f32, %b: f32, %s : f32): + outs(%argx : tensor<32xf32>) { + ^bb(%a: f32, %b: f32, %x: f32): %0 = mulf %a, %b : f32 linalg.yield %0 : f32 } -> tensor<32xf32> @@ -401,57 +410,58 @@ } // CHECK-LABEL: func @add_sd( -// CHECK-SAME: %[[VAL_0:.*]]: tensor<32xf32>, -// CHECK-SAME: %[[VAL_1:.*]]: tensor<32xf32>) -> tensor<32xf32> { -// CHECK: %[[VAL_2:.*]] = constant 999 : index -// CHECK: %[[VAL_3:.*]] = constant 32 : index -// CHECK: %[[VAL_4:.*]] = constant 0 : index -// CHECK: %[[VAL_5:.*]] = constant true -// CHECK: %[[VAL_6:.*]] = constant 1 : index -// CHECK: %[[VAL_7:.*]] = alloca(%[[VAL_2]]) : memref -// CHECK: %[[VAL_8:.*]] = alloca(%[[VAL_2]]) : memref -// CHECK: %[[VAL_9:.*]] = alloca(%[[VAL_2]]) : memref -// CHECK: %[[VAL_10:.*]] = alloca() : memref<32xf32> +// CHECK-SAME: %[[VAL_0:.*0]]: tensor<32xf32>, +// CHECK-SAME: %[[VAL_1:.*1]]: tensor<32xf32>, +// CHECK-SAME: %[[VAL_2:.*2]]: tensor<32xf32>) -> tensor<32xf32> { +// CHECK: %[[VAL_3:.*]] = constant 999 : index +// CHECK: %[[VAL_4:.*]] = constant 32 : index +// CHECK: %[[VAL_5:.*]] = constant 0 : index +// CHECK: %[[VAL_6:.*]] = constant true +// CHECK: %[[VAL_7:.*]] = constant 1 : index +// CHECK: %[[VAL_8:.*]] = alloca(%[[VAL_3]]) : memref +// CHECK: %[[VAL_9:.*]] = alloca(%[[VAL_3]]) : memref +// CHECK: %[[VAL_10:.*]] = alloca(%[[VAL_3]]) : memref // CHECK: %[[VAL_11:.*]] = alloca() : memref<32xf32> -// CHECK: %[[VAL_12:.*]] = load %[[VAL_7]]{{\[}}%[[VAL_4]]] : memref -// CHECK: %[[VAL_13:.*]] = load %[[VAL_7]]{{\[}}%[[VAL_6]]] : memref -// CHECK: %[[VAL_14:.*]]:2 = scf.while (%[[VAL_15:.*]] = %[[VAL_12]], %[[VAL_16:.*]] = %[[VAL_4]]) : (index, index) -> (index, index) { -// CHECK: %[[VAL_17:.*]] = cmpi ult, %[[VAL_15]], %[[VAL_13]] : index -// CHECK: scf.condition(%[[VAL_17]]) %[[VAL_15]], %[[VAL_16]] : index, index +// CHECK: %[[VAL_12:.*]] = alloca() : memref<32xf32> +// CHECK: %[[VAL_13:.*]] = load %[[VAL_8]]{{\[}}%[[VAL_5]]] : memref +// CHECK: %[[VAL_14:.*]] = load %[[VAL_8]]{{\[}}%[[VAL_7]]] : memref +// CHECK: %[[VAL_15:.*]]:2 = scf.while (%[[VAL_16:.*]] = %[[VAL_13]], %[[VAL_17:.*]] = %[[VAL_5]]) : (index, index) -> (index, index) { +// CHECK: %[[VAL_18:.*]] = cmpi ult, %[[VAL_16]], %[[VAL_14]] : index +// CHECK: scf.condition(%[[VAL_18]]) %[[VAL_16]], %[[VAL_17]] : index, index // CHECK: } do { -// CHECK: ^bb0(%[[VAL_18:.*]]: index, %[[VAL_19:.*]]: index): -// CHECK: %[[VAL_20:.*]] = load %[[VAL_8]]{{\[}}%[[VAL_18]]] : memref -// CHECK: %[[VAL_21:.*]] = cmpi eq, %[[VAL_20]], %[[VAL_19]] : index -// CHECK: scf.if %[[VAL_21]] { -// CHECK: %[[VAL_22:.*]] = load %[[VAL_9]]{{\[}}%[[VAL_18]]] : memref -// CHECK: %[[VAL_23:.*]] = load %[[VAL_10]]{{\[}}%[[VAL_19]]] : memref<32xf32> -// CHECK: %[[VAL_24:.*]] = addf %[[VAL_22]], %[[VAL_23]] : f32 -// CHECK: store %[[VAL_24]], %[[VAL_11]]{{\[}}%[[VAL_19]]] : memref<32xf32> +// CHECK: ^bb0(%[[VAL_19:.*]]: index, %[[VAL_20:.*]]: index): +// CHECK: %[[VAL_21:.*]] = load %[[VAL_9]]{{\[}}%[[VAL_19]]] : memref +// CHECK: %[[VAL_22:.*]] = cmpi eq, %[[VAL_21]], %[[VAL_20]] : index +// CHECK: scf.if %[[VAL_22]] { +// CHECK: %[[VAL_23:.*]] = load %[[VAL_10]]{{\[}}%[[VAL_19]]] : memref +// CHECK: %[[VAL_24:.*]] = load %[[VAL_11]]{{\[}}%[[VAL_20]]] : memref<32xf32> +// CHECK: %[[VAL_25:.*]] = addf %[[VAL_23]], %[[VAL_24]] : f32 +// CHECK: store %[[VAL_25]], %[[VAL_12]]{{\[}}%[[VAL_20]]] : memref<32xf32> // CHECK: } else { -// CHECK: scf.if %[[VAL_5]] { -// CHECK: %[[VAL_25:.*]] = load %[[VAL_10]]{{\[}}%[[VAL_19]]] : memref<32xf32> -// CHECK: store %[[VAL_25]], %[[VAL_11]]{{\[}}%[[VAL_19]]] : memref<32xf32> +// CHECK: scf.if %[[VAL_6]] { +// CHECK: %[[VAL_26:.*]] = load %[[VAL_11]]{{\[}}%[[VAL_20]]] : memref<32xf32> +// CHECK: store %[[VAL_26]], %[[VAL_12]]{{\[}}%[[VAL_20]]] : memref<32xf32> // CHECK: } else { // CHECK: } // CHECK: } -// CHECK: %[[VAL_26:.*]] = cmpi eq, %[[VAL_20]], %[[VAL_19]] : index -// CHECK: %[[VAL_27:.*]] = addi %[[VAL_18]], %[[VAL_6]] : index -// CHECK: %[[VAL_28:.*]] = select %[[VAL_26]], %[[VAL_27]], %[[VAL_18]] : index -// CHECK: %[[VAL_29:.*]] = addi %[[VAL_19]], %[[VAL_6]] : index -// CHECK: scf.yield %[[VAL_28]], %[[VAL_29]] : index, index +// CHECK: %[[VAL_27:.*]] = cmpi eq, %[[VAL_21]], %[[VAL_20]] : index +// CHECK: %[[VAL_28:.*]] = addi %[[VAL_19]], %[[VAL_7]] : index +// CHECK: %[[VAL_29:.*]] = select %[[VAL_27]], %[[VAL_28]], %[[VAL_19]] : index +// CHECK: %[[VAL_30:.*]] = addi %[[VAL_20]], %[[VAL_7]] : index +// CHECK: scf.yield %[[VAL_29]], %[[VAL_30]] : index, index // CHECK: } -// CHECK: scf.for %[[VAL_30:.*]] = %[[VAL_31:.*]]#1 to %[[VAL_3]] step %[[VAL_6]] { -// CHECK: %[[VAL_32:.*]] = load %[[VAL_10]]{{\[}}%[[VAL_30]]] : memref<32xf32> -// CHECK: store %[[VAL_32]], %[[VAL_11]]{{\[}}%[[VAL_30]]] : memref<32xf32> +// CHECK: scf.for %[[VAL_31:.*]] = %[[VAL_32:.*]]#1 to %[[VAL_4]] step %[[VAL_7]] { +// CHECK: %[[VAL_33:.*]] = load %[[VAL_11]]{{\[}}%[[VAL_31]]] : memref<32xf32> +// CHECK: store %[[VAL_33]], %[[VAL_12]]{{\[}}%[[VAL_31]]] : memref<32xf32> // CHECK: } -// CHECK: %[[VAL_33:.*]] = tensor_load %[[VAL_11]] : memref<32xf32> -// CHECK: return %[[VAL_33]] : tensor<32xf32> +// CHECK: %[[VAL_34:.*]] = tensor_load %[[VAL_12]] : memref<32xf32> +// CHECK: return %[[VAL_34]] : tensor<32xf32> // CHECK: } -func @add_sd(%arga: tensor<32xf32>, %argb: tensor<32xf32>) -> tensor<32xf32> { +func @add_sd(%arga: tensor<32xf32>, %argb: tensor<32xf32>, %argx: tensor<32xf32>) -> tensor<32xf32> { %0 = linalg.generic #trait_sd ins(%arga, %argb: tensor<32xf32>, tensor<32xf32>) - outs(%arga : tensor<32xf32>) { - ^bb(%a: f32, %b: f32, %s : f32): + outs(%argx: tensor<32xf32>) { + ^bb(%a: f32, %b: f32, %x: f32): %0 = addf %a, %b : f32 linalg.yield %0 : f32 } -> tensor<32xf32> @@ -459,33 +469,34 @@ } // CHECK-LABEL: func @mul_sd( -// CHECK-SAME: %[[VAL_0:.*]]: tensor<32xf32>, -// CHECK-SAME: %[[VAL_1:.*]]: tensor<32xf32>) -> tensor<32xf32> { -// CHECK: %[[VAL_2:.*]] = constant 999 : index -// CHECK: %[[VAL_3:.*]] = constant 0 : index -// CHECK: %[[VAL_4:.*]] = constant 1 : index -// CHECK: %[[VAL_5:.*]] = alloca(%[[VAL_2]]) : memref -// CHECK: %[[VAL_6:.*]] = alloca(%[[VAL_2]]) : memref -// CHECK: %[[VAL_7:.*]] = alloca(%[[VAL_2]]) : memref -// CHECK: %[[VAL_8:.*]] = alloca() : memref<32xf32> +// CHECK-SAME: %[[VAL_0:.*0]]: tensor<32xf32>, +// CHECK-SAME: %[[VAL_1:.*1]]: tensor<32xf32>, +// CHECK-SAME: %[[VAL_2:.*2]]: tensor<32xf32>) -> tensor<32xf32> { +// CHECK: %[[VAL_3:.*]] = constant 999 : index +// CHECK: %[[VAL_4:.*]] = constant 0 : index +// CHECK: %[[VAL_5:.*]] = constant 1 : index +// CHECK: %[[VAL_6:.*]] = alloca(%[[VAL_3]]) : memref +// CHECK: %[[VAL_7:.*]] = alloca(%[[VAL_3]]) : memref +// CHECK: %[[VAL_8:.*]] = alloca(%[[VAL_3]]) : memref // CHECK: %[[VAL_9:.*]] = alloca() : memref<32xf32> -// CHECK: %[[VAL_10:.*]] = load %[[VAL_5]]{{\[}}%[[VAL_3]]] : memref -// CHECK: %[[VAL_11:.*]] = load %[[VAL_5]]{{\[}}%[[VAL_4]]] : memref -// CHECK: scf.for %[[VAL_12:.*]] = %[[VAL_10]] to %[[VAL_11]] step %[[VAL_4]] { -// CHECK: %[[VAL_13:.*]] = load %[[VAL_6]]{{\[}}%[[VAL_12]]] : memref -// CHECK: %[[VAL_14:.*]] = load %[[VAL_7]]{{\[}}%[[VAL_12]]] : memref -// CHECK: %[[VAL_15:.*]] = load %[[VAL_8]]{{\[}}%[[VAL_13]]] : memref<32xf32> -// CHECK: %[[VAL_16:.*]] = mulf %[[VAL_14]], %[[VAL_15]] : f32 -// CHECK: store %[[VAL_16]], %[[VAL_9]]{{\[}}%[[VAL_13]]] : memref<32xf32> +// CHECK: %[[VAL_10:.*]] = alloca() : memref<32xf32> +// CHECK: %[[VAL_11:.*]] = load %[[VAL_6]]{{\[}}%[[VAL_4]]] : memref +// CHECK: %[[VAL_12:.*]] = load %[[VAL_6]]{{\[}}%[[VAL_5]]] : memref +// CHECK: scf.for %[[VAL_13:.*]] = %[[VAL_11]] to %[[VAL_12]] step %[[VAL_5]] { +// CHECK: %[[VAL_14:.*]] = load %[[VAL_7]]{{\[}}%[[VAL_13]]] : memref +// CHECK: %[[VAL_15:.*]] = load %[[VAL_8]]{{\[}}%[[VAL_13]]] : memref +// CHECK: %[[VAL_16:.*]] = load %[[VAL_9]]{{\[}}%[[VAL_14]]] : memref<32xf32> +// CHECK: %[[VAL_17:.*]] = mulf %[[VAL_15]], %[[VAL_16]] : f32 +// CHECK: store %[[VAL_17]], %[[VAL_10]]{{\[}}%[[VAL_14]]] : memref<32xf32> // CHECK: } -// CHECK: %[[VAL_17:.*]] = tensor_load %[[VAL_9]] : memref<32xf32> -// CHECK: return %[[VAL_17]] : tensor<32xf32> +// CHECK: %[[VAL_18:.*]] = tensor_load %[[VAL_10]] : memref<32xf32> +// CHECK: return %[[VAL_18]] : tensor<32xf32> // CHECK: } -func @mul_sd(%arga: tensor<32xf32>, %argb: tensor<32xf32>) -> tensor<32xf32> { +func @mul_sd(%arga: tensor<32xf32>, %argb: tensor<32xf32>, %argx: tensor<32xf32>) -> tensor<32xf32> { %0 = linalg.generic #trait_sd ins(%arga, %argb: tensor<32xf32>, tensor<32xf32>) - outs(%arga : tensor<32xf32>) { - ^bb(%a: f32, %b: f32, %s : f32): + outs(%argx: tensor<32xf32>) { + ^bb(%a: f32, %b: f32, %x: f32): %0 = mulf %a, %b : f32 linalg.yield %0 : f32 } -> tensor<32xf32> @@ -508,81 +519,82 @@ } // CHECK-LABEL: func @add_ss( -// CHECK-SAME: %[[VAL_0:.*]]: tensor<32xf32>, -// CHECK-SAME: %[[VAL_1:.*]]: tensor<32xf32>) -> tensor<32xf32> { -// CHECK: %[[VAL_2:.*]] = constant 999 : index -// CHECK: %[[VAL_3:.*]] = constant 0 : index -// CHECK: %[[VAL_4:.*]] = constant 1 : index -// CHECK: %[[VAL_5:.*]] = alloca(%[[VAL_2]]) : memref -// CHECK: %[[VAL_6:.*]] = alloca(%[[VAL_2]]) : memref -// CHECK: %[[VAL_7:.*]] = alloca(%[[VAL_2]]) : memref -// CHECK: %[[VAL_8:.*]] = alloca(%[[VAL_2]]) : memref -// CHECK: %[[VAL_9:.*]] = alloca(%[[VAL_2]]) : memref -// CHECK: %[[VAL_10:.*]] = alloca(%[[VAL_2]]) : memref -// CHECK: %[[VAL_11:.*]] = alloca() : memref<32xf32> -// CHECK: %[[VAL_12:.*]] = load %[[VAL_5]]{{\[}}%[[VAL_3]]] : memref -// CHECK: %[[VAL_13:.*]] = load %[[VAL_5]]{{\[}}%[[VAL_4]]] : memref -// CHECK: %[[VAL_14:.*]] = load %[[VAL_8]]{{\[}}%[[VAL_3]]] : memref -// CHECK: %[[VAL_15:.*]] = load %[[VAL_8]]{{\[}}%[[VAL_4]]] : memref -// CHECK: %[[VAL_16:.*]]:2 = scf.while (%[[VAL_17:.*]] = %[[VAL_12]], %[[VAL_18:.*]] = %[[VAL_14]]) : (index, index) -> (index, index) { -// CHECK: %[[VAL_19:.*]] = cmpi ult, %[[VAL_17]], %[[VAL_13]] : index -// CHECK: %[[VAL_20:.*]] = cmpi ult, %[[VAL_18]], %[[VAL_15]] : index -// CHECK: %[[VAL_21:.*]] = and %[[VAL_19]], %[[VAL_20]] : i1 -// CHECK: scf.condition(%[[VAL_21]]) %[[VAL_17]], %[[VAL_18]] : index, index +// CHECK-SAME: %[[VAL_0:.*0]]: tensor<32xf32>, +// CHECK-SAME: %[[VAL_1:.*1]]: tensor<32xf32>, +// CHECK-SAME: %[[VAL_2:.*2]]: tensor<32xf32>) -> tensor<32xf32> { +// CHECK: %[[VAL_3:.*]] = constant 999 : index +// CHECK: %[[VAL_4:.*]] = constant 0 : index +// CHECK: %[[VAL_5:.*]] = constant 1 : index +// CHECK: %[[VAL_6:.*]] = alloca(%[[VAL_3]]) : memref +// CHECK: %[[VAL_7:.*]] = alloca(%[[VAL_3]]) : memref +// CHECK: %[[VAL_8:.*]] = alloca(%[[VAL_3]]) : memref +// CHECK: %[[VAL_9:.*]] = alloca(%[[VAL_3]]) : memref +// CHECK: %[[VAL_10:.*]] = alloca(%[[VAL_3]]) : memref +// CHECK: %[[VAL_11:.*]] = alloca(%[[VAL_3]]) : memref +// CHECK: %[[VAL_12:.*]] = alloca() : memref<32xf32> +// CHECK: %[[VAL_13:.*]] = load %[[VAL_6]]{{\[}}%[[VAL_4]]] : memref +// CHECK: %[[VAL_14:.*]] = load %[[VAL_6]]{{\[}}%[[VAL_5]]] : memref +// CHECK: %[[VAL_15:.*]] = load %[[VAL_9]]{{\[}}%[[VAL_4]]] : memref +// CHECK: %[[VAL_16:.*]] = load %[[VAL_9]]{{\[}}%[[VAL_5]]] : memref +// CHECK: %[[VAL_17:.*]]:2 = scf.while (%[[VAL_18:.*]] = %[[VAL_13]], %[[VAL_19:.*]] = %[[VAL_15]]) : (index, index) -> (index, index) { +// CHECK: %[[VAL_20:.*]] = cmpi ult, %[[VAL_18]], %[[VAL_14]] : index +// CHECK: %[[VAL_21:.*]] = cmpi ult, %[[VAL_19]], %[[VAL_16]] : index +// CHECK: %[[VAL_22:.*]] = and %[[VAL_20]], %[[VAL_21]] : i1 +// CHECK: scf.condition(%[[VAL_22]]) %[[VAL_18]], %[[VAL_19]] : index, index // CHECK: } do { -// CHECK: ^bb0(%[[VAL_22:.*]]: index, %[[VAL_23:.*]]: index): -// CHECK: %[[VAL_24:.*]] = load %[[VAL_6]]{{\[}}%[[VAL_22]]] : memref -// CHECK: %[[VAL_25:.*]] = load %[[VAL_9]]{{\[}}%[[VAL_23]]] : memref -// CHECK: %[[VAL_26:.*]] = cmpi ult, %[[VAL_25]], %[[VAL_24]] : index -// CHECK: %[[VAL_27:.*]] = select %[[VAL_26]], %[[VAL_25]], %[[VAL_24]] : index -// CHECK: %[[VAL_28:.*]] = cmpi eq, %[[VAL_24]], %[[VAL_27]] : index -// CHECK: %[[VAL_29:.*]] = cmpi eq, %[[VAL_25]], %[[VAL_27]] : index -// CHECK: %[[VAL_30:.*]] = and %[[VAL_28]], %[[VAL_29]] : i1 -// CHECK: scf.if %[[VAL_30]] { -// CHECK: %[[VAL_31:.*]] = load %[[VAL_7]]{{\[}}%[[VAL_22]]] : memref -// CHECK: %[[VAL_32:.*]] = load %[[VAL_10]]{{\[}}%[[VAL_23]]] : memref -// CHECK: %[[VAL_33:.*]] = addf %[[VAL_31]], %[[VAL_32]] : f32 -// CHECK: store %[[VAL_33]], %[[VAL_11]]{{\[}}%[[VAL_27]]] : memref<32xf32> +// CHECK: ^bb0(%[[VAL_23:.*]]: index, %[[VAL_24:.*]]: index): +// CHECK: %[[VAL_25:.*]] = load %[[VAL_7]]{{\[}}%[[VAL_23]]] : memref +// CHECK: %[[VAL_26:.*]] = load %[[VAL_10]]{{\[}}%[[VAL_24]]] : memref +// CHECK: %[[VAL_27:.*]] = cmpi ult, %[[VAL_26]], %[[VAL_25]] : index +// CHECK: %[[VAL_28:.*]] = select %[[VAL_27]], %[[VAL_26]], %[[VAL_25]] : index +// CHECK: %[[VAL_29:.*]] = cmpi eq, %[[VAL_25]], %[[VAL_28]] : index +// CHECK: %[[VAL_30:.*]] = cmpi eq, %[[VAL_26]], %[[VAL_28]] : index +// CHECK: %[[VAL_31:.*]] = and %[[VAL_29]], %[[VAL_30]] : i1 +// CHECK: scf.if %[[VAL_31]] { +// CHECK: %[[VAL_32:.*]] = load %[[VAL_8]]{{\[}}%[[VAL_23]]] : memref +// CHECK: %[[VAL_33:.*]] = load %[[VAL_11]]{{\[}}%[[VAL_24]]] : memref +// CHECK: %[[VAL_34:.*]] = addf %[[VAL_32]], %[[VAL_33]] : f32 +// CHECK: store %[[VAL_34]], %[[VAL_12]]{{\[}}%[[VAL_28]]] : memref<32xf32> // CHECK: } else { -// CHECK: %[[VAL_34:.*]] = cmpi eq, %[[VAL_24]], %[[VAL_27]] : index -// CHECK: scf.if %[[VAL_34]] { -// CHECK: %[[VAL_35:.*]] = load %[[VAL_7]]{{\[}}%[[VAL_22]]] : memref -// CHECK: store %[[VAL_35]], %[[VAL_11]]{{\[}}%[[VAL_27]]] : memref<32xf32> +// CHECK: %[[VAL_35:.*]] = cmpi eq, %[[VAL_25]], %[[VAL_28]] : index +// CHECK: scf.if %[[VAL_35]] { +// CHECK: %[[VAL_36:.*]] = load %[[VAL_8]]{{\[}}%[[VAL_23]]] : memref +// CHECK: store %[[VAL_36]], %[[VAL_12]]{{\[}}%[[VAL_28]]] : memref<32xf32> // CHECK: } else { -// CHECK: %[[VAL_36:.*]] = cmpi eq, %[[VAL_25]], %[[VAL_27]] : index -// CHECK: scf.if %[[VAL_36]] { -// CHECK: %[[VAL_37:.*]] = load %[[VAL_10]]{{\[}}%[[VAL_23]]] : memref -// CHECK: store %[[VAL_37]], %[[VAL_11]]{{\[}}%[[VAL_27]]] : memref<32xf32> +// CHECK: %[[VAL_37:.*]] = cmpi eq, %[[VAL_26]], %[[VAL_28]] : index +// CHECK: scf.if %[[VAL_37]] { +// CHECK: %[[VAL_38:.*]] = load %[[VAL_11]]{{\[}}%[[VAL_24]]] : memref +// CHECK: store %[[VAL_38]], %[[VAL_12]]{{\[}}%[[VAL_28]]] : memref<32xf32> // CHECK: } else { // CHECK: } // CHECK: } // CHECK: } -// CHECK: %[[VAL_38:.*]] = cmpi eq, %[[VAL_24]], %[[VAL_27]] : index -// CHECK: %[[VAL_39:.*]] = addi %[[VAL_22]], %[[VAL_4]] : index -// CHECK: %[[VAL_40:.*]] = select %[[VAL_38]], %[[VAL_39]], %[[VAL_22]] : index -// CHECK: %[[VAL_41:.*]] = cmpi eq, %[[VAL_25]], %[[VAL_27]] : index -// CHECK: %[[VAL_42:.*]] = addi %[[VAL_23]], %[[VAL_4]] : index -// CHECK: %[[VAL_43:.*]] = select %[[VAL_41]], %[[VAL_42]], %[[VAL_23]] : index -// CHECK: scf.yield %[[VAL_40]], %[[VAL_43]] : index, index +// CHECK: %[[VAL_39:.*]] = cmpi eq, %[[VAL_25]], %[[VAL_28]] : index +// CHECK: %[[VAL_40:.*]] = addi %[[VAL_23]], %[[VAL_5]] : index +// CHECK: %[[VAL_41:.*]] = select %[[VAL_39]], %[[VAL_40]], %[[VAL_23]] : index +// CHECK: %[[VAL_42:.*]] = cmpi eq, %[[VAL_26]], %[[VAL_28]] : index +// CHECK: %[[VAL_43:.*]] = addi %[[VAL_24]], %[[VAL_5]] : index +// CHECK: %[[VAL_44:.*]] = select %[[VAL_42]], %[[VAL_43]], %[[VAL_24]] : index +// CHECK: scf.yield %[[VAL_41]], %[[VAL_44]] : index, index // CHECK: } -// CHECK: scf.for %[[VAL_44:.*]] = %[[VAL_45:.*]]#0 to %[[VAL_13]] step %[[VAL_4]] { -// CHECK: %[[VAL_46:.*]] = load %[[VAL_6]]{{\[}}%[[VAL_44]]] : memref -// CHECK: %[[VAL_47:.*]] = load %[[VAL_7]]{{\[}}%[[VAL_44]]] : memref -// CHECK: store %[[VAL_47]], %[[VAL_11]]{{\[}}%[[VAL_46]]] : memref<32xf32> +// CHECK: scf.for %[[VAL_45:.*]] = %[[VAL_46:.*]]#0 to %[[VAL_14]] step %[[VAL_5]] { +// CHECK: %[[VAL_47:.*]] = load %[[VAL_7]]{{\[}}%[[VAL_45]]] : memref +// CHECK: %[[VAL_48:.*]] = load %[[VAL_8]]{{\[}}%[[VAL_45]]] : memref +// CHECK: store %[[VAL_48]], %[[VAL_12]]{{\[}}%[[VAL_47]]] : memref<32xf32> // CHECK: } -// CHECK: scf.for %[[VAL_48:.*]] = %[[VAL_49:.*]]#1 to %[[VAL_15]] step %[[VAL_4]] { -// CHECK: %[[VAL_50:.*]] = load %[[VAL_9]]{{\[}}%[[VAL_48]]] : memref -// CHECK: %[[VAL_51:.*]] = load %[[VAL_10]]{{\[}}%[[VAL_48]]] : memref -// CHECK: store %[[VAL_51]], %[[VAL_11]]{{\[}}%[[VAL_50]]] : memref<32xf32> +// CHECK: scf.for %[[VAL_49:.*]] = %[[VAL_50:.*]]#1 to %[[VAL_16]] step %[[VAL_5]] { +// CHECK: %[[VAL_51:.*]] = load %[[VAL_10]]{{\[}}%[[VAL_49]]] : memref +// CHECK: %[[VAL_52:.*]] = load %[[VAL_11]]{{\[}}%[[VAL_49]]] : memref +// CHECK: store %[[VAL_52]], %[[VAL_12]]{{\[}}%[[VAL_51]]] : memref<32xf32> // CHECK: } -// CHECK: %[[VAL_52:.*]] = tensor_load %[[VAL_11]] : memref<32xf32> -// CHECK: return %[[VAL_52]] : tensor<32xf32> +// CHECK: %[[VAL_53:.*]] = tensor_load %[[VAL_12]] : memref<32xf32> +// CHECK: return %[[VAL_53]] : tensor<32xf32> // CHECK: } -func @add_ss(%arga: tensor<32xf32>, %argb: tensor<32xf32>) -> tensor<32xf32> { +func @add_ss(%arga: tensor<32xf32>, %argb: tensor<32xf32>, %argx: tensor<32xf32>) -> tensor<32xf32> { %0 = linalg.generic #trait_ss ins(%arga, %argb: tensor<32xf32>, tensor<32xf32>) - outs(%arga : tensor<32xf32>) { - ^bb(%a: f32, %b: f32, %s : f32): + outs(%argx: tensor<32xf32>) { + ^bb(%a: f32, %b: f32, %x: f32): %0 = addf %a, %b : f32 linalg.yield %0 : f32 } -> tensor<32xf32> @@ -590,59 +602,60 @@ } // CHECK-LABEL: func @mul_ss( -// CHECK-SAME: %[[VAL_0:.*]]: tensor<32xf32>, -// CHECK-SAME: %[[VAL_1:.*]]: tensor<32xf32>) -> tensor<32xf32> { -// CHECK: %[[VAL_2:.*]] = constant 999 : index -// CHECK: %[[VAL_3:.*]] = constant 0 : index -// CHECK: %[[VAL_4:.*]] = constant 1 : index -// CHECK: %[[VAL_5:.*]] = alloca(%[[VAL_2]]) : memref -// CHECK: %[[VAL_6:.*]] = alloca(%[[VAL_2]]) : memref -// CHECK: %[[VAL_7:.*]] = alloca(%[[VAL_2]]) : memref -// CHECK: %[[VAL_8:.*]] = alloca(%[[VAL_2]]) : memref -// CHECK: %[[VAL_9:.*]] = alloca(%[[VAL_2]]) : memref -// CHECK: %[[VAL_10:.*]] = alloca(%[[VAL_2]]) : memref -// CHECK: %[[VAL_11:.*]] = alloca() : memref<32xf32> -// CHECK: %[[VAL_12:.*]] = load %[[VAL_5]]{{\[}}%[[VAL_3]]] : memref -// CHECK: %[[VAL_13:.*]] = load %[[VAL_5]]{{\[}}%[[VAL_4]]] : memref -// CHECK: %[[VAL_14:.*]] = load %[[VAL_8]]{{\[}}%[[VAL_3]]] : memref -// CHECK: %[[VAL_15:.*]] = load %[[VAL_8]]{{\[}}%[[VAL_4]]] : memref -// CHECK: %[[VAL_16:.*]]:2 = scf.while (%[[VAL_17:.*]] = %[[VAL_12]], %[[VAL_18:.*]] = %[[VAL_14]]) : (index, index) -> (index, index) { -// CHECK: %[[VAL_19:.*]] = cmpi ult, %[[VAL_17]], %[[VAL_13]] : index -// CHECK: %[[VAL_20:.*]] = cmpi ult, %[[VAL_18]], %[[VAL_15]] : index -// CHECK: %[[VAL_21:.*]] = and %[[VAL_19]], %[[VAL_20]] : i1 -// CHECK: scf.condition(%[[VAL_21]]) %[[VAL_17]], %[[VAL_18]] : index, index +// CHECK-SAME: %[[VAL_0:.*0]]: tensor<32xf32>, +// CHECK-SAME: %[[VAL_1:.*1]]: tensor<32xf32>, +// CHECK-SAME: %[[VAL_2:.*2]]: tensor<32xf32>) -> tensor<32xf32> { +// CHECK: %[[VAL_3:.*]] = constant 999 : index +// CHECK: %[[VAL_4:.*]] = constant 0 : index +// CHECK: %[[VAL_5:.*]] = constant 1 : index +// CHECK: %[[VAL_6:.*]] = alloca(%[[VAL_3]]) : memref +// CHECK: %[[VAL_7:.*]] = alloca(%[[VAL_3]]) : memref +// CHECK: %[[VAL_8:.*]] = alloca(%[[VAL_3]]) : memref +// CHECK: %[[VAL_9:.*]] = alloca(%[[VAL_3]]) : memref +// CHECK: %[[VAL_10:.*]] = alloca(%[[VAL_3]]) : memref +// CHECK: %[[VAL_11:.*]] = alloca(%[[VAL_3]]) : memref +// CHECK: %[[VAL_12:.*]] = alloca() : memref<32xf32> +// CHECK: %[[VAL_13:.*]] = load %[[VAL_6]]{{\[}}%[[VAL_4]]] : memref +// CHECK: %[[VAL_14:.*]] = load %[[VAL_6]]{{\[}}%[[VAL_5]]] : memref +// CHECK: %[[VAL_15:.*]] = load %[[VAL_9]]{{\[}}%[[VAL_4]]] : memref +// CHECK: %[[VAL_16:.*]] = load %[[VAL_9]]{{\[}}%[[VAL_5]]] : memref +// CHECK: %[[VAL_17:.*]]:2 = scf.while (%[[VAL_18:.*]] = %[[VAL_13]], %[[VAL_19:.*]] = %[[VAL_15]]) : (index, index) -> (index, index) { +// CHECK: %[[VAL_20:.*]] = cmpi ult, %[[VAL_18]], %[[VAL_14]] : index +// CHECK: %[[VAL_21:.*]] = cmpi ult, %[[VAL_19]], %[[VAL_16]] : index +// CHECK: %[[VAL_22:.*]] = and %[[VAL_20]], %[[VAL_21]] : i1 +// CHECK: scf.condition(%[[VAL_22]]) %[[VAL_18]], %[[VAL_19]] : index, index // CHECK: } do { -// CHECK: ^bb0(%[[VAL_22:.*]]: index, %[[VAL_23:.*]]: index): -// CHECK: %[[VAL_24:.*]] = load %[[VAL_6]]{{\[}}%[[VAL_22]]] : memref -// CHECK: %[[VAL_25:.*]] = load %[[VAL_9]]{{\[}}%[[VAL_23]]] : memref -// CHECK: %[[VAL_26:.*]] = cmpi ult, %[[VAL_25]], %[[VAL_24]] : index -// CHECK: %[[VAL_27:.*]] = select %[[VAL_26]], %[[VAL_25]], %[[VAL_24]] : index -// CHECK: %[[VAL_28:.*]] = cmpi eq, %[[VAL_24]], %[[VAL_27]] : index -// CHECK: %[[VAL_29:.*]] = cmpi eq, %[[VAL_25]], %[[VAL_27]] : index -// CHECK: %[[VAL_30:.*]] = and %[[VAL_28]], %[[VAL_29]] : i1 -// CHECK: scf.if %[[VAL_30]] { -// CHECK: %[[VAL_31:.*]] = load %[[VAL_7]]{{\[}}%[[VAL_22]]] : memref -// CHECK: %[[VAL_32:.*]] = load %[[VAL_10]]{{\[}}%[[VAL_23]]] : memref -// CHECK: %[[VAL_33:.*]] = mulf %[[VAL_31]], %[[VAL_32]] : f32 -// CHECK: store %[[VAL_33]], %[[VAL_11]]{{\[}}%[[VAL_27]]] : memref<32xf32> +// CHECK: ^bb0(%[[VAL_23:.*]]: index, %[[VAL_24:.*]]: index): +// CHECK: %[[VAL_25:.*]] = load %[[VAL_7]]{{\[}}%[[VAL_23]]] : memref +// CHECK: %[[VAL_26:.*]] = load %[[VAL_10]]{{\[}}%[[VAL_24]]] : memref +// CHECK: %[[VAL_27:.*]] = cmpi ult, %[[VAL_26]], %[[VAL_25]] : index +// CHECK: %[[VAL_28:.*]] = select %[[VAL_27]], %[[VAL_26]], %[[VAL_25]] : index +// CHECK: %[[VAL_29:.*]] = cmpi eq, %[[VAL_25]], %[[VAL_28]] : index +// CHECK: %[[VAL_30:.*]] = cmpi eq, %[[VAL_26]], %[[VAL_28]] : index +// CHECK: %[[VAL_31:.*]] = and %[[VAL_29]], %[[VAL_30]] : i1 +// CHECK: scf.if %[[VAL_31]] { +// CHECK: %[[VAL_32:.*]] = load %[[VAL_8]]{{\[}}%[[VAL_23]]] : memref +// CHECK: %[[VAL_33:.*]] = load %[[VAL_11]]{{\[}}%[[VAL_24]]] : memref +// CHECK: %[[VAL_34:.*]] = mulf %[[VAL_32]], %[[VAL_33]] : f32 +// CHECK: store %[[VAL_34]], %[[VAL_12]]{{\[}}%[[VAL_28]]] : memref<32xf32> // CHECK: } else { // CHECK: } -// CHECK: %[[VAL_34:.*]] = cmpi eq, %[[VAL_24]], %[[VAL_27]] : index -// CHECK: %[[VAL_35:.*]] = addi %[[VAL_22]], %[[VAL_4]] : index -// CHECK: %[[VAL_36:.*]] = select %[[VAL_34]], %[[VAL_35]], %[[VAL_22]] : index -// CHECK: %[[VAL_37:.*]] = cmpi eq, %[[VAL_25]], %[[VAL_27]] : index -// CHECK: %[[VAL_38:.*]] = addi %[[VAL_23]], %[[VAL_4]] : index -// CHECK: %[[VAL_39:.*]] = select %[[VAL_37]], %[[VAL_38]], %[[VAL_23]] : index -// CHECK: scf.yield %[[VAL_36]], %[[VAL_39]] : index, index +// CHECK: %[[VAL_35:.*]] = cmpi eq, %[[VAL_25]], %[[VAL_28]] : index +// CHECK: %[[VAL_36:.*]] = addi %[[VAL_23]], %[[VAL_5]] : index +// CHECK: %[[VAL_37:.*]] = select %[[VAL_35]], %[[VAL_36]], %[[VAL_23]] : index +// CHECK: %[[VAL_38:.*]] = cmpi eq, %[[VAL_26]], %[[VAL_28]] : index +// CHECK: %[[VAL_39:.*]] = addi %[[VAL_24]], %[[VAL_5]] : index +// CHECK: %[[VAL_40:.*]] = select %[[VAL_38]], %[[VAL_39]], %[[VAL_24]] : index +// CHECK: scf.yield %[[VAL_37]], %[[VAL_40]] : index, index // CHECK: } -// CHECK: %[[VAL_40:.*]] = tensor_load %[[VAL_11]] : memref<32xf32> -// CHECK: return %[[VAL_40]] : tensor<32xf32> +// CHECK: %[[VAL_41:.*]] = tensor_load %[[VAL_12]] : memref<32xf32> +// CHECK: return %[[VAL_41]] : tensor<32xf32> // CHECK: } -func @mul_ss(%arga: tensor<32xf32>, %argb: tensor<32xf32>) -> tensor<32xf32> { +func @mul_ss(%arga: tensor<32xf32>, %argb: tensor<32xf32>, %argx: tensor<32xf32>) -> tensor<32xf32> { %0 = linalg.generic #trait_ss ins(%arga, %argb: tensor<32xf32>, tensor<32xf32>) - outs(%arga : tensor<32xf32>) { - ^bb(%a: f32, %b: f32, %s : f32): + outs(%argx: tensor<32xf32>) { + ^bb(%a: f32, %b: f32, %x: f32): %0 = mulf %a, %b : f32 linalg.yield %0 : f32 } -> tensor<32xf32> @@ -667,85 +680,85 @@ // CHECK-LABEL: func @two_way_inv( // CHECK-SAME: %[[VAL_0:.*0]]: tensor<16xf32>, // CHECK-SAME: %[[VAL_1:.*1]]: tensor<16xf32>, -// CHECK-SAME: %[[VAL_2:.*2]]: f32) -> tensor<16xf32> { -// CHECK: %[[VAL_3:.*]] = constant 999 : index -// CHECK: %[[VAL_4:.*]] = constant 0 : index -// CHECK: %[[VAL_5:.*]] = constant 1 : index -// CHECK: %[[VAL_6:.*]] = alloca(%[[VAL_3]]) : memref -// CHECK: %[[VAL_7:.*]] = alloca(%[[VAL_3]]) : memref -// CHECK: %[[VAL_8:.*]] = alloca(%[[VAL_3]]) : memref -// CHECK: %[[VAL_9:.*]] = alloca(%[[VAL_3]]) : memref -// CHECK: %[[VAL_10:.*]] = alloca(%[[VAL_3]]) : memref -// CHECK: %[[VAL_11:.*]] = alloca(%[[VAL_3]]) : memref -// CHECK: %[[VAL_12:.*]] = alloca() : memref<16xf32> -// CHECK: %[[VAL_13:.*]] = load %[[VAL_6]]{{\[}}%[[VAL_4]]] : memref -// CHECK: %[[VAL_14:.*]] = load %[[VAL_6]]{{\[}}%[[VAL_5]]] : memref -// CHECK: %[[VAL_15:.*]] = load %[[VAL_9]]{{\[}}%[[VAL_4]]] : memref -// CHECK: %[[VAL_16:.*]] = load %[[VAL_9]]{{\[}}%[[VAL_5]]] : memref -// CHECK: %[[VAL_17:.*]]:3 = scf.while (%[[VAL_18:.*]] = %[[VAL_13]], %[[VAL_19:.*]] = %[[VAL_15]], %[[VAL_20:.*]] = %[[VAL_4]]) : (index, index, index) -> (index, index, index) { -// CHECK: %[[VAL_21:.*]] = cmpi ult, %[[VAL_18]], %[[VAL_14]] : index -// CHECK: %[[VAL_22:.*]] = cmpi ult, %[[VAL_19]], %[[VAL_16]] : index -// CHECK: %[[VAL_23:.*]] = and %[[VAL_21]], %[[VAL_22]] : i1 -// CHECK: scf.condition(%[[VAL_23]]) %[[VAL_18]], %[[VAL_19]], %[[VAL_20]] : index, index, index +// CHECK-SAME: %[[VAL_2:.*2]]: f32, +// CHECK-SAME: %[[VAL_3:.*3]]: tensor<16xf32>) -> tensor<16xf32> { +// CHECK: %[[VAL_4:.*]] = constant 999 : index +// CHECK: %[[VAL_5:.*]] = constant 0 : index +// CHECK: %[[VAL_6:.*]] = constant 1 : index +// CHECK: %[[VAL_7:.*]] = alloca(%[[VAL_4]]) : memref +// CHECK: %[[VAL_8:.*]] = alloca(%[[VAL_4]]) : memref +// CHECK: %[[VAL_9:.*]] = alloca(%[[VAL_4]]) : memref +// CHECK: %[[VAL_10:.*]] = alloca(%[[VAL_4]]) : memref +// CHECK: %[[VAL_11:.*]] = alloca(%[[VAL_4]]) : memref +// CHECK: %[[VAL_12:.*]] = alloca(%[[VAL_4]]) : memref +// CHECK: %[[VAL_13:.*]] = alloca() : memref<16xf32> +// CHECK: %[[VAL_14:.*]] = load %[[VAL_7]]{{\[}}%[[VAL_5]]] : memref +// CHECK: %[[VAL_15:.*]] = load %[[VAL_7]]{{\[}}%[[VAL_6]]] : memref +// CHECK: %[[VAL_16:.*]] = load %[[VAL_10]]{{\[}}%[[VAL_5]]] : memref +// CHECK: %[[VAL_17:.*]] = load %[[VAL_10]]{{\[}}%[[VAL_6]]] : memref +// CHECK: %[[VAL_18:.*]]:3 = scf.while (%[[VAL_19:.*]] = %[[VAL_14]], %[[VAL_20:.*]] = %[[VAL_16]], %[[VAL_21:.*]] = %[[VAL_5]]) : (index, index, index) -> (index, index, index) { +// CHECK: %[[VAL_22:.*]] = cmpi ult, %[[VAL_19]], %[[VAL_15]] : index +// CHECK: %[[VAL_23:.*]] = cmpi ult, %[[VAL_20]], %[[VAL_17]] : index +// CHECK: %[[VAL_24:.*]] = and %[[VAL_22]], %[[VAL_23]] : i1 +// CHECK: scf.condition(%[[VAL_24]]) %[[VAL_19]], %[[VAL_20]], %[[VAL_21]] : index, index, index // CHECK: } do { -// CHECK: ^bb0(%[[VAL_24:.*]]: index, %[[VAL_25:.*]]: index, %[[VAL_26:.*]]: index): -// CHECK: %[[VAL_27:.*]] = load %[[VAL_7]]{{\[}}%[[VAL_24]]] : memref -// CHECK: %[[VAL_28:.*]] = load %[[VAL_10]]{{\[}}%[[VAL_25]]] : memref -// CHECK: %[[VAL_29:.*]] = cmpi eq, %[[VAL_27]], %[[VAL_26]] : index -// CHECK: %[[VAL_30:.*]] = cmpi eq, %[[VAL_28]], %[[VAL_26]] : index -// CHECK: %[[VAL_31:.*]] = and %[[VAL_29]], %[[VAL_30]] : i1 -// CHECK: scf.if %[[VAL_31]] { -// CHECK: %[[VAL_32:.*]] = load %[[VAL_8]]{{\[}}%[[VAL_24]]] : memref -// CHECK: %[[VAL_33:.*]] = mulf %[[VAL_32]], %[[VAL_2]] : f32 -// CHECK: %[[VAL_34:.*]] = load %[[VAL_11]]{{\[}}%[[VAL_25]]] : memref -// CHECK: %[[VAL_35:.*]] = mulf %[[VAL_34]], %[[VAL_2]] : f32 -// CHECK: %[[VAL_36:.*]] = addf %[[VAL_33]], %[[VAL_35]] : f32 -// CHECK: store %[[VAL_36]], %[[VAL_12]]{{\[}}%[[VAL_26]]] : memref<16xf32> +// CHECK: ^bb0(%[[VAL_25:.*]]: index, %[[VAL_26:.*]]: index, %[[VAL_27:.*]]: index): +// CHECK: %[[VAL_28:.*]] = load %[[VAL_8]]{{\[}}%[[VAL_25]]] : memref +// CHECK: %[[VAL_29:.*]] = load %[[VAL_11]]{{\[}}%[[VAL_26]]] : memref +// CHECK: %[[VAL_30:.*]] = cmpi eq, %[[VAL_28]], %[[VAL_27]] : index +// CHECK: %[[VAL_31:.*]] = cmpi eq, %[[VAL_29]], %[[VAL_27]] : index +// CHECK: %[[VAL_32:.*]] = and %[[VAL_30]], %[[VAL_31]] : i1 +// CHECK: scf.if %[[VAL_32]] { +// CHECK: %[[VAL_33:.*]] = load %[[VAL_9]]{{\[}}%[[VAL_25]]] : memref +// CHECK: %[[VAL_34:.*]] = mulf %[[VAL_33]], %[[VAL_2]] : f32 +// CHECK: %[[VAL_35:.*]] = load %[[VAL_12]]{{\[}}%[[VAL_26]]] : memref +// CHECK: %[[VAL_36:.*]] = mulf %[[VAL_35]], %[[VAL_2]] : f32 +// CHECK: %[[VAL_37:.*]] = addf %[[VAL_34]], %[[VAL_36]] : f32 +// CHECK: store %[[VAL_37]], %[[VAL_13]]{{\[}}%[[VAL_27]]] : memref<16xf32> // CHECK: } else { -// CHECK: %[[VAL_37:.*]] = cmpi eq, %[[VAL_27]], %[[VAL_26]] : index -// CHECK: scf.if %[[VAL_37]] { -// CHECK: %[[VAL_38:.*]] = load %[[VAL_8]]{{\[}}%[[VAL_24]]] : memref -// CHECK: %[[VAL_39:.*]] = mulf %[[VAL_38]], %[[VAL_2]] : f32 -// CHECK: store %[[VAL_39]], %[[VAL_12]]{{\[}}%[[VAL_26]]] : memref<16xf32> +// CHECK: %[[VAL_38:.*]] = cmpi eq, %[[VAL_28]], %[[VAL_27]] : index +// CHECK: scf.if %[[VAL_38]] { +// CHECK: %[[VAL_39:.*]] = load %[[VAL_9]]{{\[}}%[[VAL_25]]] : memref +// CHECK: %[[VAL_40:.*]] = mulf %[[VAL_39]], %[[VAL_2]] : f32 +// CHECK: store %[[VAL_40]], %[[VAL_13]]{{\[}}%[[VAL_27]]] : memref<16xf32> // CHECK: } else { -// CHECK: %[[VAL_40:.*]] = cmpi eq, %[[VAL_28]], %[[VAL_26]] : index -// CHECK: scf.if %[[VAL_40]] { -// CHECK: %[[VAL_41:.*]] = load %[[VAL_11]]{{\[}}%[[VAL_25]]] : memref -// CHECK: %[[VAL_42:.*]] = mulf %[[VAL_41]], %[[VAL_2]] : f32 -// CHECK: store %[[VAL_42]], %[[VAL_12]]{{\[}}%[[VAL_26]]] : memref<16xf32> +// CHECK: %[[VAL_41:.*]] = cmpi eq, %[[VAL_29]], %[[VAL_27]] : index +// CHECK: scf.if %[[VAL_41]] { +// CHECK: %[[VAL_42:.*]] = load %[[VAL_12]]{{\[}}%[[VAL_26]]] : memref +// CHECK: %[[VAL_43:.*]] = mulf %[[VAL_42]], %[[VAL_2]] : f32 +// CHECK: store %[[VAL_43]], %[[VAL_13]]{{\[}}%[[VAL_27]]] : memref<16xf32> // CHECK: } else { // CHECK: } // CHECK: } // CHECK: } -// CHECK: %[[VAL_43:.*]] = cmpi eq, %[[VAL_27]], %[[VAL_26]] : index -// CHECK: %[[VAL_44:.*]] = addi %[[VAL_24]], %[[VAL_5]] : index -// CHECK: %[[VAL_45:.*]] = select %[[VAL_43]], %[[VAL_44]], %[[VAL_24]] : index -// CHECK: %[[VAL_46:.*]] = cmpi eq, %[[VAL_28]], %[[VAL_26]] : index -// CHECK: %[[VAL_47:.*]] = addi %[[VAL_25]], %[[VAL_5]] : index -// CHECK: %[[VAL_48:.*]] = select %[[VAL_46]], %[[VAL_47]], %[[VAL_25]] : index -// CHECK: %[[VAL_49:.*]] = addi %[[VAL_26]], %[[VAL_5]] : index -// CHECK: scf.yield %[[VAL_45]], %[[VAL_48]], %[[VAL_49]] : index, index, index +// CHECK: %[[VAL_44:.*]] = cmpi eq, %[[VAL_28]], %[[VAL_27]] : index +// CHECK: %[[VAL_45:.*]] = addi %[[VAL_25]], %[[VAL_6]] : index +// CHECK: %[[VAL_46:.*]] = select %[[VAL_44]], %[[VAL_45]], %[[VAL_25]] : index +// CHECK: %[[VAL_47:.*]] = cmpi eq, %[[VAL_29]], %[[VAL_27]] : index +// CHECK: %[[VAL_48:.*]] = addi %[[VAL_26]], %[[VAL_6]] : index +// CHECK: %[[VAL_49:.*]] = select %[[VAL_47]], %[[VAL_48]], %[[VAL_26]] : index +// CHECK: %[[VAL_50:.*]] = addi %[[VAL_27]], %[[VAL_6]] : index +// CHECK: scf.yield %[[VAL_46]], %[[VAL_49]], %[[VAL_50]] : index, index, index // CHECK: } -// CHECK: scf.for %[[VAL_50:.*]] = %[[VAL_51:.*]]#0 to %[[VAL_14]] step %[[VAL_5]] { -// CHECK: %[[VAL_52:.*]] = load %[[VAL_8]]{{\[}}%[[VAL_50]]] : memref -// CHECK: %[[VAL_53:.*]] = mulf %[[VAL_52]], %[[VAL_2]] : f32 -// CHECK: store %[[VAL_53]], %[[VAL_12]]{{\[}}%[[VAL_51]]#2] : memref<16xf32> +// CHECK: scf.for %[[VAL_51:.*]] = %[[VAL_52:.*]]#0 to %[[VAL_15]] step %[[VAL_6]] { +// CHECK: %[[VAL_53:.*]] = load %[[VAL_9]]{{\[}}%[[VAL_51]]] : memref +// CHECK: %[[VAL_54:.*]] = mulf %[[VAL_53]], %[[VAL_2]] : f32 +// CHECK: store %[[VAL_54]], %[[VAL_13]]{{\[}}%[[VAL_52]]#2] : memref<16xf32> // CHECK: } -// CHECK: scf.for %[[VAL_54:.*]] = %[[VAL_55:.*]]#1 to %[[VAL_16]] step %[[VAL_5]] { -// CHECK: %[[VAL_56:.*]] = load %[[VAL_10]]{{\[}}%[[VAL_54]]] : memref -// CHECK: %[[VAL_57:.*]] = load %[[VAL_11]]{{\[}}%[[VAL_54]]] : memref -// CHECK: %[[VAL_58:.*]] = mulf %[[VAL_57]], %[[VAL_2]] : f32 -// CHECK: store %[[VAL_58]], %[[VAL_12]]{{\[}}%[[VAL_56]]] : memref<16xf32> +// CHECK: scf.for %[[VAL_55:.*]] = %[[VAL_56:.*]]#1 to %[[VAL_17]] step %[[VAL_6]] { +// CHECK: %[[VAL_57:.*]] = load %[[VAL_11]]{{\[}}%[[VAL_55]]] : memref +// CHECK: %[[VAL_58:.*]] = load %[[VAL_12]]{{\[}}%[[VAL_55]]] : memref +// CHECK: %[[VAL_59:.*]] = mulf %[[VAL_58]], %[[VAL_2]] : f32 +// CHECK: store %[[VAL_59]], %[[VAL_13]]{{\[}}%[[VAL_57]]] : memref<16xf32> // CHECK: } -// CHECK: %[[VAL_59:.*]] = tensor_load %[[VAL_12]] : memref<16xf32> -// CHECK: return %[[VAL_59]] : tensor<16xf32> +// CHECK: %[[VAL_60:.*]] = tensor_load %[[VAL_13]] : memref<16xf32> +// CHECK: return %[[VAL_60]] : tensor<16xf32> // CHECK: } -func @two_way_inv(%arga: tensor<16xf32>, - %argb: tensor<16xf32>, %argc: f32) -> tensor<16xf32> { +func @two_way_inv(%arga: tensor<16xf32>, %argb: tensor<16xf32>, %argc: f32, %argx: tensor<16xf32>) -> tensor<16xf32> { %0 = linalg.generic #trait_two_way_inv ins(%arga, %argb : tensor<16xf32>, tensor<16xf32>) - outs(%argb : tensor<16xf32>) { - ^bb(%a : f32, %b : f32, %c : f32): + outs(%argx: tensor<16xf32>) { + ^bb(%a : f32, %b : f32, %x : f32): %0 = mulf %a, %argc : f32 %1 = mulf %b, %argc : f32 %2 = addf %0, %1 : f32 @@ -757,85 +770,86 @@ // CHECK-LABEL: func @two_way_inv_alt( // CHECK-SAME: %[[VAL_0:.*0]]: tensor<16xf32>, // CHECK-SAME: %[[VAL_1:.*1]]: tensor<16xf32>, -// CHECK-SAME: %[[VAL_2:.*2]]: f32) -> tensor<16xf32> { -// CHECK: %[[VAL_3:.*]] = constant 999 : index -// CHECK: %[[VAL_4:.*]] = constant 0 : index -// CHECK: %[[VAL_5:.*]] = constant 1 : index -// CHECK: %[[VAL_6:.*]] = alloca(%[[VAL_3]]) : memref -// CHECK: %[[VAL_7:.*]] = alloca(%[[VAL_3]]) : memref -// CHECK: %[[VAL_8:.*]] = alloca(%[[VAL_3]]) : memref -// CHECK: %[[VAL_9:.*]] = alloca(%[[VAL_3]]) : memref -// CHECK: %[[VAL_10:.*]] = alloca(%[[VAL_3]]) : memref -// CHECK: %[[VAL_11:.*]] = alloca(%[[VAL_3]]) : memref -// CHECK: %[[VAL_12:.*]] = alloca() : memref<16xf32> -// CHECK: %[[VAL_13:.*]] = load %[[VAL_6]]{{\[}}%[[VAL_4]]] : memref -// CHECK: %[[VAL_14:.*]] = load %[[VAL_6]]{{\[}}%[[VAL_5]]] : memref -// CHECK: %[[VAL_15:.*]] = load %[[VAL_9]]{{\[}}%[[VAL_4]]] : memref -// CHECK: %[[VAL_16:.*]] = load %[[VAL_9]]{{\[}}%[[VAL_5]]] : memref -// CHECK: %[[VAL_17:.*]]:3 = scf.while (%[[VAL_18:.*]] = %[[VAL_13]], %[[VAL_19:.*]] = %[[VAL_15]], %[[VAL_20:.*]] = %[[VAL_4]]) : (index, index, index) -> (index, index, index) { -// CHECK: %[[VAL_21:.*]] = cmpi ult, %[[VAL_18]], %[[VAL_14]] : index -// CHECK: %[[VAL_22:.*]] = cmpi ult, %[[VAL_19]], %[[VAL_16]] : index -// CHECK: %[[VAL_23:.*]] = and %[[VAL_21]], %[[VAL_22]] : i1 -// CHECK: scf.condition(%[[VAL_23]]) %[[VAL_18]], %[[VAL_19]], %[[VAL_20]] : index, index, index +// CHECK-SAME: %[[VAL_2:.*2]]: f32, +// CHECK-SAME: %[[VAL_3:.*3]]: tensor<16xf32>) -> tensor<16xf32> { +// CHECK: %[[VAL_4:.*]] = constant 999 : index +// CHECK: %[[VAL_5:.*]] = constant 0 : index +// CHECK: %[[VAL_6:.*]] = constant 1 : index +// CHECK: %[[VAL_7:.*]] = alloca(%[[VAL_4]]) : memref +// CHECK: %[[VAL_8:.*]] = alloca(%[[VAL_4]]) : memref +// CHECK: %[[VAL_9:.*]] = alloca(%[[VAL_4]]) : memref +// CHECK: %[[VAL_10:.*]] = alloca(%[[VAL_4]]) : memref +// CHECK: %[[VAL_11:.*]] = alloca(%[[VAL_4]]) : memref +// CHECK: %[[VAL_12:.*]] = alloca(%[[VAL_4]]) : memref +// CHECK: %[[VAL_13:.*]] = alloca() : memref<16xf32> +// CHECK: %[[VAL_14:.*]] = load %[[VAL_7]]{{\[}}%[[VAL_5]]] : memref +// CHECK: %[[VAL_15:.*]] = load %[[VAL_7]]{{\[}}%[[VAL_6]]] : memref +// CHECK: %[[VAL_16:.*]] = load %[[VAL_10]]{{\[}}%[[VAL_5]]] : memref +// CHECK: %[[VAL_17:.*]] = load %[[VAL_10]]{{\[}}%[[VAL_6]]] : memref +// CHECK: %[[VAL_18:.*]]:3 = scf.while (%[[VAL_19:.*]] = %[[VAL_14]], %[[VAL_20:.*]] = %[[VAL_16]], %[[VAL_21:.*]] = %[[VAL_5]]) : (index, index, index) -> (index, index, index) { +// CHECK: %[[VAL_22:.*]] = cmpi ult, %[[VAL_19]], %[[VAL_15]] : index +// CHECK: %[[VAL_23:.*]] = cmpi ult, %[[VAL_20]], %[[VAL_17]] : index +// CHECK: %[[VAL_24:.*]] = and %[[VAL_22]], %[[VAL_23]] : i1 +// CHECK: scf.condition(%[[VAL_24]]) %[[VAL_19]], %[[VAL_20]], %[[VAL_21]] : index, index, index // CHECK: } do { -// CHECK: ^bb0(%[[VAL_24:.*]]: index, %[[VAL_25:.*]]: index, %[[VAL_26:.*]]: index): -// CHECK: %[[VAL_27:.*]] = load %[[VAL_7]]{{\[}}%[[VAL_24]]] : memref -// CHECK: %[[VAL_28:.*]] = load %[[VAL_10]]{{\[}}%[[VAL_25]]] : memref -// CHECK: %[[VAL_29:.*]] = cmpi eq, %[[VAL_27]], %[[VAL_26]] : index -// CHECK: %[[VAL_30:.*]] = cmpi eq, %[[VAL_28]], %[[VAL_26]] : index -// CHECK: %[[VAL_31:.*]] = and %[[VAL_29]], %[[VAL_30]] : i1 -// CHECK: scf.if %[[VAL_31]] { -// CHECK: %[[VAL_32:.*]] = load %[[VAL_8]]{{\[}}%[[VAL_24]]] : memref -// CHECK: %[[VAL_33:.*]] = load %[[VAL_11]]{{\[}}%[[VAL_25]]] : memref -// CHECK: %[[VAL_34:.*]] = addf %[[VAL_32]], %[[VAL_33]] : f32 -// CHECK: %[[VAL_35:.*]] = mulf %[[VAL_34]], %[[VAL_2]] : f32 -// CHECK: store %[[VAL_35]], %[[VAL_12]]{{\[}}%[[VAL_26]]] : memref<16xf32> +// CHECK: ^bb0(%[[VAL_25:.*]]: index, %[[VAL_26:.*]]: index, %[[VAL_27:.*]]: index): +// CHECK: %[[VAL_28:.*]] = load %[[VAL_8]]{{\[}}%[[VAL_25]]] : memref +// CHECK: %[[VAL_29:.*]] = load %[[VAL_11]]{{\[}}%[[VAL_26]]] : memref +// CHECK: %[[VAL_30:.*]] = cmpi eq, %[[VAL_28]], %[[VAL_27]] : index +// CHECK: %[[VAL_31:.*]] = cmpi eq, %[[VAL_29]], %[[VAL_27]] : index +// CHECK: %[[VAL_32:.*]] = and %[[VAL_30]], %[[VAL_31]] : i1 +// CHECK: scf.if %[[VAL_32]] { +// CHECK: %[[VAL_33:.*]] = load %[[VAL_9]]{{\[}}%[[VAL_25]]] : memref +// CHECK: %[[VAL_34:.*]] = load %[[VAL_12]]{{\[}}%[[VAL_26]]] : memref +// CHECK: %[[VAL_35:.*]] = addf %[[VAL_33]], %[[VAL_34]] : f32 +// CHECK: %[[VAL_36:.*]] = mulf %[[VAL_35]], %[[VAL_2]] : f32 +// CHECK: store %[[VAL_36]], %[[VAL_13]]{{\[}}%[[VAL_27]]] : memref<16xf32> // CHECK: } else { -// CHECK: %[[VAL_36:.*]] = cmpi eq, %[[VAL_27]], %[[VAL_26]] : index -// CHECK: scf.if %[[VAL_36]] { -// CHECK: %[[VAL_37:.*]] = load %[[VAL_8]]{{\[}}%[[VAL_24]]] : memref -// CHECK: %[[VAL_38:.*]] = mulf %[[VAL_37]], %[[VAL_2]] : f32 -// CHECK: store %[[VAL_38]], %[[VAL_12]]{{\[}}%[[VAL_26]]] : memref<16xf32> +// CHECK: %[[VAL_37:.*]] = cmpi eq, %[[VAL_28]], %[[VAL_27]] : index +// CHECK: scf.if %[[VAL_37]] { +// CHECK: %[[VAL_38:.*]] = load %[[VAL_9]]{{\[}}%[[VAL_25]]] : memref +// CHECK: %[[VAL_39:.*]] = mulf %[[VAL_38]], %[[VAL_2]] : f32 +// CHECK: store %[[VAL_39]], %[[VAL_13]]{{\[}}%[[VAL_27]]] : memref<16xf32> // CHECK: } else { -// CHECK: %[[VAL_39:.*]] = cmpi eq, %[[VAL_28]], %[[VAL_26]] : index -// CHECK: scf.if %[[VAL_39]] { -// CHECK: %[[VAL_40:.*]] = load %[[VAL_11]]{{\[}}%[[VAL_25]]] : memref -// CHECK: %[[VAL_41:.*]] = mulf %[[VAL_40]], %[[VAL_2]] : f32 -// CHECK: store %[[VAL_41]], %[[VAL_12]]{{\[}}%[[VAL_26]]] : memref<16xf32> +// CHECK: %[[VAL_40:.*]] = cmpi eq, %[[VAL_29]], %[[VAL_27]] : index +// CHECK: scf.if %[[VAL_40]] { +// CHECK: %[[VAL_41:.*]] = load %[[VAL_12]]{{\[}}%[[VAL_26]]] : memref +// CHECK: %[[VAL_42:.*]] = mulf %[[VAL_41]], %[[VAL_2]] : f32 +// CHECK: store %[[VAL_42]], %[[VAL_13]]{{\[}}%[[VAL_27]]] : memref<16xf32> // CHECK: } else { // CHECK: } // CHECK: } // CHECK: } -// CHECK: %[[VAL_42:.*]] = cmpi eq, %[[VAL_27]], %[[VAL_26]] : index -// CHECK: %[[VAL_43:.*]] = addi %[[VAL_24]], %[[VAL_5]] : index -// CHECK: %[[VAL_44:.*]] = select %[[VAL_42]], %[[VAL_43]], %[[VAL_24]] : index -// CHECK: %[[VAL_45:.*]] = cmpi eq, %[[VAL_28]], %[[VAL_26]] : index -// CHECK: %[[VAL_46:.*]] = addi %[[VAL_25]], %[[VAL_5]] : index -// CHECK: %[[VAL_47:.*]] = select %[[VAL_45]], %[[VAL_46]], %[[VAL_25]] : index -// CHECK: %[[VAL_48:.*]] = addi %[[VAL_26]], %[[VAL_5]] : index -// CHECK: scf.yield %[[VAL_44]], %[[VAL_47]], %[[VAL_48]] : index, index, index +// CHECK: %[[VAL_43:.*]] = cmpi eq, %[[VAL_28]], %[[VAL_27]] : index +// CHECK: %[[VAL_44:.*]] = addi %[[VAL_25]], %[[VAL_6]] : index +// CHECK: %[[VAL_45:.*]] = select %[[VAL_43]], %[[VAL_44]], %[[VAL_25]] : index +// CHECK: %[[VAL_46:.*]] = cmpi eq, %[[VAL_29]], %[[VAL_27]] : index +// CHECK: %[[VAL_47:.*]] = addi %[[VAL_26]], %[[VAL_6]] : index +// CHECK: %[[VAL_48:.*]] = select %[[VAL_46]], %[[VAL_47]], %[[VAL_26]] : index +// CHECK: %[[VAL_49:.*]] = addi %[[VAL_27]], %[[VAL_6]] : index +// CHECK: scf.yield %[[VAL_45]], %[[VAL_48]], %[[VAL_49]] : index, index, index // CHECK: } -// CHECK: scf.for %[[VAL_49:.*]] = %[[VAL_50:.*]]#0 to %[[VAL_14]] step %[[VAL_5]] { -// CHECK: %[[VAL_51:.*]] = load %[[VAL_8]]{{\[}}%[[VAL_49]]] : memref -// CHECK: %[[VAL_52:.*]] = mulf %[[VAL_51]], %[[VAL_2]] : f32 -// CHECK: store %[[VAL_52]], %[[VAL_12]]{{\[}}%[[VAL_50]]#2] : memref<16xf32> +// CHECK: scf.for %[[VAL_50:.*]] = %[[VAL_51:.*]]#0 to %[[VAL_15]] step %[[VAL_6]] { +// CHECK: %[[VAL_52:.*]] = load %[[VAL_9]]{{\[}}%[[VAL_50]]] : memref +// CHECK: %[[VAL_53:.*]] = mulf %[[VAL_52]], %[[VAL_2]] : f32 +// CHECK: store %[[VAL_53]], %[[VAL_13]]{{\[}}%[[VAL_51]]#2] : memref<16xf32> // CHECK: } -// CHECK: scf.for %[[VAL_53:.*]] = %[[VAL_54:.*]]#1 to %[[VAL_16]] step %[[VAL_5]] { -// CHECK: %[[VAL_55:.*]] = load %[[VAL_10]]{{\[}}%[[VAL_53]]] : memref -// CHECK: %[[VAL_56:.*]] = load %[[VAL_11]]{{\[}}%[[VAL_53]]] : memref -// CHECK: %[[VAL_57:.*]] = mulf %[[VAL_56]], %[[VAL_2]] : f32 -// CHECK: store %[[VAL_57]], %[[VAL_12]]{{\[}}%[[VAL_55]]] : memref<16xf32> +// CHECK: scf.for %[[VAL_54:.*]] = %[[VAL_55:.*]]#1 to %[[VAL_17]] step %[[VAL_6]] { +// CHECK: %[[VAL_56:.*]] = load %[[VAL_11]]{{\[}}%[[VAL_54]]] : memref +// CHECK: %[[VAL_57:.*]] = load %[[VAL_12]]{{\[}}%[[VAL_54]]] : memref +// CHECK: %[[VAL_58:.*]] = mulf %[[VAL_57]], %[[VAL_2]] : f32 +// CHECK: store %[[VAL_58]], %[[VAL_13]]{{\[}}%[[VAL_56]]] : memref<16xf32> // CHECK: } -// CHECK: %[[VAL_58:.*]] = tensor_load %[[VAL_12]] : memref<16xf32> -// CHECK: return %[[VAL_58]] : tensor<16xf32> +// CHECK: %[[VAL_59:.*]] = tensor_load %[[VAL_13]] : memref<16xf32> +// CHECK: return %[[VAL_59]] : tensor<16xf32> // CHECK: } func @two_way_inv_alt(%arga: tensor<16xf32>, - %argb: tensor<16xf32>, %argc: f32) -> tensor<16xf32> { + %argb: tensor<16xf32>, %argc: f32, %argx: tensor<16xf32>) -> tensor<16xf32> { // Same kernel, but now expressed as "x(i) = (a(i) + b(i)) * c". %0 = linalg.generic #trait_two_way_inv ins(%arga, %argb : tensor<16xf32>, tensor<16xf32>) - outs(%argb : tensor<16xf32>) { - ^bb(%a : f32, %b : f32, %c : f32): + outs(%argx: tensor<16xf32>) { + ^bb(%a : f32, %b : f32, %x : f32): %0 = addf %a, %b : f32 %1 = mulf %0, %argc : f32 linalg.yield %1: f32 @@ -863,19 +877,19 @@ // CHECK: %[[VAL_3:.*]] = constant 0 : index // CHECK: %[[VAL_4:.*]] = constant 1 : index // CHECK: %[[VAL_5:.*]] = alloca(%[[VAL_2]]) : memref -// CHECK: %[[VAL_7:.*]] = alloca(%[[VAL_2]]) : memref -// CHECK: %[[VAL_8:.*]] = alloca() : memref -// CHECK: %[[VAL_9:.*]] = load %[[VAL_5]]{{\[}}%[[VAL_3]]] : memref -// CHECK: %[[VAL_10:.*]] = load %[[VAL_5]]{{\[}}%[[VAL_4]]] : memref -// CHECK: %[[VAL_11:.*]] = load %[[VAL_8]][] : memref -// CHECK: %[[VAL_12:.*]] = scf.for %[[VAL_13:.*]] = %[[VAL_9]] to %[[VAL_10]] step %[[VAL_4]] iter_args(%[[VAL_14:.*]] = %[[VAL_11]]) -> (f32) { -// CHECK: %[[VAL_15:.*]] = load %[[VAL_7]]{{\[}}%[[VAL_13]]] : memref -// CHECK: %[[VAL_16:.*]] = addf %[[VAL_14]], %[[VAL_15]] : f32 -// CHECK: scf.yield %[[VAL_16]] : f32 +// CHECK: %[[VAL_6:.*]] = alloca(%[[VAL_2]]) : memref +// CHECK: %[[VAL_7:.*]] = alloca() : memref +// CHECK: %[[VAL_8:.*]] = load %[[VAL_5]]{{\[}}%[[VAL_3]]] : memref +// CHECK: %[[VAL_9:.*]] = load %[[VAL_5]]{{\[}}%[[VAL_4]]] : memref +// CHECK: %[[VAL_10:.*]] = load %[[VAL_7]][] : memref +// CHECK: %[[VAL_11:.*]] = scf.for %[[VAL_12:.*]] = %[[VAL_8]] to %[[VAL_9]] step %[[VAL_4]] iter_args(%[[VAL_13:.*]] = %[[VAL_10]]) -> (f32) { +// CHECK: %[[VAL_14:.*]] = load %[[VAL_6]]{{\[}}%[[VAL_12]]] : memref +// CHECK: %[[VAL_15:.*]] = addf %[[VAL_13]], %[[VAL_14]] : f32 +// CHECK: scf.yield %[[VAL_15]] : f32 // CHECK: } -// CHECK: store %[[VAL_17:.*]], %[[VAL_8]][] : memref -// CHECK: %[[VAL_18:.*]] = tensor_load %[[VAL_8]] : memref -// CHECK: return %[[VAL_18]] : tensor +// CHECK: store %[[VAL_16:.*]], %[[VAL_7]][] : memref +// CHECK: %[[VAL_17:.*]] = tensor_load %[[VAL_7]] : memref +// CHECK: return %[[VAL_17]] : tensor // CHECK: } func @sum_reduction(%arga: tensor, %argx: tensor) -> tensor { %0 = linalg.generic #trait_sum_reduction diff --git a/mlir/test/Dialect/Linalg/sparse_2d.mlir b/mlir/test/Dialect/Linalg/sparse_2d.mlir --- a/mlir/test/Dialect/Linalg/sparse_2d.mlir +++ b/mlir/test/Dialect/Linalg/sparse_2d.mlir @@ -17,31 +17,32 @@ } // CHECK-LABEL: func @add_dd( -// CHECK-SAME: %[[VAL_0:.*]]: tensor<32x16xf32>, -// CHECK-SAME: %[[VAL_1:.*]]: tensor<32x16xf32>) -> tensor<32x16xf32> { -// CHECK: %[[VAL_2:.*]] = constant 32 : index -// CHECK: %[[VAL_3:.*]] = constant 16 : index -// CHECK: %[[VAL_4:.*]] = constant 0 : index -// CHECK: %[[VAL_5:.*]] = constant 1 : index -// CHECK: %[[VAL_6:.*]] = alloca() : memref<32x16xf32> +// CHECK-SAME: %[[VAL_0:.*0]]: tensor<32x16xf32>, +// CHECK-SAME: %[[VAL_1:.*1]]: tensor<32x16xf32>, +// CHECK-SAME: %[[VAL_2:.*2]]: tensor<32x16xf32>) -> tensor<32x16xf32> { +// CHECK: %[[VAL_3:.*]] = constant 32 : index +// CHECK: %[[VAL_4:.*]] = constant 16 : index +// CHECK: %[[VAL_5:.*]] = constant 0 : index +// CHECK: %[[VAL_6:.*]] = constant 1 : index // CHECK: %[[VAL_7:.*]] = alloca() : memref<32x16xf32> // CHECK: %[[VAL_8:.*]] = alloca() : memref<32x16xf32> -// CHECK: scf.for %[[VAL_9:.*]] = %[[VAL_4]] to %[[VAL_2]] step %[[VAL_5]] { -// CHECK: scf.for %[[VAL_10:.*]] = %[[VAL_4]] to %[[VAL_3]] step %[[VAL_5]] { -// CHECK: %[[VAL_11:.*]] = load %[[VAL_6]]{{\[}}%[[VAL_9]], %[[VAL_10]]] : memref<32x16xf32> -// CHECK: %[[VAL_12:.*]] = load %[[VAL_7]]{{\[}}%[[VAL_9]], %[[VAL_10]]] : memref<32x16xf32> -// CHECK: %[[VAL_13:.*]] = addf %[[VAL_11]], %[[VAL_12]] : f32 -// CHECK: store %[[VAL_13]], %[[VAL_8]]{{\[}}%[[VAL_9]], %[[VAL_10]]] : memref<32x16xf32> +// CHECK: %[[VAL_9:.*]] = alloca() : memref<32x16xf32> +// CHECK: scf.for %[[VAL_10:.*]] = %[[VAL_5]] to %[[VAL_3]] step %[[VAL_6]] { +// CHECK: scf.for %[[VAL_11:.*]] = %[[VAL_5]] to %[[VAL_4]] step %[[VAL_6]] { +// CHECK: %[[VAL_12:.*]] = load %[[VAL_7]]{{\[}}%[[VAL_10]], %[[VAL_11]]] : memref<32x16xf32> +// CHECK: %[[VAL_13:.*]] = load %[[VAL_8]]{{\[}}%[[VAL_10]], %[[VAL_11]]] : memref<32x16xf32> +// CHECK: %[[VAL_14:.*]] = addf %[[VAL_12]], %[[VAL_13]] : f32 +// CHECK: store %[[VAL_14]], %[[VAL_9]]{{\[}}%[[VAL_10]], %[[VAL_11]]] : memref<32x16xf32> // CHECK: } // CHECK: } -// CHECK: %[[VAL_14:.*]] = tensor_load %[[VAL_8]] : memref<32x16xf32> -// CHECK: return %[[VAL_14]] : tensor<32x16xf32> +// CHECK: %[[VAL_15:.*]] = tensor_load %[[VAL_9]] : memref<32x16xf32> +// CHECK: return %[[VAL_15]] : tensor<32x16xf32> // CHECK: } -func @add_dd(%arga: tensor<32x16xf32>, %argb: tensor<32x16xf32>) -> tensor<32x16xf32> { +func @add_dd(%arga: tensor<32x16xf32>, %argb: tensor<32x16xf32>, %argx: tensor<32x16xf32>) -> tensor<32x16xf32> { %0 = linalg.generic #trait_dd ins(%arga, %argb: tensor<32x16xf32>, tensor<32x16xf32>) - outs(%arga: tensor<32x16xf32>) { - ^bb(%a: f32, %b: f32, %s: f32): + outs(%argx: tensor<32x16xf32>) { + ^bb(%a: f32, %b: f32, %x: f32): %0 = addf %a, %b : f32 linalg.yield %0 : f32 } -> tensor<32x16xf32> @@ -49,31 +50,32 @@ } // CHECK-LABEL: func @mul_dd( -// CHECK-SAME: %[[VAL_0:.*]]: tensor<32x16xf32>, -// CHECK-SAME: %[[VAL_1:.*]]: tensor<32x16xf32>) -> tensor<32x16xf32> { -// CHECK: %[[VAL_2:.*]] = constant 32 : index -// CHECK: %[[VAL_3:.*]] = constant 16 : index -// CHECK: %[[VAL_4:.*]] = constant 0 : index -// CHECK: %[[VAL_5:.*]] = constant 1 : index -// CHECK: %[[VAL_6:.*]] = alloca() : memref<32x16xf32> +// CHECK-SAME: %[[VAL_0:.*0]]: tensor<32x16xf32>, +// CHECK-SAME: %[[VAL_1:.*1]]: tensor<32x16xf32>, +// CHECK-SAME: %[[VAL_2:.*2]]: tensor<32x16xf32>) -> tensor<32x16xf32> { +// CHECK: %[[VAL_3:.*]] = constant 32 : index +// CHECK: %[[VAL_4:.*]] = constant 16 : index +// CHECK: %[[VAL_5:.*]] = constant 0 : index +// CHECK: %[[VAL_6:.*]] = constant 1 : index // CHECK: %[[VAL_7:.*]] = alloca() : memref<32x16xf32> // CHECK: %[[VAL_8:.*]] = alloca() : memref<32x16xf32> -// CHECK: scf.for %[[VAL_9:.*]] = %[[VAL_4]] to %[[VAL_2]] step %[[VAL_5]] { -// CHECK: scf.for %[[VAL_10:.*]] = %[[VAL_4]] to %[[VAL_3]] step %[[VAL_5]] { -// CHECK: %[[VAL_11:.*]] = load %[[VAL_6]]{{\[}}%[[VAL_9]], %[[VAL_10]]] : memref<32x16xf32> -// CHECK: %[[VAL_12:.*]] = load %[[VAL_7]]{{\[}}%[[VAL_9]], %[[VAL_10]]] : memref<32x16xf32> -// CHECK: %[[VAL_13:.*]] = mulf %[[VAL_11]], %[[VAL_12]] : f32 -// CHECK: store %[[VAL_13]], %[[VAL_8]]{{\[}}%[[VAL_9]], %[[VAL_10]]] : memref<32x16xf32> +// CHECK: %[[VAL_9:.*]] = alloca() : memref<32x16xf32> +// CHECK: scf.for %[[VAL_10:.*]] = %[[VAL_5]] to %[[VAL_3]] step %[[VAL_6]] { +// CHECK: scf.for %[[VAL_11:.*]] = %[[VAL_5]] to %[[VAL_4]] step %[[VAL_6]] { +// CHECK: %[[VAL_12:.*]] = load %[[VAL_7]]{{\[}}%[[VAL_10]], %[[VAL_11]]] : memref<32x16xf32> +// CHECK: %[[VAL_13:.*]] = load %[[VAL_8]]{{\[}}%[[VAL_10]], %[[VAL_11]]] : memref<32x16xf32> +// CHECK: %[[VAL_14:.*]] = mulf %[[VAL_12]], %[[VAL_13]] : f32 +// CHECK: store %[[VAL_14]], %[[VAL_9]]{{\[}}%[[VAL_10]], %[[VAL_11]]] : memref<32x16xf32> // CHECK: } // CHECK: } -// CHECK: %[[VAL_14:.*]] = tensor_load %[[VAL_8]] : memref<32x16xf32> -// CHECK: return %[[VAL_14]] : tensor<32x16xf32> +// CHECK: %[[VAL_15:.*]] = tensor_load %[[VAL_9]] : memref<32x16xf32> +// CHECK: return %[[VAL_15]] : tensor<32x16xf32> // CHECK: } -func @mul_dd(%arga: tensor<32x16xf32>, %argb: tensor<32x16xf32>) -> tensor<32x16xf32> { +func @mul_dd(%arga: tensor<32x16xf32>, %argb: tensor<32x16xf32>, %argx: tensor<32x16xf32>) -> tensor<32x16xf32> { %0 = linalg.generic #trait_dd ins(%arga, %argb: tensor<32x16xf32>, tensor<32x16xf32>) - outs(%arga : tensor<32x16xf32>) { - ^bb(%a: f32, %b: f32, %s: f32): + outs(%argx : tensor<32x16xf32>) { + ^bb(%a: f32, %b: f32, %x: f32): %0 = mulf %a, %b : f32 linalg.yield %0 : f32 } -> tensor<32x16xf32> @@ -96,61 +98,62 @@ } // CHECK-LABEL: func @add_ds( -// CHECK-SAME: %[[VAL_0:.*]]: tensor<32x16xf32>, -// CHECK-SAME: %[[VAL_1:.*]]: tensor<32x16xf32>) -> tensor<32x16xf32> { -// CHECK: %[[VAL_2:.*]] = constant 999 : index -// CHECK: %[[VAL_3:.*]] = constant 32 : index -// CHECK: %[[VAL_4:.*]] = constant 16 : index -// CHECK: %[[VAL_5:.*]] = constant 0 : index -// CHECK: %[[VAL_6:.*]] = constant true -// CHECK: %[[VAL_7:.*]] = constant 1 : index -// CHECK: %[[VAL_8:.*]] = alloca(%[[VAL_2]]) : memref -// CHECK: %[[VAL_9:.*]] = alloca(%[[VAL_2]]) : memref -// CHECK: %[[VAL_10:.*]] = alloca(%[[VAL_2]]) : memref -// CHECK: %[[VAL_11:.*]] = alloca() : memref<32x16xf32> +// CHECK-SAME: %[[VAL_0:.*0]]: tensor<32x16xf32>, +// CHECK-SAME: %[[VAL_1:.*1]]: tensor<32x16xf32>, +// CHECK-SAME: %[[VAL_2:.*2]]: tensor<32x16xf32>) -> tensor<32x16xf32> { +// CHECK: %[[VAL_3:.*]] = constant 999 : index +// CHECK: %[[VAL_4:.*]] = constant 32 : index +// CHECK: %[[VAL_5:.*]] = constant 16 : index +// CHECK: %[[VAL_6:.*]] = constant 0 : index +// CHECK: %[[VAL_7:.*]] = constant true +// CHECK: %[[VAL_8:.*]] = constant 1 : index +// CHECK: %[[VAL_9:.*]] = alloca(%[[VAL_3]]) : memref +// CHECK: %[[VAL_10:.*]] = alloca(%[[VAL_3]]) : memref +// CHECK: %[[VAL_11:.*]] = alloca(%[[VAL_3]]) : memref // CHECK: %[[VAL_12:.*]] = alloca() : memref<32x16xf32> -// CHECK: scf.for %[[VAL_13:.*]] = %[[VAL_5]] to %[[VAL_3]] step %[[VAL_7]] { -// CHECK: %[[VAL_14:.*]] = load %[[VAL_8]]{{\[}}%[[VAL_13]]] : memref -// CHECK: %[[VAL_15:.*]] = addi %[[VAL_13]], %[[VAL_7]] : index -// CHECK: %[[VAL_16:.*]] = load %[[VAL_8]]{{\[}}%[[VAL_15]]] : memref -// CHECK: %[[VAL_17:.*]]:2 = scf.while (%[[VAL_18:.*]] = %[[VAL_14]], %[[VAL_19:.*]] = %[[VAL_5]]) : (index, index) -> (index, index) { -// CHECK: %[[VAL_20:.*]] = cmpi ult, %[[VAL_18]], %[[VAL_16]] : index -// CHECK: scf.condition(%[[VAL_20]]) %[[VAL_18]], %[[VAL_19]] : index, index +// CHECK: %[[VAL_13:.*]] = alloca() : memref<32x16xf32> +// CHECK: scf.for %[[VAL_14:.*]] = %[[VAL_6]] to %[[VAL_4]] step %[[VAL_8]] { +// CHECK: %[[VAL_15:.*]] = load %[[VAL_9]]{{\[}}%[[VAL_14]]] : memref +// CHECK: %[[VAL_16:.*]] = addi %[[VAL_14]], %[[VAL_8]] : index +// CHECK: %[[VAL_17:.*]] = load %[[VAL_9]]{{\[}}%[[VAL_16]]] : memref +// CHECK: %[[VAL_18:.*]]:2 = scf.while (%[[VAL_19:.*]] = %[[VAL_15]], %[[VAL_20:.*]] = %[[VAL_6]]) : (index, index) -> (index, index) { +// CHECK: %[[VAL_21:.*]] = cmpi ult, %[[VAL_19]], %[[VAL_17]] : index +// CHECK: scf.condition(%[[VAL_21]]) %[[VAL_19]], %[[VAL_20]] : index, index // CHECK: } do { -// CHECK: ^bb0(%[[VAL_21:.*]]: index, %[[VAL_22:.*]]: index): -// CHECK: %[[VAL_23:.*]] = load %[[VAL_9]]{{\[}}%[[VAL_21]]] : memref -// CHECK: %[[VAL_24:.*]] = cmpi eq, %[[VAL_23]], %[[VAL_22]] : index -// CHECK: scf.if %[[VAL_24]] { -// CHECK: %[[VAL_25:.*]] = load %[[VAL_10]]{{\[}}%[[VAL_21]]] : memref -// CHECK: %[[VAL_26:.*]] = load %[[VAL_11]]{{\[}}%[[VAL_13]], %[[VAL_22]]] : memref<32x16xf32> -// CHECK: %[[VAL_27:.*]] = addf %[[VAL_25]], %[[VAL_26]] : f32 -// CHECK: store %[[VAL_27]], %[[VAL_12]]{{\[}}%[[VAL_13]], %[[VAL_22]]] : memref<32x16xf32> +// CHECK: ^bb0(%[[VAL_22:.*]]: index, %[[VAL_23:.*]]: index): +// CHECK: %[[VAL_24:.*]] = load %[[VAL_10]]{{\[}}%[[VAL_22]]] : memref +// CHECK: %[[VAL_25:.*]] = cmpi eq, %[[VAL_24]], %[[VAL_23]] : index +// CHECK: scf.if %[[VAL_25]] { +// CHECK: %[[VAL_26:.*]] = load %[[VAL_11]]{{\[}}%[[VAL_22]]] : memref +// CHECK: %[[VAL_27:.*]] = load %[[VAL_12]]{{\[}}%[[VAL_14]], %[[VAL_23]]] : memref<32x16xf32> +// CHECK: %[[VAL_28:.*]] = addf %[[VAL_26]], %[[VAL_27]] : f32 +// CHECK: store %[[VAL_28]], %[[VAL_13]]{{\[}}%[[VAL_14]], %[[VAL_23]]] : memref<32x16xf32> // CHECK: } else { -// CHECK: scf.if %[[VAL_6]] { -// CHECK: %[[VAL_28:.*]] = load %[[VAL_11]]{{\[}}%[[VAL_13]], %[[VAL_22]]] : memref<32x16xf32> -// CHECK: store %[[VAL_28]], %[[VAL_12]]{{\[}}%[[VAL_13]], %[[VAL_22]]] : memref<32x16xf32> +// CHECK: scf.if %[[VAL_7]] { +// CHECK: %[[VAL_29:.*]] = load %[[VAL_12]]{{\[}}%[[VAL_14]], %[[VAL_23]]] : memref<32x16xf32> +// CHECK: store %[[VAL_29]], %[[VAL_13]]{{\[}}%[[VAL_14]], %[[VAL_23]]] : memref<32x16xf32> // CHECK: } else { // CHECK: } // CHECK: } -// CHECK: %[[VAL_29:.*]] = cmpi eq, %[[VAL_23]], %[[VAL_22]] : index -// CHECK: %[[VAL_30:.*]] = addi %[[VAL_21]], %[[VAL_7]] : index -// CHECK: %[[VAL_31:.*]] = select %[[VAL_29]], %[[VAL_30]], %[[VAL_21]] : index -// CHECK: %[[VAL_32:.*]] = addi %[[VAL_22]], %[[VAL_7]] : index -// CHECK: scf.yield %[[VAL_31]], %[[VAL_32]] : index, index +// CHECK: %[[VAL_30:.*]] = cmpi eq, %[[VAL_24]], %[[VAL_23]] : index +// CHECK: %[[VAL_31:.*]] = addi %[[VAL_22]], %[[VAL_8]] : index +// CHECK: %[[VAL_32:.*]] = select %[[VAL_30]], %[[VAL_31]], %[[VAL_22]] : index +// CHECK: %[[VAL_33:.*]] = addi %[[VAL_23]], %[[VAL_8]] : index +// CHECK: scf.yield %[[VAL_32]], %[[VAL_33]] : index, index // CHECK: } -// CHECK: scf.for %[[VAL_33:.*]] = %[[VAL_34:.*]]#1 to %[[VAL_4]] step %[[VAL_7]] { -// CHECK: %[[VAL_35:.*]] = load %[[VAL_11]]{{\[}}%[[VAL_13]], %[[VAL_33]]] : memref<32x16xf32> -// CHECK: store %[[VAL_35]], %[[VAL_12]]{{\[}}%[[VAL_13]], %[[VAL_33]]] : memref<32x16xf32> +// CHECK: scf.for %[[VAL_34:.*]] = %[[VAL_35:.*]]#1 to %[[VAL_5]] step %[[VAL_8]] { +// CHECK: %[[VAL_36:.*]] = load %[[VAL_12]]{{\[}}%[[VAL_14]], %[[VAL_34]]] : memref<32x16xf32> +// CHECK: store %[[VAL_36]], %[[VAL_13]]{{\[}}%[[VAL_14]], %[[VAL_34]]] : memref<32x16xf32> // CHECK: } // CHECK: } -// CHECK: %[[VAL_36:.*]] = tensor_load %[[VAL_12]] : memref<32x16xf32> -// CHECK: return %[[VAL_36]] : tensor<32x16xf32> +// CHECK: %[[VAL_37:.*]] = tensor_load %[[VAL_13]] : memref<32x16xf32> +// CHECK: return %[[VAL_37]] : tensor<32x16xf32> // CHECK: } -func @add_ds(%arga: tensor<32x16xf32>, %argb: tensor<32x16xf32>) -> tensor<32x16xf32> { +func @add_ds(%arga: tensor<32x16xf32>, %argb: tensor<32x16xf32>, %argx: tensor<32x16xf32>) -> tensor<32x16xf32> { %0 = linalg.generic #trait_ds ins(%arga, %argb: tensor<32x16xf32>, tensor<32x16xf32>) - outs(%arga : tensor<32x16xf32>) { - ^bb(%a: f32, %b: f32, %s: f32): + outs(%argx : tensor<32x16xf32>) { + ^bb(%a: f32, %b: f32, %x: f32): %0 = addf %a, %b : f32 linalg.yield %0 : f32 } -> tensor<32x16xf32> @@ -158,37 +161,38 @@ } // CHECK-LABEL: func @mul_ds( -// CHECK-SAME: %[[VAL_0:.*]]: tensor<32x16xf32>, -// CHECK-SAME: %[[VAL_1:.*]]: tensor<32x16xf32>) -> tensor<32x16xf32> { -// CHECK: %[[VAL_2:.*]] = constant 999 : index -// CHECK: %[[VAL_3:.*]] = constant 32 : index -// CHECK: %[[VAL_4:.*]] = constant 0 : index -// CHECK: %[[VAL_5:.*]] = constant 1 : index -// CHECK: %[[VAL_6:.*]] = alloca(%[[VAL_2]]) : memref -// CHECK: %[[VAL_7:.*]] = alloca(%[[VAL_2]]) : memref -// CHECK: %[[VAL_8:.*]] = alloca(%[[VAL_2]]) : memref -// CHECK: %[[VAL_9:.*]] = alloca() : memref<32x16xf32> +// CHECK-SAME: %[[VAL_0:.*0]]: tensor<32x16xf32>, +// CHECK-SAME: %[[VAL_1:.*1]]: tensor<32x16xf32>, +// CHECK-SAME: %[[VAL_2:.*2]]: tensor<32x16xf32>) -> tensor<32x16xf32> { +// CHECK: %[[VAL_3:.*]] = constant 999 : index +// CHECK: %[[VAL_4:.*]] = constant 32 : index +// CHECK: %[[VAL_5:.*]] = constant 0 : index +// CHECK: %[[VAL_6:.*]] = constant 1 : index +// CHECK: %[[VAL_7:.*]] = alloca(%[[VAL_3]]) : memref +// CHECK: %[[VAL_8:.*]] = alloca(%[[VAL_3]]) : memref +// CHECK: %[[VAL_9:.*]] = alloca(%[[VAL_3]]) : memref // CHECK: %[[VAL_10:.*]] = alloca() : memref<32x16xf32> -// CHECK: scf.for %[[VAL_11:.*]] = %[[VAL_4]] to %[[VAL_3]] step %[[VAL_5]] { -// CHECK: %[[VAL_12:.*]] = load %[[VAL_6]]{{\[}}%[[VAL_11]]] : memref -// CHECK: %[[VAL_13:.*]] = addi %[[VAL_11]], %[[VAL_5]] : index -// CHECK: %[[VAL_14:.*]] = load %[[VAL_6]]{{\[}}%[[VAL_13]]] : memref -// CHECK: scf.for %[[VAL_15:.*]] = %[[VAL_12]] to %[[VAL_14]] step %[[VAL_5]] { -// CHECK: %[[VAL_16:.*]] = load %[[VAL_7]]{{\[}}%[[VAL_15]]] : memref -// CHECK: %[[VAL_17:.*]] = load %[[VAL_8]]{{\[}}%[[VAL_15]]] : memref -// CHECK: %[[VAL_18:.*]] = load %[[VAL_9]]{{\[}}%[[VAL_11]], %[[VAL_16]]] : memref<32x16xf32> -// CHECK: %[[VAL_19:.*]] = mulf %[[VAL_17]], %[[VAL_18]] : f32 -// CHECK: store %[[VAL_19]], %[[VAL_10]]{{\[}}%[[VAL_11]], %[[VAL_16]]] : memref<32x16xf32> +// CHECK: %[[VAL_11:.*]] = alloca() : memref<32x16xf32> +// CHECK: scf.for %[[VAL_12:.*]] = %[[VAL_5]] to %[[VAL_4]] step %[[VAL_6]] { +// CHECK: %[[VAL_13:.*]] = load %[[VAL_7]]{{\[}}%[[VAL_12]]] : memref +// CHECK: %[[VAL_14:.*]] = addi %[[VAL_12]], %[[VAL_6]] : index +// CHECK: %[[VAL_15:.*]] = load %[[VAL_7]]{{\[}}%[[VAL_14]]] : memref +// CHECK: scf.for %[[VAL_16:.*]] = %[[VAL_13]] to %[[VAL_15]] step %[[VAL_6]] { +// CHECK: %[[VAL_17:.*]] = load %[[VAL_8]]{{\[}}%[[VAL_16]]] : memref +// CHECK: %[[VAL_18:.*]] = load %[[VAL_9]]{{\[}}%[[VAL_16]]] : memref +// CHECK: %[[VAL_19:.*]] = load %[[VAL_10]]{{\[}}%[[VAL_12]], %[[VAL_17]]] : memref<32x16xf32> +// CHECK: %[[VAL_20:.*]] = mulf %[[VAL_18]], %[[VAL_19]] : f32 +// CHECK: store %[[VAL_20]], %[[VAL_11]]{{\[}}%[[VAL_12]], %[[VAL_17]]] : memref<32x16xf32> // CHECK: } // CHECK: } -// CHECK: %[[VAL_20:.*]] = tensor_load %[[VAL_10]] : memref<32x16xf32> -// CHECK: return %[[VAL_20]] : tensor<32x16xf32> +// CHECK: %[[VAL_21:.*]] = tensor_load %[[VAL_11]] : memref<32x16xf32> +// CHECK: return %[[VAL_21]] : tensor<32x16xf32> // CHECK: } -func @mul_ds(%arga: tensor<32x16xf32>, %argb: tensor<32x16xf32>) -> tensor<32x16xf32> { +func @mul_ds(%arga: tensor<32x16xf32>, %argb: tensor<32x16xf32>, %argx: tensor<32x16xf32>) -> tensor<32x16xf32> { %0 = linalg.generic #trait_ds ins(%arga, %argb: tensor<32x16xf32>, tensor<32x16xf32>) - outs(%arga : tensor<32x16xf32>) { - ^bb(%a: f32, %b: f32, %s: f32): + outs(%argx : tensor<32x16xf32>) { + ^bb(%a: f32, %b: f32, %x: f32): %0 = mulf %a, %b : f32 linalg.yield %0 : f32 } -> tensor<32x16xf32> @@ -211,66 +215,67 @@ } // CHECK-LABEL: func @add_sd( -// CHECK-SAME: %[[VAL_0:.*]]: tensor<32x16xf32>, -// CHECK-SAME: %[[VAL_1:.*]]: tensor<32x16xf32>) -> tensor<32x16xf32> { -// CHECK: %[[VAL_2:.*]] = constant 999 : index -// CHECK: %[[VAL_3:.*]] = constant 32 : index -// CHECK: %[[VAL_4:.*]] = constant 16 : index -// CHECK: %[[VAL_5:.*]] = constant true -// CHECK: %[[VAL_6:.*]] = constant 0 : index -// CHECK: %[[VAL_7:.*]] = constant 1 : index -// CHECK: %[[VAL_8:.*]] = alloca(%[[VAL_2]]) : memref -// CHECK: %[[VAL_9:.*]] = alloca(%[[VAL_2]]) : memref -// CHECK: %[[VAL_10:.*]] = alloca(%[[VAL_2]]) : memref -// CHECK: %[[VAL_11:.*]] = alloca() : memref<32x16xf32> +// CHECK-SAME: %[[VAL_0:.*0]]: tensor<32x16xf32>, +// CHECK-SAME: %[[VAL_1:.*1]]: tensor<32x16xf32>, +// CHECK-SAME: %[[VAL_2:.*2]]: tensor<32x16xf32>) -> tensor<32x16xf32> { +// CHECK: %[[VAL_3:.*]] = constant 999 : index +// CHECK: %[[VAL_4:.*]] = constant 32 : index +// CHECK: %[[VAL_5:.*]] = constant 16 : index +// CHECK: %[[VAL_6:.*]] = constant true +// CHECK: %[[VAL_7:.*]] = constant 0 : index +// CHECK: %[[VAL_8:.*]] = constant 1 : index +// CHECK: %[[VAL_9:.*]] = alloca(%[[VAL_3]]) : memref +// CHECK: %[[VAL_10:.*]] = alloca(%[[VAL_3]]) : memref +// CHECK: %[[VAL_11:.*]] = alloca(%[[VAL_3]]) : memref // CHECK: %[[VAL_12:.*]] = alloca() : memref<32x16xf32> -// CHECK: %[[VAL_13:.*]] = load %[[VAL_8]]{{\[}}%[[VAL_6]]] : memref -// CHECK: %[[VAL_14:.*]] = load %[[VAL_8]]{{\[}}%[[VAL_7]]] : memref -// CHECK: %[[VAL_15:.*]]:2 = scf.while (%[[VAL_16:.*]] = %[[VAL_13]], %[[VAL_17:.*]] = %[[VAL_6]]) : (index, index) -> (index, index) { -// CHECK: %[[VAL_18:.*]] = cmpi ult, %[[VAL_16]], %[[VAL_14]] : index -// CHECK: scf.condition(%[[VAL_18]]) %[[VAL_16]], %[[VAL_17]] : index, index +// CHECK: %[[VAL_13:.*]] = alloca() : memref<32x16xf32> +// CHECK: %[[VAL_14:.*]] = load %[[VAL_9]]{{\[}}%[[VAL_7]]] : memref +// CHECK: %[[VAL_15:.*]] = load %[[VAL_9]]{{\[}}%[[VAL_8]]] : memref +// CHECK: %[[VAL_16:.*]]:2 = scf.while (%[[VAL_17:.*]] = %[[VAL_14]], %[[VAL_18:.*]] = %[[VAL_7]]) : (index, index) -> (index, index) { +// CHECK: %[[VAL_19:.*]] = cmpi ult, %[[VAL_17]], %[[VAL_15]] : index +// CHECK: scf.condition(%[[VAL_19]]) %[[VAL_17]], %[[VAL_18]] : index, index // CHECK: } do { -// CHECK: ^bb0(%[[VAL_19:.*]]: index, %[[VAL_20:.*]]: index): -// CHECK: %[[VAL_21:.*]] = load %[[VAL_9]]{{\[}}%[[VAL_19]]] : memref -// CHECK: %[[VAL_22:.*]] = cmpi eq, %[[VAL_21]], %[[VAL_20]] : index -// CHECK: scf.if %[[VAL_22]] { -// CHECK: scf.for %[[VAL_23:.*]] = %[[VAL_6]] to %[[VAL_4]] step %[[VAL_7]] { -// CHECK: %[[VAL_24:.*]] = muli %[[VAL_19]], %[[VAL_4]] : index -// CHECK: %[[VAL_25:.*]] = addi %[[VAL_24]], %[[VAL_23]] : index -// CHECK: %[[VAL_26:.*]] = load %[[VAL_10]]{{\[}}%[[VAL_25]]] : memref -// CHECK: %[[VAL_27:.*]] = load %[[VAL_11]]{{\[}}%[[VAL_20]], %[[VAL_23]]] : memref<32x16xf32> -// CHECK: %[[VAL_28:.*]] = addf %[[VAL_26]], %[[VAL_27]] : f32 -// CHECK: store %[[VAL_28]], %[[VAL_12]]{{\[}}%[[VAL_20]], %[[VAL_23]]] : memref<32x16xf32> +// CHECK: ^bb0(%[[VAL_20:.*]]: index, %[[VAL_21:.*]]: index): +// CHECK: %[[VAL_22:.*]] = load %[[VAL_10]]{{\[}}%[[VAL_20]]] : memref +// CHECK: %[[VAL_23:.*]] = cmpi eq, %[[VAL_22]], %[[VAL_21]] : index +// CHECK: scf.if %[[VAL_23]] { +// CHECK: scf.for %[[VAL_24:.*]] = %[[VAL_7]] to %[[VAL_5]] step %[[VAL_8]] { +// CHECK: %[[VAL_25:.*]] = muli %[[VAL_20]], %[[VAL_5]] : index +// CHECK: %[[VAL_26:.*]] = addi %[[VAL_25]], %[[VAL_24]] : index +// CHECK: %[[VAL_27:.*]] = load %[[VAL_11]]{{\[}}%[[VAL_26]]] : memref +// CHECK: %[[VAL_28:.*]] = load %[[VAL_12]]{{\[}}%[[VAL_21]], %[[VAL_24]]] : memref<32x16xf32> +// CHECK: %[[VAL_29:.*]] = addf %[[VAL_27]], %[[VAL_28]] : f32 +// CHECK: store %[[VAL_29]], %[[VAL_13]]{{\[}}%[[VAL_21]], %[[VAL_24]]] : memref<32x16xf32> // CHECK: } // CHECK: } else { -// CHECK: scf.if %[[VAL_5]] { -// CHECK: scf.for %[[VAL_29:.*]] = %[[VAL_6]] to %[[VAL_4]] step %[[VAL_7]] { -// CHECK: %[[VAL_30:.*]] = load %[[VAL_11]]{{\[}}%[[VAL_20]], %[[VAL_29]]] : memref<32x16xf32> -// CHECK: store %[[VAL_30]], %[[VAL_12]]{{\[}}%[[VAL_20]], %[[VAL_29]]] : memref<32x16xf32> +// CHECK: scf.if %[[VAL_6]] { +// CHECK: scf.for %[[VAL_30:.*]] = %[[VAL_7]] to %[[VAL_5]] step %[[VAL_8]] { +// CHECK: %[[VAL_31:.*]] = load %[[VAL_12]]{{\[}}%[[VAL_21]], %[[VAL_30]]] : memref<32x16xf32> +// CHECK: store %[[VAL_31]], %[[VAL_13]]{{\[}}%[[VAL_21]], %[[VAL_30]]] : memref<32x16xf32> // CHECK: } // CHECK: } else { // CHECK: } // CHECK: } -// CHECK: %[[VAL_31:.*]] = cmpi eq, %[[VAL_21]], %[[VAL_20]] : index -// CHECK: %[[VAL_32:.*]] = addi %[[VAL_19]], %[[VAL_7]] : index -// CHECK: %[[VAL_33:.*]] = select %[[VAL_31]], %[[VAL_32]], %[[VAL_19]] : index -// CHECK: %[[VAL_34:.*]] = addi %[[VAL_20]], %[[VAL_7]] : index -// CHECK: scf.yield %[[VAL_33]], %[[VAL_34]] : index, index +// CHECK: %[[VAL_32:.*]] = cmpi eq, %[[VAL_22]], %[[VAL_21]] : index +// CHECK: %[[VAL_33:.*]] = addi %[[VAL_20]], %[[VAL_8]] : index +// CHECK: %[[VAL_34:.*]] = select %[[VAL_32]], %[[VAL_33]], %[[VAL_20]] : index +// CHECK: %[[VAL_35:.*]] = addi %[[VAL_21]], %[[VAL_8]] : index +// CHECK: scf.yield %[[VAL_34]], %[[VAL_35]] : index, index // CHECK: } -// CHECK: scf.for %[[VAL_35:.*]] = %[[VAL_36:.*]]#1 to %[[VAL_3]] step %[[VAL_7]] { -// CHECK: scf.for %[[VAL_37:.*]] = %[[VAL_6]] to %[[VAL_4]] step %[[VAL_7]] { -// CHECK: %[[VAL_38:.*]] = load %[[VAL_11]]{{\[}}%[[VAL_35]], %[[VAL_37]]] : memref<32x16xf32> -// CHECK: store %[[VAL_38]], %[[VAL_12]]{{\[}}%[[VAL_35]], %[[VAL_37]]] : memref<32x16xf32> +// CHECK: scf.for %[[VAL_36:.*]] = %[[VAL_37:.*]]#1 to %[[VAL_4]] step %[[VAL_8]] { +// CHECK: scf.for %[[VAL_38:.*]] = %[[VAL_7]] to %[[VAL_5]] step %[[VAL_8]] { +// CHECK: %[[VAL_39:.*]] = load %[[VAL_12]]{{\[}}%[[VAL_36]], %[[VAL_38]]] : memref<32x16xf32> +// CHECK: store %[[VAL_39]], %[[VAL_13]]{{\[}}%[[VAL_36]], %[[VAL_38]]] : memref<32x16xf32> // CHECK: } // CHECK: } -// CHECK: %[[VAL_39:.*]] = tensor_load %[[VAL_12]] : memref<32x16xf32> -// CHECK: return %[[VAL_39]] : tensor<32x16xf32> +// CHECK: %[[VAL_40:.*]] = tensor_load %[[VAL_13]] : memref<32x16xf32> +// CHECK: return %[[VAL_40]] : tensor<32x16xf32> // CHECK: } -func @add_sd(%arga: tensor<32x16xf32>, %argb: tensor<32x16xf32>) -> tensor<32x16xf32> { +func @add_sd(%arga: tensor<32x16xf32>, %argb: tensor<32x16xf32>, %argx: tensor<32x16xf32>) -> tensor<32x16xf32> { %0 = linalg.generic #trait_sd ins(%arga, %argb: tensor<32x16xf32>, tensor<32x16xf32>) - outs(%arga : tensor<32x16xf32>) { - ^bb(%a: f32, %b: f32, %s: f32): + outs(%argx : tensor<32x16xf32>) { + ^bb(%a: f32, %b: f32, %x: f32): %0 = addf %a, %b : f32 linalg.yield %0 : f32 } -> tensor<32x16xf32> @@ -278,38 +283,39 @@ } // CHECK-LABEL: func @mul_sd( -// CHECK-SAME: %[[VAL_0:.*]]: tensor<32x16xf32>, -// CHECK-SAME: %[[VAL_1:.*]]: tensor<32x16xf32>) -> tensor<32x16xf32> { -// CHECK: %[[VAL_2:.*]] = constant 999 : index -// CHECK: %[[VAL_3:.*]] = constant 16 : index -// CHECK: %[[VAL_4:.*]] = constant 0 : index -// CHECK: %[[VAL_5:.*]] = constant 1 : index -// CHECK: %[[VAL_6:.*]] = alloca(%[[VAL_2]]) : memref -// CHECK: %[[VAL_7:.*]] = alloca(%[[VAL_2]]) : memref -// CHECK: %[[VAL_8:.*]] = alloca(%[[VAL_2]]) : memref -// CHECK: %[[VAL_9:.*]] = alloca() : memref<32x16xf32> +// CHECK-SAME: %[[VAL_0:.*0]]: tensor<32x16xf32>, +// CHECK-SAME: %[[VAL_1:.*1]]: tensor<32x16xf32>, +// CHECK-SAME: %[[VAL_2:.*2]]: tensor<32x16xf32>) -> tensor<32x16xf32> { +// CHECK: %[[VAL_3:.*]] = constant 999 : index +// CHECK: %[[VAL_4:.*]] = constant 16 : index +// CHECK: %[[VAL_5:.*]] = constant 0 : index +// CHECK: %[[VAL_6:.*]] = constant 1 : index +// CHECK: %[[VAL_7:.*]] = alloca(%[[VAL_3]]) : memref +// CHECK: %[[VAL_8:.*]] = alloca(%[[VAL_3]]) : memref +// CHECK: %[[VAL_9:.*]] = alloca(%[[VAL_3]]) : memref // CHECK: %[[VAL_10:.*]] = alloca() : memref<32x16xf32> -// CHECK: %[[VAL_11:.*]] = load %[[VAL_6]]{{\[}}%[[VAL_4]]] : memref -// CHECK: %[[VAL_12:.*]] = load %[[VAL_6]]{{\[}}%[[VAL_5]]] : memref -// CHECK: scf.for %[[VAL_13:.*]] = %[[VAL_11]] to %[[VAL_12]] step %[[VAL_5]] { -// CHECK: %[[VAL_14:.*]] = load %[[VAL_7]]{{\[}}%[[VAL_13]]] : memref -// CHECK: scf.for %[[VAL_15:.*]] = %[[VAL_4]] to %[[VAL_3]] step %[[VAL_5]] { -// CHECK: %[[VAL_16:.*]] = muli %[[VAL_13]], %[[VAL_3]] : index -// CHECK: %[[VAL_17:.*]] = addi %[[VAL_16]], %[[VAL_15]] : index -// CHECK: %[[VAL_18:.*]] = load %[[VAL_8]]{{\[}}%[[VAL_17]]] : memref -// CHECK: %[[VAL_19:.*]] = load %[[VAL_9]]{{\[}}%[[VAL_14]], %[[VAL_15]]] : memref<32x16xf32> -// CHECK: %[[VAL_20:.*]] = mulf %[[VAL_18]], %[[VAL_19]] : f32 -// CHECK: store %[[VAL_20]], %[[VAL_10]]{{\[}}%[[VAL_14]], %[[VAL_15]]] : memref<32x16xf32> +// CHECK: %[[VAL_11:.*]] = alloca() : memref<32x16xf32> +// CHECK: %[[VAL_12:.*]] = load %[[VAL_7]]{{\[}}%[[VAL_5]]] : memref +// CHECK: %[[VAL_13:.*]] = load %[[VAL_7]]{{\[}}%[[VAL_6]]] : memref +// CHECK: scf.for %[[VAL_14:.*]] = %[[VAL_12]] to %[[VAL_13]] step %[[VAL_6]] { +// CHECK: %[[VAL_15:.*]] = load %[[VAL_8]]{{\[}}%[[VAL_14]]] : memref +// CHECK: scf.for %[[VAL_16:.*]] = %[[VAL_5]] to %[[VAL_4]] step %[[VAL_6]] { +// CHECK: %[[VAL_17:.*]] = muli %[[VAL_14]], %[[VAL_4]] : index +// CHECK: %[[VAL_18:.*]] = addi %[[VAL_17]], %[[VAL_16]] : index +// CHECK: %[[VAL_19:.*]] = load %[[VAL_9]]{{\[}}%[[VAL_18]]] : memref +// CHECK: %[[VAL_20:.*]] = load %[[VAL_10]]{{\[}}%[[VAL_15]], %[[VAL_16]]] : memref<32x16xf32> +// CHECK: %[[VAL_21:.*]] = mulf %[[VAL_19]], %[[VAL_20]] : f32 +// CHECK: store %[[VAL_21]], %[[VAL_11]]{{\[}}%[[VAL_15]], %[[VAL_16]]] : memref<32x16xf32> // CHECK: } // CHECK: } -// CHECK: %[[VAL_21:.*]] = tensor_load %[[VAL_10]] : memref<32x16xf32> -// CHECK: return %[[VAL_21]] : tensor<32x16xf32> +// CHECK: %[[VAL_22:.*]] = tensor_load %[[VAL_11]] : memref<32x16xf32> +// CHECK: return %[[VAL_22]] : tensor<32x16xf32> // CHECK: } -func @mul_sd(%arga: tensor<32x16xf32>, %argb: tensor<32x16xf32>) -> tensor<32x16xf32> { +func @mul_sd(%arga: tensor<32x16xf32>, %argb: tensor<32x16xf32>, %argx: tensor<32x16xf32>) -> tensor<32x16xf32> { %0 = linalg.generic #trait_sd ins(%arga, %argb: tensor<32x16xf32>, tensor<32x16xf32>) - outs(%arga : tensor<32x16xf32>) { - ^bb(%a: f32, %b: f32, %s: f32): + outs(%argx : tensor<32x16xf32>) { + ^bb(%a: f32, %b: f32, %x: f32): %0 = mulf %a, %b : f32 linalg.yield %0 : f32 } -> tensor<32x16xf32> @@ -332,92 +338,93 @@ } // CHECK-LABEL: func @add_ss( -// CHECK-SAME: %[[VAL_0:.*]]: tensor<32x16xf32>, -// CHECK-SAME: %[[VAL_1:.*]]: tensor<32x16xf32>) -> tensor<32x16xf32> { -// CHECK: %[[VAL_2:.*]] = constant 999 : index -// CHECK: %[[VAL_3:.*]] = constant 32 : index -// CHECK: %[[VAL_4:.*]] = constant 16 : index -// CHECK: %[[VAL_5:.*]] = constant true -// CHECK: %[[VAL_6:.*]] = constant 0 : index -// CHECK: %[[VAL_7:.*]] = constant 1 : index -// CHECK: %[[VAL_8:.*]] = alloca(%[[VAL_2]]) : memref -// CHECK: %[[VAL_9:.*]] = alloca(%[[VAL_2]]) : memref -// CHECK: %[[VAL_10:.*]] = alloca(%[[VAL_2]]) : memref -// CHECK: %[[VAL_11:.*]] = alloca(%[[VAL_2]]) : memref -// CHECK: %[[VAL_12:.*]] = alloca(%[[VAL_2]]) : memref -// CHECK: %[[VAL_13:.*]] = alloca() : memref<32x16xf32> +// CHECK-SAME: %[[VAL_0:.*0]]: tensor<32x16xf32>, +// CHECK-SAME: %[[VAL_1:.*1]]: tensor<32x16xf32>, +// CHECK-SAME: %[[VAL_2:.*2]]: tensor<32x16xf32>) -> tensor<32x16xf32> { +// CHECK: %[[VAL_3:.*]] = constant 999 : index +// CHECK: %[[VAL_4:.*]] = constant 32 : index +// CHECK: %[[VAL_5:.*]] = constant 16 : index +// CHECK: %[[VAL_6:.*]] = constant true +// CHECK: %[[VAL_7:.*]] = constant 0 : index +// CHECK: %[[VAL_8:.*]] = constant 1 : index +// CHECK: %[[VAL_9:.*]] = alloca(%[[VAL_3]]) : memref +// CHECK: %[[VAL_10:.*]] = alloca(%[[VAL_3]]) : memref +// CHECK: %[[VAL_11:.*]] = alloca(%[[VAL_3]]) : memref +// CHECK: %[[VAL_12:.*]] = alloca(%[[VAL_3]]) : memref +// CHECK: %[[VAL_13:.*]] = alloca(%[[VAL_3]]) : memref // CHECK: %[[VAL_14:.*]] = alloca() : memref<32x16xf32> -// CHECK: %[[VAL_15:.*]] = load %[[VAL_8]]{{\[}}%[[VAL_6]]] : memref -// CHECK: %[[VAL_16:.*]] = load %[[VAL_8]]{{\[}}%[[VAL_7]]] : memref -// CHECK: %[[VAL_17:.*]]:2 = scf.while (%[[VAL_18:.*]] = %[[VAL_15]], %[[VAL_19:.*]] = %[[VAL_6]]) : (index, index) -> (index, index) { -// CHECK: %[[VAL_20:.*]] = cmpi ult, %[[VAL_18]], %[[VAL_16]] : index -// CHECK: scf.condition(%[[VAL_20]]) %[[VAL_18]], %[[VAL_19]] : index, index +// CHECK: %[[VAL_15:.*]] = alloca() : memref<32x16xf32> +// CHECK: %[[VAL_16:.*]] = load %[[VAL_9]]{{\[}}%[[VAL_7]]] : memref +// CHECK: %[[VAL_17:.*]] = load %[[VAL_9]]{{\[}}%[[VAL_8]]] : memref +// CHECK: %[[VAL_18:.*]]:2 = scf.while (%[[VAL_19:.*]] = %[[VAL_16]], %[[VAL_20:.*]] = %[[VAL_7]]) : (index, index) -> (index, index) { +// CHECK: %[[VAL_21:.*]] = cmpi ult, %[[VAL_19]], %[[VAL_17]] : index +// CHECK: scf.condition(%[[VAL_21]]) %[[VAL_19]], %[[VAL_20]] : index, index // CHECK: } do { -// CHECK: ^bb0(%[[VAL_21:.*]]: index, %[[VAL_22:.*]]: index): -// CHECK: %[[VAL_23:.*]] = load %[[VAL_9]]{{\[}}%[[VAL_21]]] : memref -// CHECK: %[[VAL_24:.*]] = cmpi eq, %[[VAL_23]], %[[VAL_22]] : index -// CHECK: scf.if %[[VAL_24]] { -// CHECK: %[[VAL_25:.*]] = load %[[VAL_10]]{{\[}}%[[VAL_21]]] : memref -// CHECK: %[[VAL_26:.*]] = addi %[[VAL_21]], %[[VAL_7]] : index -// CHECK: %[[VAL_27:.*]] = load %[[VAL_10]]{{\[}}%[[VAL_26]]] : memref -// CHECK: %[[VAL_28:.*]]:2 = scf.while (%[[VAL_29:.*]] = %[[VAL_25]], %[[VAL_30:.*]] = %[[VAL_6]]) : (index, index) -> (index, index) { -// CHECK: %[[VAL_31:.*]] = cmpi ult, %[[VAL_29]], %[[VAL_27]] : index -// CHECK: scf.condition(%[[VAL_31]]) %[[VAL_29]], %[[VAL_30]] : index, index +// CHECK: ^bb0(%[[VAL_22:.*]]: index, %[[VAL_23:.*]]: index): +// CHECK: %[[VAL_24:.*]] = load %[[VAL_10]]{{\[}}%[[VAL_22]]] : memref +// CHECK: %[[VAL_25:.*]] = cmpi eq, %[[VAL_24]], %[[VAL_23]] : index +// CHECK: scf.if %[[VAL_25]] { +// CHECK: %[[VAL_26:.*]] = load %[[VAL_11]]{{\[}}%[[VAL_22]]] : memref +// CHECK: %[[VAL_27:.*]] = addi %[[VAL_22]], %[[VAL_8]] : index +// CHECK: %[[VAL_28:.*]] = load %[[VAL_11]]{{\[}}%[[VAL_27]]] : memref +// CHECK: %[[VAL_29:.*]]:2 = scf.while (%[[VAL_30:.*]] = %[[VAL_26]], %[[VAL_31:.*]] = %[[VAL_7]]) : (index, index) -> (index, index) { +// CHECK: %[[VAL_32:.*]] = cmpi ult, %[[VAL_30]], %[[VAL_28]] : index +// CHECK: scf.condition(%[[VAL_32]]) %[[VAL_30]], %[[VAL_31]] : index, index // CHECK: } do { -// CHECK: ^bb0(%[[VAL_32:.*]]: index, %[[VAL_33:.*]]: index): -// CHECK: %[[VAL_34:.*]] = load %[[VAL_11]]{{\[}}%[[VAL_32]]] : memref -// CHECK: %[[VAL_35:.*]] = cmpi eq, %[[VAL_34]], %[[VAL_33]] : index -// CHECK: scf.if %[[VAL_35]] { -// CHECK: %[[VAL_36:.*]] = load %[[VAL_12]]{{\[}}%[[VAL_32]]] : memref -// CHECK: %[[VAL_37:.*]] = load %[[VAL_13]]{{\[}}%[[VAL_22]], %[[VAL_33]]] : memref<32x16xf32> -// CHECK: %[[VAL_38:.*]] = addf %[[VAL_36]], %[[VAL_37]] : f32 -// CHECK: store %[[VAL_38]], %[[VAL_14]]{{\[}}%[[VAL_22]], %[[VAL_33]]] : memref<32x16xf32> +// CHECK: ^bb0(%[[VAL_33:.*]]: index, %[[VAL_34:.*]]: index): +// CHECK: %[[VAL_35:.*]] = load %[[VAL_12]]{{\[}}%[[VAL_33]]] : memref +// CHECK: %[[VAL_36:.*]] = cmpi eq, %[[VAL_35]], %[[VAL_34]] : index +// CHECK: scf.if %[[VAL_36]] { +// CHECK: %[[VAL_37:.*]] = load %[[VAL_13]]{{\[}}%[[VAL_33]]] : memref +// CHECK: %[[VAL_38:.*]] = load %[[VAL_14]]{{\[}}%[[VAL_23]], %[[VAL_34]]] : memref<32x16xf32> +// CHECK: %[[VAL_39:.*]] = addf %[[VAL_37]], %[[VAL_38]] : f32 +// CHECK: store %[[VAL_39]], %[[VAL_15]]{{\[}}%[[VAL_23]], %[[VAL_34]]] : memref<32x16xf32> // CHECK: } else { -// CHECK: scf.if %[[VAL_5]] { -// CHECK: %[[VAL_39:.*]] = load %[[VAL_13]]{{\[}}%[[VAL_22]], %[[VAL_33]]] : memref<32x16xf32> -// CHECK: store %[[VAL_39]], %[[VAL_14]]{{\[}}%[[VAL_22]], %[[VAL_33]]] : memref<32x16xf32> +// CHECK: scf.if %[[VAL_6]] { +// CHECK: %[[VAL_40:.*]] = load %[[VAL_14]]{{\[}}%[[VAL_23]], %[[VAL_34]]] : memref<32x16xf32> +// CHECK: store %[[VAL_40]], %[[VAL_15]]{{\[}}%[[VAL_23]], %[[VAL_34]]] : memref<32x16xf32> // CHECK: } else { // CHECK: } // CHECK: } -// CHECK: %[[VAL_40:.*]] = cmpi eq, %[[VAL_34]], %[[VAL_33]] : index -// CHECK: %[[VAL_41:.*]] = addi %[[VAL_32]], %[[VAL_7]] : index -// CHECK: %[[VAL_42:.*]] = select %[[VAL_40]], %[[VAL_41]], %[[VAL_32]] : index -// CHECK: %[[VAL_43:.*]] = addi %[[VAL_33]], %[[VAL_7]] : index -// CHECK: scf.yield %[[VAL_42]], %[[VAL_43]] : index, index +// CHECK: %[[VAL_41:.*]] = cmpi eq, %[[VAL_35]], %[[VAL_34]] : index +// CHECK: %[[VAL_42:.*]] = addi %[[VAL_33]], %[[VAL_8]] : index +// CHECK: %[[VAL_43:.*]] = select %[[VAL_41]], %[[VAL_42]], %[[VAL_33]] : index +// CHECK: %[[VAL_44:.*]] = addi %[[VAL_34]], %[[VAL_8]] : index +// CHECK: scf.yield %[[VAL_43]], %[[VAL_44]] : index, index // CHECK: } -// CHECK: scf.for %[[VAL_44:.*]] = %[[VAL_45:.*]]#1 to %[[VAL_4]] step %[[VAL_7]] { -// CHECK: %[[VAL_46:.*]] = load %[[VAL_13]]{{\[}}%[[VAL_22]], %[[VAL_44]]] : memref<32x16xf32> -// CHECK: store %[[VAL_46]], %[[VAL_14]]{{\[}}%[[VAL_22]], %[[VAL_44]]] : memref<32x16xf32> +// CHECK: scf.for %[[VAL_45:.*]] = %[[VAL_46:.*]]#1 to %[[VAL_5]] step %[[VAL_8]] { +// CHECK: %[[VAL_47:.*]] = load %[[VAL_14]]{{\[}}%[[VAL_23]], %[[VAL_45]]] : memref<32x16xf32> +// CHECK: store %[[VAL_47]], %[[VAL_15]]{{\[}}%[[VAL_23]], %[[VAL_45]]] : memref<32x16xf32> // CHECK: } // CHECK: } else { -// CHECK: scf.if %[[VAL_5]] { -// CHECK: scf.for %[[VAL_47:.*]] = %[[VAL_6]] to %[[VAL_4]] step %[[VAL_7]] { -// CHECK: %[[VAL_48:.*]] = load %[[VAL_13]]{{\[}}%[[VAL_22]], %[[VAL_47]]] : memref<32x16xf32> -// CHECK: store %[[VAL_48]], %[[VAL_14]]{{\[}}%[[VAL_22]], %[[VAL_47]]] : memref<32x16xf32> +// CHECK: scf.if %[[VAL_6]] { +// CHECK: scf.for %[[VAL_48:.*]] = %[[VAL_7]] to %[[VAL_5]] step %[[VAL_8]] { +// CHECK: %[[VAL_49:.*]] = load %[[VAL_14]]{{\[}}%[[VAL_23]], %[[VAL_48]]] : memref<32x16xf32> +// CHECK: store %[[VAL_49]], %[[VAL_15]]{{\[}}%[[VAL_23]], %[[VAL_48]]] : memref<32x16xf32> // CHECK: } // CHECK: } else { // CHECK: } // CHECK: } -// CHECK: %[[VAL_49:.*]] = cmpi eq, %[[VAL_23]], %[[VAL_22]] : index -// CHECK: %[[VAL_50:.*]] = addi %[[VAL_21]], %[[VAL_7]] : index -// CHECK: %[[VAL_51:.*]] = select %[[VAL_49]], %[[VAL_50]], %[[VAL_21]] : index -// CHECK: %[[VAL_52:.*]] = addi %[[VAL_22]], %[[VAL_7]] : index -// CHECK: scf.yield %[[VAL_51]], %[[VAL_52]] : index, index +// CHECK: %[[VAL_50:.*]] = cmpi eq, %[[VAL_24]], %[[VAL_23]] : index +// CHECK: %[[VAL_51:.*]] = addi %[[VAL_22]], %[[VAL_8]] : index +// CHECK: %[[VAL_52:.*]] = select %[[VAL_50]], %[[VAL_51]], %[[VAL_22]] : index +// CHECK: %[[VAL_53:.*]] = addi %[[VAL_23]], %[[VAL_8]] : index +// CHECK: scf.yield %[[VAL_52]], %[[VAL_53]] : index, index // CHECK: } -// CHECK: scf.for %[[VAL_53:.*]] = %[[VAL_54:.*]]#1 to %[[VAL_3]] step %[[VAL_7]] { -// CHECK: scf.for %[[VAL_55:.*]] = %[[VAL_6]] to %[[VAL_4]] step %[[VAL_7]] { -// CHECK: %[[VAL_56:.*]] = load %[[VAL_13]]{{\[}}%[[VAL_53]], %[[VAL_55]]] : memref<32x16xf32> -// CHECK: store %[[VAL_56]], %[[VAL_14]]{{\[}}%[[VAL_53]], %[[VAL_55]]] : memref<32x16xf32> +// CHECK: scf.for %[[VAL_54:.*]] = %[[VAL_55:.*]]#1 to %[[VAL_4]] step %[[VAL_8]] { +// CHECK: scf.for %[[VAL_56:.*]] = %[[VAL_7]] to %[[VAL_5]] step %[[VAL_8]] { +// CHECK: %[[VAL_57:.*]] = load %[[VAL_14]]{{\[}}%[[VAL_54]], %[[VAL_56]]] : memref<32x16xf32> +// CHECK: store %[[VAL_57]], %[[VAL_15]]{{\[}}%[[VAL_54]], %[[VAL_56]]] : memref<32x16xf32> // CHECK: } // CHECK: } -// CHECK: %[[VAL_57:.*]] = tensor_load %[[VAL_14]] : memref<32x16xf32> -// CHECK: return %[[VAL_57]] : tensor<32x16xf32> +// CHECK: %[[VAL_58:.*]] = tensor_load %[[VAL_15]] : memref<32x16xf32> +// CHECK: return %[[VAL_58]] : tensor<32x16xf32> // CHECK: } -func @add_ss(%arga: tensor<32x16xf32>, %argb: tensor<32x16xf32>) -> tensor<32x16xf32> { +func @add_ss(%arga: tensor<32x16xf32>, %argb: tensor<32x16xf32>, %argx: tensor<32x16xf32>) -> tensor<32x16xf32> { %0 = linalg.generic #trait_ss ins(%arga, %argb: tensor<32x16xf32>, tensor<32x16xf32>) - outs(%arga : tensor<32x16xf32>) { - ^bb(%a: f32, %b: f32, %s: f32): + outs(%argx : tensor<32x16xf32>) { + ^bb(%a: f32, %b: f32, %x: f32): %0 = addf %a, %b : f32 linalg.yield %0 : f32 } -> tensor<32x16xf32> @@ -425,41 +432,42 @@ } // CHECK-LABEL: func @mul_ss( -// CHECK-SAME: %[[VAL_0:.*]]: tensor<32x16xf32>, -// CHECK-SAME: %[[VAL_1:.*]]: tensor<32x16xf32>) -> tensor<32x16xf32> { -// CHECK: %[[VAL_2:.*]] = constant 999 : index -// CHECK: %[[VAL_3:.*]] = constant 0 : index -// CHECK: %[[VAL_4:.*]] = constant 1 : index -// CHECK: %[[VAL_5:.*]] = alloca(%[[VAL_2]]) : memref -// CHECK: %[[VAL_6:.*]] = alloca(%[[VAL_2]]) : memref -// CHECK: %[[VAL_7:.*]] = alloca(%[[VAL_2]]) : memref -// CHECK: %[[VAL_8:.*]] = alloca(%[[VAL_2]]) : memref -// CHECK: %[[VAL_9:.*]] = alloca(%[[VAL_2]]) : memref -// CHECK: %[[VAL_10:.*]] = alloca() : memref<32x16xf32> +// CHECK-SAME: %[[VAL_0:.*0]]: tensor<32x16xf32>, +// CHECK-SAME: %[[VAL_1:.*1]]: tensor<32x16xf32>, +// CHECK-SAME: %[[VAL_2:.*2]]: tensor<32x16xf32>) -> tensor<32x16xf32> { +// CHECK: %[[VAL_3:.*]] = constant 999 : index +// CHECK: %[[VAL_4:.*]] = constant 0 : index +// CHECK: %[[VAL_5:.*]] = constant 1 : index +// CHECK: %[[VAL_6:.*]] = alloca(%[[VAL_3]]) : memref +// CHECK: %[[VAL_7:.*]] = alloca(%[[VAL_3]]) : memref +// CHECK: %[[VAL_8:.*]] = alloca(%[[VAL_3]]) : memref +// CHECK: %[[VAL_9:.*]] = alloca(%[[VAL_3]]) : memref +// CHECK: %[[VAL_10:.*]] = alloca(%[[VAL_3]]) : memref // CHECK: %[[VAL_11:.*]] = alloca() : memref<32x16xf32> -// CHECK: %[[VAL_12:.*]] = load %[[VAL_5]]{{\[}}%[[VAL_3]]] : memref -// CHECK: %[[VAL_13:.*]] = load %[[VAL_5]]{{\[}}%[[VAL_4]]] : memref -// CHECK: scf.for %[[VAL_14:.*]] = %[[VAL_12]] to %[[VAL_13]] step %[[VAL_4]] { -// CHECK: %[[VAL_15:.*]] = load %[[VAL_6]]{{\[}}%[[VAL_14]]] : memref -// CHECK: %[[VAL_16:.*]] = load %[[VAL_7]]{{\[}}%[[VAL_14]]] : memref -// CHECK: %[[VAL_17:.*]] = addi %[[VAL_14]], %[[VAL_4]] : index -// CHECK: %[[VAL_18:.*]] = load %[[VAL_7]]{{\[}}%[[VAL_17]]] : memref -// CHECK: scf.for %[[VAL_19:.*]] = %[[VAL_16]] to %[[VAL_18]] step %[[VAL_4]] { -// CHECK: %[[VAL_20:.*]] = load %[[VAL_8]]{{\[}}%[[VAL_19]]] : memref -// CHECK: %[[VAL_21:.*]] = load %[[VAL_9]]{{\[}}%[[VAL_19]]] : memref -// CHECK: %[[VAL_22:.*]] = load %[[VAL_10]]{{\[}}%[[VAL_15]], %[[VAL_20]]] : memref<32x16xf32> -// CHECK: %[[VAL_23:.*]] = mulf %[[VAL_21]], %[[VAL_22]] : f32 -// CHECK: store %[[VAL_23]], %[[VAL_11]]{{\[}}%[[VAL_15]], %[[VAL_20]]] : memref<32x16xf32> +// CHECK: %[[VAL_12:.*]] = alloca() : memref<32x16xf32> +// CHECK: %[[VAL_13:.*]] = load %[[VAL_6]]{{\[}}%[[VAL_4]]] : memref +// CHECK: %[[VAL_14:.*]] = load %[[VAL_6]]{{\[}}%[[VAL_5]]] : memref +// CHECK: scf.for %[[VAL_15:.*]] = %[[VAL_13]] to %[[VAL_14]] step %[[VAL_5]] { +// CHECK: %[[VAL_16:.*]] = load %[[VAL_7]]{{\[}}%[[VAL_15]]] : memref +// CHECK: %[[VAL_17:.*]] = load %[[VAL_8]]{{\[}}%[[VAL_15]]] : memref +// CHECK: %[[VAL_18:.*]] = addi %[[VAL_15]], %[[VAL_5]] : index +// CHECK: %[[VAL_19:.*]] = load %[[VAL_8]]{{\[}}%[[VAL_18]]] : memref +// CHECK: scf.for %[[VAL_20:.*]] = %[[VAL_17]] to %[[VAL_19]] step %[[VAL_5]] { +// CHECK: %[[VAL_21:.*]] = load %[[VAL_9]]{{\[}}%[[VAL_20]]] : memref +// CHECK: %[[VAL_22:.*]] = load %[[VAL_10]]{{\[}}%[[VAL_20]]] : memref +// CHECK: %[[VAL_23:.*]] = load %[[VAL_11]]{{\[}}%[[VAL_16]], %[[VAL_21]]] : memref<32x16xf32> +// CHECK: %[[VAL_24:.*]] = mulf %[[VAL_22]], %[[VAL_23]] : f32 +// CHECK: store %[[VAL_24]], %[[VAL_12]]{{\[}}%[[VAL_16]], %[[VAL_21]]] : memref<32x16xf32> // CHECK: } // CHECK: } -// CHECK: %[[VAL_24:.*]] = tensor_load %[[VAL_11]] : memref<32x16xf32> -// CHECK: return %[[VAL_24]] : tensor<32x16xf32> +// CHECK: %[[VAL_25:.*]] = tensor_load %[[VAL_12]] : memref<32x16xf32> +// CHECK: return %[[VAL_25]] : tensor<32x16xf32> // CHECK: } -func @mul_ss(%arga: tensor<32x16xf32>, %argb: tensor<32x16xf32>) -> tensor<32x16xf32> { +func @mul_ss(%arga: tensor<32x16xf32>, %argb: tensor<32x16xf32>, %argx: tensor<32x16xf32>) -> tensor<32x16xf32> { %0 = linalg.generic #trait_ss ins(%arga, %argb: tensor<32x16xf32>, tensor<32x16xf32>) - outs(%arga : tensor<32x16xf32>) { - ^bb(%a: f32, %b: f32, %s: f32): + outs(%argx : tensor<32x16xf32>) { + ^bb(%a: f32, %b: f32, %x: f32): %0 = mulf %a, %b : f32 linalg.yield %0 : f32 } -> tensor<32x16xf32> @@ -482,162 +490,163 @@ } // CHECK-LABEL: func @add_ss_ss( -// CHECK-SAME: %[[VAL_0:.*]]: tensor<32x16xf32>, -// CHECK-SAME: %[[VAL_1:.*]]: tensor<32x16xf32>) -> tensor<32x16xf32> { -// CHECK: %[[VAL_2:.*]] = constant 999 : index -// CHECK: %[[VAL_3:.*]] = constant 0 : index -// CHECK: %[[VAL_4:.*]] = constant 1 : index -// CHECK: %[[VAL_5:.*]] = alloca(%[[VAL_2]]) : memref -// CHECK: %[[VAL_6:.*]] = alloca(%[[VAL_2]]) : memref -// CHECK: %[[VAL_7:.*]] = alloca(%[[VAL_2]]) : memref -// CHECK: %[[VAL_8:.*]] = alloca(%[[VAL_2]]) : memref -// CHECK: %[[VAL_9:.*]] = alloca(%[[VAL_2]]) : memref -// CHECK: %[[VAL_10:.*]] = alloca(%[[VAL_2]]) : memref -// CHECK: %[[VAL_11:.*]] = alloca(%[[VAL_2]]) : memref -// CHECK: %[[VAL_12:.*]] = alloca(%[[VAL_2]]) : memref -// CHECK: %[[VAL_13:.*]] = alloca(%[[VAL_2]]) : memref -// CHECK: %[[VAL_14:.*]] = alloca(%[[VAL_2]]) : memref -// CHECK: %[[VAL_15:.*]] = alloca() : memref<32x16xf32> -// CHECK: %[[VAL_16:.*]] = load %[[VAL_5]]{{\[}}%[[VAL_3]]] : memref -// CHECK: %[[VAL_17:.*]] = load %[[VAL_5]]{{\[}}%[[VAL_4]]] : memref -// CHECK: %[[VAL_18:.*]] = load %[[VAL_10]]{{\[}}%[[VAL_3]]] : memref -// CHECK: %[[VAL_19:.*]] = load %[[VAL_10]]{{\[}}%[[VAL_4]]] : memref -// CHECK: %[[VAL_20:.*]]:2 = scf.while (%[[VAL_21:.*]] = %[[VAL_16]], %[[VAL_22:.*]] = %[[VAL_18]]) : (index, index) -> (index, index) { -// CHECK: %[[VAL_23:.*]] = cmpi ult, %[[VAL_21]], %[[VAL_17]] : index -// CHECK: %[[VAL_24:.*]] = cmpi ult, %[[VAL_22]], %[[VAL_19]] : index -// CHECK: %[[VAL_25:.*]] = and %[[VAL_23]], %[[VAL_24]] : i1 -// CHECK: scf.condition(%[[VAL_25]]) %[[VAL_21]], %[[VAL_22]] : index, index +// CHECK-SAME: %[[VAL_0:.*0]]: tensor<32x16xf32>, +// CHECK-SAME: %[[VAL_1:.*1]]: tensor<32x16xf32>, +// CHECK-SAME: %[[VAL_2:.*2]]: tensor<32x16xf32>) -> tensor<32x16xf32> { +// CHECK: %[[VAL_3:.*]] = constant 999 : index +// CHECK: %[[VAL_4:.*]] = constant 0 : index +// CHECK: %[[VAL_5:.*]] = constant 1 : index +// CHECK: %[[VAL_6:.*]] = alloca(%[[VAL_3]]) : memref +// CHECK: %[[VAL_7:.*]] = alloca(%[[VAL_3]]) : memref +// CHECK: %[[VAL_8:.*]] = alloca(%[[VAL_3]]) : memref +// CHECK: %[[VAL_9:.*]] = alloca(%[[VAL_3]]) : memref +// CHECK: %[[VAL_10:.*]] = alloca(%[[VAL_3]]) : memref +// CHECK: %[[VAL_11:.*]] = alloca(%[[VAL_3]]) : memref +// CHECK: %[[VAL_12:.*]] = alloca(%[[VAL_3]]) : memref +// CHECK: %[[VAL_13:.*]] = alloca(%[[VAL_3]]) : memref +// CHECK: %[[VAL_14:.*]] = alloca(%[[VAL_3]]) : memref +// CHECK: %[[VAL_15:.*]] = alloca(%[[VAL_3]]) : memref +// CHECK: %[[VAL_16:.*]] = alloca() : memref<32x16xf32> +// CHECK: %[[VAL_17:.*]] = load %[[VAL_6]]{{\[}}%[[VAL_4]]] : memref +// CHECK: %[[VAL_18:.*]] = load %[[VAL_6]]{{\[}}%[[VAL_5]]] : memref +// CHECK: %[[VAL_19:.*]] = load %[[VAL_11]]{{\[}}%[[VAL_4]]] : memref +// CHECK: %[[VAL_20:.*]] = load %[[VAL_11]]{{\[}}%[[VAL_5]]] : memref +// CHECK: %[[VAL_21:.*]]:2 = scf.while (%[[VAL_22:.*]] = %[[VAL_17]], %[[VAL_23:.*]] = %[[VAL_19]]) : (index, index) -> (index, index) { +// CHECK: %[[VAL_24:.*]] = cmpi ult, %[[VAL_22]], %[[VAL_18]] : index +// CHECK: %[[VAL_25:.*]] = cmpi ult, %[[VAL_23]], %[[VAL_20]] : index +// CHECK: %[[VAL_26:.*]] = and %[[VAL_24]], %[[VAL_25]] : i1 +// CHECK: scf.condition(%[[VAL_26]]) %[[VAL_22]], %[[VAL_23]] : index, index // CHECK: } do { -// CHECK: ^bb0(%[[VAL_26:.*]]: index, %[[VAL_27:.*]]: index): -// CHECK: %[[VAL_28:.*]] = load %[[VAL_6]]{{\[}}%[[VAL_26]]] : memref -// CHECK: %[[VAL_29:.*]] = load %[[VAL_11]]{{\[}}%[[VAL_27]]] : memref -// CHECK: %[[VAL_30:.*]] = cmpi ult, %[[VAL_29]], %[[VAL_28]] : index -// CHECK: %[[VAL_31:.*]] = select %[[VAL_30]], %[[VAL_29]], %[[VAL_28]] : index -// CHECK: %[[VAL_32:.*]] = cmpi eq, %[[VAL_28]], %[[VAL_31]] : index -// CHECK: %[[VAL_33:.*]] = cmpi eq, %[[VAL_29]], %[[VAL_31]] : index -// CHECK: %[[VAL_34:.*]] = and %[[VAL_32]], %[[VAL_33]] : i1 -// CHECK: scf.if %[[VAL_34]] { -// CHECK: %[[VAL_35:.*]] = load %[[VAL_7]]{{\[}}%[[VAL_26]]] : memref -// CHECK: %[[VAL_36:.*]] = addi %[[VAL_26]], %[[VAL_4]] : index -// CHECK: %[[VAL_37:.*]] = load %[[VAL_7]]{{\[}}%[[VAL_36]]] : memref -// CHECK: %[[VAL_38:.*]] = load %[[VAL_12]]{{\[}}%[[VAL_27]]] : memref -// CHECK: %[[VAL_39:.*]] = addi %[[VAL_27]], %[[VAL_4]] : index -// CHECK: %[[VAL_40:.*]] = load %[[VAL_12]]{{\[}}%[[VAL_39]]] : memref -// CHECK: %[[VAL_41:.*]]:2 = scf.while (%[[VAL_42:.*]] = %[[VAL_35]], %[[VAL_43:.*]] = %[[VAL_38]]) : (index, index) -> (index, index) { -// CHECK: %[[VAL_44:.*]] = cmpi ult, %[[VAL_42]], %[[VAL_37]] : index -// CHECK: %[[VAL_45:.*]] = cmpi ult, %[[VAL_43]], %[[VAL_40]] : index -// CHECK: %[[VAL_46:.*]] = and %[[VAL_44]], %[[VAL_45]] : i1 -// CHECK: scf.condition(%[[VAL_46]]) %[[VAL_42]], %[[VAL_43]] : index, index +// CHECK: ^bb0(%[[VAL_27:.*]]: index, %[[VAL_28:.*]]: index): +// CHECK: %[[VAL_29:.*]] = load %[[VAL_7]]{{\[}}%[[VAL_27]]] : memref +// CHECK: %[[VAL_30:.*]] = load %[[VAL_12]]{{\[}}%[[VAL_28]]] : memref +// CHECK: %[[VAL_31:.*]] = cmpi ult, %[[VAL_30]], %[[VAL_29]] : index +// CHECK: %[[VAL_32:.*]] = select %[[VAL_31]], %[[VAL_30]], %[[VAL_29]] : index +// CHECK: %[[VAL_33:.*]] = cmpi eq, %[[VAL_29]], %[[VAL_32]] : index +// CHECK: %[[VAL_34:.*]] = cmpi eq, %[[VAL_30]], %[[VAL_32]] : index +// CHECK: %[[VAL_35:.*]] = and %[[VAL_33]], %[[VAL_34]] : i1 +// CHECK: scf.if %[[VAL_35]] { +// CHECK: %[[VAL_36:.*]] = load %[[VAL_8]]{{\[}}%[[VAL_27]]] : memref +// CHECK: %[[VAL_37:.*]] = addi %[[VAL_27]], %[[VAL_5]] : index +// CHECK: %[[VAL_38:.*]] = load %[[VAL_8]]{{\[}}%[[VAL_37]]] : memref +// CHECK: %[[VAL_39:.*]] = load %[[VAL_13]]{{\[}}%[[VAL_28]]] : memref +// CHECK: %[[VAL_40:.*]] = addi %[[VAL_28]], %[[VAL_5]] : index +// CHECK: %[[VAL_41:.*]] = load %[[VAL_13]]{{\[}}%[[VAL_40]]] : memref +// CHECK: %[[VAL_42:.*]]:2 = scf.while (%[[VAL_43:.*]] = %[[VAL_36]], %[[VAL_44:.*]] = %[[VAL_39]]) : (index, index) -> (index, index) { +// CHECK: %[[VAL_45:.*]] = cmpi ult, %[[VAL_43]], %[[VAL_38]] : index +// CHECK: %[[VAL_46:.*]] = cmpi ult, %[[VAL_44]], %[[VAL_41]] : index +// CHECK: %[[VAL_47:.*]] = and %[[VAL_45]], %[[VAL_46]] : i1 +// CHECK: scf.condition(%[[VAL_47]]) %[[VAL_43]], %[[VAL_44]] : index, index // CHECK: } do { -// CHECK: ^bb0(%[[VAL_47:.*]]: index, %[[VAL_48:.*]]: index): -// CHECK: %[[VAL_49:.*]] = load %[[VAL_8]]{{\[}}%[[VAL_47]]] : memref -// CHECK: %[[VAL_50:.*]] = load %[[VAL_13]]{{\[}}%[[VAL_48]]] : memref -// CHECK: %[[VAL_51:.*]] = cmpi ult, %[[VAL_50]], %[[VAL_49]] : index -// CHECK: %[[VAL_52:.*]] = select %[[VAL_51]], %[[VAL_50]], %[[VAL_49]] : index -// CHECK: %[[VAL_53:.*]] = cmpi eq, %[[VAL_49]], %[[VAL_52]] : index -// CHECK: %[[VAL_54:.*]] = cmpi eq, %[[VAL_50]], %[[VAL_52]] : index -// CHECK: %[[VAL_55:.*]] = and %[[VAL_53]], %[[VAL_54]] : i1 -// CHECK: scf.if %[[VAL_55]] { -// CHECK: %[[VAL_56:.*]] = load %[[VAL_9]]{{\[}}%[[VAL_47]]] : memref -// CHECK: %[[VAL_57:.*]] = load %[[VAL_14]]{{\[}}%[[VAL_48]]] : memref -// CHECK: %[[VAL_58:.*]] = addf %[[VAL_56]], %[[VAL_57]] : f32 -// CHECK: store %[[VAL_58]], %[[VAL_15]]{{\[}}%[[VAL_31]], %[[VAL_52]]] : memref<32x16xf32> +// CHECK: ^bb0(%[[VAL_48:.*]]: index, %[[VAL_49:.*]]: index): +// CHECK: %[[VAL_50:.*]] = load %[[VAL_9]]{{\[}}%[[VAL_48]]] : memref +// CHECK: %[[VAL_51:.*]] = load %[[VAL_14]]{{\[}}%[[VAL_49]]] : memref +// CHECK: %[[VAL_52:.*]] = cmpi ult, %[[VAL_51]], %[[VAL_50]] : index +// CHECK: %[[VAL_53:.*]] = select %[[VAL_52]], %[[VAL_51]], %[[VAL_50]] : index +// CHECK: %[[VAL_54:.*]] = cmpi eq, %[[VAL_50]], %[[VAL_53]] : index +// CHECK: %[[VAL_55:.*]] = cmpi eq, %[[VAL_51]], %[[VAL_53]] : index +// CHECK: %[[VAL_56:.*]] = and %[[VAL_54]], %[[VAL_55]] : i1 +// CHECK: scf.if %[[VAL_56]] { +// CHECK: %[[VAL_57:.*]] = load %[[VAL_10]]{{\[}}%[[VAL_48]]] : memref +// CHECK: %[[VAL_58:.*]] = load %[[VAL_15]]{{\[}}%[[VAL_49]]] : memref +// CHECK: %[[VAL_59:.*]] = addf %[[VAL_57]], %[[VAL_58]] : f32 +// CHECK: store %[[VAL_59]], %[[VAL_16]]{{\[}}%[[VAL_32]], %[[VAL_53]]] : memref<32x16xf32> // CHECK: } else { -// CHECK: %[[VAL_59:.*]] = cmpi eq, %[[VAL_49]], %[[VAL_52]] : index -// CHECK: scf.if %[[VAL_59]] { -// CHECK: %[[VAL_60:.*]] = load %[[VAL_9]]{{\[}}%[[VAL_47]]] : memref -// CHECK: store %[[VAL_60]], %[[VAL_15]]{{\[}}%[[VAL_31]], %[[VAL_52]]] : memref<32x16xf32> +// CHECK: %[[VAL_60:.*]] = cmpi eq, %[[VAL_50]], %[[VAL_53]] : index +// CHECK: scf.if %[[VAL_60]] { +// CHECK: %[[VAL_61:.*]] = load %[[VAL_10]]{{\[}}%[[VAL_48]]] : memref +// CHECK: store %[[VAL_61]], %[[VAL_16]]{{\[}}%[[VAL_32]], %[[VAL_53]]] : memref<32x16xf32> // CHECK: } else { -// CHECK: %[[VAL_61:.*]] = cmpi eq, %[[VAL_50]], %[[VAL_52]] : index -// CHECK: scf.if %[[VAL_61]] { -// CHECK: %[[VAL_62:.*]] = load %[[VAL_14]]{{\[}}%[[VAL_48]]] : memref -// CHECK: store %[[VAL_62]], %[[VAL_15]]{{\[}}%[[VAL_31]], %[[VAL_52]]] : memref<32x16xf32> +// CHECK: %[[VAL_62:.*]] = cmpi eq, %[[VAL_51]], %[[VAL_53]] : index +// CHECK: scf.if %[[VAL_62]] { +// CHECK: %[[VAL_63:.*]] = load %[[VAL_15]]{{\[}}%[[VAL_49]]] : memref +// CHECK: store %[[VAL_63]], %[[VAL_16]]{{\[}}%[[VAL_32]], %[[VAL_53]]] : memref<32x16xf32> // CHECK: } else { // CHECK: } // CHECK: } // CHECK: } -// CHECK: %[[VAL_63:.*]] = cmpi eq, %[[VAL_49]], %[[VAL_52]] : index -// CHECK: %[[VAL_64:.*]] = addi %[[VAL_47]], %[[VAL_4]] : index -// CHECK: %[[VAL_65:.*]] = select %[[VAL_63]], %[[VAL_64]], %[[VAL_47]] : index -// CHECK: %[[VAL_66:.*]] = cmpi eq, %[[VAL_50]], %[[VAL_52]] : index -// CHECK: %[[VAL_67:.*]] = addi %[[VAL_48]], %[[VAL_4]] : index -// CHECK: %[[VAL_68:.*]] = select %[[VAL_66]], %[[VAL_67]], %[[VAL_48]] : index -// CHECK: scf.yield %[[VAL_65]], %[[VAL_68]] : index, index +// CHECK: %[[VAL_64:.*]] = cmpi eq, %[[VAL_50]], %[[VAL_53]] : index +// CHECK: %[[VAL_65:.*]] = addi %[[VAL_48]], %[[VAL_5]] : index +// CHECK: %[[VAL_66:.*]] = select %[[VAL_64]], %[[VAL_65]], %[[VAL_48]] : index +// CHECK: %[[VAL_67:.*]] = cmpi eq, %[[VAL_51]], %[[VAL_53]] : index +// CHECK: %[[VAL_68:.*]] = addi %[[VAL_49]], %[[VAL_5]] : index +// CHECK: %[[VAL_69:.*]] = select %[[VAL_67]], %[[VAL_68]], %[[VAL_49]] : index +// CHECK: scf.yield %[[VAL_66]], %[[VAL_69]] : index, index // CHECK: } -// CHECK: scf.for %[[VAL_69:.*]] = %[[VAL_70:.*]]#0 to %[[VAL_37]] step %[[VAL_4]] { -// CHECK: %[[VAL_71:.*]] = load %[[VAL_8]]{{\[}}%[[VAL_69]]] : memref -// CHECK: %[[VAL_72:.*]] = load %[[VAL_9]]{{\[}}%[[VAL_69]]] : memref -// CHECK: store %[[VAL_72]], %[[VAL_15]]{{\[}}%[[VAL_31]], %[[VAL_71]]] : memref<32x16xf32> +// CHECK: scf.for %[[VAL_70:.*]] = %[[VAL_71:.*]]#0 to %[[VAL_38]] step %[[VAL_5]] { +// CHECK: %[[VAL_72:.*]] = load %[[VAL_9]]{{\[}}%[[VAL_70]]] : memref +// CHECK: %[[VAL_73:.*]] = load %[[VAL_10]]{{\[}}%[[VAL_70]]] : memref +// CHECK: store %[[VAL_73]], %[[VAL_16]]{{\[}}%[[VAL_32]], %[[VAL_72]]] : memref<32x16xf32> // CHECK: } -// CHECK: scf.for %[[VAL_73:.*]] = %[[VAL_74:.*]]#1 to %[[VAL_40]] step %[[VAL_4]] { -// CHECK: %[[VAL_75:.*]] = load %[[VAL_13]]{{\[}}%[[VAL_73]]] : memref -// CHECK: %[[VAL_76:.*]] = load %[[VAL_14]]{{\[}}%[[VAL_73]]] : memref -// CHECK: store %[[VAL_76]], %[[VAL_15]]{{\[}}%[[VAL_31]], %[[VAL_75]]] : memref<32x16xf32> +// CHECK: scf.for %[[VAL_74:.*]] = %[[VAL_75:.*]]#1 to %[[VAL_41]] step %[[VAL_5]] { +// CHECK: %[[VAL_76:.*]] = load %[[VAL_14]]{{\[}}%[[VAL_74]]] : memref +// CHECK: %[[VAL_77:.*]] = load %[[VAL_15]]{{\[}}%[[VAL_74]]] : memref +// CHECK: store %[[VAL_77]], %[[VAL_16]]{{\[}}%[[VAL_32]], %[[VAL_76]]] : memref<32x16xf32> // CHECK: } // CHECK: } else { -// CHECK: %[[VAL_77:.*]] = cmpi eq, %[[VAL_28]], %[[VAL_31]] : index -// CHECK: scf.if %[[VAL_77]] { -// CHECK: %[[VAL_78:.*]] = load %[[VAL_7]]{{\[}}%[[VAL_26]]] : memref -// CHECK: %[[VAL_79:.*]] = addi %[[VAL_26]], %[[VAL_4]] : index -// CHECK: %[[VAL_80:.*]] = load %[[VAL_7]]{{\[}}%[[VAL_79]]] : memref -// CHECK: scf.for %[[VAL_81:.*]] = %[[VAL_78]] to %[[VAL_80]] step %[[VAL_4]] { -// CHECK: %[[VAL_82:.*]] = load %[[VAL_8]]{{\[}}%[[VAL_81]]] : memref -// CHECK: %[[VAL_83:.*]] = load %[[VAL_9]]{{\[}}%[[VAL_81]]] : memref -// CHECK: store %[[VAL_83]], %[[VAL_15]]{{\[}}%[[VAL_31]], %[[VAL_82]]] : memref<32x16xf32> +// CHECK: %[[VAL_78:.*]] = cmpi eq, %[[VAL_29]], %[[VAL_32]] : index +// CHECK: scf.if %[[VAL_78]] { +// CHECK: %[[VAL_79:.*]] = load %[[VAL_8]]{{\[}}%[[VAL_27]]] : memref +// CHECK: %[[VAL_80:.*]] = addi %[[VAL_27]], %[[VAL_5]] : index +// CHECK: %[[VAL_81:.*]] = load %[[VAL_8]]{{\[}}%[[VAL_80]]] : memref +// CHECK: scf.for %[[VAL_82:.*]] = %[[VAL_79]] to %[[VAL_81]] step %[[VAL_5]] { +// CHECK: %[[VAL_83:.*]] = load %[[VAL_9]]{{\[}}%[[VAL_82]]] : memref +// CHECK: %[[VAL_84:.*]] = load %[[VAL_10]]{{\[}}%[[VAL_82]]] : memref +// CHECK: store %[[VAL_84]], %[[VAL_16]]{{\[}}%[[VAL_32]], %[[VAL_83]]] : memref<32x16xf32> // CHECK: } // CHECK: } else { -// CHECK: %[[VAL_84:.*]] = cmpi eq, %[[VAL_29]], %[[VAL_31]] : index -// CHECK: scf.if %[[VAL_84]] { -// CHECK: %[[VAL_85:.*]] = load %[[VAL_12]]{{\[}}%[[VAL_27]]] : memref -// CHECK: %[[VAL_86:.*]] = addi %[[VAL_27]], %[[VAL_4]] : index -// CHECK: %[[VAL_87:.*]] = load %[[VAL_12]]{{\[}}%[[VAL_86]]] : memref -// CHECK: scf.for %[[VAL_88:.*]] = %[[VAL_85]] to %[[VAL_87]] step %[[VAL_4]] { -// CHECK: %[[VAL_89:.*]] = load %[[VAL_13]]{{\[}}%[[VAL_88]]] : memref -// CHECK: %[[VAL_90:.*]] = load %[[VAL_14]]{{\[}}%[[VAL_88]]] : memref -// CHECK: store %[[VAL_90]], %[[VAL_15]]{{\[}}%[[VAL_31]], %[[VAL_89]]] : memref<32x16xf32> +// CHECK: %[[VAL_85:.*]] = cmpi eq, %[[VAL_30]], %[[VAL_32]] : index +// CHECK: scf.if %[[VAL_85]] { +// CHECK: %[[VAL_86:.*]] = load %[[VAL_13]]{{\[}}%[[VAL_28]]] : memref +// CHECK: %[[VAL_87:.*]] = addi %[[VAL_28]], %[[VAL_5]] : index +// CHECK: %[[VAL_88:.*]] = load %[[VAL_13]]{{\[}}%[[VAL_87]]] : memref +// CHECK: scf.for %[[VAL_89:.*]] = %[[VAL_86]] to %[[VAL_88]] step %[[VAL_5]] { +// CHECK: %[[VAL_90:.*]] = load %[[VAL_14]]{{\[}}%[[VAL_89]]] : memref +// CHECK: %[[VAL_91:.*]] = load %[[VAL_15]]{{\[}}%[[VAL_89]]] : memref +// CHECK: store %[[VAL_91]], %[[VAL_16]]{{\[}}%[[VAL_32]], %[[VAL_90]]] : memref<32x16xf32> // CHECK: } // CHECK: } else { // CHECK: } // CHECK: } // CHECK: } -// CHECK: %[[VAL_91:.*]] = cmpi eq, %[[VAL_28]], %[[VAL_31]] : index -// CHECK: %[[VAL_92:.*]] = addi %[[VAL_26]], %[[VAL_4]] : index -// CHECK: %[[VAL_93:.*]] = select %[[VAL_91]], %[[VAL_92]], %[[VAL_26]] : index -// CHECK: %[[VAL_94:.*]] = cmpi eq, %[[VAL_29]], %[[VAL_31]] : index -// CHECK: %[[VAL_95:.*]] = addi %[[VAL_27]], %[[VAL_4]] : index -// CHECK: %[[VAL_96:.*]] = select %[[VAL_94]], %[[VAL_95]], %[[VAL_27]] : index -// CHECK: scf.yield %[[VAL_93]], %[[VAL_96]] : index, index +// CHECK: %[[VAL_92:.*]] = cmpi eq, %[[VAL_29]], %[[VAL_32]] : index +// CHECK: %[[VAL_93:.*]] = addi %[[VAL_27]], %[[VAL_5]] : index +// CHECK: %[[VAL_94:.*]] = select %[[VAL_92]], %[[VAL_93]], %[[VAL_27]] : index +// CHECK: %[[VAL_95:.*]] = cmpi eq, %[[VAL_30]], %[[VAL_32]] : index +// CHECK: %[[VAL_96:.*]] = addi %[[VAL_28]], %[[VAL_5]] : index +// CHECK: %[[VAL_97:.*]] = select %[[VAL_95]], %[[VAL_96]], %[[VAL_28]] : index +// CHECK: scf.yield %[[VAL_94]], %[[VAL_97]] : index, index // CHECK: } -// CHECK: scf.for %[[VAL_97:.*]] = %[[VAL_98:.*]]#0 to %[[VAL_17]] step %[[VAL_4]] { -// CHECK: %[[VAL_99:.*]] = load %[[VAL_6]]{{\[}}%[[VAL_97]]] : memref -// CHECK: %[[VAL_100:.*]] = load %[[VAL_7]]{{\[}}%[[VAL_97]]] : memref -// CHECK: %[[VAL_101:.*]] = addi %[[VAL_97]], %[[VAL_4]] : index -// CHECK: %[[VAL_102:.*]] = load %[[VAL_7]]{{\[}}%[[VAL_101]]] : memref -// CHECK: scf.for %[[VAL_103:.*]] = %[[VAL_100]] to %[[VAL_102]] step %[[VAL_4]] { -// CHECK: %[[VAL_104:.*]] = load %[[VAL_8]]{{\[}}%[[VAL_103]]] : memref -// CHECK: %[[VAL_105:.*]] = load %[[VAL_9]]{{\[}}%[[VAL_103]]] : memref -// CHECK: store %[[VAL_105]], %[[VAL_15]]{{\[}}%[[VAL_99]], %[[VAL_104]]] : memref<32x16xf32> +// CHECK: scf.for %[[VAL_98:.*]] = %[[VAL_99:.*]]#0 to %[[VAL_18]] step %[[VAL_5]] { +// CHECK: %[[VAL_100:.*]] = load %[[VAL_7]]{{\[}}%[[VAL_98]]] : memref +// CHECK: %[[VAL_101:.*]] = load %[[VAL_8]]{{\[}}%[[VAL_98]]] : memref +// CHECK: %[[VAL_102:.*]] = addi %[[VAL_98]], %[[VAL_5]] : index +// CHECK: %[[VAL_103:.*]] = load %[[VAL_8]]{{\[}}%[[VAL_102]]] : memref +// CHECK: scf.for %[[VAL_104:.*]] = %[[VAL_101]] to %[[VAL_103]] step %[[VAL_5]] { +// CHECK: %[[VAL_105:.*]] = load %[[VAL_9]]{{\[}}%[[VAL_104]]] : memref +// CHECK: %[[VAL_106:.*]] = load %[[VAL_10]]{{\[}}%[[VAL_104]]] : memref +// CHECK: store %[[VAL_106]], %[[VAL_16]]{{\[}}%[[VAL_100]], %[[VAL_105]]] : memref<32x16xf32> // CHECK: } // CHECK: } -// CHECK: scf.for %[[VAL_106:.*]] = %[[VAL_107:.*]]#1 to %[[VAL_19]] step %[[VAL_4]] { -// CHECK: %[[VAL_108:.*]] = load %[[VAL_11]]{{\[}}%[[VAL_106]]] : memref -// CHECK: %[[VAL_109:.*]] = load %[[VAL_12]]{{\[}}%[[VAL_106]]] : memref -// CHECK: %[[VAL_110:.*]] = addi %[[VAL_106]], %[[VAL_4]] : index -// CHECK: %[[VAL_111:.*]] = load %[[VAL_12]]{{\[}}%[[VAL_110]]] : memref -// CHECK: scf.for %[[VAL_112:.*]] = %[[VAL_109]] to %[[VAL_111]] step %[[VAL_4]] { -// CHECK: %[[VAL_113:.*]] = load %[[VAL_13]]{{\[}}%[[VAL_112]]] : memref -// CHECK: %[[VAL_114:.*]] = load %[[VAL_14]]{{\[}}%[[VAL_112]]] : memref -// CHECK: store %[[VAL_114]], %[[VAL_15]]{{\[}}%[[VAL_108]], %[[VAL_113]]] : memref<32x16xf32> +// CHECK: scf.for %[[VAL_107:.*]] = %[[VAL_108:.*]]#1 to %[[VAL_20]] step %[[VAL_5]] { +// CHECK: %[[VAL_109:.*]] = load %[[VAL_12]]{{\[}}%[[VAL_107]]] : memref +// CHECK: %[[VAL_110:.*]] = load %[[VAL_13]]{{\[}}%[[VAL_107]]] : memref +// CHECK: %[[VAL_111:.*]] = addi %[[VAL_107]], %[[VAL_5]] : index +// CHECK: %[[VAL_112:.*]] = load %[[VAL_13]]{{\[}}%[[VAL_111]]] : memref +// CHECK: scf.for %[[VAL_113:.*]] = %[[VAL_110]] to %[[VAL_112]] step %[[VAL_5]] { +// CHECK: %[[VAL_114:.*]] = load %[[VAL_14]]{{\[}}%[[VAL_113]]] : memref +// CHECK: %[[VAL_115:.*]] = load %[[VAL_15]]{{\[}}%[[VAL_113]]] : memref +// CHECK: store %[[VAL_115]], %[[VAL_16]]{{\[}}%[[VAL_109]], %[[VAL_114]]] : memref<32x16xf32> // CHECK: } // CHECK: } -// CHECK: %[[VAL_115:.*]] = tensor_load %[[VAL_15]] : memref<32x16xf32> -// CHECK: return %[[VAL_115]] : tensor<32x16xf32> +// CHECK: %[[VAL_116:.*]] = tensor_load %[[VAL_16]] : memref<32x16xf32> +// CHECK: return %[[VAL_116]] : tensor<32x16xf32> // CHECK: } -func @add_ss_ss(%arga: tensor<32x16xf32>, %argb: tensor<32x16xf32>) -> tensor<32x16xf32> { +func @add_ss_ss(%arga: tensor<32x16xf32>, %argb: tensor<32x16xf32>, %argx: tensor<32x16xf32>) -> tensor<32x16xf32> { %0 = linalg.generic #trait_ss_ss ins(%arga, %argb: tensor<32x16xf32>, tensor<32x16xf32>) - outs(%arga : tensor<32x16xf32>) { - ^bb(%a: f32, %b: f32, %s: f32): + outs(%argx : tensor<32x16xf32>) { + ^bb(%a: f32, %b: f32, %x: f32): %0 = addf %a, %b : f32 linalg.yield %0 : f32 } -> tensor<32x16xf32> @@ -645,94 +654,95 @@ } // CHECK-LABEL: func @mul_ss_ss( -// CHECK-SAME: %[[VAL_0:.*]]: tensor<32x16xf32>, -// CHECK-SAME: %[[VAL_1:.*]]: tensor<32x16xf32>) -> tensor<32x16xf32> { -// CHECK: %[[VAL_2:.*]] = constant 999 : index -// CHECK: %[[VAL_3:.*]] = constant 0 : index -// CHECK: %[[VAL_4:.*]] = constant 1 : index -// CHECK: %[[VAL_5:.*]] = alloca(%[[VAL_2]]) : memref -// CHECK: %[[VAL_6:.*]] = alloca(%[[VAL_2]]) : memref -// CHECK: %[[VAL_7:.*]] = alloca(%[[VAL_2]]) : memref -// CHECK: %[[VAL_8:.*]] = alloca(%[[VAL_2]]) : memref -// CHECK: %[[VAL_9:.*]] = alloca(%[[VAL_2]]) : memref -// CHECK: %[[VAL_10:.*]] = alloca(%[[VAL_2]]) : memref -// CHECK: %[[VAL_11:.*]] = alloca(%[[VAL_2]]) : memref -// CHECK: %[[VAL_12:.*]] = alloca(%[[VAL_2]]) : memref -// CHECK: %[[VAL_13:.*]] = alloca(%[[VAL_2]]) : memref -// CHECK: %[[VAL_14:.*]] = alloca(%[[VAL_2]]) : memref -// CHECK: %[[VAL_15:.*]] = alloca() : memref<32x16xf32> -// CHECK: %[[VAL_16:.*]] = load %[[VAL_5]]{{\[}}%[[VAL_3]]] : memref -// CHECK: %[[VAL_17:.*]] = load %[[VAL_5]]{{\[}}%[[VAL_4]]] : memref -// CHECK: %[[VAL_18:.*]] = load %[[VAL_10]]{{\[}}%[[VAL_3]]] : memref -// CHECK: %[[VAL_19:.*]] = load %[[VAL_10]]{{\[}}%[[VAL_4]]] : memref -// CHECK: %[[VAL_20:.*]]:2 = scf.while (%[[VAL_21:.*]] = %[[VAL_16]], %[[VAL_22:.*]] = %[[VAL_18]]) : (index, index) -> (index, index) { -// CHECK: %[[VAL_23:.*]] = cmpi ult, %[[VAL_21]], %[[VAL_17]] : index -// CHECK: %[[VAL_24:.*]] = cmpi ult, %[[VAL_22]], %[[VAL_19]] : index -// CHECK: %[[VAL_25:.*]] = and %[[VAL_23]], %[[VAL_24]] : i1 -// CHECK: scf.condition(%[[VAL_25]]) %[[VAL_21]], %[[VAL_22]] : index, index +// CHECK-SAME: %[[VAL_0:.*0]]: tensor<32x16xf32>, +// CHECK-SAME: %[[VAL_1:.*1]]: tensor<32x16xf32>, +// CHECK-SAME: %[[VAL_2:.*2]]: tensor<32x16xf32>) -> tensor<32x16xf32> { +// CHECK: %[[VAL_3:.*]] = constant 999 : index +// CHECK: %[[VAL_4:.*]] = constant 0 : index +// CHECK: %[[VAL_5:.*]] = constant 1 : index +// CHECK: %[[VAL_6:.*]] = alloca(%[[VAL_3]]) : memref +// CHECK: %[[VAL_7:.*]] = alloca(%[[VAL_3]]) : memref +// CHECK: %[[VAL_8:.*]] = alloca(%[[VAL_3]]) : memref +// CHECK: %[[VAL_9:.*]] = alloca(%[[VAL_3]]) : memref +// CHECK: %[[VAL_10:.*]] = alloca(%[[VAL_3]]) : memref +// CHECK: %[[VAL_11:.*]] = alloca(%[[VAL_3]]) : memref +// CHECK: %[[VAL_12:.*]] = alloca(%[[VAL_3]]) : memref +// CHECK: %[[VAL_13:.*]] = alloca(%[[VAL_3]]) : memref +// CHECK: %[[VAL_14:.*]] = alloca(%[[VAL_3]]) : memref +// CHECK: %[[VAL_15:.*]] = alloca(%[[VAL_3]]) : memref +// CHECK: %[[VAL_16:.*]] = alloca() : memref<32x16xf32> +// CHECK: %[[VAL_17:.*]] = load %[[VAL_6]]{{\[}}%[[VAL_4]]] : memref +// CHECK: %[[VAL_18:.*]] = load %[[VAL_6]]{{\[}}%[[VAL_5]]] : memref +// CHECK: %[[VAL_19:.*]] = load %[[VAL_11]]{{\[}}%[[VAL_4]]] : memref +// CHECK: %[[VAL_20:.*]] = load %[[VAL_11]]{{\[}}%[[VAL_5]]] : memref +// CHECK: %[[VAL_21:.*]]:2 = scf.while (%[[VAL_22:.*]] = %[[VAL_17]], %[[VAL_23:.*]] = %[[VAL_19]]) : (index, index) -> (index, index) { +// CHECK: %[[VAL_24:.*]] = cmpi ult, %[[VAL_22]], %[[VAL_18]] : index +// CHECK: %[[VAL_25:.*]] = cmpi ult, %[[VAL_23]], %[[VAL_20]] : index +// CHECK: %[[VAL_26:.*]] = and %[[VAL_24]], %[[VAL_25]] : i1 +// CHECK: scf.condition(%[[VAL_26]]) %[[VAL_22]], %[[VAL_23]] : index, index // CHECK: } do { -// CHECK: ^bb0(%[[VAL_26:.*]]: index, %[[VAL_27:.*]]: index): -// CHECK: %[[VAL_28:.*]] = load %[[VAL_6]]{{\[}}%[[VAL_26]]] : memref -// CHECK: %[[VAL_29:.*]] = load %[[VAL_11]]{{\[}}%[[VAL_27]]] : memref -// CHECK: %[[VAL_30:.*]] = cmpi ult, %[[VAL_29]], %[[VAL_28]] : index -// CHECK: %[[VAL_31:.*]] = select %[[VAL_30]], %[[VAL_29]], %[[VAL_28]] : index -// CHECK: %[[VAL_32:.*]] = cmpi eq, %[[VAL_28]], %[[VAL_31]] : index -// CHECK: %[[VAL_33:.*]] = cmpi eq, %[[VAL_29]], %[[VAL_31]] : index -// CHECK: %[[VAL_34:.*]] = and %[[VAL_32]], %[[VAL_33]] : i1 -// CHECK: scf.if %[[VAL_34]] { -// CHECK: %[[VAL_35:.*]] = load %[[VAL_7]]{{\[}}%[[VAL_26]]] : memref -// CHECK: %[[VAL_36:.*]] = addi %[[VAL_26]], %[[VAL_4]] : index -// CHECK: %[[VAL_37:.*]] = load %[[VAL_7]]{{\[}}%[[VAL_36]]] : memref -// CHECK: %[[VAL_38:.*]] = load %[[VAL_12]]{{\[}}%[[VAL_27]]] : memref -// CHECK: %[[VAL_39:.*]] = addi %[[VAL_27]], %[[VAL_4]] : index -// CHECK: %[[VAL_40:.*]] = load %[[VAL_12]]{{\[}}%[[VAL_39]]] : memref -// CHECK: %[[VAL_41:.*]]:2 = scf.while (%[[VAL_42:.*]] = %[[VAL_35]], %[[VAL_43:.*]] = %[[VAL_38]]) : (index, index) -> (index, index) { -// CHECK: %[[VAL_44:.*]] = cmpi ult, %[[VAL_42]], %[[VAL_37]] : index -// CHECK: %[[VAL_45:.*]] = cmpi ult, %[[VAL_43]], %[[VAL_40]] : index -// CHECK: %[[VAL_46:.*]] = and %[[VAL_44]], %[[VAL_45]] : i1 -// CHECK: scf.condition(%[[VAL_46]]) %[[VAL_42]], %[[VAL_43]] : index, index +// CHECK: ^bb0(%[[VAL_27:.*]]: index, %[[VAL_28:.*]]: index): +// CHECK: %[[VAL_29:.*]] = load %[[VAL_7]]{{\[}}%[[VAL_27]]] : memref +// CHECK: %[[VAL_30:.*]] = load %[[VAL_12]]{{\[}}%[[VAL_28]]] : memref +// CHECK: %[[VAL_31:.*]] = cmpi ult, %[[VAL_30]], %[[VAL_29]] : index +// CHECK: %[[VAL_32:.*]] = select %[[VAL_31]], %[[VAL_30]], %[[VAL_29]] : index +// CHECK: %[[VAL_33:.*]] = cmpi eq, %[[VAL_29]], %[[VAL_32]] : index +// CHECK: %[[VAL_34:.*]] = cmpi eq, %[[VAL_30]], %[[VAL_32]] : index +// CHECK: %[[VAL_35:.*]] = and %[[VAL_33]], %[[VAL_34]] : i1 +// CHECK: scf.if %[[VAL_35]] { +// CHECK: %[[VAL_36:.*]] = load %[[VAL_8]]{{\[}}%[[VAL_27]]] : memref +// CHECK: %[[VAL_37:.*]] = addi %[[VAL_27]], %[[VAL_5]] : index +// CHECK: %[[VAL_38:.*]] = load %[[VAL_8]]{{\[}}%[[VAL_37]]] : memref +// CHECK: %[[VAL_39:.*]] = load %[[VAL_13]]{{\[}}%[[VAL_28]]] : memref +// CHECK: %[[VAL_40:.*]] = addi %[[VAL_28]], %[[VAL_5]] : index +// CHECK: %[[VAL_41:.*]] = load %[[VAL_13]]{{\[}}%[[VAL_40]]] : memref +// CHECK: %[[VAL_42:.*]]:2 = scf.while (%[[VAL_43:.*]] = %[[VAL_36]], %[[VAL_44:.*]] = %[[VAL_39]]) : (index, index) -> (index, index) { +// CHECK: %[[VAL_45:.*]] = cmpi ult, %[[VAL_43]], %[[VAL_38]] : index +// CHECK: %[[VAL_46:.*]] = cmpi ult, %[[VAL_44]], %[[VAL_41]] : index +// CHECK: %[[VAL_47:.*]] = and %[[VAL_45]], %[[VAL_46]] : i1 +// CHECK: scf.condition(%[[VAL_47]]) %[[VAL_43]], %[[VAL_44]] : index, index // CHECK: } do { -// CHECK: ^bb0(%[[VAL_47:.*]]: index, %[[VAL_48:.*]]: index): -// CHECK: %[[VAL_49:.*]] = load %[[VAL_8]]{{\[}}%[[VAL_47]]] : memref -// CHECK: %[[VAL_50:.*]] = load %[[VAL_13]]{{\[}}%[[VAL_48]]] : memref -// CHECK: %[[VAL_51:.*]] = cmpi ult, %[[VAL_50]], %[[VAL_49]] : index -// CHECK: %[[VAL_52:.*]] = select %[[VAL_51]], %[[VAL_50]], %[[VAL_49]] : index -// CHECK: %[[VAL_53:.*]] = cmpi eq, %[[VAL_49]], %[[VAL_52]] : index -// CHECK: %[[VAL_54:.*]] = cmpi eq, %[[VAL_50]], %[[VAL_52]] : index -// CHECK: %[[VAL_55:.*]] = and %[[VAL_53]], %[[VAL_54]] : i1 -// CHECK: scf.if %[[VAL_55]] { -// CHECK: %[[VAL_56:.*]] = load %[[VAL_9]]{{\[}}%[[VAL_47]]] : memref -// CHECK: %[[VAL_57:.*]] = load %[[VAL_14]]{{\[}}%[[VAL_48]]] : memref -// CHECK: %[[VAL_58:.*]] = mulf %[[VAL_56]], %[[VAL_57]] : f32 -// CHECK: store %[[VAL_58]], %[[VAL_15]]{{\[}}%[[VAL_31]], %[[VAL_52]]] : memref<32x16xf32> +// CHECK: ^bb0(%[[VAL_48:.*]]: index, %[[VAL_49:.*]]: index): +// CHECK: %[[VAL_50:.*]] = load %[[VAL_9]]{{\[}}%[[VAL_48]]] : memref +// CHECK: %[[VAL_51:.*]] = load %[[VAL_14]]{{\[}}%[[VAL_49]]] : memref +// CHECK: %[[VAL_52:.*]] = cmpi ult, %[[VAL_51]], %[[VAL_50]] : index +// CHECK: %[[VAL_53:.*]] = select %[[VAL_52]], %[[VAL_51]], %[[VAL_50]] : index +// CHECK: %[[VAL_54:.*]] = cmpi eq, %[[VAL_50]], %[[VAL_53]] : index +// CHECK: %[[VAL_55:.*]] = cmpi eq, %[[VAL_51]], %[[VAL_53]] : index +// CHECK: %[[VAL_56:.*]] = and %[[VAL_54]], %[[VAL_55]] : i1 +// CHECK: scf.if %[[VAL_56]] { +// CHECK: %[[VAL_57:.*]] = load %[[VAL_10]]{{\[}}%[[VAL_48]]] : memref +// CHECK: %[[VAL_58:.*]] = load %[[VAL_15]]{{\[}}%[[VAL_49]]] : memref +// CHECK: %[[VAL_59:.*]] = mulf %[[VAL_57]], %[[VAL_58]] : f32 +// CHECK: store %[[VAL_59]], %[[VAL_16]]{{\[}}%[[VAL_32]], %[[VAL_53]]] : memref<32x16xf32> // CHECK: } else { // CHECK: } -// CHECK: %[[VAL_59:.*]] = cmpi eq, %[[VAL_49]], %[[VAL_52]] : index -// CHECK: %[[VAL_60:.*]] = addi %[[VAL_47]], %[[VAL_4]] : index -// CHECK: %[[VAL_61:.*]] = select %[[VAL_59]], %[[VAL_60]], %[[VAL_47]] : index -// CHECK: %[[VAL_62:.*]] = cmpi eq, %[[VAL_50]], %[[VAL_52]] : index -// CHECK: %[[VAL_63:.*]] = addi %[[VAL_48]], %[[VAL_4]] : index -// CHECK: %[[VAL_64:.*]] = select %[[VAL_62]], %[[VAL_63]], %[[VAL_48]] : index -// CHECK: scf.yield %[[VAL_61]], %[[VAL_64]] : index, index +// CHECK: %[[VAL_60:.*]] = cmpi eq, %[[VAL_50]], %[[VAL_53]] : index +// CHECK: %[[VAL_61:.*]] = addi %[[VAL_48]], %[[VAL_5]] : index +// CHECK: %[[VAL_62:.*]] = select %[[VAL_60]], %[[VAL_61]], %[[VAL_48]] : index +// CHECK: %[[VAL_63:.*]] = cmpi eq, %[[VAL_51]], %[[VAL_53]] : index +// CHECK: %[[VAL_64:.*]] = addi %[[VAL_49]], %[[VAL_5]] : index +// CHECK: %[[VAL_65:.*]] = select %[[VAL_63]], %[[VAL_64]], %[[VAL_49]] : index +// CHECK: scf.yield %[[VAL_62]], %[[VAL_65]] : index, index // CHECK: } // CHECK: } else { // CHECK: } -// CHECK: %[[VAL_65:.*]] = cmpi eq, %[[VAL_28]], %[[VAL_31]] : index -// CHECK: %[[VAL_66:.*]] = addi %[[VAL_26]], %[[VAL_4]] : index -// CHECK: %[[VAL_67:.*]] = select %[[VAL_65]], %[[VAL_66]], %[[VAL_26]] : index -// CHECK: %[[VAL_68:.*]] = cmpi eq, %[[VAL_29]], %[[VAL_31]] : index -// CHECK: %[[VAL_69:.*]] = addi %[[VAL_27]], %[[VAL_4]] : index -// CHECK: %[[VAL_70:.*]] = select %[[VAL_68]], %[[VAL_69]], %[[VAL_27]] : index -// CHECK: scf.yield %[[VAL_67]], %[[VAL_70]] : index, index +// CHECK: %[[VAL_66:.*]] = cmpi eq, %[[VAL_29]], %[[VAL_32]] : index +// CHECK: %[[VAL_67:.*]] = addi %[[VAL_27]], %[[VAL_5]] : index +// CHECK: %[[VAL_68:.*]] = select %[[VAL_66]], %[[VAL_67]], %[[VAL_27]] : index +// CHECK: %[[VAL_69:.*]] = cmpi eq, %[[VAL_30]], %[[VAL_32]] : index +// CHECK: %[[VAL_70:.*]] = addi %[[VAL_28]], %[[VAL_5]] : index +// CHECK: %[[VAL_71:.*]] = select %[[VAL_69]], %[[VAL_70]], %[[VAL_28]] : index +// CHECK: scf.yield %[[VAL_68]], %[[VAL_71]] : index, index // CHECK: } -// CHECK: %[[VAL_71:.*]] = tensor_load %[[VAL_15]] : memref<32x16xf32> -// CHECK: return %[[VAL_71]] : tensor<32x16xf32> +// CHECK: %[[VAL_72:.*]] = tensor_load %[[VAL_16]] : memref<32x16xf32> +// CHECK: return %[[VAL_72]] : tensor<32x16xf32> // CHECK: } -func @mul_ss_ss(%arga: tensor<32x16xf32>, %argb: tensor<32x16xf32>) -> tensor<32x16xf32> { +func @mul_ss_ss(%arga: tensor<32x16xf32>, %argb: tensor<32x16xf32>, %argx: tensor<32x16xf32>) -> tensor<32x16xf32> { %0 = linalg.generic #trait_ss_ss ins(%arga, %argb: tensor<32x16xf32>, tensor<32x16xf32>) - outs(%arga : tensor<32x16xf32>) { - ^bb(%a: f32, %b: f32, %s: f32): + outs(%argx : tensor<32x16xf32>) { + ^bb(%a: f32, %b: f32, %x: f32): %0 = mulf %a, %b : f32 linalg.yield %0 : f32 } -> tensor<32x16xf32> @@ -755,162 +765,163 @@ } // CHECK-LABEL: func @add_sd_ds( -// CHECK-SAME: %[[VAL_0:.*]]: tensor<32x16xf32>, -// CHECK-SAME: %[[VAL_1:.*]]: tensor<32x16xf32>) -> tensor<32x16xf32> { -// CHECK: %[[VAL_2:.*]] = constant 999 : index -// CHECK: %[[VAL_3:.*]] = constant 0 : index -// CHECK: %[[VAL_4:.*]] = constant 1 : index -// CHECK: %[[VAL_5:.*]] = alloca(%[[VAL_2]]) : memref -// CHECK: %[[VAL_6:.*]] = alloca(%[[VAL_2]]) : memref -// CHECK: %[[VAL_7:.*]] = alloca(%[[VAL_2]]) : memref -// CHECK: %[[VAL_8:.*]] = alloca(%[[VAL_2]]) : memref -// CHECK: %[[VAL_9:.*]] = alloca(%[[VAL_2]]) : memref -// CHECK: %[[VAL_10:.*]] = alloca(%[[VAL_2]]) : memref -// CHECK: %[[VAL_11:.*]] = alloca(%[[VAL_2]]) : memref -// CHECK: %[[VAL_12:.*]] = alloca(%[[VAL_2]]) : memref -// CHECK: %[[VAL_13:.*]] = alloca(%[[VAL_2]]) : memref -// CHECK: %[[VAL_14:.*]] = alloca(%[[VAL_2]]) : memref -// CHECK: %[[VAL_15:.*]] = alloca() : memref<32x16xf32> -// CHECK: %[[VAL_16:.*]] = load %[[VAL_5]]{{\[}}%[[VAL_3]]] : memref -// CHECK: %[[VAL_17:.*]] = load %[[VAL_5]]{{\[}}%[[VAL_4]]] : memref -// CHECK: %[[VAL_18:.*]] = load %[[VAL_10]]{{\[}}%[[VAL_3]]] : memref -// CHECK: %[[VAL_19:.*]] = load %[[VAL_10]]{{\[}}%[[VAL_4]]] : memref -// CHECK: %[[VAL_20:.*]]:2 = scf.while (%[[VAL_21:.*]] = %[[VAL_16]], %[[VAL_22:.*]] = %[[VAL_18]]) : (index, index) -> (index, index) { -// CHECK: %[[VAL_23:.*]] = cmpi ult, %[[VAL_21]], %[[VAL_17]] : index -// CHECK: %[[VAL_24:.*]] = cmpi ult, %[[VAL_22]], %[[VAL_19]] : index -// CHECK: %[[VAL_25:.*]] = and %[[VAL_23]], %[[VAL_24]] : i1 -// CHECK: scf.condition(%[[VAL_25]]) %[[VAL_21]], %[[VAL_22]] : index, index +// CHECK-SAME: %[[VAL_0:.*0]]: tensor<32x16xf32>, +// CHECK-SAME: %[[VAL_1:.*1]]: tensor<32x16xf32>, +// CHECK-SAME: %[[VAL_2:.*2]]: tensor<32x16xf32>) -> tensor<32x16xf32> { +// CHECK: %[[VAL_3:.*]] = constant 999 : index +// CHECK: %[[VAL_4:.*]] = constant 0 : index +// CHECK: %[[VAL_5:.*]] = constant 1 : index +// CHECK: %[[VAL_6:.*]] = alloca(%[[VAL_3]]) : memref +// CHECK: %[[VAL_7:.*]] = alloca(%[[VAL_3]]) : memref +// CHECK: %[[VAL_8:.*]] = alloca(%[[VAL_3]]) : memref +// CHECK: %[[VAL_9:.*]] = alloca(%[[VAL_3]]) : memref +// CHECK: %[[VAL_10:.*]] = alloca(%[[VAL_3]]) : memref +// CHECK: %[[VAL_11:.*]] = alloca(%[[VAL_3]]) : memref +// CHECK: %[[VAL_12:.*]] = alloca(%[[VAL_3]]) : memref +// CHECK: %[[VAL_13:.*]] = alloca(%[[VAL_3]]) : memref +// CHECK: %[[VAL_14:.*]] = alloca(%[[VAL_3]]) : memref +// CHECK: %[[VAL_15:.*]] = alloca(%[[VAL_3]]) : memref +// CHECK: %[[VAL_16:.*]] = alloca() : memref<32x16xf32> +// CHECK: %[[VAL_17:.*]] = load %[[VAL_6]]{{\[}}%[[VAL_4]]] : memref +// CHECK: %[[VAL_18:.*]] = load %[[VAL_6]]{{\[}}%[[VAL_5]]] : memref +// CHECK: %[[VAL_19:.*]] = load %[[VAL_11]]{{\[}}%[[VAL_4]]] : memref +// CHECK: %[[VAL_20:.*]] = load %[[VAL_11]]{{\[}}%[[VAL_5]]] : memref +// CHECK: %[[VAL_21:.*]]:2 = scf.while (%[[VAL_22:.*]] = %[[VAL_17]], %[[VAL_23:.*]] = %[[VAL_19]]) : (index, index) -> (index, index) { +// CHECK: %[[VAL_24:.*]] = cmpi ult, %[[VAL_22]], %[[VAL_18]] : index +// CHECK: %[[VAL_25:.*]] = cmpi ult, %[[VAL_23]], %[[VAL_20]] : index +// CHECK: %[[VAL_26:.*]] = and %[[VAL_24]], %[[VAL_25]] : i1 +// CHECK: scf.condition(%[[VAL_26]]) %[[VAL_22]], %[[VAL_23]] : index, index // CHECK: } do { -// CHECK: ^bb0(%[[VAL_26:.*]]: index, %[[VAL_27:.*]]: index): -// CHECK: %[[VAL_28:.*]] = load %[[VAL_6]]{{\[}}%[[VAL_26]]] : memref -// CHECK: %[[VAL_29:.*]] = load %[[VAL_11]]{{\[}}%[[VAL_27]]] : memref -// CHECK: %[[VAL_30:.*]] = cmpi ult, %[[VAL_29]], %[[VAL_28]] : index -// CHECK: %[[VAL_31:.*]] = select %[[VAL_30]], %[[VAL_29]], %[[VAL_28]] : index -// CHECK: %[[VAL_32:.*]] = cmpi eq, %[[VAL_28]], %[[VAL_31]] : index -// CHECK: %[[VAL_33:.*]] = cmpi eq, %[[VAL_29]], %[[VAL_31]] : index -// CHECK: %[[VAL_34:.*]] = and %[[VAL_32]], %[[VAL_33]] : i1 -// CHECK: scf.if %[[VAL_34]] { -// CHECK: %[[VAL_35:.*]] = load %[[VAL_7]]{{\[}}%[[VAL_26]]] : memref -// CHECK: %[[VAL_36:.*]] = addi %[[VAL_26]], %[[VAL_4]] : index -// CHECK: %[[VAL_37:.*]] = load %[[VAL_7]]{{\[}}%[[VAL_36]]] : memref -// CHECK: %[[VAL_38:.*]] = load %[[VAL_12]]{{\[}}%[[VAL_27]]] : memref -// CHECK: %[[VAL_39:.*]] = addi %[[VAL_27]], %[[VAL_4]] : index -// CHECK: %[[VAL_40:.*]] = load %[[VAL_12]]{{\[}}%[[VAL_39]]] : memref -// CHECK: %[[VAL_41:.*]]:2 = scf.while (%[[VAL_42:.*]] = %[[VAL_35]], %[[VAL_43:.*]] = %[[VAL_38]]) : (index, index) -> (index, index) { -// CHECK: %[[VAL_44:.*]] = cmpi ult, %[[VAL_42]], %[[VAL_37]] : index -// CHECK: %[[VAL_45:.*]] = cmpi ult, %[[VAL_43]], %[[VAL_40]] : index -// CHECK: %[[VAL_46:.*]] = and %[[VAL_44]], %[[VAL_45]] : i1 -// CHECK: scf.condition(%[[VAL_46]]) %[[VAL_42]], %[[VAL_43]] : index, index +// CHECK: ^bb0(%[[VAL_27:.*]]: index, %[[VAL_28:.*]]: index): +// CHECK: %[[VAL_29:.*]] = load %[[VAL_7]]{{\[}}%[[VAL_27]]] : memref +// CHECK: %[[VAL_30:.*]] = load %[[VAL_12]]{{\[}}%[[VAL_28]]] : memref +// CHECK: %[[VAL_31:.*]] = cmpi ult, %[[VAL_30]], %[[VAL_29]] : index +// CHECK: %[[VAL_32:.*]] = select %[[VAL_31]], %[[VAL_30]], %[[VAL_29]] : index +// CHECK: %[[VAL_33:.*]] = cmpi eq, %[[VAL_29]], %[[VAL_32]] : index +// CHECK: %[[VAL_34:.*]] = cmpi eq, %[[VAL_30]], %[[VAL_32]] : index +// CHECK: %[[VAL_35:.*]] = and %[[VAL_33]], %[[VAL_34]] : i1 +// CHECK: scf.if %[[VAL_35]] { +// CHECK: %[[VAL_36:.*]] = load %[[VAL_8]]{{\[}}%[[VAL_27]]] : memref +// CHECK: %[[VAL_37:.*]] = addi %[[VAL_27]], %[[VAL_5]] : index +// CHECK: %[[VAL_38:.*]] = load %[[VAL_8]]{{\[}}%[[VAL_37]]] : memref +// CHECK: %[[VAL_39:.*]] = load %[[VAL_13]]{{\[}}%[[VAL_28]]] : memref +// CHECK: %[[VAL_40:.*]] = addi %[[VAL_28]], %[[VAL_5]] : index +// CHECK: %[[VAL_41:.*]] = load %[[VAL_13]]{{\[}}%[[VAL_40]]] : memref +// CHECK: %[[VAL_42:.*]]:2 = scf.while (%[[VAL_43:.*]] = %[[VAL_36]], %[[VAL_44:.*]] = %[[VAL_39]]) : (index, index) -> (index, index) { +// CHECK: %[[VAL_45:.*]] = cmpi ult, %[[VAL_43]], %[[VAL_38]] : index +// CHECK: %[[VAL_46:.*]] = cmpi ult, %[[VAL_44]], %[[VAL_41]] : index +// CHECK: %[[VAL_47:.*]] = and %[[VAL_45]], %[[VAL_46]] : i1 +// CHECK: scf.condition(%[[VAL_47]]) %[[VAL_43]], %[[VAL_44]] : index, index // CHECK: } do { -// CHECK: ^bb0(%[[VAL_47:.*]]: index, %[[VAL_48:.*]]: index): -// CHECK: %[[VAL_49:.*]] = load %[[VAL_8]]{{\[}}%[[VAL_47]]] : memref -// CHECK: %[[VAL_50:.*]] = load %[[VAL_13]]{{\[}}%[[VAL_48]]] : memref -// CHECK: %[[VAL_51:.*]] = cmpi ult, %[[VAL_50]], %[[VAL_49]] : index -// CHECK: %[[VAL_52:.*]] = select %[[VAL_51]], %[[VAL_50]], %[[VAL_49]] : index -// CHECK: %[[VAL_53:.*]] = cmpi eq, %[[VAL_49]], %[[VAL_52]] : index -// CHECK: %[[VAL_54:.*]] = cmpi eq, %[[VAL_50]], %[[VAL_52]] : index -// CHECK: %[[VAL_55:.*]] = and %[[VAL_53]], %[[VAL_54]] : i1 -// CHECK: scf.if %[[VAL_55]] { -// CHECK: %[[VAL_56:.*]] = load %[[VAL_9]]{{\[}}%[[VAL_47]]] : memref -// CHECK: %[[VAL_57:.*]] = load %[[VAL_14]]{{\[}}%[[VAL_48]]] : memref -// CHECK: %[[VAL_58:.*]] = addf %[[VAL_56]], %[[VAL_57]] : f32 -// CHECK: store %[[VAL_58]], %[[VAL_15]]{{\[}}%[[VAL_31]], %[[VAL_52]]] : memref<32x16xf32> +// CHECK: ^bb0(%[[VAL_48:.*]]: index, %[[VAL_49:.*]]: index): +// CHECK: %[[VAL_50:.*]] = load %[[VAL_9]]{{\[}}%[[VAL_48]]] : memref +// CHECK: %[[VAL_51:.*]] = load %[[VAL_14]]{{\[}}%[[VAL_49]]] : memref +// CHECK: %[[VAL_52:.*]] = cmpi ult, %[[VAL_51]], %[[VAL_50]] : index +// CHECK: %[[VAL_53:.*]] = select %[[VAL_52]], %[[VAL_51]], %[[VAL_50]] : index +// CHECK: %[[VAL_54:.*]] = cmpi eq, %[[VAL_50]], %[[VAL_53]] : index +// CHECK: %[[VAL_55:.*]] = cmpi eq, %[[VAL_51]], %[[VAL_53]] : index +// CHECK: %[[VAL_56:.*]] = and %[[VAL_54]], %[[VAL_55]] : i1 +// CHECK: scf.if %[[VAL_56]] { +// CHECK: %[[VAL_57:.*]] = load %[[VAL_10]]{{\[}}%[[VAL_48]]] : memref +// CHECK: %[[VAL_58:.*]] = load %[[VAL_15]]{{\[}}%[[VAL_49]]] : memref +// CHECK: %[[VAL_59:.*]] = addf %[[VAL_57]], %[[VAL_58]] : f32 +// CHECK: store %[[VAL_59]], %[[VAL_16]]{{\[}}%[[VAL_32]], %[[VAL_53]]] : memref<32x16xf32> // CHECK: } else { -// CHECK: %[[VAL_59:.*]] = cmpi eq, %[[VAL_49]], %[[VAL_52]] : index -// CHECK: scf.if %[[VAL_59]] { -// CHECK: %[[VAL_60:.*]] = load %[[VAL_9]]{{\[}}%[[VAL_47]]] : memref -// CHECK: store %[[VAL_60]], %[[VAL_15]]{{\[}}%[[VAL_31]], %[[VAL_52]]] : memref<32x16xf32> +// CHECK: %[[VAL_60:.*]] = cmpi eq, %[[VAL_50]], %[[VAL_53]] : index +// CHECK: scf.if %[[VAL_60]] { +// CHECK: %[[VAL_61:.*]] = load %[[VAL_10]]{{\[}}%[[VAL_48]]] : memref +// CHECK: store %[[VAL_61]], %[[VAL_16]]{{\[}}%[[VAL_32]], %[[VAL_53]]] : memref<32x16xf32> // CHECK: } else { -// CHECK: %[[VAL_61:.*]] = cmpi eq, %[[VAL_50]], %[[VAL_52]] : index -// CHECK: scf.if %[[VAL_61]] { -// CHECK: %[[VAL_62:.*]] = load %[[VAL_14]]{{\[}}%[[VAL_48]]] : memref -// CHECK: store %[[VAL_62]], %[[VAL_15]]{{\[}}%[[VAL_31]], %[[VAL_52]]] : memref<32x16xf32> +// CHECK: %[[VAL_62:.*]] = cmpi eq, %[[VAL_51]], %[[VAL_53]] : index +// CHECK: scf.if %[[VAL_62]] { +// CHECK: %[[VAL_63:.*]] = load %[[VAL_15]]{{\[}}%[[VAL_49]]] : memref +// CHECK: store %[[VAL_63]], %[[VAL_16]]{{\[}}%[[VAL_32]], %[[VAL_53]]] : memref<32x16xf32> // CHECK: } else { // CHECK: } // CHECK: } // CHECK: } -// CHECK: %[[VAL_63:.*]] = cmpi eq, %[[VAL_49]], %[[VAL_52]] : index -// CHECK: %[[VAL_64:.*]] = addi %[[VAL_47]], %[[VAL_4]] : index -// CHECK: %[[VAL_65:.*]] = select %[[VAL_63]], %[[VAL_64]], %[[VAL_47]] : index -// CHECK: %[[VAL_66:.*]] = cmpi eq, %[[VAL_50]], %[[VAL_52]] : index -// CHECK: %[[VAL_67:.*]] = addi %[[VAL_48]], %[[VAL_4]] : index -// CHECK: %[[VAL_68:.*]] = select %[[VAL_66]], %[[VAL_67]], %[[VAL_48]] : index -// CHECK: scf.yield %[[VAL_65]], %[[VAL_68]] : index, index +// CHECK: %[[VAL_64:.*]] = cmpi eq, %[[VAL_50]], %[[VAL_53]] : index +// CHECK: %[[VAL_65:.*]] = addi %[[VAL_48]], %[[VAL_5]] : index +// CHECK: %[[VAL_66:.*]] = select %[[VAL_64]], %[[VAL_65]], %[[VAL_48]] : index +// CHECK: %[[VAL_67:.*]] = cmpi eq, %[[VAL_51]], %[[VAL_53]] : index +// CHECK: %[[VAL_68:.*]] = addi %[[VAL_49]], %[[VAL_5]] : index +// CHECK: %[[VAL_69:.*]] = select %[[VAL_67]], %[[VAL_68]], %[[VAL_49]] : index +// CHECK: scf.yield %[[VAL_66]], %[[VAL_69]] : index, index // CHECK: } -// CHECK: scf.for %[[VAL_69:.*]] = %[[VAL_70:.*]]#0 to %[[VAL_37]] step %[[VAL_4]] { -// CHECK: %[[VAL_71:.*]] = load %[[VAL_8]]{{\[}}%[[VAL_69]]] : memref -// CHECK: %[[VAL_72:.*]] = load %[[VAL_9]]{{\[}}%[[VAL_69]]] : memref -// CHECK: store %[[VAL_72]], %[[VAL_15]]{{\[}}%[[VAL_31]], %[[VAL_71]]] : memref<32x16xf32> +// CHECK: scf.for %[[VAL_70:.*]] = %[[VAL_71:.*]]#0 to %[[VAL_38]] step %[[VAL_5]] { +// CHECK: %[[VAL_72:.*]] = load %[[VAL_9]]{{\[}}%[[VAL_70]]] : memref +// CHECK: %[[VAL_73:.*]] = load %[[VAL_10]]{{\[}}%[[VAL_70]]] : memref +// CHECK: store %[[VAL_73]], %[[VAL_16]]{{\[}}%[[VAL_32]], %[[VAL_72]]] : memref<32x16xf32> // CHECK: } -// CHECK: scf.for %[[VAL_73:.*]] = %[[VAL_74:.*]]#1 to %[[VAL_40]] step %[[VAL_4]] { -// CHECK: %[[VAL_75:.*]] = load %[[VAL_13]]{{\[}}%[[VAL_73]]] : memref -// CHECK: %[[VAL_76:.*]] = load %[[VAL_14]]{{\[}}%[[VAL_73]]] : memref -// CHECK: store %[[VAL_76]], %[[VAL_15]]{{\[}}%[[VAL_31]], %[[VAL_75]]] : memref<32x16xf32> +// CHECK: scf.for %[[VAL_74:.*]] = %[[VAL_75:.*]]#1 to %[[VAL_41]] step %[[VAL_5]] { +// CHECK: %[[VAL_76:.*]] = load %[[VAL_14]]{{\[}}%[[VAL_74]]] : memref +// CHECK: %[[VAL_77:.*]] = load %[[VAL_15]]{{\[}}%[[VAL_74]]] : memref +// CHECK: store %[[VAL_77]], %[[VAL_16]]{{\[}}%[[VAL_32]], %[[VAL_76]]] : memref<32x16xf32> // CHECK: } // CHECK: } else { -// CHECK: %[[VAL_77:.*]] = cmpi eq, %[[VAL_28]], %[[VAL_31]] : index -// CHECK: scf.if %[[VAL_77]] { -// CHECK: %[[VAL_78:.*]] = load %[[VAL_7]]{{\[}}%[[VAL_26]]] : memref -// CHECK: %[[VAL_79:.*]] = addi %[[VAL_26]], %[[VAL_4]] : index -// CHECK: %[[VAL_80:.*]] = load %[[VAL_7]]{{\[}}%[[VAL_79]]] : memref -// CHECK: scf.for %[[VAL_81:.*]] = %[[VAL_78]] to %[[VAL_80]] step %[[VAL_4]] { -// CHECK: %[[VAL_82:.*]] = load %[[VAL_8]]{{\[}}%[[VAL_81]]] : memref -// CHECK: %[[VAL_83:.*]] = load %[[VAL_9]]{{\[}}%[[VAL_81]]] : memref -// CHECK: store %[[VAL_83]], %[[VAL_15]]{{\[}}%[[VAL_31]], %[[VAL_82]]] : memref<32x16xf32> +// CHECK: %[[VAL_78:.*]] = cmpi eq, %[[VAL_29]], %[[VAL_32]] : index +// CHECK: scf.if %[[VAL_78]] { +// CHECK: %[[VAL_79:.*]] = load %[[VAL_8]]{{\[}}%[[VAL_27]]] : memref +// CHECK: %[[VAL_80:.*]] = addi %[[VAL_27]], %[[VAL_5]] : index +// CHECK: %[[VAL_81:.*]] = load %[[VAL_8]]{{\[}}%[[VAL_80]]] : memref +// CHECK: scf.for %[[VAL_82:.*]] = %[[VAL_79]] to %[[VAL_81]] step %[[VAL_5]] { +// CHECK: %[[VAL_83:.*]] = load %[[VAL_9]]{{\[}}%[[VAL_82]]] : memref +// CHECK: %[[VAL_84:.*]] = load %[[VAL_10]]{{\[}}%[[VAL_82]]] : memref +// CHECK: store %[[VAL_84]], %[[VAL_16]]{{\[}}%[[VAL_32]], %[[VAL_83]]] : memref<32x16xf32> // CHECK: } // CHECK: } else { -// CHECK: %[[VAL_84:.*]] = cmpi eq, %[[VAL_29]], %[[VAL_31]] : index -// CHECK: scf.if %[[VAL_84]] { -// CHECK: %[[VAL_85:.*]] = load %[[VAL_12]]{{\[}}%[[VAL_27]]] : memref -// CHECK: %[[VAL_86:.*]] = addi %[[VAL_27]], %[[VAL_4]] : index -// CHECK: %[[VAL_87:.*]] = load %[[VAL_12]]{{\[}}%[[VAL_86]]] : memref -// CHECK: scf.for %[[VAL_88:.*]] = %[[VAL_85]] to %[[VAL_87]] step %[[VAL_4]] { -// CHECK: %[[VAL_89:.*]] = load %[[VAL_13]]{{\[}}%[[VAL_88]]] : memref -// CHECK: %[[VAL_90:.*]] = load %[[VAL_14]]{{\[}}%[[VAL_88]]] : memref -// CHECK: store %[[VAL_90]], %[[VAL_15]]{{\[}}%[[VAL_31]], %[[VAL_89]]] : memref<32x16xf32> +// CHECK: %[[VAL_85:.*]] = cmpi eq, %[[VAL_30]], %[[VAL_32]] : index +// CHECK: scf.if %[[VAL_85]] { +// CHECK: %[[VAL_86:.*]] = load %[[VAL_13]]{{\[}}%[[VAL_28]]] : memref +// CHECK: %[[VAL_87:.*]] = addi %[[VAL_28]], %[[VAL_5]] : index +// CHECK: %[[VAL_88:.*]] = load %[[VAL_13]]{{\[}}%[[VAL_87]]] : memref +// CHECK: scf.for %[[VAL_89:.*]] = %[[VAL_86]] to %[[VAL_88]] step %[[VAL_5]] { +// CHECK: %[[VAL_90:.*]] = load %[[VAL_14]]{{\[}}%[[VAL_89]]] : memref +// CHECK: %[[VAL_91:.*]] = load %[[VAL_15]]{{\[}}%[[VAL_89]]] : memref +// CHECK: store %[[VAL_91]], %[[VAL_16]]{{\[}}%[[VAL_32]], %[[VAL_90]]] : memref<32x16xf32> // CHECK: } // CHECK: } else { // CHECK: } // CHECK: } // CHECK: } -// CHECK: %[[VAL_91:.*]] = cmpi eq, %[[VAL_28]], %[[VAL_31]] : index -// CHECK: %[[VAL_92:.*]] = addi %[[VAL_26]], %[[VAL_4]] : index -// CHECK: %[[VAL_93:.*]] = select %[[VAL_91]], %[[VAL_92]], %[[VAL_26]] : index -// CHECK: %[[VAL_94:.*]] = cmpi eq, %[[VAL_29]], %[[VAL_31]] : index -// CHECK: %[[VAL_95:.*]] = addi %[[VAL_27]], %[[VAL_4]] : index -// CHECK: %[[VAL_96:.*]] = select %[[VAL_94]], %[[VAL_95]], %[[VAL_27]] : index -// CHECK: scf.yield %[[VAL_93]], %[[VAL_96]] : index, index +// CHECK: %[[VAL_92:.*]] = cmpi eq, %[[VAL_29]], %[[VAL_32]] : index +// CHECK: %[[VAL_93:.*]] = addi %[[VAL_27]], %[[VAL_5]] : index +// CHECK: %[[VAL_94:.*]] = select %[[VAL_92]], %[[VAL_93]], %[[VAL_27]] : index +// CHECK: %[[VAL_95:.*]] = cmpi eq, %[[VAL_30]], %[[VAL_32]] : index +// CHECK: %[[VAL_96:.*]] = addi %[[VAL_28]], %[[VAL_5]] : index +// CHECK: %[[VAL_97:.*]] = select %[[VAL_95]], %[[VAL_96]], %[[VAL_28]] : index +// CHECK: scf.yield %[[VAL_94]], %[[VAL_97]] : index, index // CHECK: } -// CHECK: scf.for %[[VAL_97:.*]] = %[[VAL_98:.*]]#0 to %[[VAL_17]] step %[[VAL_4]] { -// CHECK: %[[VAL_99:.*]] = load %[[VAL_6]]{{\[}}%[[VAL_97]]] : memref -// CHECK: %[[VAL_100:.*]] = load %[[VAL_7]]{{\[}}%[[VAL_97]]] : memref -// CHECK: %[[VAL_101:.*]] = addi %[[VAL_97]], %[[VAL_4]] : index -// CHECK: %[[VAL_102:.*]] = load %[[VAL_7]]{{\[}}%[[VAL_101]]] : memref -// CHECK: scf.for %[[VAL_103:.*]] = %[[VAL_100]] to %[[VAL_102]] step %[[VAL_4]] { -// CHECK: %[[VAL_104:.*]] = load %[[VAL_8]]{{\[}}%[[VAL_103]]] : memref -// CHECK: %[[VAL_105:.*]] = load %[[VAL_9]]{{\[}}%[[VAL_103]]] : memref -// CHECK: store %[[VAL_105]], %[[VAL_15]]{{\[}}%[[VAL_99]], %[[VAL_104]]] : memref<32x16xf32> +// CHECK: scf.for %[[VAL_98:.*]] = %[[VAL_99:.*]]#0 to %[[VAL_18]] step %[[VAL_5]] { +// CHECK: %[[VAL_100:.*]] = load %[[VAL_7]]{{\[}}%[[VAL_98]]] : memref +// CHECK: %[[VAL_101:.*]] = load %[[VAL_8]]{{\[}}%[[VAL_98]]] : memref +// CHECK: %[[VAL_102:.*]] = addi %[[VAL_98]], %[[VAL_5]] : index +// CHECK: %[[VAL_103:.*]] = load %[[VAL_8]]{{\[}}%[[VAL_102]]] : memref +// CHECK: scf.for %[[VAL_104:.*]] = %[[VAL_101]] to %[[VAL_103]] step %[[VAL_5]] { +// CHECK: %[[VAL_105:.*]] = load %[[VAL_9]]{{\[}}%[[VAL_104]]] : memref +// CHECK: %[[VAL_106:.*]] = load %[[VAL_10]]{{\[}}%[[VAL_104]]] : memref +// CHECK: store %[[VAL_106]], %[[VAL_16]]{{\[}}%[[VAL_100]], %[[VAL_105]]] : memref<32x16xf32> // CHECK: } // CHECK: } -// CHECK: scf.for %[[VAL_106:.*]] = %[[VAL_107:.*]]#1 to %[[VAL_19]] step %[[VAL_4]] { -// CHECK: %[[VAL_108:.*]] = load %[[VAL_11]]{{\[}}%[[VAL_106]]] : memref -// CHECK: %[[VAL_109:.*]] = load %[[VAL_12]]{{\[}}%[[VAL_106]]] : memref -// CHECK: %[[VAL_110:.*]] = addi %[[VAL_106]], %[[VAL_4]] : index -// CHECK: %[[VAL_111:.*]] = load %[[VAL_12]]{{\[}}%[[VAL_110]]] : memref -// CHECK: scf.for %[[VAL_112:.*]] = %[[VAL_109]] to %[[VAL_111]] step %[[VAL_4]] { -// CHECK: %[[VAL_113:.*]] = load %[[VAL_13]]{{\[}}%[[VAL_112]]] : memref -// CHECK: %[[VAL_114:.*]] = load %[[VAL_14]]{{\[}}%[[VAL_112]]] : memref -// CHECK: store %[[VAL_114]], %[[VAL_15]]{{\[}}%[[VAL_108]], %[[VAL_113]]] : memref<32x16xf32> +// CHECK: scf.for %[[VAL_107:.*]] = %[[VAL_108:.*]]#1 to %[[VAL_20]] step %[[VAL_5]] { +// CHECK: %[[VAL_109:.*]] = load %[[VAL_12]]{{\[}}%[[VAL_107]]] : memref +// CHECK: %[[VAL_110:.*]] = load %[[VAL_13]]{{\[}}%[[VAL_107]]] : memref +// CHECK: %[[VAL_111:.*]] = addi %[[VAL_107]], %[[VAL_5]] : index +// CHECK: %[[VAL_112:.*]] = load %[[VAL_13]]{{\[}}%[[VAL_111]]] : memref +// CHECK: scf.for %[[VAL_113:.*]] = %[[VAL_110]] to %[[VAL_112]] step %[[VAL_5]] { +// CHECK: %[[VAL_114:.*]] = load %[[VAL_14]]{{\[}}%[[VAL_113]]] : memref +// CHECK: %[[VAL_115:.*]] = load %[[VAL_15]]{{\[}}%[[VAL_113]]] : memref +// CHECK: store %[[VAL_115]], %[[VAL_16]]{{\[}}%[[VAL_109]], %[[VAL_114]]] : memref<32x16xf32> // CHECK: } // CHECK: } -// CHECK: %[[VAL_115:.*]] = tensor_load %[[VAL_15]] : memref<32x16xf32> -// CHECK: return %[[VAL_115]] : tensor<32x16xf32> +// CHECK: %[[VAL_116:.*]] = tensor_load %[[VAL_16]] : memref<32x16xf32> +// CHECK: return %[[VAL_116]] : tensor<32x16xf32> // CHECK: } -func @add_sd_ds(%arga: tensor<32x16xf32>, %argb: tensor<32x16xf32>) -> tensor<32x16xf32> { +func @add_sd_ds(%arga: tensor<32x16xf32>, %argb: tensor<32x16xf32>, %argx: tensor<32x16xf32>) -> tensor<32x16xf32> { %0 = linalg.generic #trait_ss_ss ins(%arga, %argb: tensor<32x16xf32>, tensor<32x16xf32>) - outs(%arga : tensor<32x16xf32>) { - ^bb(%a: f32, %b: f32, %s: f32): + outs(%argx : tensor<32x16xf32>) { + ^bb(%a: f32, %b: f32, %x: f32): %0 = addf %a, %b : f32 linalg.yield %0 : f32 } -> tensor<32x16xf32> @@ -918,94 +929,95 @@ } // CHECK-LABEL: func @mul_sd_ds( -// CHECK-SAME: %[[VAL_0:.*]]: tensor<32x16xf32>, -// CHECK-SAME: %[[VAL_1:.*]]: tensor<32x16xf32>) -> tensor<32x16xf32> { -// CHECK: %[[VAL_2:.*]] = constant 999 : index -// CHECK: %[[VAL_3:.*]] = constant 0 : index -// CHECK: %[[VAL_4:.*]] = constant 1 : index -// CHECK: %[[VAL_5:.*]] = alloca(%[[VAL_2]]) : memref -// CHECK: %[[VAL_6:.*]] = alloca(%[[VAL_2]]) : memref -// CHECK: %[[VAL_7:.*]] = alloca(%[[VAL_2]]) : memref -// CHECK: %[[VAL_8:.*]] = alloca(%[[VAL_2]]) : memref -// CHECK: %[[VAL_9:.*]] = alloca(%[[VAL_2]]) : memref -// CHECK: %[[VAL_10:.*]] = alloca(%[[VAL_2]]) : memref -// CHECK: %[[VAL_11:.*]] = alloca(%[[VAL_2]]) : memref -// CHECK: %[[VAL_12:.*]] = alloca(%[[VAL_2]]) : memref -// CHECK: %[[VAL_13:.*]] = alloca(%[[VAL_2]]) : memref -// CHECK: %[[VAL_14:.*]] = alloca(%[[VAL_2]]) : memref -// CHECK: %[[VAL_15:.*]] = alloca() : memref<32x16xf32> -// CHECK: %[[VAL_16:.*]] = load %[[VAL_5]]{{\[}}%[[VAL_3]]] : memref -// CHECK: %[[VAL_17:.*]] = load %[[VAL_5]]{{\[}}%[[VAL_4]]] : memref -// CHECK: %[[VAL_18:.*]] = load %[[VAL_10]]{{\[}}%[[VAL_3]]] : memref -// CHECK: %[[VAL_19:.*]] = load %[[VAL_10]]{{\[}}%[[VAL_4]]] : memref -// CHECK: %[[VAL_20:.*]]:2 = scf.while (%[[VAL_21:.*]] = %[[VAL_16]], %[[VAL_22:.*]] = %[[VAL_18]]) : (index, index) -> (index, index) { -// CHECK: %[[VAL_23:.*]] = cmpi ult, %[[VAL_21]], %[[VAL_17]] : index -// CHECK: %[[VAL_24:.*]] = cmpi ult, %[[VAL_22]], %[[VAL_19]] : index -// CHECK: %[[VAL_25:.*]] = and %[[VAL_23]], %[[VAL_24]] : i1 -// CHECK: scf.condition(%[[VAL_25]]) %[[VAL_21]], %[[VAL_22]] : index, index +// CHECK-SAME: %[[VAL_0:.*0]]: tensor<32x16xf32>, +// CHECK-SAME: %[[VAL_1:.*1]]: tensor<32x16xf32>, +// CHECK-SAME: %[[VAL_2:.*2]]: tensor<32x16xf32>) -> tensor<32x16xf32> { +// CHECK: %[[VAL_3:.*]] = constant 999 : index +// CHECK: %[[VAL_4:.*]] = constant 0 : index +// CHECK: %[[VAL_5:.*]] = constant 1 : index +// CHECK: %[[VAL_6:.*]] = alloca(%[[VAL_3]]) : memref +// CHECK: %[[VAL_7:.*]] = alloca(%[[VAL_3]]) : memref +// CHECK: %[[VAL_8:.*]] = alloca(%[[VAL_3]]) : memref +// CHECK: %[[VAL_9:.*]] = alloca(%[[VAL_3]]) : memref +// CHECK: %[[VAL_10:.*]] = alloca(%[[VAL_3]]) : memref +// CHECK: %[[VAL_11:.*]] = alloca(%[[VAL_3]]) : memref +// CHECK: %[[VAL_12:.*]] = alloca(%[[VAL_3]]) : memref +// CHECK: %[[VAL_13:.*]] = alloca(%[[VAL_3]]) : memref +// CHECK: %[[VAL_14:.*]] = alloca(%[[VAL_3]]) : memref +// CHECK: %[[VAL_15:.*]] = alloca(%[[VAL_3]]) : memref +// CHECK: %[[VAL_16:.*]] = alloca() : memref<32x16xf32> +// CHECK: %[[VAL_17:.*]] = load %[[VAL_6]]{{\[}}%[[VAL_4]]] : memref +// CHECK: %[[VAL_18:.*]] = load %[[VAL_6]]{{\[}}%[[VAL_5]]] : memref +// CHECK: %[[VAL_19:.*]] = load %[[VAL_11]]{{\[}}%[[VAL_4]]] : memref +// CHECK: %[[VAL_20:.*]] = load %[[VAL_11]]{{\[}}%[[VAL_5]]] : memref +// CHECK: %[[VAL_21:.*]]:2 = scf.while (%[[VAL_22:.*]] = %[[VAL_17]], %[[VAL_23:.*]] = %[[VAL_19]]) : (index, index) -> (index, index) { +// CHECK: %[[VAL_24:.*]] = cmpi ult, %[[VAL_22]], %[[VAL_18]] : index +// CHECK: %[[VAL_25:.*]] = cmpi ult, %[[VAL_23]], %[[VAL_20]] : index +// CHECK: %[[VAL_26:.*]] = and %[[VAL_24]], %[[VAL_25]] : i1 +// CHECK: scf.condition(%[[VAL_26]]) %[[VAL_22]], %[[VAL_23]] : index, index // CHECK: } do { -// CHECK: ^bb0(%[[VAL_26:.*]]: index, %[[VAL_27:.*]]: index): -// CHECK: %[[VAL_28:.*]] = load %[[VAL_6]]{{\[}}%[[VAL_26]]] : memref -// CHECK: %[[VAL_29:.*]] = load %[[VAL_11]]{{\[}}%[[VAL_27]]] : memref -// CHECK: %[[VAL_30:.*]] = cmpi ult, %[[VAL_29]], %[[VAL_28]] : index -// CHECK: %[[VAL_31:.*]] = select %[[VAL_30]], %[[VAL_29]], %[[VAL_28]] : index -// CHECK: %[[VAL_32:.*]] = cmpi eq, %[[VAL_28]], %[[VAL_31]] : index -// CHECK: %[[VAL_33:.*]] = cmpi eq, %[[VAL_29]], %[[VAL_31]] : index -// CHECK: %[[VAL_34:.*]] = and %[[VAL_32]], %[[VAL_33]] : i1 -// CHECK: scf.if %[[VAL_34]] { -// CHECK: %[[VAL_35:.*]] = load %[[VAL_7]]{{\[}}%[[VAL_26]]] : memref -// CHECK: %[[VAL_36:.*]] = addi %[[VAL_26]], %[[VAL_4]] : index -// CHECK: %[[VAL_37:.*]] = load %[[VAL_7]]{{\[}}%[[VAL_36]]] : memref -// CHECK: %[[VAL_38:.*]] = load %[[VAL_12]]{{\[}}%[[VAL_27]]] : memref -// CHECK: %[[VAL_39:.*]] = addi %[[VAL_27]], %[[VAL_4]] : index -// CHECK: %[[VAL_40:.*]] = load %[[VAL_12]]{{\[}}%[[VAL_39]]] : memref -// CHECK: %[[VAL_41:.*]]:2 = scf.while (%[[VAL_42:.*]] = %[[VAL_35]], %[[VAL_43:.*]] = %[[VAL_38]]) : (index, index) -> (index, index) { -// CHECK: %[[VAL_44:.*]] = cmpi ult, %[[VAL_42]], %[[VAL_37]] : index -// CHECK: %[[VAL_45:.*]] = cmpi ult, %[[VAL_43]], %[[VAL_40]] : index -// CHECK: %[[VAL_46:.*]] = and %[[VAL_44]], %[[VAL_45]] : i1 -// CHECK: scf.condition(%[[VAL_46]]) %[[VAL_42]], %[[VAL_43]] : index, index +// CHECK: ^bb0(%[[VAL_27:.*]]: index, %[[VAL_28:.*]]: index): +// CHECK: %[[VAL_29:.*]] = load %[[VAL_7]]{{\[}}%[[VAL_27]]] : memref +// CHECK: %[[VAL_30:.*]] = load %[[VAL_12]]{{\[}}%[[VAL_28]]] : memref +// CHECK: %[[VAL_31:.*]] = cmpi ult, %[[VAL_30]], %[[VAL_29]] : index +// CHECK: %[[VAL_32:.*]] = select %[[VAL_31]], %[[VAL_30]], %[[VAL_29]] : index +// CHECK: %[[VAL_33:.*]] = cmpi eq, %[[VAL_29]], %[[VAL_32]] : index +// CHECK: %[[VAL_34:.*]] = cmpi eq, %[[VAL_30]], %[[VAL_32]] : index +// CHECK: %[[VAL_35:.*]] = and %[[VAL_33]], %[[VAL_34]] : i1 +// CHECK: scf.if %[[VAL_35]] { +// CHECK: %[[VAL_36:.*]] = load %[[VAL_8]]{{\[}}%[[VAL_27]]] : memref +// CHECK: %[[VAL_37:.*]] = addi %[[VAL_27]], %[[VAL_5]] : index +// CHECK: %[[VAL_38:.*]] = load %[[VAL_8]]{{\[}}%[[VAL_37]]] : memref +// CHECK: %[[VAL_39:.*]] = load %[[VAL_13]]{{\[}}%[[VAL_28]]] : memref +// CHECK: %[[VAL_40:.*]] = addi %[[VAL_28]], %[[VAL_5]] : index +// CHECK: %[[VAL_41:.*]] = load %[[VAL_13]]{{\[}}%[[VAL_40]]] : memref +// CHECK: %[[VAL_42:.*]]:2 = scf.while (%[[VAL_43:.*]] = %[[VAL_36]], %[[VAL_44:.*]] = %[[VAL_39]]) : (index, index) -> (index, index) { +// CHECK: %[[VAL_45:.*]] = cmpi ult, %[[VAL_43]], %[[VAL_38]] : index +// CHECK: %[[VAL_46:.*]] = cmpi ult, %[[VAL_44]], %[[VAL_41]] : index +// CHECK: %[[VAL_47:.*]] = and %[[VAL_45]], %[[VAL_46]] : i1 +// CHECK: scf.condition(%[[VAL_47]]) %[[VAL_43]], %[[VAL_44]] : index, index // CHECK: } do { -// CHECK: ^bb0(%[[VAL_47:.*]]: index, %[[VAL_48:.*]]: index): -// CHECK: %[[VAL_49:.*]] = load %[[VAL_8]]{{\[}}%[[VAL_47]]] : memref -// CHECK: %[[VAL_50:.*]] = load %[[VAL_13]]{{\[}}%[[VAL_48]]] : memref -// CHECK: %[[VAL_51:.*]] = cmpi ult, %[[VAL_50]], %[[VAL_49]] : index -// CHECK: %[[VAL_52:.*]] = select %[[VAL_51]], %[[VAL_50]], %[[VAL_49]] : index -// CHECK: %[[VAL_53:.*]] = cmpi eq, %[[VAL_49]], %[[VAL_52]] : index -// CHECK: %[[VAL_54:.*]] = cmpi eq, %[[VAL_50]], %[[VAL_52]] : index -// CHECK: %[[VAL_55:.*]] = and %[[VAL_53]], %[[VAL_54]] : i1 -// CHECK: scf.if %[[VAL_55]] { -// CHECK: %[[VAL_56:.*]] = load %[[VAL_9]]{{\[}}%[[VAL_47]]] : memref -// CHECK: %[[VAL_57:.*]] = load %[[VAL_14]]{{\[}}%[[VAL_48]]] : memref -// CHECK: %[[VAL_58:.*]] = mulf %[[VAL_56]], %[[VAL_57]] : f32 -// CHECK: store %[[VAL_58]], %[[VAL_15]]{{\[}}%[[VAL_31]], %[[VAL_52]]] : memref<32x16xf32> +// CHECK: ^bb0(%[[VAL_48:.*]]: index, %[[VAL_49:.*]]: index): +// CHECK: %[[VAL_50:.*]] = load %[[VAL_9]]{{\[}}%[[VAL_48]]] : memref +// CHECK: %[[VAL_51:.*]] = load %[[VAL_14]]{{\[}}%[[VAL_49]]] : memref +// CHECK: %[[VAL_52:.*]] = cmpi ult, %[[VAL_51]], %[[VAL_50]] : index +// CHECK: %[[VAL_53:.*]] = select %[[VAL_52]], %[[VAL_51]], %[[VAL_50]] : index +// CHECK: %[[VAL_54:.*]] = cmpi eq, %[[VAL_50]], %[[VAL_53]] : index +// CHECK: %[[VAL_55:.*]] = cmpi eq, %[[VAL_51]], %[[VAL_53]] : index +// CHECK: %[[VAL_56:.*]] = and %[[VAL_54]], %[[VAL_55]] : i1 +// CHECK: scf.if %[[VAL_56]] { +// CHECK: %[[VAL_57:.*]] = load %[[VAL_10]]{{\[}}%[[VAL_48]]] : memref +// CHECK: %[[VAL_58:.*]] = load %[[VAL_15]]{{\[}}%[[VAL_49]]] : memref +// CHECK: %[[VAL_59:.*]] = mulf %[[VAL_57]], %[[VAL_58]] : f32 +// CHECK: store %[[VAL_59]], %[[VAL_16]]{{\[}}%[[VAL_32]], %[[VAL_53]]] : memref<32x16xf32> // CHECK: } else { // CHECK: } -// CHECK: %[[VAL_59:.*]] = cmpi eq, %[[VAL_49]], %[[VAL_52]] : index -// CHECK: %[[VAL_60:.*]] = addi %[[VAL_47]], %[[VAL_4]] : index -// CHECK: %[[VAL_61:.*]] = select %[[VAL_59]], %[[VAL_60]], %[[VAL_47]] : index -// CHECK: %[[VAL_62:.*]] = cmpi eq, %[[VAL_50]], %[[VAL_52]] : index -// CHECK: %[[VAL_63:.*]] = addi %[[VAL_48]], %[[VAL_4]] : index -// CHECK: %[[VAL_64:.*]] = select %[[VAL_62]], %[[VAL_63]], %[[VAL_48]] : index -// CHECK: scf.yield %[[VAL_61]], %[[VAL_64]] : index, index +// CHECK: %[[VAL_60:.*]] = cmpi eq, %[[VAL_50]], %[[VAL_53]] : index +// CHECK: %[[VAL_61:.*]] = addi %[[VAL_48]], %[[VAL_5]] : index +// CHECK: %[[VAL_62:.*]] = select %[[VAL_60]], %[[VAL_61]], %[[VAL_48]] : index +// CHECK: %[[VAL_63:.*]] = cmpi eq, %[[VAL_51]], %[[VAL_53]] : index +// CHECK: %[[VAL_64:.*]] = addi %[[VAL_49]], %[[VAL_5]] : index +// CHECK: %[[VAL_65:.*]] = select %[[VAL_63]], %[[VAL_64]], %[[VAL_49]] : index +// CHECK: scf.yield %[[VAL_62]], %[[VAL_65]] : index, index // CHECK: } // CHECK: } else { // CHECK: } -// CHECK: %[[VAL_65:.*]] = cmpi eq, %[[VAL_28]], %[[VAL_31]] : index -// CHECK: %[[VAL_66:.*]] = addi %[[VAL_26]], %[[VAL_4]] : index -// CHECK: %[[VAL_67:.*]] = select %[[VAL_65]], %[[VAL_66]], %[[VAL_26]] : index -// CHECK: %[[VAL_68:.*]] = cmpi eq, %[[VAL_29]], %[[VAL_31]] : index -// CHECK: %[[VAL_69:.*]] = addi %[[VAL_27]], %[[VAL_4]] : index -// CHECK: %[[VAL_70:.*]] = select %[[VAL_68]], %[[VAL_69]], %[[VAL_27]] : index -// CHECK: scf.yield %[[VAL_67]], %[[VAL_70]] : index, index +// CHECK: %[[VAL_66:.*]] = cmpi eq, %[[VAL_29]], %[[VAL_32]] : index +// CHECK: %[[VAL_67:.*]] = addi %[[VAL_27]], %[[VAL_5]] : index +// CHECK: %[[VAL_68:.*]] = select %[[VAL_66]], %[[VAL_67]], %[[VAL_27]] : index +// CHECK: %[[VAL_69:.*]] = cmpi eq, %[[VAL_30]], %[[VAL_32]] : index +// CHECK: %[[VAL_70:.*]] = addi %[[VAL_28]], %[[VAL_5]] : index +// CHECK: %[[VAL_71:.*]] = select %[[VAL_69]], %[[VAL_70]], %[[VAL_28]] : index +// CHECK: scf.yield %[[VAL_68]], %[[VAL_71]] : index, index // CHECK: } -// CHECK: %[[VAL_71:.*]] = tensor_load %[[VAL_15]] : memref<32x16xf32> -// CHECK: return %[[VAL_71]] : tensor<32x16xf32> +// CHECK: %[[VAL_72:.*]] = tensor_load %[[VAL_16]] : memref<32x16xf32> +// CHECK: return %[[VAL_72]] : tensor<32x16xf32> // CHECK: } -func @mul_sd_ds(%arga: tensor<32x16xf32>, %argb: tensor<32x16xf32>) -> tensor<32x16xf32> { +func @mul_sd_ds(%arga: tensor<32x16xf32>, %argb: tensor<32x16xf32>, %argx: tensor<32x16xf32>) -> tensor<32x16xf32> { %0 = linalg.generic #trait_ss_ss ins(%arga, %argb: tensor<32x16xf32>, tensor<32x16xf32>) - outs(%arga : tensor<32x16xf32>) { - ^bb(%a: f32, %b: f32, %s: f32): + outs(%argx : tensor<32x16xf32>) { + ^bb(%a: f32, %b: f32, %x: f32): %0 = mulf %a, %b : f32 linalg.yield %0 : f32 } -> tensor<32x16xf32> @@ -1028,9 +1040,9 @@ } // CHECK-LABEL: func @matvec( -// CHECK-SAME: %[[VAL_0:.*]]: tensor<16x32xf32>, -// CHECK-SAME: %[[VAL_1:.*]]: tensor<32xf32>, -// CHECK-SAME: %[[VAL_2:.*]]: tensor<16xf32>) -> tensor<16xf32> { +// CHECK-SAME: %[[VAL_0:.*0]]: tensor<16x32xf32>, +// CHECK-SAME: %[[VAL_1:.*1]]: tensor<32xf32>, +// CHECK-SAME: %[[VAL_2:.*2]]: tensor<16xf32>) -> tensor<16xf32> { // CHECK: %[[VAL_3:.*]] = constant 999 : index // CHECK: %[[VAL_4:.*]] = constant 16 : index // CHECK: %[[VAL_5:.*]] = constant 0 : index @@ -1091,22 +1103,22 @@ // CHECK: %[[VAL_4:.*]] = constant 0 : index // CHECK: %[[VAL_5:.*]] = constant 1 : index // CHECK: %[[VAL_6:.*]] = alloca(%[[VAL_2]]) : memref -// CHECK: %[[VAL_8:.*]] = alloca(%[[VAL_2]]) : memref -// CHECK: %[[VAL_9:.*]] = alloca() : memref -// CHECK: scf.for %[[VAL_10:.*]] = %[[VAL_4]] to %[[VAL_3]] step %[[VAL_5]] { -// CHECK: %[[VAL_11:.*]] = load %[[VAL_6]]{{\[}}%[[VAL_10]]] : memref -// CHECK: %[[VAL_12:.*]] = addi %[[VAL_10]], %[[VAL_5]] : index -// CHECK: %[[VAL_13:.*]] = load %[[VAL_6]]{{\[}}%[[VAL_12]]] : memref -// CHECK: %[[VAL_14:.*]] = load %[[VAL_9]][] : memref -// CHECK: %[[VAL_15:.*]] = scf.for %[[VAL_16:.*]] = %[[VAL_11]] to %[[VAL_13]] step %[[VAL_5]] iter_args(%[[VAL_17:.*]] = %[[VAL_14]]) -> (f32) { -// CHECK: %[[VAL_18:.*]] = load %[[VAL_8]]{{\[}}%[[VAL_16]]] : memref -// CHECK: %[[VAL_19:.*]] = addf %[[VAL_17]], %[[VAL_18]] : f32 -// CHECK: scf.yield %[[VAL_19]] : f32 +// CHECK: %[[VAL_7:.*]] = alloca(%[[VAL_2]]) : memref +// CHECK: %[[VAL_8:.*]] = alloca() : memref +// CHECK: scf.for %[[VAL_9:.*]] = %[[VAL_4]] to %[[VAL_3]] step %[[VAL_5]] { +// CHECK: %[[VAL_10:.*]] = load %[[VAL_6]]{{\[}}%[[VAL_9]]] : memref +// CHECK: %[[VAL_11:.*]] = addi %[[VAL_9]], %[[VAL_5]] : index +// CHECK: %[[VAL_12:.*]] = load %[[VAL_6]]{{\[}}%[[VAL_11]]] : memref +// CHECK: %[[VAL_13:.*]] = load %[[VAL_8]][] : memref +// CHECK: %[[VAL_14:.*]] = scf.for %[[VAL_15:.*]] = %[[VAL_10]] to %[[VAL_12]] step %[[VAL_5]] iter_args(%[[VAL_16:.*]] = %[[VAL_13]]) -> (f32) { +// CHECK: %[[VAL_17:.*]] = load %[[VAL_7]]{{\[}}%[[VAL_15]]] : memref +// CHECK: %[[VAL_18:.*]] = addf %[[VAL_16]], %[[VAL_17]] : f32 +// CHECK: scf.yield %[[VAL_18]] : f32 // CHECK: } -// CHECK: store %[[VAL_20:.*]], %[[VAL_9]][] : memref +// CHECK: store %[[VAL_19:.*]], %[[VAL_8]][] : memref // CHECK: } -// CHECK: %[[VAL_21:.*]] = tensor_load %[[VAL_9]] : memref -// CHECK: return %[[VAL_21]] : tensor +// CHECK: %[[VAL_20:.*]] = tensor_load %[[VAL_8]] : memref +// CHECK: return %[[VAL_20]] : tensor // CHECK: } func @sum_reduction(%arga: tensor<10x20xf32>, %argx: tensor) -> tensor { %0 = linalg.generic #trait_sum_reduction @@ -1133,37 +1145,38 @@ } // CHECK-LABEL: func @scale( -// CHECK-SAME: %[[VAL_0:.*]]: tensor) -> tensor { -// CHECK: %[[VAL_1:.*]] = constant 2.000000e+00 : f64 -// CHECK: %[[VAL_2:.*]] = constant 999 : index -// CHECK: %[[VAL_3:.*]] = constant 0 : index -// CHECK: %[[VAL_4:.*]] = constant 1 : index -// CHECK: %[[VAL_5:.*]] = alloca(%[[VAL_2]]) : memref -// CHECK: %[[VAL_6:.*]] = alloca(%[[VAL_2]]) : memref -// CHECK: %[[VAL_7:.*]] = alloca(%[[VAL_2]]) : memref -// CHECK: %[[VAL_8:.*]] = dim %[[VAL_0]], %[[VAL_3]] : tensor -// CHECK: %[[VAL_9:.*]] = dim %[[VAL_0]], %[[VAL_4]] : tensor -// CHECK: %[[VAL_10:.*]] = alloca(%[[VAL_8]], %[[VAL_9]]) : memref -// CHECK: scf.for %[[VAL_11:.*]] = %[[VAL_3]] to %[[VAL_8]] step %[[VAL_4]] { -// CHECK: %[[VAL_12:.*]] = load %[[VAL_5]]{{\[}}%[[VAL_11]]] : memref -// CHECK: %[[VAL_13:.*]] = addi %[[VAL_11]], %[[VAL_4]] : index -// CHECK: %[[VAL_14:.*]] = load %[[VAL_5]]{{\[}}%[[VAL_13]]] : memref -// CHECK: scf.for %[[VAL_15:.*]] = %[[VAL_12]] to %[[VAL_14]] step %[[VAL_4]] { -// CHECK: %[[VAL_16:.*]] = load %[[VAL_6]]{{\[}}%[[VAL_15]]] : memref -// CHECK: %[[VAL_17:.*]] = load %[[VAL_7]]{{\[}}%[[VAL_15]]] : memref -// CHECK: %[[VAL_18:.*]] = mulf %[[VAL_17]], %[[VAL_1]] : f64 -// CHECK: store %[[VAL_18]], %[[VAL_10]]{{\[}}%[[VAL_11]], %[[VAL_16]]] : memref +// CHECK-SAME: %[[VAL_0:.*]]: tensor, +// CHECK-SAME: %[[VAL_1:.*]]: tensor) -> tensor { +// CHECK: %[[VAL_2:.*]] = constant 2.000000e+00 : f64 +// CHECK: %[[VAL_3:.*]] = constant 999 : index +// CHECK: %[[VAL_4:.*]] = constant 0 : index +// CHECK: %[[VAL_5:.*]] = constant 1 : index +// CHECK: %[[VAL_6:.*]] = alloca(%[[VAL_3]]) : memref +// CHECK: %[[VAL_7:.*]] = alloca(%[[VAL_3]]) : memref +// CHECK: %[[VAL_8:.*]] = alloca(%[[VAL_3]]) : memref +// CHECK: %[[VAL_9:.*]] = dim %[[VAL_1]], %[[VAL_4]] : tensor +// CHECK: %[[VAL_10:.*]] = dim %[[VAL_1]], %[[VAL_5]] : tensor +// CHECK: %[[VAL_11:.*]] = alloca(%[[VAL_9]], %[[VAL_10]]) : memref +// CHECK: scf.for %[[VAL_12:.*]] = %[[VAL_4]] to %[[VAL_9]] step %[[VAL_5]] { +// CHECK: %[[VAL_13:.*]] = load %[[VAL_6]]{{\[}}%[[VAL_12]]] : memref +// CHECK: %[[VAL_14:.*]] = addi %[[VAL_12]], %[[VAL_5]] : index +// CHECK: %[[VAL_15:.*]] = load %[[VAL_6]]{{\[}}%[[VAL_14]]] : memref +// CHECK: scf.for %[[VAL_16:.*]] = %[[VAL_13]] to %[[VAL_15]] step %[[VAL_5]] { +// CHECK: %[[VAL_17:.*]] = load %[[VAL_7]]{{\[}}%[[VAL_16]]] : memref +// CHECK: %[[VAL_18:.*]] = load %[[VAL_8]]{{\[}}%[[VAL_16]]] : memref +// CHECK: %[[VAL_19:.*]] = mulf %[[VAL_18]], %[[VAL_2]] : f64 +// CHECK: store %[[VAL_19]], %[[VAL_11]]{{\[}}%[[VAL_12]], %[[VAL_17]]] : memref // CHECK: } // CHECK: } -// CHECK: %[[VAL_19:.*]] = tensor_load %[[VAL_10]] : memref -// CHECK: return %[[VAL_19]] : tensor +// CHECK: %[[VAL_20:.*]] = tensor_load %[[VAL_11]] : memref +// CHECK: return %[[VAL_20]] : tensor // CHECK: } -func @scale(%arga: tensor) -> tensor { +func @scale(%arga: tensor, %argx: tensor) -> tensor { %0 = constant 2.0 : f64 %1 = linalg.generic #trait_scale ins(%arga: tensor) - outs(%arga: tensor) { - ^bb(%a: f64, %s: f64): + outs(%argx: tensor) { + ^bb(%a: f64, %x: f64): %2 = mulf %a, %0 : f64 linalg.yield %2 : f64 } -> tensor @@ -1469,7 +1482,7 @@ tensor, tensor, tensor) - outs(%argx : tensor) { + outs(%argx: tensor) { ^bb(%a : f32, %b : f32, %c : f32, %d : f32, %e : f32, %x : f32): %0 = mulf %a, %b : f32 %1 = mulf %0, %d : f32 diff --git a/mlir/test/Dialect/Linalg/sparse_3d.mlir b/mlir/test/Dialect/Linalg/sparse_3d.mlir --- a/mlir/test/Dialect/Linalg/sparse_3d.mlir +++ b/mlir/test/Dialect/Linalg/sparse_3d.mlir @@ -17,34 +17,35 @@ } // CHECK-LABEL: func @add_ddd( -// CHECK-SAME: %[[VAL_0:.*]]: tensor<32x16x8xf32>, -// CHECK-SAME: %[[VAL_1:.*]]: tensor<32x16x8xf32>) -> tensor<32x16x8xf32> { -// CHECK: %[[VAL_2:.*]] = constant 32 : index -// CHECK: %[[VAL_3:.*]] = constant 16 : index -// CHECK: %[[VAL_4:.*]] = constant 8 : index -// CHECK: %[[VAL_5:.*]] = constant 0 : index -// CHECK: %[[VAL_6:.*]] = constant 1 : index -// CHECK: %[[VAL_7:.*]] = alloca() : memref<32x16x8xf32> +// CHECK-SAME: %[[VAL_0:.*0]]: tensor<32x16x8xf32>, +// CHECK-SAME: %[[VAL_1:.*1]]: tensor<32x16x8xf32>, +// CHECK-SAME: %[[VAL_2:.*2]]: tensor<32x16x8xf32>) -> tensor<32x16x8xf32> { +// CHECK: %[[VAL_3:.*]] = constant 32 : index +// CHECK: %[[VAL_4:.*]] = constant 16 : index +// CHECK: %[[VAL_5:.*]] = constant 8 : index +// CHECK: %[[VAL_6:.*]] = constant 0 : index +// CHECK: %[[VAL_7:.*]] = constant 1 : index // CHECK: %[[VAL_8:.*]] = alloca() : memref<32x16x8xf32> // CHECK: %[[VAL_9:.*]] = alloca() : memref<32x16x8xf32> -// CHECK: scf.for %[[VAL_10:.*]] = %[[VAL_5]] to %[[VAL_2]] step %[[VAL_6]] { -// CHECK: scf.for %[[VAL_11:.*]] = %[[VAL_5]] to %[[VAL_3]] step %[[VAL_6]] { -// CHECK: scf.for %[[VAL_12:.*]] = %[[VAL_5]] to %[[VAL_4]] step %[[VAL_6]] { -// CHECK: %[[VAL_13:.*]] = load %[[VAL_7]]{{\[}}%[[VAL_10]], %[[VAL_11]], %[[VAL_12]]] : memref<32x16x8xf32> -// CHECK: %[[VAL_14:.*]] = load %[[VAL_8]]{{\[}}%[[VAL_10]], %[[VAL_11]], %[[VAL_12]]] : memref<32x16x8xf32> -// CHECK: %[[VAL_15:.*]] = addf %[[VAL_13]], %[[VAL_14]] : f32 -// CHECK: store %[[VAL_15]], %[[VAL_9]]{{\[}}%[[VAL_10]], %[[VAL_11]], %[[VAL_12]]] : memref<32x16x8xf32> +// CHECK: %[[VAL_10:.*]] = alloca() : memref<32x16x8xf32> +// CHECK: scf.for %[[VAL_11:.*]] = %[[VAL_6]] to %[[VAL_3]] step %[[VAL_7]] { +// CHECK: scf.for %[[VAL_12:.*]] = %[[VAL_6]] to %[[VAL_4]] step %[[VAL_7]] { +// CHECK: scf.for %[[VAL_13:.*]] = %[[VAL_6]] to %[[VAL_5]] step %[[VAL_7]] { +// CHECK: %[[VAL_14:.*]] = load %[[VAL_8]]{{\[}}%[[VAL_11]], %[[VAL_12]], %[[VAL_13]]] : memref<32x16x8xf32> +// CHECK: %[[VAL_15:.*]] = load %[[VAL_9]]{{\[}}%[[VAL_11]], %[[VAL_12]], %[[VAL_13]]] : memref<32x16x8xf32> +// CHECK: %[[VAL_16:.*]] = addf %[[VAL_14]], %[[VAL_15]] : f32 +// CHECK: store %[[VAL_16]], %[[VAL_10]]{{\[}}%[[VAL_11]], %[[VAL_12]], %[[VAL_13]]] : memref<32x16x8xf32> // CHECK: } // CHECK: } // CHECK: } -// CHECK: %[[VAL_16:.*]] = tensor_load %[[VAL_9]] : memref<32x16x8xf32> -// CHECK: return %[[VAL_16]] : tensor<32x16x8xf32> +// CHECK: %[[VAL_17:.*]] = tensor_load %[[VAL_10]] : memref<32x16x8xf32> +// CHECK: return %[[VAL_17]] : tensor<32x16x8xf32> // CHECK: } -func @add_ddd(%arga: tensor<32x16x8xf32>, %argb: tensor<32x16x8xf32>) -> tensor<32x16x8xf32> { +func @add_ddd(%arga: tensor<32x16x8xf32>, %argb: tensor<32x16x8xf32>, %argx: tensor<32x16x8xf32>) -> tensor<32x16x8xf32> { %0 = linalg.generic #trait_ddd ins(%arga, %argb: tensor<32x16x8xf32>, tensor<32x16x8xf32>) - outs(%arga : tensor<32x16x8xf32>) { - ^bb(%a: f32, %b: f32, %s: f32): + outs(%argx: tensor<32x16x8xf32>) { + ^bb(%a: f32, %b: f32, %x: f32): %0 = addf %a, %b : f32 linalg.yield %0 : f32 } -> tensor<32x16x8xf32> @@ -52,34 +53,35 @@ } // CHECK-LABEL: func @mul_ddd( -// CHECK-SAME: %[[VAL_0:.*]]: tensor<32x16x8xf32>, -// CHECK-SAME: %[[VAL_1:.*]]: tensor<32x16x8xf32>) -> tensor<32x16x8xf32> { -// CHECK: %[[VAL_2:.*]] = constant 32 : index -// CHECK: %[[VAL_3:.*]] = constant 16 : index -// CHECK: %[[VAL_4:.*]] = constant 8 : index -// CHECK: %[[VAL_5:.*]] = constant 0 : index -// CHECK: %[[VAL_6:.*]] = constant 1 : index -// CHECK: %[[VAL_7:.*]] = alloca() : memref<32x16x8xf32> +// CHECK-SAME: %[[VAL_0:.*0]]: tensor<32x16x8xf32>, +// CHECK-SAME: %[[VAL_1:.*1]]: tensor<32x16x8xf32>, +// CHECK-SAME: %[[VAL_2:.*2]]: tensor<32x16x8xf32>) -> tensor<32x16x8xf32> { +// CHECK: %[[VAL_3:.*]] = constant 32 : index +// CHECK: %[[VAL_4:.*]] = constant 16 : index +// CHECK: %[[VAL_5:.*]] = constant 8 : index +// CHECK: %[[VAL_6:.*]] = constant 0 : index +// CHECK: %[[VAL_7:.*]] = constant 1 : index // CHECK: %[[VAL_8:.*]] = alloca() : memref<32x16x8xf32> // CHECK: %[[VAL_9:.*]] = alloca() : memref<32x16x8xf32> -// CHECK: scf.for %[[VAL_10:.*]] = %[[VAL_5]] to %[[VAL_2]] step %[[VAL_6]] { -// CHECK: scf.for %[[VAL_11:.*]] = %[[VAL_5]] to %[[VAL_3]] step %[[VAL_6]] { -// CHECK: scf.for %[[VAL_12:.*]] = %[[VAL_5]] to %[[VAL_4]] step %[[VAL_6]] { -// CHECK: %[[VAL_13:.*]] = load %[[VAL_7]]{{\[}}%[[VAL_10]], %[[VAL_11]], %[[VAL_12]]] : memref<32x16x8xf32> -// CHECK: %[[VAL_14:.*]] = load %[[VAL_8]]{{\[}}%[[VAL_10]], %[[VAL_11]], %[[VAL_12]]] : memref<32x16x8xf32> -// CHECK: %[[VAL_15:.*]] = mulf %[[VAL_13]], %[[VAL_14]] : f32 -// CHECK: store %[[VAL_15]], %[[VAL_9]]{{\[}}%[[VAL_10]], %[[VAL_11]], %[[VAL_12]]] : memref<32x16x8xf32> +// CHECK: %[[VAL_10:.*]] = alloca() : memref<32x16x8xf32> +// CHECK: scf.for %[[VAL_11:.*]] = %[[VAL_6]] to %[[VAL_3]] step %[[VAL_7]] { +// CHECK: scf.for %[[VAL_12:.*]] = %[[VAL_6]] to %[[VAL_4]] step %[[VAL_7]] { +// CHECK: scf.for %[[VAL_13:.*]] = %[[VAL_6]] to %[[VAL_5]] step %[[VAL_7]] { +// CHECK: %[[VAL_14:.*]] = load %[[VAL_8]]{{\[}}%[[VAL_11]], %[[VAL_12]], %[[VAL_13]]] : memref<32x16x8xf32> +// CHECK: %[[VAL_15:.*]] = load %[[VAL_9]]{{\[}}%[[VAL_11]], %[[VAL_12]], %[[VAL_13]]] : memref<32x16x8xf32> +// CHECK: %[[VAL_16:.*]] = mulf %[[VAL_14]], %[[VAL_15]] : f32 +// CHECK: store %[[VAL_16]], %[[VAL_10]]{{\[}}%[[VAL_11]], %[[VAL_12]], %[[VAL_13]]] : memref<32x16x8xf32> // CHECK: } // CHECK: } // CHECK: } -// CHECK: %[[VAL_16:.*]] = tensor_load %[[VAL_9]] : memref<32x16x8xf32> -// CHECK: return %[[VAL_16]] : tensor<32x16x8xf32> +// CHECK: %[[VAL_17:.*]] = tensor_load %[[VAL_10]] : memref<32x16x8xf32> +// CHECK: return %[[VAL_17]] : tensor<32x16x8xf32> // CHECK: } -func @mul_ddd(%arga: tensor<32x16x8xf32>, %argb: tensor<32x16x8xf32>) -> tensor<32x16x8xf32> { +func @mul_ddd(%arga: tensor<32x16x8xf32>, %argb: tensor<32x16x8xf32>, %argx: tensor<32x16x8xf32>) -> tensor<32x16x8xf32> { %0 = linalg.generic #trait_ddd ins(%arga, %argb: tensor<32x16x8xf32>, tensor<32x16x8xf32>) - outs(%arga : tensor<32x16x8xf32>) { - ^bb(%a: f32, %b: f32, %s : f32): + outs(%argx: tensor<32x16x8xf32>) { + ^bb(%a: f32, %b: f32, %x: f32): %0 = mulf %a, %b : f32 linalg.yield %0 : f32 } -> tensor<32x16x8xf32> @@ -102,66 +104,67 @@ } // CHECK-LABEL: func @add_dds( -// CHECK-SAME: %[[VAL_0:.*]]: tensor<32x16x8xf32>, -// CHECK-SAME: %[[VAL_1:.*]]: tensor<32x16x8xf32>) -> tensor<32x16x8xf32> { -// CHECK: %[[VAL_2:.*]] = constant 999 : index -// CHECK: %[[VAL_3:.*]] = constant 32 : index -// CHECK: %[[VAL_4:.*]] = constant 16 : index -// CHECK: %[[VAL_5:.*]] = constant 8 : index -// CHECK: %[[VAL_6:.*]] = constant 0 : index -// CHECK: %[[VAL_7:.*]] = constant true -// CHECK: %[[VAL_8:.*]] = constant 1 : index -// CHECK: %[[VAL_9:.*]] = alloca(%[[VAL_2]]) : memref -// CHECK: %[[VAL_10:.*]] = alloca(%[[VAL_2]]) : memref -// CHECK: %[[VAL_11:.*]] = alloca(%[[VAL_2]]) : memref -// CHECK: %[[VAL_12:.*]] = alloca() : memref<32x16x8xf32> +// CHECK-SAME: %[[VAL_0:.*0]]: tensor<32x16x8xf32>, +// CHECK-SAME: %[[VAL_1:.*1]]: tensor<32x16x8xf32>, +// CHECK-SAME: %[[VAL_2:.*2]]: tensor<32x16x8xf32>) -> tensor<32x16x8xf32> { +// CHECK: %[[VAL_3:.*]] = constant 999 : index +// CHECK: %[[VAL_4:.*]] = constant 32 : index +// CHECK: %[[VAL_5:.*]] = constant 16 : index +// CHECK: %[[VAL_6:.*]] = constant 8 : index +// CHECK: %[[VAL_7:.*]] = constant 0 : index +// CHECK: %[[VAL_8:.*]] = constant true +// CHECK: %[[VAL_9:.*]] = constant 1 : index +// CHECK: %[[VAL_10:.*]] = alloca(%[[VAL_3]]) : memref +// CHECK: %[[VAL_11:.*]] = alloca(%[[VAL_3]]) : memref +// CHECK: %[[VAL_12:.*]] = alloca(%[[VAL_3]]) : memref // CHECK: %[[VAL_13:.*]] = alloca() : memref<32x16x8xf32> -// CHECK: scf.for %[[VAL_14:.*]] = %[[VAL_6]] to %[[VAL_3]] step %[[VAL_8]] { -// CHECK: scf.for %[[VAL_15:.*]] = %[[VAL_6]] to %[[VAL_4]] step %[[VAL_8]] { -// CHECK: %[[VAL_16:.*]] = muli %[[VAL_14]], %[[VAL_4]] : index -// CHECK: %[[VAL_17:.*]] = addi %[[VAL_16]], %[[VAL_15]] : index -// CHECK: %[[VAL_18:.*]] = load %[[VAL_9]]{{\[}}%[[VAL_17]]] : memref -// CHECK: %[[VAL_19:.*]] = addi %[[VAL_17]], %[[VAL_8]] : index -// CHECK: %[[VAL_20:.*]] = load %[[VAL_9]]{{\[}}%[[VAL_19]]] : memref -// CHECK: %[[VAL_21:.*]]:2 = scf.while (%[[VAL_22:.*]] = %[[VAL_18]], %[[VAL_23:.*]] = %[[VAL_6]]) : (index, index) -> (index, index) { -// CHECK: %[[VAL_24:.*]] = cmpi ult, %[[VAL_22]], %[[VAL_20]] : index -// CHECK: scf.condition(%[[VAL_24]]) %[[VAL_22]], %[[VAL_23]] : index, index +// CHECK: %[[VAL_14:.*]] = alloca() : memref<32x16x8xf32> +// CHECK: scf.for %[[VAL_15:.*]] = %[[VAL_7]] to %[[VAL_4]] step %[[VAL_9]] { +// CHECK: scf.for %[[VAL_16:.*]] = %[[VAL_7]] to %[[VAL_5]] step %[[VAL_9]] { +// CHECK: %[[VAL_17:.*]] = muli %[[VAL_15]], %[[VAL_5]] : index +// CHECK: %[[VAL_18:.*]] = addi %[[VAL_17]], %[[VAL_16]] : index +// CHECK: %[[VAL_19:.*]] = load %[[VAL_10]]{{\[}}%[[VAL_18]]] : memref +// CHECK: %[[VAL_20:.*]] = addi %[[VAL_18]], %[[VAL_9]] : index +// CHECK: %[[VAL_21:.*]] = load %[[VAL_10]]{{\[}}%[[VAL_20]]] : memref +// CHECK: %[[VAL_22:.*]]:2 = scf.while (%[[VAL_23:.*]] = %[[VAL_19]], %[[VAL_24:.*]] = %[[VAL_7]]) : (index, index) -> (index, index) { +// CHECK: %[[VAL_25:.*]] = cmpi ult, %[[VAL_23]], %[[VAL_21]] : index +// CHECK: scf.condition(%[[VAL_25]]) %[[VAL_23]], %[[VAL_24]] : index, index // CHECK: } do { -// CHECK: ^bb0(%[[VAL_25:.*]]: index, %[[VAL_26:.*]]: index): -// CHECK: %[[VAL_27:.*]] = load %[[VAL_10]]{{\[}}%[[VAL_25]]] : memref -// CHECK: %[[VAL_28:.*]] = cmpi eq, %[[VAL_27]], %[[VAL_26]] : index -// CHECK: scf.if %[[VAL_28]] { -// CHECK: %[[VAL_29:.*]] = load %[[VAL_11]]{{\[}}%[[VAL_25]]] : memref -// CHECK: %[[VAL_30:.*]] = load %[[VAL_12]]{{\[}}%[[VAL_14]], %[[VAL_15]], %[[VAL_26]]] : memref<32x16x8xf32> -// CHECK: %[[VAL_31:.*]] = addf %[[VAL_29]], %[[VAL_30]] : f32 -// CHECK: store %[[VAL_31]], %[[VAL_13]]{{\[}}%[[VAL_14]], %[[VAL_15]], %[[VAL_26]]] : memref<32x16x8xf32> +// CHECK: ^bb0(%[[VAL_26:.*]]: index, %[[VAL_27:.*]]: index): +// CHECK: %[[VAL_28:.*]] = load %[[VAL_11]]{{\[}}%[[VAL_26]]] : memref +// CHECK: %[[VAL_29:.*]] = cmpi eq, %[[VAL_28]], %[[VAL_27]] : index +// CHECK: scf.if %[[VAL_29]] { +// CHECK: %[[VAL_30:.*]] = load %[[VAL_12]]{{\[}}%[[VAL_26]]] : memref +// CHECK: %[[VAL_31:.*]] = load %[[VAL_13]]{{\[}}%[[VAL_15]], %[[VAL_16]], %[[VAL_27]]] : memref<32x16x8xf32> +// CHECK: %[[VAL_32:.*]] = addf %[[VAL_30]], %[[VAL_31]] : f32 +// CHECK: store %[[VAL_32]], %[[VAL_14]]{{\[}}%[[VAL_15]], %[[VAL_16]], %[[VAL_27]]] : memref<32x16x8xf32> // CHECK: } else { -// CHECK: scf.if %[[VAL_7]] { -// CHECK: %[[VAL_32:.*]] = load %[[VAL_12]]{{\[}}%[[VAL_14]], %[[VAL_15]], %[[VAL_26]]] : memref<32x16x8xf32> -// CHECK: store %[[VAL_32]], %[[VAL_13]]{{\[}}%[[VAL_14]], %[[VAL_15]], %[[VAL_26]]] : memref<32x16x8xf32> +// CHECK: scf.if %[[VAL_8]] { +// CHECK: %[[VAL_33:.*]] = load %[[VAL_13]]{{\[}}%[[VAL_15]], %[[VAL_16]], %[[VAL_27]]] : memref<32x16x8xf32> +// CHECK: store %[[VAL_33]], %[[VAL_14]]{{\[}}%[[VAL_15]], %[[VAL_16]], %[[VAL_27]]] : memref<32x16x8xf32> // CHECK: } else { // CHECK: } // CHECK: } -// CHECK: %[[VAL_33:.*]] = cmpi eq, %[[VAL_27]], %[[VAL_26]] : index -// CHECK: %[[VAL_34:.*]] = addi %[[VAL_25]], %[[VAL_8]] : index -// CHECK: %[[VAL_35:.*]] = select %[[VAL_33]], %[[VAL_34]], %[[VAL_25]] : index -// CHECK: %[[VAL_36:.*]] = addi %[[VAL_26]], %[[VAL_8]] : index -// CHECK: scf.yield %[[VAL_35]], %[[VAL_36]] : index, index +// CHECK: %[[VAL_34:.*]] = cmpi eq, %[[VAL_28]], %[[VAL_27]] : index +// CHECK: %[[VAL_35:.*]] = addi %[[VAL_26]], %[[VAL_9]] : index +// CHECK: %[[VAL_36:.*]] = select %[[VAL_34]], %[[VAL_35]], %[[VAL_26]] : index +// CHECK: %[[VAL_37:.*]] = addi %[[VAL_27]], %[[VAL_9]] : index +// CHECK: scf.yield %[[VAL_36]], %[[VAL_37]] : index, index // CHECK: } -// CHECK: scf.for %[[VAL_37:.*]] = %[[VAL_38:.*]]#1 to %[[VAL_5]] step %[[VAL_8]] { -// CHECK: %[[VAL_39:.*]] = load %[[VAL_12]]{{\[}}%[[VAL_14]], %[[VAL_15]], %[[VAL_37]]] : memref<32x16x8xf32> -// CHECK: store %[[VAL_39]], %[[VAL_13]]{{\[}}%[[VAL_14]], %[[VAL_15]], %[[VAL_37]]] : memref<32x16x8xf32> +// CHECK: scf.for %[[VAL_38:.*]] = %[[VAL_39:.*]]#1 to %[[VAL_6]] step %[[VAL_9]] { +// CHECK: %[[VAL_40:.*]] = load %[[VAL_13]]{{\[}}%[[VAL_15]], %[[VAL_16]], %[[VAL_38]]] : memref<32x16x8xf32> +// CHECK: store %[[VAL_40]], %[[VAL_14]]{{\[}}%[[VAL_15]], %[[VAL_16]], %[[VAL_38]]] : memref<32x16x8xf32> // CHECK: } // CHECK: } // CHECK: } -// CHECK: %[[VAL_40:.*]] = tensor_load %[[VAL_13]] : memref<32x16x8xf32> -// CHECK: return %[[VAL_40]] : tensor<32x16x8xf32> +// CHECK: %[[VAL_41:.*]] = tensor_load %[[VAL_14]] : memref<32x16x8xf32> +// CHECK: return %[[VAL_41]] : tensor<32x16x8xf32> // CHECK: } -func @add_dds(%arga: tensor<32x16x8xf32>, %argb: tensor<32x16x8xf32>) -> tensor<32x16x8xf32> { +func @add_dds(%arga: tensor<32x16x8xf32>, %argb: tensor<32x16x8xf32>, %argx: tensor<32x16x8xf32>) -> tensor<32x16x8xf32> { %0 = linalg.generic #trait_dds ins(%arga, %argb: tensor<32x16x8xf32>, tensor<32x16x8xf32>) - outs(%arga : tensor<32x16x8xf32>) { - ^bb(%a: f32, %b: f32, %s : f32): + outs(%argx: tensor<32x16x8xf32>) { + ^bb(%a: f32, %b: f32, %x: f32): %0 = addf %a, %b : f32 linalg.yield %0 : f32 } -> tensor<32x16x8xf32> @@ -169,42 +172,43 @@ } // CHECK-LABEL: func @mul_dds( -// CHECK-SAME: %[[VAL_0:.*]]: tensor<32x16x8xf32>, -// CHECK-SAME: %[[VAL_1:.*]]: tensor<32x16x8xf32>) -> tensor<32x16x8xf32> { -// CHECK: %[[VAL_2:.*]] = constant 999 : index -// CHECK: %[[VAL_3:.*]] = constant 32 : index -// CHECK: %[[VAL_4:.*]] = constant 16 : index -// CHECK: %[[VAL_5:.*]] = constant 0 : index -// CHECK: %[[VAL_6:.*]] = constant 1 : index -// CHECK: %[[VAL_7:.*]] = alloca(%[[VAL_2]]) : memref -// CHECK: %[[VAL_8:.*]] = alloca(%[[VAL_2]]) : memref -// CHECK: %[[VAL_9:.*]] = alloca(%[[VAL_2]]) : memref -// CHECK: %[[VAL_10:.*]] = alloca() : memref<32x16x8xf32> +// CHECK-SAME: %[[VAL_0:.*0]]: tensor<32x16x8xf32>, +// CHECK-SAME: %[[VAL_1:.*1]]: tensor<32x16x8xf32>, +// CHECK-SAME: %[[VAL_2:.*2]]: tensor<32x16x8xf32>) -> tensor<32x16x8xf32> { +// CHECK: %[[VAL_3:.*]] = constant 999 : index +// CHECK: %[[VAL_4:.*]] = constant 32 : index +// CHECK: %[[VAL_5:.*]] = constant 16 : index +// CHECK: %[[VAL_6:.*]] = constant 0 : index +// CHECK: %[[VAL_7:.*]] = constant 1 : index +// CHECK: %[[VAL_8:.*]] = alloca(%[[VAL_3]]) : memref +// CHECK: %[[VAL_9:.*]] = alloca(%[[VAL_3]]) : memref +// CHECK: %[[VAL_10:.*]] = alloca(%[[VAL_3]]) : memref // CHECK: %[[VAL_11:.*]] = alloca() : memref<32x16x8xf32> -// CHECK: scf.for %[[VAL_12:.*]] = %[[VAL_5]] to %[[VAL_3]] step %[[VAL_6]] { -// CHECK: scf.for %[[VAL_13:.*]] = %[[VAL_5]] to %[[VAL_4]] step %[[VAL_6]] { -// CHECK: %[[VAL_14:.*]] = muli %[[VAL_12]], %[[VAL_4]] : index -// CHECK: %[[VAL_15:.*]] = addi %[[VAL_14]], %[[VAL_13]] : index -// CHECK: %[[VAL_16:.*]] = load %[[VAL_7]]{{\[}}%[[VAL_15]]] : memref -// CHECK: %[[VAL_17:.*]] = addi %[[VAL_15]], %[[VAL_6]] : index -// CHECK: %[[VAL_18:.*]] = load %[[VAL_7]]{{\[}}%[[VAL_17]]] : memref -// CHECK: scf.for %[[VAL_19:.*]] = %[[VAL_16]] to %[[VAL_18]] step %[[VAL_6]] { -// CHECK: %[[VAL_20:.*]] = load %[[VAL_8]]{{\[}}%[[VAL_19]]] : memref -// CHECK: %[[VAL_21:.*]] = load %[[VAL_9]]{{\[}}%[[VAL_19]]] : memref -// CHECK: %[[VAL_22:.*]] = load %[[VAL_10]]{{\[}}%[[VAL_12]], %[[VAL_13]], %[[VAL_20]]] : memref<32x16x8xf32> -// CHECK: %[[VAL_23:.*]] = mulf %[[VAL_21]], %[[VAL_22]] : f32 -// CHECK: store %[[VAL_23]], %[[VAL_11]]{{\[}}%[[VAL_12]], %[[VAL_13]], %[[VAL_20]]] : memref<32x16x8xf32> +// CHECK: %[[VAL_12:.*]] = alloca() : memref<32x16x8xf32> +// CHECK: scf.for %[[VAL_13:.*]] = %[[VAL_6]] to %[[VAL_4]] step %[[VAL_7]] { +// CHECK: scf.for %[[VAL_14:.*]] = %[[VAL_6]] to %[[VAL_5]] step %[[VAL_7]] { +// CHECK: %[[VAL_15:.*]] = muli %[[VAL_13]], %[[VAL_5]] : index +// CHECK: %[[VAL_16:.*]] = addi %[[VAL_15]], %[[VAL_14]] : index +// CHECK: %[[VAL_17:.*]] = load %[[VAL_8]]{{\[}}%[[VAL_16]]] : memref +// CHECK: %[[VAL_18:.*]] = addi %[[VAL_16]], %[[VAL_7]] : index +// CHECK: %[[VAL_19:.*]] = load %[[VAL_8]]{{\[}}%[[VAL_18]]] : memref +// CHECK: scf.for %[[VAL_20:.*]] = %[[VAL_17]] to %[[VAL_19]] step %[[VAL_7]] { +// CHECK: %[[VAL_21:.*]] = load %[[VAL_9]]{{\[}}%[[VAL_20]]] : memref +// CHECK: %[[VAL_22:.*]] = load %[[VAL_10]]{{\[}}%[[VAL_20]]] : memref +// CHECK: %[[VAL_23:.*]] = load %[[VAL_11]]{{\[}}%[[VAL_13]], %[[VAL_14]], %[[VAL_21]]] : memref<32x16x8xf32> +// CHECK: %[[VAL_24:.*]] = mulf %[[VAL_22]], %[[VAL_23]] : f32 +// CHECK: store %[[VAL_24]], %[[VAL_12]]{{\[}}%[[VAL_13]], %[[VAL_14]], %[[VAL_21]]] : memref<32x16x8xf32> // CHECK: } // CHECK: } // CHECK: } -// CHECK: %[[VAL_24:.*]] = tensor_load %[[VAL_11]] : memref<32x16x8xf32> -// CHECK: return %[[VAL_24]] : tensor<32x16x8xf32> +// CHECK: %[[VAL_25:.*]] = tensor_load %[[VAL_12]] : memref<32x16x8xf32> +// CHECK: return %[[VAL_25]] : tensor<32x16x8xf32> // CHECK: } -func @mul_dds(%arga: tensor<32x16x8xf32>, %argb: tensor<32x16x8xf32>) -> tensor<32x16x8xf32> { +func @mul_dds(%arga: tensor<32x16x8xf32>, %argb: tensor<32x16x8xf32>, %argx: tensor<32x16x8xf32>) -> tensor<32x16x8xf32> { %0 = linalg.generic #trait_dds ins(%arga, %argb: tensor<32x16x8xf32>, tensor<32x16x8xf32>) - outs(%arga : tensor<32x16x8xf32>) { - ^bb(%a: f32, %b: f32, %s : f32): + outs(%argx: tensor<32x16x8xf32>) { + ^bb(%a: f32, %b: f32, %x: f32): %0 = mulf %a, %b : f32 linalg.yield %0 : f32 } -> tensor<32x16x8xf32> @@ -227,70 +231,71 @@ } // CHECK-LABEL: func @add_dsd( -// CHECK-SAME: %[[VAL_0:.*]]: tensor<32x16x8xf32>, -// CHECK-SAME: %[[VAL_1:.*]]: tensor<32x16x8xf32>) -> tensor<32x16x8xf32> { -// CHECK: %[[VAL_2:.*]] = constant 999 : index -// CHECK: %[[VAL_3:.*]] = constant 32 : index -// CHECK: %[[VAL_4:.*]] = constant 16 : index -// CHECK: %[[VAL_5:.*]] = constant 8 : index -// CHECK: %[[VAL_6:.*]] = constant true -// CHECK: %[[VAL_7:.*]] = constant 0 : index -// CHECK: %[[VAL_8:.*]] = constant 1 : index -// CHECK: %[[VAL_9:.*]] = alloca(%[[VAL_2]]) : memref -// CHECK: %[[VAL_10:.*]] = alloca(%[[VAL_2]]) : memref -// CHECK: %[[VAL_11:.*]] = alloca(%[[VAL_2]]) : memref -// CHECK: %[[VAL_12:.*]] = alloca() : memref<32x16x8xf32> +// CHECK-SAME: %[[VAL_0:.*0]]: tensor<32x16x8xf32>, +// CHECK-SAME: %[[VAL_1:.*1]]: tensor<32x16x8xf32>, +// CHECK-SAME: %[[VAL_2:.*2]]: tensor<32x16x8xf32>) -> tensor<32x16x8xf32> { +// CHECK: %[[VAL_3:.*]] = constant 999 : index +// CHECK: %[[VAL_4:.*]] = constant 32 : index +// CHECK: %[[VAL_5:.*]] = constant 16 : index +// CHECK: %[[VAL_6:.*]] = constant 8 : index +// CHECK: %[[VAL_7:.*]] = constant true +// CHECK: %[[VAL_8:.*]] = constant 0 : index +// CHECK: %[[VAL_9:.*]] = constant 1 : index +// CHECK: %[[VAL_10:.*]] = alloca(%[[VAL_3]]) : memref +// CHECK: %[[VAL_11:.*]] = alloca(%[[VAL_3]]) : memref +// CHECK: %[[VAL_12:.*]] = alloca(%[[VAL_3]]) : memref // CHECK: %[[VAL_13:.*]] = alloca() : memref<32x16x8xf32> -// CHECK: scf.for %[[VAL_14:.*]] = %[[VAL_7]] to %[[VAL_3]] step %[[VAL_8]] { -// CHECK: %[[VAL_15:.*]] = load %[[VAL_9]]{{\[}}%[[VAL_14]]] : memref -// CHECK: %[[VAL_16:.*]] = addi %[[VAL_14]], %[[VAL_8]] : index -// CHECK: %[[VAL_17:.*]] = load %[[VAL_9]]{{\[}}%[[VAL_16]]] : memref -// CHECK: %[[VAL_18:.*]]:2 = scf.while (%[[VAL_19:.*]] = %[[VAL_15]], %[[VAL_20:.*]] = %[[VAL_7]]) : (index, index) -> (index, index) { -// CHECK: %[[VAL_21:.*]] = cmpi ult, %[[VAL_19]], %[[VAL_17]] : index -// CHECK: scf.condition(%[[VAL_21]]) %[[VAL_19]], %[[VAL_20]] : index, index +// CHECK: %[[VAL_14:.*]] = alloca() : memref<32x16x8xf32> +// CHECK: scf.for %[[VAL_15:.*]] = %[[VAL_8]] to %[[VAL_4]] step %[[VAL_9]] { +// CHECK: %[[VAL_16:.*]] = load %[[VAL_10]]{{\[}}%[[VAL_15]]] : memref +// CHECK: %[[VAL_17:.*]] = addi %[[VAL_15]], %[[VAL_9]] : index +// CHECK: %[[VAL_18:.*]] = load %[[VAL_10]]{{\[}}%[[VAL_17]]] : memref +// CHECK: %[[VAL_19:.*]]:2 = scf.while (%[[VAL_20:.*]] = %[[VAL_16]], %[[VAL_21:.*]] = %[[VAL_8]]) : (index, index) -> (index, index) { +// CHECK: %[[VAL_22:.*]] = cmpi ult, %[[VAL_20]], %[[VAL_18]] : index +// CHECK: scf.condition(%[[VAL_22]]) %[[VAL_20]], %[[VAL_21]] : index, index // CHECK: } do { -// CHECK: ^bb0(%[[VAL_22:.*]]: index, %[[VAL_23:.*]]: index): -// CHECK: %[[VAL_24:.*]] = load %[[VAL_10]]{{\[}}%[[VAL_22]]] : memref -// CHECK: %[[VAL_25:.*]] = cmpi eq, %[[VAL_24]], %[[VAL_23]] : index -// CHECK: scf.if %[[VAL_25]] { -// CHECK: scf.for %[[VAL_26:.*]] = %[[VAL_7]] to %[[VAL_5]] step %[[VAL_8]] { -// CHECK: %[[VAL_27:.*]] = muli %[[VAL_22]], %[[VAL_5]] : index -// CHECK: %[[VAL_28:.*]] = addi %[[VAL_27]], %[[VAL_26]] : index -// CHECK: %[[VAL_29:.*]] = load %[[VAL_11]]{{\[}}%[[VAL_28]]] : memref -// CHECK: %[[VAL_30:.*]] = load %[[VAL_12]]{{\[}}%[[VAL_14]], %[[VAL_23]], %[[VAL_26]]] : memref<32x16x8xf32> -// CHECK: %[[VAL_31:.*]] = addf %[[VAL_29]], %[[VAL_30]] : f32 -// CHECK: store %[[VAL_31]], %[[VAL_13]]{{\[}}%[[VAL_14]], %[[VAL_23]], %[[VAL_26]]] : memref<32x16x8xf32> +// CHECK: ^bb0(%[[VAL_23:.*]]: index, %[[VAL_24:.*]]: index): +// CHECK: %[[VAL_25:.*]] = load %[[VAL_11]]{{\[}}%[[VAL_23]]] : memref +// CHECK: %[[VAL_26:.*]] = cmpi eq, %[[VAL_25]], %[[VAL_24]] : index +// CHECK: scf.if %[[VAL_26]] { +// CHECK: scf.for %[[VAL_27:.*]] = %[[VAL_8]] to %[[VAL_6]] step %[[VAL_9]] { +// CHECK: %[[VAL_28:.*]] = muli %[[VAL_23]], %[[VAL_6]] : index +// CHECK: %[[VAL_29:.*]] = addi %[[VAL_28]], %[[VAL_27]] : index +// CHECK: %[[VAL_30:.*]] = load %[[VAL_12]]{{\[}}%[[VAL_29]]] : memref +// CHECK: %[[VAL_31:.*]] = load %[[VAL_13]]{{\[}}%[[VAL_15]], %[[VAL_24]], %[[VAL_27]]] : memref<32x16x8xf32> +// CHECK: %[[VAL_32:.*]] = addf %[[VAL_30]], %[[VAL_31]] : f32 +// CHECK: store %[[VAL_32]], %[[VAL_14]]{{\[}}%[[VAL_15]], %[[VAL_24]], %[[VAL_27]]] : memref<32x16x8xf32> // CHECK: } // CHECK: } else { -// CHECK: scf.if %[[VAL_6]] { -// CHECK: scf.for %[[VAL_32:.*]] = %[[VAL_7]] to %[[VAL_5]] step %[[VAL_8]] { -// CHECK: %[[VAL_33:.*]] = load %[[VAL_12]]{{\[}}%[[VAL_14]], %[[VAL_23]], %[[VAL_32]]] : memref<32x16x8xf32> -// CHECK: store %[[VAL_33]], %[[VAL_13]]{{\[}}%[[VAL_14]], %[[VAL_23]], %[[VAL_32]]] : memref<32x16x8xf32> +// CHECK: scf.if %[[VAL_7]] { +// CHECK: scf.for %[[VAL_33:.*]] = %[[VAL_8]] to %[[VAL_6]] step %[[VAL_9]] { +// CHECK: %[[VAL_34:.*]] = load %[[VAL_13]]{{\[}}%[[VAL_15]], %[[VAL_24]], %[[VAL_33]]] : memref<32x16x8xf32> +// CHECK: store %[[VAL_34]], %[[VAL_14]]{{\[}}%[[VAL_15]], %[[VAL_24]], %[[VAL_33]]] : memref<32x16x8xf32> // CHECK: } // CHECK: } else { // CHECK: } // CHECK: } -// CHECK: %[[VAL_34:.*]] = cmpi eq, %[[VAL_24]], %[[VAL_23]] : index -// CHECK: %[[VAL_35:.*]] = addi %[[VAL_22]], %[[VAL_8]] : index -// CHECK: %[[VAL_36:.*]] = select %[[VAL_34]], %[[VAL_35]], %[[VAL_22]] : index -// CHECK: %[[VAL_37:.*]] = addi %[[VAL_23]], %[[VAL_8]] : index -// CHECK: scf.yield %[[VAL_36]], %[[VAL_37]] : index, index +// CHECK: %[[VAL_35:.*]] = cmpi eq, %[[VAL_25]], %[[VAL_24]] : index +// CHECK: %[[VAL_36:.*]] = addi %[[VAL_23]], %[[VAL_9]] : index +// CHECK: %[[VAL_37:.*]] = select %[[VAL_35]], %[[VAL_36]], %[[VAL_23]] : index +// CHECK: %[[VAL_38:.*]] = addi %[[VAL_24]], %[[VAL_9]] : index +// CHECK: scf.yield %[[VAL_37]], %[[VAL_38]] : index, index // CHECK: } -// CHECK: scf.for %[[VAL_38:.*]] = %[[VAL_39:.*]]#1 to %[[VAL_4]] step %[[VAL_8]] { -// CHECK: scf.for %[[VAL_40:.*]] = %[[VAL_7]] to %[[VAL_5]] step %[[VAL_8]] { -// CHECK: %[[VAL_41:.*]] = load %[[VAL_12]]{{\[}}%[[VAL_14]], %[[VAL_38]], %[[VAL_40]]] : memref<32x16x8xf32> -// CHECK: store %[[VAL_41]], %[[VAL_13]]{{\[}}%[[VAL_14]], %[[VAL_38]], %[[VAL_40]]] : memref<32x16x8xf32> +// CHECK: scf.for %[[VAL_39:.*]] = %[[VAL_40:.*]]#1 to %[[VAL_5]] step %[[VAL_9]] { +// CHECK: scf.for %[[VAL_41:.*]] = %[[VAL_8]] to %[[VAL_6]] step %[[VAL_9]] { +// CHECK: %[[VAL_42:.*]] = load %[[VAL_13]]{{\[}}%[[VAL_15]], %[[VAL_39]], %[[VAL_41]]] : memref<32x16x8xf32> +// CHECK: store %[[VAL_42]], %[[VAL_14]]{{\[}}%[[VAL_15]], %[[VAL_39]], %[[VAL_41]]] : memref<32x16x8xf32> // CHECK: } // CHECK: } // CHECK: } -// CHECK: %[[VAL_42:.*]] = tensor_load %[[VAL_13]] : memref<32x16x8xf32> -// CHECK: return %[[VAL_42]] : tensor<32x16x8xf32> +// CHECK: %[[VAL_43:.*]] = tensor_load %[[VAL_14]] : memref<32x16x8xf32> +// CHECK: return %[[VAL_43]] : tensor<32x16x8xf32> // CHECK: } -func @add_dsd(%arga: tensor<32x16x8xf32>, %argb: tensor<32x16x8xf32>) -> tensor<32x16x8xf32> { +func @add_dsd(%arga: tensor<32x16x8xf32>, %argb: tensor<32x16x8xf32>, %argx: tensor<32x16x8xf32>) -> tensor<32x16x8xf32> { %0 = linalg.generic #trait_dsd ins(%arga, %argb: tensor<32x16x8xf32>, tensor<32x16x8xf32>) - outs(%arga : tensor<32x16x8xf32>) { - ^bb(%a: f32, %b: f32, %s : f32): + outs(%argx: tensor<32x16x8xf32>) { + ^bb(%a: f32, %b: f32, %x: f32): %0 = addf %a, %b : f32 linalg.yield %0 : f32 } -> tensor<32x16x8xf32> @@ -298,42 +303,43 @@ } // CHECK-LABEL: func @mul_dsd( -// CHECK-SAME: %[[VAL_0:.*]]: tensor<32x16x8xf32>, -// CHECK-SAME: %[[VAL_1:.*]]: tensor<32x16x8xf32>) -> tensor<32x16x8xf32> { -// CHECK: %[[VAL_2:.*]] = constant 999 : index -// CHECK: %[[VAL_3:.*]] = constant 32 : index -// CHECK: %[[VAL_4:.*]] = constant 8 : index -// CHECK: %[[VAL_5:.*]] = constant 0 : index -// CHECK: %[[VAL_6:.*]] = constant 1 : index -// CHECK: %[[VAL_7:.*]] = alloca(%[[VAL_2]]) : memref -// CHECK: %[[VAL_8:.*]] = alloca(%[[VAL_2]]) : memref -// CHECK: %[[VAL_9:.*]] = alloca(%[[VAL_2]]) : memref -// CHECK: %[[VAL_10:.*]] = alloca() : memref<32x16x8xf32> +// CHECK-SAME: %[[VAL_0:.*0]]: tensor<32x16x8xf32>, +// CHECK-SAME: %[[VAL_1:.*1]]: tensor<32x16x8xf32>, +// CHECK-SAME: %[[VAL_2:.*2]]: tensor<32x16x8xf32>) -> tensor<32x16x8xf32> { +// CHECK: %[[VAL_3:.*]] = constant 999 : index +// CHECK: %[[VAL_4:.*]] = constant 32 : index +// CHECK: %[[VAL_5:.*]] = constant 8 : index +// CHECK: %[[VAL_6:.*]] = constant 0 : index +// CHECK: %[[VAL_7:.*]] = constant 1 : index +// CHECK: %[[VAL_8:.*]] = alloca(%[[VAL_3]]) : memref +// CHECK: %[[VAL_9:.*]] = alloca(%[[VAL_3]]) : memref +// CHECK: %[[VAL_10:.*]] = alloca(%[[VAL_3]]) : memref // CHECK: %[[VAL_11:.*]] = alloca() : memref<32x16x8xf32> -// CHECK: scf.for %[[VAL_12:.*]] = %[[VAL_5]] to %[[VAL_3]] step %[[VAL_6]] { -// CHECK: %[[VAL_13:.*]] = load %[[VAL_7]]{{\[}}%[[VAL_12]]] : memref -// CHECK: %[[VAL_14:.*]] = addi %[[VAL_12]], %[[VAL_6]] : index -// CHECK: %[[VAL_15:.*]] = load %[[VAL_7]]{{\[}}%[[VAL_14]]] : memref -// CHECK: scf.for %[[VAL_16:.*]] = %[[VAL_13]] to %[[VAL_15]] step %[[VAL_6]] { -// CHECK: %[[VAL_17:.*]] = load %[[VAL_8]]{{\[}}%[[VAL_16]]] : memref -// CHECK: scf.for %[[VAL_18:.*]] = %[[VAL_5]] to %[[VAL_4]] step %[[VAL_6]] { -// CHECK: %[[VAL_19:.*]] = muli %[[VAL_16]], %[[VAL_4]] : index -// CHECK: %[[VAL_20:.*]] = addi %[[VAL_19]], %[[VAL_18]] : index -// CHECK: %[[VAL_21:.*]] = load %[[VAL_9]]{{\[}}%[[VAL_20]]] : memref -// CHECK: %[[VAL_22:.*]] = load %[[VAL_10]]{{\[}}%[[VAL_12]], %[[VAL_17]], %[[VAL_18]]] : memref<32x16x8xf32> -// CHECK: %[[VAL_23:.*]] = mulf %[[VAL_21]], %[[VAL_22]] : f32 -// CHECK: store %[[VAL_23]], %[[VAL_11]]{{\[}}%[[VAL_12]], %[[VAL_17]], %[[VAL_18]]] : memref<32x16x8xf32> +// CHECK: %[[VAL_12:.*]] = alloca() : memref<32x16x8xf32> +// CHECK: scf.for %[[VAL_13:.*]] = %[[VAL_6]] to %[[VAL_4]] step %[[VAL_7]] { +// CHECK: %[[VAL_14:.*]] = load %[[VAL_8]]{{\[}}%[[VAL_13]]] : memref +// CHECK: %[[VAL_15:.*]] = addi %[[VAL_13]], %[[VAL_7]] : index +// CHECK: %[[VAL_16:.*]] = load %[[VAL_8]]{{\[}}%[[VAL_15]]] : memref +// CHECK: scf.for %[[VAL_17:.*]] = %[[VAL_14]] to %[[VAL_16]] step %[[VAL_7]] { +// CHECK: %[[VAL_18:.*]] = load %[[VAL_9]]{{\[}}%[[VAL_17]]] : memref +// CHECK: scf.for %[[VAL_19:.*]] = %[[VAL_6]] to %[[VAL_5]] step %[[VAL_7]] { +// CHECK: %[[VAL_20:.*]] = muli %[[VAL_17]], %[[VAL_5]] : index +// CHECK: %[[VAL_21:.*]] = addi %[[VAL_20]], %[[VAL_19]] : index +// CHECK: %[[VAL_22:.*]] = load %[[VAL_10]]{{\[}}%[[VAL_21]]] : memref +// CHECK: %[[VAL_23:.*]] = load %[[VAL_11]]{{\[}}%[[VAL_13]], %[[VAL_18]], %[[VAL_19]]] : memref<32x16x8xf32> +// CHECK: %[[VAL_24:.*]] = mulf %[[VAL_22]], %[[VAL_23]] : f32 +// CHECK: store %[[VAL_24]], %[[VAL_12]]{{\[}}%[[VAL_13]], %[[VAL_18]], %[[VAL_19]]] : memref<32x16x8xf32> // CHECK: } // CHECK: } // CHECK: } -// CHECK: %[[VAL_24:.*]] = tensor_load %[[VAL_11]] : memref<32x16x8xf32> -// CHECK: return %[[VAL_24]] : tensor<32x16x8xf32> +// CHECK: %[[VAL_25:.*]] = tensor_load %[[VAL_12]] : memref<32x16x8xf32> +// CHECK: return %[[VAL_25]] : tensor<32x16x8xf32> // CHECK: } -func @mul_dsd(%arga: tensor<32x16x8xf32>, %argb: tensor<32x16x8xf32>) -> tensor<32x16x8xf32> { +func @mul_dsd(%arga: tensor<32x16x8xf32>, %argb: tensor<32x16x8xf32>, %argx: tensor<32x16x8xf32>) -> tensor<32x16x8xf32> { %0 = linalg.generic #trait_dsd ins(%arga, %argb: tensor<32x16x8xf32>, tensor<32x16x8xf32>) - outs(%arga : tensor<32x16x8xf32>) { - ^bb(%a: f32, %b: f32, %s : f32): + outs(%argx: tensor<32x16x8xf32>) { + ^bb(%a: f32, %b: f32, %x: f32): %0 = mulf %a, %b : f32 linalg.yield %0 : f32 } -> tensor<32x16x8xf32> @@ -356,96 +362,97 @@ } // CHECK-LABEL: func @add_dss( -// CHECK-SAME: %[[VAL_0:.*]]: tensor<32x16x8xf32>, -// CHECK-SAME: %[[VAL_1:.*]]: tensor<32x16x8xf32>) -> tensor<32x16x8xf32> { -// CHECK: %[[VAL_2:.*]] = constant 999 : index -// CHECK: %[[VAL_3:.*]] = constant 32 : index -// CHECK: %[[VAL_4:.*]] = constant 16 : index -// CHECK: %[[VAL_5:.*]] = constant 8 : index -// CHECK: %[[VAL_6:.*]] = constant true -// CHECK: %[[VAL_7:.*]] = constant 0 : index -// CHECK: %[[VAL_8:.*]] = constant 1 : index -// CHECK: %[[VAL_9:.*]] = alloca(%[[VAL_2]]) : memref -// CHECK: %[[VAL_10:.*]] = alloca(%[[VAL_2]]) : memref -// CHECK: %[[VAL_11:.*]] = alloca(%[[VAL_2]]) : memref -// CHECK: %[[VAL_12:.*]] = alloca(%[[VAL_2]]) : memref -// CHECK: %[[VAL_13:.*]] = alloca(%[[VAL_2]]) : memref -// CHECK: %[[VAL_14:.*]] = alloca() : memref<32x16x8xf32> +// CHECK-SAME: %[[VAL_0:.*0]]: tensor<32x16x8xf32>, +// CHECK-SAME: %[[VAL_1:.*1]]: tensor<32x16x8xf32>, +// CHECK-SAME: %[[VAL_2:.*2]]: tensor<32x16x8xf32>) -> tensor<32x16x8xf32> { +// CHECK: %[[VAL_3:.*]] = constant 999 : index +// CHECK: %[[VAL_4:.*]] = constant 32 : index +// CHECK: %[[VAL_5:.*]] = constant 16 : index +// CHECK: %[[VAL_6:.*]] = constant 8 : index +// CHECK: %[[VAL_7:.*]] = constant true +// CHECK: %[[VAL_8:.*]] = constant 0 : index +// CHECK: %[[VAL_9:.*]] = constant 1 : index +// CHECK: %[[VAL_10:.*]] = alloca(%[[VAL_3]]) : memref +// CHECK: %[[VAL_11:.*]] = alloca(%[[VAL_3]]) : memref +// CHECK: %[[VAL_12:.*]] = alloca(%[[VAL_3]]) : memref +// CHECK: %[[VAL_13:.*]] = alloca(%[[VAL_3]]) : memref +// CHECK: %[[VAL_14:.*]] = alloca(%[[VAL_3]]) : memref // CHECK: %[[VAL_15:.*]] = alloca() : memref<32x16x8xf32> -// CHECK: scf.for %[[VAL_16:.*]] = %[[VAL_7]] to %[[VAL_3]] step %[[VAL_8]] { -// CHECK: %[[VAL_17:.*]] = load %[[VAL_9]]{{\[}}%[[VAL_16]]] : memref -// CHECK: %[[VAL_18:.*]] = addi %[[VAL_16]], %[[VAL_8]] : index -// CHECK: %[[VAL_19:.*]] = load %[[VAL_9]]{{\[}}%[[VAL_18]]] : memref -// CHECK: %[[VAL_20:.*]]:2 = scf.while (%[[VAL_21:.*]] = %[[VAL_17]], %[[VAL_22:.*]] = %[[VAL_7]]) : (index, index) -> (index, index) { -// CHECK: %[[VAL_23:.*]] = cmpi ult, %[[VAL_21]], %[[VAL_19]] : index -// CHECK: scf.condition(%[[VAL_23]]) %[[VAL_21]], %[[VAL_22]] : index, index +// CHECK: %[[VAL_16:.*]] = alloca() : memref<32x16x8xf32> +// CHECK: scf.for %[[VAL_17:.*]] = %[[VAL_8]] to %[[VAL_4]] step %[[VAL_9]] { +// CHECK: %[[VAL_18:.*]] = load %[[VAL_10]]{{\[}}%[[VAL_17]]] : memref +// CHECK: %[[VAL_19:.*]] = addi %[[VAL_17]], %[[VAL_9]] : index +// CHECK: %[[VAL_20:.*]] = load %[[VAL_10]]{{\[}}%[[VAL_19]]] : memref +// CHECK: %[[VAL_21:.*]]:2 = scf.while (%[[VAL_22:.*]] = %[[VAL_18]], %[[VAL_23:.*]] = %[[VAL_8]]) : (index, index) -> (index, index) { +// CHECK: %[[VAL_24:.*]] = cmpi ult, %[[VAL_22]], %[[VAL_20]] : index +// CHECK: scf.condition(%[[VAL_24]]) %[[VAL_22]], %[[VAL_23]] : index, index // CHECK: } do { -// CHECK: ^bb0(%[[VAL_24:.*]]: index, %[[VAL_25:.*]]: index): -// CHECK: %[[VAL_26:.*]] = load %[[VAL_10]]{{\[}}%[[VAL_24]]] : memref -// CHECK: %[[VAL_27:.*]] = cmpi eq, %[[VAL_26]], %[[VAL_25]] : index -// CHECK: scf.if %[[VAL_27]] { -// CHECK: %[[VAL_28:.*]] = load %[[VAL_11]]{{\[}}%[[VAL_24]]] : memref -// CHECK: %[[VAL_29:.*]] = addi %[[VAL_24]], %[[VAL_8]] : index -// CHECK: %[[VAL_30:.*]] = load %[[VAL_11]]{{\[}}%[[VAL_29]]] : memref -// CHECK: %[[VAL_31:.*]]:2 = scf.while (%[[VAL_32:.*]] = %[[VAL_28]], %[[VAL_33:.*]] = %[[VAL_7]]) : (index, index) -> (index, index) { -// CHECK: %[[VAL_34:.*]] = cmpi ult, %[[VAL_32]], %[[VAL_30]] : index -// CHECK: scf.condition(%[[VAL_34]]) %[[VAL_32]], %[[VAL_33]] : index, index +// CHECK: ^bb0(%[[VAL_25:.*]]: index, %[[VAL_26:.*]]: index): +// CHECK: %[[VAL_27:.*]] = load %[[VAL_11]]{{\[}}%[[VAL_25]]] : memref +// CHECK: %[[VAL_28:.*]] = cmpi eq, %[[VAL_27]], %[[VAL_26]] : index +// CHECK: scf.if %[[VAL_28]] { +// CHECK: %[[VAL_29:.*]] = load %[[VAL_12]]{{\[}}%[[VAL_25]]] : memref +// CHECK: %[[VAL_30:.*]] = addi %[[VAL_25]], %[[VAL_9]] : index +// CHECK: %[[VAL_31:.*]] = load %[[VAL_12]]{{\[}}%[[VAL_30]]] : memref +// CHECK: %[[VAL_32:.*]]:2 = scf.while (%[[VAL_33:.*]] = %[[VAL_29]], %[[VAL_34:.*]] = %[[VAL_8]]) : (index, index) -> (index, index) { +// CHECK: %[[VAL_35:.*]] = cmpi ult, %[[VAL_33]], %[[VAL_31]] : index +// CHECK: scf.condition(%[[VAL_35]]) %[[VAL_33]], %[[VAL_34]] : index, index // CHECK: } do { -// CHECK: ^bb0(%[[VAL_35:.*]]: index, %[[VAL_36:.*]]: index): -// CHECK: %[[VAL_37:.*]] = load %[[VAL_12]]{{\[}}%[[VAL_35]]] : memref -// CHECK: %[[VAL_38:.*]] = cmpi eq, %[[VAL_37]], %[[VAL_36]] : index -// CHECK: scf.if %[[VAL_38]] { -// CHECK: %[[VAL_39:.*]] = load %[[VAL_13]]{{\[}}%[[VAL_35]]] : memref -// CHECK: %[[VAL_40:.*]] = load %[[VAL_14]]{{\[}}%[[VAL_16]], %[[VAL_25]], %[[VAL_36]]] : memref<32x16x8xf32> -// CHECK: %[[VAL_41:.*]] = addf %[[VAL_39]], %[[VAL_40]] : f32 -// CHECK: store %[[VAL_41]], %[[VAL_15]]{{\[}}%[[VAL_16]], %[[VAL_25]], %[[VAL_36]]] : memref<32x16x8xf32> +// CHECK: ^bb0(%[[VAL_36:.*]]: index, %[[VAL_37:.*]]: index): +// CHECK: %[[VAL_38:.*]] = load %[[VAL_13]]{{\[}}%[[VAL_36]]] : memref +// CHECK: %[[VAL_39:.*]] = cmpi eq, %[[VAL_38]], %[[VAL_37]] : index +// CHECK: scf.if %[[VAL_39]] { +// CHECK: %[[VAL_40:.*]] = load %[[VAL_14]]{{\[}}%[[VAL_36]]] : memref +// CHECK: %[[VAL_41:.*]] = load %[[VAL_15]]{{\[}}%[[VAL_17]], %[[VAL_26]], %[[VAL_37]]] : memref<32x16x8xf32> +// CHECK: %[[VAL_42:.*]] = addf %[[VAL_40]], %[[VAL_41]] : f32 +// CHECK: store %[[VAL_42]], %[[VAL_16]]{{\[}}%[[VAL_17]], %[[VAL_26]], %[[VAL_37]]] : memref<32x16x8xf32> // CHECK: } else { -// CHECK: scf.if %[[VAL_6]] { -// CHECK: %[[VAL_42:.*]] = load %[[VAL_14]]{{\[}}%[[VAL_16]], %[[VAL_25]], %[[VAL_36]]] : memref<32x16x8xf32> -// CHECK: store %[[VAL_42]], %[[VAL_15]]{{\[}}%[[VAL_16]], %[[VAL_25]], %[[VAL_36]]] : memref<32x16x8xf32> +// CHECK: scf.if %[[VAL_7]] { +// CHECK: %[[VAL_43:.*]] = load %[[VAL_15]]{{\[}}%[[VAL_17]], %[[VAL_26]], %[[VAL_37]]] : memref<32x16x8xf32> +// CHECK: store %[[VAL_43]], %[[VAL_16]]{{\[}}%[[VAL_17]], %[[VAL_26]], %[[VAL_37]]] : memref<32x16x8xf32> // CHECK: } else { // CHECK: } // CHECK: } -// CHECK: %[[VAL_43:.*]] = cmpi eq, %[[VAL_37]], %[[VAL_36]] : index -// CHECK: %[[VAL_44:.*]] = addi %[[VAL_35]], %[[VAL_8]] : index -// CHECK: %[[VAL_45:.*]] = select %[[VAL_43]], %[[VAL_44]], %[[VAL_35]] : index -// CHECK: %[[VAL_46:.*]] = addi %[[VAL_36]], %[[VAL_8]] : index -// CHECK: scf.yield %[[VAL_45]], %[[VAL_46]] : index, index +// CHECK: %[[VAL_44:.*]] = cmpi eq, %[[VAL_38]], %[[VAL_37]] : index +// CHECK: %[[VAL_45:.*]] = addi %[[VAL_36]], %[[VAL_9]] : index +// CHECK: %[[VAL_46:.*]] = select %[[VAL_44]], %[[VAL_45]], %[[VAL_36]] : index +// CHECK: %[[VAL_47:.*]] = addi %[[VAL_37]], %[[VAL_9]] : index +// CHECK: scf.yield %[[VAL_46]], %[[VAL_47]] : index, index // CHECK: } -// CHECK: scf.for %[[VAL_47:.*]] = %[[VAL_48:.*]]#1 to %[[VAL_5]] step %[[VAL_8]] { -// CHECK: %[[VAL_49:.*]] = load %[[VAL_14]]{{\[}}%[[VAL_16]], %[[VAL_25]], %[[VAL_47]]] : memref<32x16x8xf32> -// CHECK: store %[[VAL_49]], %[[VAL_15]]{{\[}}%[[VAL_16]], %[[VAL_25]], %[[VAL_47]]] : memref<32x16x8xf32> +// CHECK: scf.for %[[VAL_48:.*]] = %[[VAL_49:.*]]#1 to %[[VAL_6]] step %[[VAL_9]] { +// CHECK: %[[VAL_50:.*]] = load %[[VAL_15]]{{\[}}%[[VAL_17]], %[[VAL_26]], %[[VAL_48]]] : memref<32x16x8xf32> +// CHECK: store %[[VAL_50]], %[[VAL_16]]{{\[}}%[[VAL_17]], %[[VAL_26]], %[[VAL_48]]] : memref<32x16x8xf32> // CHECK: } // CHECK: } else { -// CHECK: scf.if %[[VAL_6]] { -// CHECK: scf.for %[[VAL_50:.*]] = %[[VAL_7]] to %[[VAL_5]] step %[[VAL_8]] { -// CHECK: %[[VAL_51:.*]] = load %[[VAL_14]]{{\[}}%[[VAL_16]], %[[VAL_25]], %[[VAL_50]]] : memref<32x16x8xf32> -// CHECK: store %[[VAL_51]], %[[VAL_15]]{{\[}}%[[VAL_16]], %[[VAL_25]], %[[VAL_50]]] : memref<32x16x8xf32> +// CHECK: scf.if %[[VAL_7]] { +// CHECK: scf.for %[[VAL_51:.*]] = %[[VAL_8]] to %[[VAL_6]] step %[[VAL_9]] { +// CHECK: %[[VAL_52:.*]] = load %[[VAL_15]]{{\[}}%[[VAL_17]], %[[VAL_26]], %[[VAL_51]]] : memref<32x16x8xf32> +// CHECK: store %[[VAL_52]], %[[VAL_16]]{{\[}}%[[VAL_17]], %[[VAL_26]], %[[VAL_51]]] : memref<32x16x8xf32> // CHECK: } // CHECK: } else { // CHECK: } // CHECK: } -// CHECK: %[[VAL_52:.*]] = cmpi eq, %[[VAL_26]], %[[VAL_25]] : index -// CHECK: %[[VAL_53:.*]] = addi %[[VAL_24]], %[[VAL_8]] : index -// CHECK: %[[VAL_54:.*]] = select %[[VAL_52]], %[[VAL_53]], %[[VAL_24]] : index -// CHECK: %[[VAL_55:.*]] = addi %[[VAL_25]], %[[VAL_8]] : index -// CHECK: scf.yield %[[VAL_54]], %[[VAL_55]] : index, index +// CHECK: %[[VAL_53:.*]] = cmpi eq, %[[VAL_27]], %[[VAL_26]] : index +// CHECK: %[[VAL_54:.*]] = addi %[[VAL_25]], %[[VAL_9]] : index +// CHECK: %[[VAL_55:.*]] = select %[[VAL_53]], %[[VAL_54]], %[[VAL_25]] : index +// CHECK: %[[VAL_56:.*]] = addi %[[VAL_26]], %[[VAL_9]] : index +// CHECK: scf.yield %[[VAL_55]], %[[VAL_56]] : index, index // CHECK: } -// CHECK: scf.for %[[VAL_56:.*]] = %[[VAL_57:.*]]#1 to %[[VAL_4]] step %[[VAL_8]] { -// CHECK: scf.for %[[VAL_58:.*]] = %[[VAL_7]] to %[[VAL_5]] step %[[VAL_8]] { -// CHECK: %[[VAL_59:.*]] = load %[[VAL_14]]{{\[}}%[[VAL_16]], %[[VAL_56]], %[[VAL_58]]] : memref<32x16x8xf32> -// CHECK: store %[[VAL_59]], %[[VAL_15]]{{\[}}%[[VAL_16]], %[[VAL_56]], %[[VAL_58]]] : memref<32x16x8xf32> +// CHECK: scf.for %[[VAL_57:.*]] = %[[VAL_58:.*]]#1 to %[[VAL_5]] step %[[VAL_9]] { +// CHECK: scf.for %[[VAL_59:.*]] = %[[VAL_8]] to %[[VAL_6]] step %[[VAL_9]] { +// CHECK: %[[VAL_60:.*]] = load %[[VAL_15]]{{\[}}%[[VAL_17]], %[[VAL_57]], %[[VAL_59]]] : memref<32x16x8xf32> +// CHECK: store %[[VAL_60]], %[[VAL_16]]{{\[}}%[[VAL_17]], %[[VAL_57]], %[[VAL_59]]] : memref<32x16x8xf32> // CHECK: } // CHECK: } // CHECK: } -// CHECK: %[[VAL_60:.*]] = tensor_load %[[VAL_15]] : memref<32x16x8xf32> -// CHECK: return %[[VAL_60]] : tensor<32x16x8xf32> +// CHECK: %[[VAL_61:.*]] = tensor_load %[[VAL_16]] : memref<32x16x8xf32> +// CHECK: return %[[VAL_61]] : tensor<32x16x8xf32> // CHECK: } -func @add_dss(%arga: tensor<32x16x8xf32>, %argb: tensor<32x16x8xf32>) -> tensor<32x16x8xf32> { +func @add_dss(%arga: tensor<32x16x8xf32>, %argb: tensor<32x16x8xf32>, %argx: tensor<32x16x8xf32>) -> tensor<32x16x8xf32> { %0 = linalg.generic #trait_dss ins(%arga, %argb: tensor<32x16x8xf32>, tensor<32x16x8xf32>) - outs(%arga : tensor<32x16x8xf32>) { - ^bb(%a: f32, %b: f32, %s : f32): + outs(%argx: tensor<32x16x8xf32>) { + ^bb(%a: f32, %b: f32, %x: f32): %0 = addf %a, %b : f32 linalg.yield %0 : f32 } -> tensor<32x16x8xf32> @@ -453,45 +460,46 @@ } // CHECK-LABEL: func @mul_dss( -// CHECK-SAME: %[[VAL_0:.*]]: tensor<32x16x8xf32>, -// CHECK-SAME: %[[VAL_1:.*]]: tensor<32x16x8xf32>) -> tensor<32x16x8xf32> { -// CHECK: %[[VAL_2:.*]] = constant 999 : index -// CHECK: %[[VAL_3:.*]] = constant 32 : index -// CHECK: %[[VAL_4:.*]] = constant 0 : index -// CHECK: %[[VAL_5:.*]] = constant 1 : index -// CHECK: %[[VAL_6:.*]] = alloca(%[[VAL_2]]) : memref -// CHECK: %[[VAL_7:.*]] = alloca(%[[VAL_2]]) : memref -// CHECK: %[[VAL_8:.*]] = alloca(%[[VAL_2]]) : memref -// CHECK: %[[VAL_9:.*]] = alloca(%[[VAL_2]]) : memref -// CHECK: %[[VAL_10:.*]] = alloca(%[[VAL_2]]) : memref -// CHECK: %[[VAL_11:.*]] = alloca() : memref<32x16x8xf32> +// CHECK-SAME: %[[VAL_0:.*0]]: tensor<32x16x8xf32>, +// CHECK-SAME: %[[VAL_1:.*1]]: tensor<32x16x8xf32>, +// CHECK-SAME: %[[VAL_2:.*2]]: tensor<32x16x8xf32>) -> tensor<32x16x8xf32> { +// CHECK: %[[VAL_3:.*]] = constant 999 : index +// CHECK: %[[VAL_4:.*]] = constant 32 : index +// CHECK: %[[VAL_5:.*]] = constant 0 : index +// CHECK: %[[VAL_6:.*]] = constant 1 : index +// CHECK: %[[VAL_7:.*]] = alloca(%[[VAL_3]]) : memref +// CHECK: %[[VAL_8:.*]] = alloca(%[[VAL_3]]) : memref +// CHECK: %[[VAL_9:.*]] = alloca(%[[VAL_3]]) : memref +// CHECK: %[[VAL_10:.*]] = alloca(%[[VAL_3]]) : memref +// CHECK: %[[VAL_11:.*]] = alloca(%[[VAL_3]]) : memref // CHECK: %[[VAL_12:.*]] = alloca() : memref<32x16x8xf32> -// CHECK: scf.for %[[VAL_13:.*]] = %[[VAL_4]] to %[[VAL_3]] step %[[VAL_5]] { -// CHECK: %[[VAL_14:.*]] = load %[[VAL_6]]{{\[}}%[[VAL_13]]] : memref -// CHECK: %[[VAL_15:.*]] = addi %[[VAL_13]], %[[VAL_5]] : index -// CHECK: %[[VAL_16:.*]] = load %[[VAL_6]]{{\[}}%[[VAL_15]]] : memref -// CHECK: scf.for %[[VAL_17:.*]] = %[[VAL_14]] to %[[VAL_16]] step %[[VAL_5]] { -// CHECK: %[[VAL_18:.*]] = load %[[VAL_7]]{{\[}}%[[VAL_17]]] : memref -// CHECK: %[[VAL_19:.*]] = load %[[VAL_8]]{{\[}}%[[VAL_17]]] : memref -// CHECK: %[[VAL_20:.*]] = addi %[[VAL_17]], %[[VAL_5]] : index -// CHECK: %[[VAL_21:.*]] = load %[[VAL_8]]{{\[}}%[[VAL_20]]] : memref -// CHECK: scf.for %[[VAL_22:.*]] = %[[VAL_19]] to %[[VAL_21]] step %[[VAL_5]] { -// CHECK: %[[VAL_23:.*]] = load %[[VAL_9]]{{\[}}%[[VAL_22]]] : memref -// CHECK: %[[VAL_24:.*]] = load %[[VAL_10]]{{\[}}%[[VAL_22]]] : memref -// CHECK: %[[VAL_25:.*]] = load %[[VAL_11]]{{\[}}%[[VAL_13]], %[[VAL_18]], %[[VAL_23]]] : memref<32x16x8xf32> -// CHECK: %[[VAL_26:.*]] = mulf %[[VAL_24]], %[[VAL_25]] : f32 -// CHECK: store %[[VAL_26]], %[[VAL_12]]{{\[}}%[[VAL_13]], %[[VAL_18]], %[[VAL_23]]] : memref<32x16x8xf32> +// CHECK: %[[VAL_13:.*]] = alloca() : memref<32x16x8xf32> +// CHECK: scf.for %[[VAL_14:.*]] = %[[VAL_5]] to %[[VAL_4]] step %[[VAL_6]] { +// CHECK: %[[VAL_15:.*]] = load %[[VAL_7]]{{\[}}%[[VAL_14]]] : memref +// CHECK: %[[VAL_16:.*]] = addi %[[VAL_14]], %[[VAL_6]] : index +// CHECK: %[[VAL_17:.*]] = load %[[VAL_7]]{{\[}}%[[VAL_16]]] : memref +// CHECK: scf.for %[[VAL_18:.*]] = %[[VAL_15]] to %[[VAL_17]] step %[[VAL_6]] { +// CHECK: %[[VAL_19:.*]] = load %[[VAL_8]]{{\[}}%[[VAL_18]]] : memref +// CHECK: %[[VAL_20:.*]] = load %[[VAL_9]]{{\[}}%[[VAL_18]]] : memref +// CHECK: %[[VAL_21:.*]] = addi %[[VAL_18]], %[[VAL_6]] : index +// CHECK: %[[VAL_22:.*]] = load %[[VAL_9]]{{\[}}%[[VAL_21]]] : memref +// CHECK: scf.for %[[VAL_23:.*]] = %[[VAL_20]] to %[[VAL_22]] step %[[VAL_6]] { +// CHECK: %[[VAL_24:.*]] = load %[[VAL_10]]{{\[}}%[[VAL_23]]] : memref +// CHECK: %[[VAL_25:.*]] = load %[[VAL_11]]{{\[}}%[[VAL_23]]] : memref +// CHECK: %[[VAL_26:.*]] = load %[[VAL_12]]{{\[}}%[[VAL_14]], %[[VAL_19]], %[[VAL_24]]] : memref<32x16x8xf32> +// CHECK: %[[VAL_27:.*]] = mulf %[[VAL_25]], %[[VAL_26]] : f32 +// CHECK: store %[[VAL_27]], %[[VAL_13]]{{\[}}%[[VAL_14]], %[[VAL_19]], %[[VAL_24]]] : memref<32x16x8xf32> // CHECK: } // CHECK: } // CHECK: } -// CHECK: %[[VAL_27:.*]] = tensor_load %[[VAL_12]] : memref<32x16x8xf32> -// CHECK: return %[[VAL_27]] : tensor<32x16x8xf32> +// CHECK: %[[VAL_28:.*]] = tensor_load %[[VAL_13]] : memref<32x16x8xf32> +// CHECK: return %[[VAL_28]] : tensor<32x16x8xf32> // CHECK: } -func @mul_dss(%arga: tensor<32x16x8xf32>, %argb: tensor<32x16x8xf32>) -> tensor<32x16x8xf32> { +func @mul_dss(%arga: tensor<32x16x8xf32>, %argb: tensor<32x16x8xf32>, %argx: tensor<32x16x8xf32>) -> tensor<32x16x8xf32> { %0 = linalg.generic #trait_dss ins(%arga, %argb: tensor<32x16x8xf32>, tensor<32x16x8xf32>) - outs(%arga : tensor<32x16x8xf32>) { - ^bb(%a: f32, %b: f32, %s : f32): + outs(%argx: tensor<32x16x8xf32>) { + ^bb(%a: f32, %b: f32, %x: f32): %0 = mulf %a, %b : f32 linalg.yield %0 : f32 } -> tensor<32x16x8xf32> @@ -514,75 +522,76 @@ } // CHECK-LABEL: func @add_sdd( -// CHECK-SAME: %[[VAL_0:.*]]: tensor<32x16x8xf32>, -// CHECK-SAME: %[[VAL_1:.*]]: tensor<32x16x8xf32>) -> tensor<32x16x8xf32> { -// CHECK: %[[VAL_2:.*]] = constant 999 : index -// CHECK: %[[VAL_3:.*]] = constant 32 : index -// CHECK: %[[VAL_4:.*]] = constant 16 : index -// CHECK: %[[VAL_5:.*]] = constant 8 : index -// CHECK: %[[VAL_6:.*]] = constant true -// CHECK: %[[VAL_7:.*]] = constant 0 : index -// CHECK: %[[VAL_8:.*]] = constant 1 : index -// CHECK: %[[VAL_9:.*]] = alloca(%[[VAL_2]]) : memref -// CHECK: %[[VAL_10:.*]] = alloca(%[[VAL_2]]) : memref -// CHECK: %[[VAL_11:.*]] = alloca(%[[VAL_2]]) : memref -// CHECK: %[[VAL_12:.*]] = alloca() : memref<32x16x8xf32> +// CHECK-SAME: %[[VAL_0:.*0]]: tensor<32x16x8xf32>, +// CHECK-SAME: %[[VAL_1:.*1]]: tensor<32x16x8xf32>, +// CHECK-SAME: %[[VAL_2:.*2]]: tensor<32x16x8xf32>) -> tensor<32x16x8xf32> { +// CHECK: %[[VAL_3:.*]] = constant 999 : index +// CHECK: %[[VAL_4:.*]] = constant 32 : index +// CHECK: %[[VAL_5:.*]] = constant 16 : index +// CHECK: %[[VAL_6:.*]] = constant 8 : index +// CHECK: %[[VAL_7:.*]] = constant true +// CHECK: %[[VAL_8:.*]] = constant 0 : index +// CHECK: %[[VAL_9:.*]] = constant 1 : index +// CHECK: %[[VAL_10:.*]] = alloca(%[[VAL_3]]) : memref +// CHECK: %[[VAL_11:.*]] = alloca(%[[VAL_3]]) : memref +// CHECK: %[[VAL_12:.*]] = alloca(%[[VAL_3]]) : memref // CHECK: %[[VAL_13:.*]] = alloca() : memref<32x16x8xf32> -// CHECK: %[[VAL_14:.*]] = load %[[VAL_9]]{{\[}}%[[VAL_7]]] : memref -// CHECK: %[[VAL_15:.*]] = load %[[VAL_9]]{{\[}}%[[VAL_8]]] : memref -// CHECK: %[[VAL_16:.*]]:2 = scf.while (%[[VAL_17:.*]] = %[[VAL_14]], %[[VAL_18:.*]] = %[[VAL_7]]) : (index, index) -> (index, index) { -// CHECK: %[[VAL_19:.*]] = cmpi ult, %[[VAL_17]], %[[VAL_15]] : index -// CHECK: scf.condition(%[[VAL_19]]) %[[VAL_17]], %[[VAL_18]] : index, index +// CHECK: %[[VAL_14:.*]] = alloca() : memref<32x16x8xf32> +// CHECK: %[[VAL_15:.*]] = load %[[VAL_10]]{{\[}}%[[VAL_8]]] : memref +// CHECK: %[[VAL_16:.*]] = load %[[VAL_10]]{{\[}}%[[VAL_9]]] : memref +// CHECK: %[[VAL_17:.*]]:2 = scf.while (%[[VAL_18:.*]] = %[[VAL_15]], %[[VAL_19:.*]] = %[[VAL_8]]) : (index, index) -> (index, index) { +// CHECK: %[[VAL_20:.*]] = cmpi ult, %[[VAL_18]], %[[VAL_16]] : index +// CHECK: scf.condition(%[[VAL_20]]) %[[VAL_18]], %[[VAL_19]] : index, index // CHECK: } do { -// CHECK: ^bb0(%[[VAL_20:.*]]: index, %[[VAL_21:.*]]: index): -// CHECK: %[[VAL_22:.*]] = load %[[VAL_10]]{{\[}}%[[VAL_20]]] : memref -// CHECK: %[[VAL_23:.*]] = cmpi eq, %[[VAL_22]], %[[VAL_21]] : index -// CHECK: scf.if %[[VAL_23]] { -// CHECK: scf.for %[[VAL_24:.*]] = %[[VAL_7]] to %[[VAL_4]] step %[[VAL_8]] { -// CHECK: %[[VAL_25:.*]] = muli %[[VAL_20]], %[[VAL_4]] : index -// CHECK: %[[VAL_26:.*]] = addi %[[VAL_25]], %[[VAL_24]] : index -// CHECK: scf.for %[[VAL_27:.*]] = %[[VAL_7]] to %[[VAL_5]] step %[[VAL_8]] { -// CHECK: %[[VAL_28:.*]] = muli %[[VAL_26]], %[[VAL_5]] : index -// CHECK: %[[VAL_29:.*]] = addi %[[VAL_28]], %[[VAL_27]] : index -// CHECK: %[[VAL_30:.*]] = load %[[VAL_11]]{{\[}}%[[VAL_29]]] : memref -// CHECK: %[[VAL_31:.*]] = load %[[VAL_12]]{{\[}}%[[VAL_21]], %[[VAL_24]], %[[VAL_27]]] : memref<32x16x8xf32> -// CHECK: %[[VAL_32:.*]] = addf %[[VAL_30]], %[[VAL_31]] : f32 -// CHECK: store %[[VAL_32]], %[[VAL_13]]{{\[}}%[[VAL_21]], %[[VAL_24]], %[[VAL_27]]] : memref<32x16x8xf32> +// CHECK: ^bb0(%[[VAL_21:.*]]: index, %[[VAL_22:.*]]: index): +// CHECK: %[[VAL_23:.*]] = load %[[VAL_11]]{{\[}}%[[VAL_21]]] : memref +// CHECK: %[[VAL_24:.*]] = cmpi eq, %[[VAL_23]], %[[VAL_22]] : index +// CHECK: scf.if %[[VAL_24]] { +// CHECK: scf.for %[[VAL_25:.*]] = %[[VAL_8]] to %[[VAL_5]] step %[[VAL_9]] { +// CHECK: %[[VAL_26:.*]] = muli %[[VAL_21]], %[[VAL_5]] : index +// CHECK: %[[VAL_27:.*]] = addi %[[VAL_26]], %[[VAL_25]] : index +// CHECK: scf.for %[[VAL_28:.*]] = %[[VAL_8]] to %[[VAL_6]] step %[[VAL_9]] { +// CHECK: %[[VAL_29:.*]] = muli %[[VAL_27]], %[[VAL_6]] : index +// CHECK: %[[VAL_30:.*]] = addi %[[VAL_29]], %[[VAL_28]] : index +// CHECK: %[[VAL_31:.*]] = load %[[VAL_12]]{{\[}}%[[VAL_30]]] : memref +// CHECK: %[[VAL_32:.*]] = load %[[VAL_13]]{{\[}}%[[VAL_22]], %[[VAL_25]], %[[VAL_28]]] : memref<32x16x8xf32> +// CHECK: %[[VAL_33:.*]] = addf %[[VAL_31]], %[[VAL_32]] : f32 +// CHECK: store %[[VAL_33]], %[[VAL_14]]{{\[}}%[[VAL_22]], %[[VAL_25]], %[[VAL_28]]] : memref<32x16x8xf32> // CHECK: } // CHECK: } // CHECK: } else { -// CHECK: scf.if %[[VAL_6]] { -// CHECK: scf.for %[[VAL_33:.*]] = %[[VAL_7]] to %[[VAL_4]] step %[[VAL_8]] { -// CHECK: scf.for %[[VAL_34:.*]] = %[[VAL_7]] to %[[VAL_5]] step %[[VAL_8]] { -// CHECK: %[[VAL_35:.*]] = load %[[VAL_12]]{{\[}}%[[VAL_21]], %[[VAL_33]], %[[VAL_34]]] : memref<32x16x8xf32> -// CHECK: store %[[VAL_35]], %[[VAL_13]]{{\[}}%[[VAL_21]], %[[VAL_33]], %[[VAL_34]]] : memref<32x16x8xf32> +// CHECK: scf.if %[[VAL_7]] { +// CHECK: scf.for %[[VAL_34:.*]] = %[[VAL_8]] to %[[VAL_5]] step %[[VAL_9]] { +// CHECK: scf.for %[[VAL_35:.*]] = %[[VAL_8]] to %[[VAL_6]] step %[[VAL_9]] { +// CHECK: %[[VAL_36:.*]] = load %[[VAL_13]]{{\[}}%[[VAL_22]], %[[VAL_34]], %[[VAL_35]]] : memref<32x16x8xf32> +// CHECK: store %[[VAL_36]], %[[VAL_14]]{{\[}}%[[VAL_22]], %[[VAL_34]], %[[VAL_35]]] : memref<32x16x8xf32> // CHECK: } // CHECK: } // CHECK: } else { // CHECK: } // CHECK: } -// CHECK: %[[VAL_36:.*]] = cmpi eq, %[[VAL_22]], %[[VAL_21]] : index -// CHECK: %[[VAL_37:.*]] = addi %[[VAL_20]], %[[VAL_8]] : index -// CHECK: %[[VAL_38:.*]] = select %[[VAL_36]], %[[VAL_37]], %[[VAL_20]] : index -// CHECK: %[[VAL_39:.*]] = addi %[[VAL_21]], %[[VAL_8]] : index -// CHECK: scf.yield %[[VAL_38]], %[[VAL_39]] : index, index +// CHECK: %[[VAL_37:.*]] = cmpi eq, %[[VAL_23]], %[[VAL_22]] : index +// CHECK: %[[VAL_38:.*]] = addi %[[VAL_21]], %[[VAL_9]] : index +// CHECK: %[[VAL_39:.*]] = select %[[VAL_37]], %[[VAL_38]], %[[VAL_21]] : index +// CHECK: %[[VAL_40:.*]] = addi %[[VAL_22]], %[[VAL_9]] : index +// CHECK: scf.yield %[[VAL_39]], %[[VAL_40]] : index, index // CHECK: } -// CHECK: scf.for %[[VAL_40:.*]] = %[[VAL_41:.*]]#1 to %[[VAL_3]] step %[[VAL_8]] { -// CHECK: scf.for %[[VAL_42:.*]] = %[[VAL_7]] to %[[VAL_4]] step %[[VAL_8]] { -// CHECK: scf.for %[[VAL_43:.*]] = %[[VAL_7]] to %[[VAL_5]] step %[[VAL_8]] { -// CHECK: %[[VAL_44:.*]] = load %[[VAL_12]]{{\[}}%[[VAL_40]], %[[VAL_42]], %[[VAL_43]]] : memref<32x16x8xf32> -// CHECK: store %[[VAL_44]], %[[VAL_13]]{{\[}}%[[VAL_40]], %[[VAL_42]], %[[VAL_43]]] : memref<32x16x8xf32> +// CHECK: scf.for %[[VAL_41:.*]] = %[[VAL_42:.*]]#1 to %[[VAL_4]] step %[[VAL_9]] { +// CHECK: scf.for %[[VAL_43:.*]] = %[[VAL_8]] to %[[VAL_5]] step %[[VAL_9]] { +// CHECK: scf.for %[[VAL_44:.*]] = %[[VAL_8]] to %[[VAL_6]] step %[[VAL_9]] { +// CHECK: %[[VAL_45:.*]] = load %[[VAL_13]]{{\[}}%[[VAL_41]], %[[VAL_43]], %[[VAL_44]]] : memref<32x16x8xf32> +// CHECK: store %[[VAL_45]], %[[VAL_14]]{{\[}}%[[VAL_41]], %[[VAL_43]], %[[VAL_44]]] : memref<32x16x8xf32> // CHECK: } // CHECK: } // CHECK: } -// CHECK: %[[VAL_45:.*]] = tensor_load %[[VAL_13]] : memref<32x16x8xf32> -// CHECK: return %[[VAL_45]] : tensor<32x16x8xf32> +// CHECK: %[[VAL_46:.*]] = tensor_load %[[VAL_14]] : memref<32x16x8xf32> +// CHECK: return %[[VAL_46]] : tensor<32x16x8xf32> // CHECK: } -func @add_sdd(%arga: tensor<32x16x8xf32>, %argb: tensor<32x16x8xf32>) -> tensor<32x16x8xf32> { +func @add_sdd(%arga: tensor<32x16x8xf32>, %argb: tensor<32x16x8xf32>, %argx: tensor<32x16x8xf32>) -> tensor<32x16x8xf32> { %0 = linalg.generic #trait_sdd ins(%arga, %argb: tensor<32x16x8xf32>, tensor<32x16x8xf32>) - outs(%arga : tensor<32x16x8xf32>) { - ^bb(%a: f32, %b: f32, %s : f32): + outs(%argx: tensor<32x16x8xf32>) { + ^bb(%a: f32, %b: f32, %x: f32): %0 = addf %a, %b : f32 linalg.yield %0 : f32 } -> tensor<32x16x8xf32> @@ -590,43 +599,44 @@ } // CHECK-LABEL: func @mul_sdd( -// CHECK-SAME: %[[VAL_0:.*]]: tensor<32x16x8xf32>, -// CHECK-SAME: %[[VAL_1:.*]]: tensor<32x16x8xf32>) -> tensor<32x16x8xf32> { -// CHECK: %[[VAL_2:.*]] = constant 999 : index -// CHECK: %[[VAL_3:.*]] = constant 16 : index -// CHECK: %[[VAL_4:.*]] = constant 8 : index -// CHECK: %[[VAL_5:.*]] = constant 0 : index -// CHECK: %[[VAL_6:.*]] = constant 1 : index -// CHECK: %[[VAL_7:.*]] = alloca(%[[VAL_2]]) : memref -// CHECK: %[[VAL_8:.*]] = alloca(%[[VAL_2]]) : memref -// CHECK: %[[VAL_9:.*]] = alloca(%[[VAL_2]]) : memref -// CHECK: %[[VAL_10:.*]] = alloca() : memref<32x16x8xf32> +// CHECK-SAME: %[[VAL_0:.*0]]: tensor<32x16x8xf32>, +// CHECK-SAME: %[[VAL_1:.*1]]: tensor<32x16x8xf32>, +// CHECK-SAME: %[[VAL_2:.*2]]: tensor<32x16x8xf32>) -> tensor<32x16x8xf32> { +// CHECK: %[[VAL_3:.*]] = constant 999 : index +// CHECK: %[[VAL_4:.*]] = constant 16 : index +// CHECK: %[[VAL_5:.*]] = constant 8 : index +// CHECK: %[[VAL_6:.*]] = constant 0 : index +// CHECK: %[[VAL_7:.*]] = constant 1 : index +// CHECK: %[[VAL_8:.*]] = alloca(%[[VAL_3]]) : memref +// CHECK: %[[VAL_9:.*]] = alloca(%[[VAL_3]]) : memref +// CHECK: %[[VAL_10:.*]] = alloca(%[[VAL_3]]) : memref // CHECK: %[[VAL_11:.*]] = alloca() : memref<32x16x8xf32> -// CHECK: %[[VAL_12:.*]] = load %[[VAL_7]]{{\[}}%[[VAL_5]]] : memref -// CHECK: %[[VAL_13:.*]] = load %[[VAL_7]]{{\[}}%[[VAL_6]]] : memref -// CHECK: scf.for %[[VAL_14:.*]] = %[[VAL_12]] to %[[VAL_13]] step %[[VAL_6]] { -// CHECK: %[[VAL_15:.*]] = load %[[VAL_8]]{{\[}}%[[VAL_14]]] : memref -// CHECK: scf.for %[[VAL_16:.*]] = %[[VAL_5]] to %[[VAL_3]] step %[[VAL_6]] { -// CHECK: %[[VAL_17:.*]] = muli %[[VAL_14]], %[[VAL_3]] : index -// CHECK: %[[VAL_18:.*]] = addi %[[VAL_17]], %[[VAL_16]] : index -// CHECK: scf.for %[[VAL_19:.*]] = %[[VAL_5]] to %[[VAL_4]] step %[[VAL_6]] { -// CHECK: %[[VAL_20:.*]] = muli %[[VAL_18]], %[[VAL_4]] : index -// CHECK: %[[VAL_21:.*]] = addi %[[VAL_20]], %[[VAL_19]] : index -// CHECK: %[[VAL_22:.*]] = load %[[VAL_9]]{{\[}}%[[VAL_21]]] : memref -// CHECK: %[[VAL_23:.*]] = load %[[VAL_10]]{{\[}}%[[VAL_15]], %[[VAL_16]], %[[VAL_19]]] : memref<32x16x8xf32> -// CHECK: %[[VAL_24:.*]] = mulf %[[VAL_22]], %[[VAL_23]] : f32 -// CHECK: store %[[VAL_24]], %[[VAL_11]]{{\[}}%[[VAL_15]], %[[VAL_16]], %[[VAL_19]]] : memref<32x16x8xf32> +// CHECK: %[[VAL_12:.*]] = alloca() : memref<32x16x8xf32> +// CHECK: %[[VAL_13:.*]] = load %[[VAL_8]]{{\[}}%[[VAL_6]]] : memref +// CHECK: %[[VAL_14:.*]] = load %[[VAL_8]]{{\[}}%[[VAL_7]]] : memref +// CHECK: scf.for %[[VAL_15:.*]] = %[[VAL_13]] to %[[VAL_14]] step %[[VAL_7]] { +// CHECK: %[[VAL_16:.*]] = load %[[VAL_9]]{{\[}}%[[VAL_15]]] : memref +// CHECK: scf.for %[[VAL_17:.*]] = %[[VAL_6]] to %[[VAL_4]] step %[[VAL_7]] { +// CHECK: %[[VAL_18:.*]] = muli %[[VAL_15]], %[[VAL_4]] : index +// CHECK: %[[VAL_19:.*]] = addi %[[VAL_18]], %[[VAL_17]] : index +// CHECK: scf.for %[[VAL_20:.*]] = %[[VAL_6]] to %[[VAL_5]] step %[[VAL_7]] { +// CHECK: %[[VAL_21:.*]] = muli %[[VAL_19]], %[[VAL_5]] : index +// CHECK: %[[VAL_22:.*]] = addi %[[VAL_21]], %[[VAL_20]] : index +// CHECK: %[[VAL_23:.*]] = load %[[VAL_10]]{{\[}}%[[VAL_22]]] : memref +// CHECK: %[[VAL_24:.*]] = load %[[VAL_11]]{{\[}}%[[VAL_16]], %[[VAL_17]], %[[VAL_20]]] : memref<32x16x8xf32> +// CHECK: %[[VAL_25:.*]] = mulf %[[VAL_23]], %[[VAL_24]] : f32 +// CHECK: store %[[VAL_25]], %[[VAL_12]]{{\[}}%[[VAL_16]], %[[VAL_17]], %[[VAL_20]]] : memref<32x16x8xf32> // CHECK: } // CHECK: } // CHECK: } -// CHECK: %[[VAL_25:.*]] = tensor_load %[[VAL_11]] : memref<32x16x8xf32> -// CHECK: return %[[VAL_25]] : tensor<32x16x8xf32> +// CHECK: %[[VAL_26:.*]] = tensor_load %[[VAL_12]] : memref<32x16x8xf32> +// CHECK: return %[[VAL_26]] : tensor<32x16x8xf32> // CHECK: } -func @mul_sdd(%arga: tensor<32x16x8xf32>, %argb: tensor<32x16x8xf32>) -> tensor<32x16x8xf32> { +func @mul_sdd(%arga: tensor<32x16x8xf32>, %argb: tensor<32x16x8xf32>, %argx: tensor<32x16x8xf32>) -> tensor<32x16x8xf32> { %0 = linalg.generic #trait_sdd ins(%arga, %argb: tensor<32x16x8xf32>, tensor<32x16x8xf32>) - outs(%arga : tensor<32x16x8xf32>) { - ^bb(%a: f32, %b: f32, %s : f32): + outs(%argx: tensor<32x16x8xf32>) { + ^bb(%a: f32, %b: f32, %x: f32): %0 = mulf %a, %b : f32 linalg.yield %0 : f32 } -> tensor<32x16x8xf32> @@ -649,101 +659,102 @@ } // CHECK-LABEL: func @add_sds( -// CHECK-SAME: %[[VAL_0:.*]]: tensor<32x16x8xf32>, -// CHECK-SAME: %[[VAL_1:.*]]: tensor<32x16x8xf32>) -> tensor<32x16x8xf32> { -// CHECK: %[[VAL_2:.*]] = constant 999 : index -// CHECK: %[[VAL_3:.*]] = constant 32 : index -// CHECK: %[[VAL_4:.*]] = constant 16 : index -// CHECK: %[[VAL_5:.*]] = constant 8 : index -// CHECK: %[[VAL_6:.*]] = constant true -// CHECK: %[[VAL_7:.*]] = constant 0 : index -// CHECK: %[[VAL_8:.*]] = constant 1 : index -// CHECK: %[[VAL_9:.*]] = alloca(%[[VAL_2]]) : memref -// CHECK: %[[VAL_10:.*]] = alloca(%[[VAL_2]]) : memref -// CHECK: %[[VAL_11:.*]] = alloca(%[[VAL_2]]) : memref -// CHECK: %[[VAL_12:.*]] = alloca(%[[VAL_2]]) : memref -// CHECK: %[[VAL_13:.*]] = alloca(%[[VAL_2]]) : memref -// CHECK: %[[VAL_14:.*]] = alloca() : memref<32x16x8xf32> +// CHECK-SAME: %[[VAL_0:.*0]]: tensor<32x16x8xf32>, +// CHECK-SAME: %[[VAL_1:.*1]]: tensor<32x16x8xf32>, +// CHECK-SAME: %[[VAL_2:.*2]]: tensor<32x16x8xf32>) -> tensor<32x16x8xf32> { +// CHECK: %[[VAL_3:.*]] = constant 999 : index +// CHECK: %[[VAL_4:.*]] = constant 32 : index +// CHECK: %[[VAL_5:.*]] = constant 16 : index +// CHECK: %[[VAL_6:.*]] = constant 8 : index +// CHECK: %[[VAL_7:.*]] = constant true +// CHECK: %[[VAL_8:.*]] = constant 0 : index +// CHECK: %[[VAL_9:.*]] = constant 1 : index +// CHECK: %[[VAL_10:.*]] = alloca(%[[VAL_3]]) : memref +// CHECK: %[[VAL_11:.*]] = alloca(%[[VAL_3]]) : memref +// CHECK: %[[VAL_12:.*]] = alloca(%[[VAL_3]]) : memref +// CHECK: %[[VAL_13:.*]] = alloca(%[[VAL_3]]) : memref +// CHECK: %[[VAL_14:.*]] = alloca(%[[VAL_3]]) : memref // CHECK: %[[VAL_15:.*]] = alloca() : memref<32x16x8xf32> -// CHECK: %[[VAL_16:.*]] = load %[[VAL_9]]{{\[}}%[[VAL_7]]] : memref -// CHECK: %[[VAL_17:.*]] = load %[[VAL_9]]{{\[}}%[[VAL_8]]] : memref -// CHECK: %[[VAL_18:.*]]:2 = scf.while (%[[VAL_19:.*]] = %[[VAL_16]], %[[VAL_20:.*]] = %[[VAL_7]]) : (index, index) -> (index, index) { -// CHECK: %[[VAL_21:.*]] = cmpi ult, %[[VAL_19]], %[[VAL_17]] : index -// CHECK: scf.condition(%[[VAL_21]]) %[[VAL_19]], %[[VAL_20]] : index, index +// CHECK: %[[VAL_16:.*]] = alloca() : memref<32x16x8xf32> +// CHECK: %[[VAL_17:.*]] = load %[[VAL_10]]{{\[}}%[[VAL_8]]] : memref +// CHECK: %[[VAL_18:.*]] = load %[[VAL_10]]{{\[}}%[[VAL_9]]] : memref +// CHECK: %[[VAL_19:.*]]:2 = scf.while (%[[VAL_20:.*]] = %[[VAL_17]], %[[VAL_21:.*]] = %[[VAL_8]]) : (index, index) -> (index, index) { +// CHECK: %[[VAL_22:.*]] = cmpi ult, %[[VAL_20]], %[[VAL_18]] : index +// CHECK: scf.condition(%[[VAL_22]]) %[[VAL_20]], %[[VAL_21]] : index, index // CHECK: } do { -// CHECK: ^bb0(%[[VAL_22:.*]]: index, %[[VAL_23:.*]]: index): -// CHECK: %[[VAL_24:.*]] = load %[[VAL_10]]{{\[}}%[[VAL_22]]] : memref -// CHECK: %[[VAL_25:.*]] = cmpi eq, %[[VAL_24]], %[[VAL_23]] : index -// CHECK: scf.if %[[VAL_25]] { -// CHECK: scf.for %[[VAL_26:.*]] = %[[VAL_7]] to %[[VAL_4]] step %[[VAL_8]] { -// CHECK: %[[VAL_27:.*]] = muli %[[VAL_22]], %[[VAL_4]] : index -// CHECK: %[[VAL_28:.*]] = addi %[[VAL_27]], %[[VAL_26]] : index -// CHECK: %[[VAL_29:.*]] = load %[[VAL_11]]{{\[}}%[[VAL_28]]] : memref -// CHECK: %[[VAL_30:.*]] = addi %[[VAL_28]], %[[VAL_8]] : index -// CHECK: %[[VAL_31:.*]] = load %[[VAL_11]]{{\[}}%[[VAL_30]]] : memref -// CHECK: %[[VAL_32:.*]]:2 = scf.while (%[[VAL_33:.*]] = %[[VAL_29]], %[[VAL_34:.*]] = %[[VAL_7]]) : (index, index) -> (index, index) { -// CHECK: %[[VAL_35:.*]] = cmpi ult, %[[VAL_33]], %[[VAL_31]] : index -// CHECK: scf.condition(%[[VAL_35]]) %[[VAL_33]], %[[VAL_34]] : index, index +// CHECK: ^bb0(%[[VAL_23:.*]]: index, %[[VAL_24:.*]]: index): +// CHECK: %[[VAL_25:.*]] = load %[[VAL_11]]{{\[}}%[[VAL_23]]] : memref +// CHECK: %[[VAL_26:.*]] = cmpi eq, %[[VAL_25]], %[[VAL_24]] : index +// CHECK: scf.if %[[VAL_26]] { +// CHECK: scf.for %[[VAL_27:.*]] = %[[VAL_8]] to %[[VAL_5]] step %[[VAL_9]] { +// CHECK: %[[VAL_28:.*]] = muli %[[VAL_23]], %[[VAL_5]] : index +// CHECK: %[[VAL_29:.*]] = addi %[[VAL_28]], %[[VAL_27]] : index +// CHECK: %[[VAL_30:.*]] = load %[[VAL_12]]{{\[}}%[[VAL_29]]] : memref +// CHECK: %[[VAL_31:.*]] = addi %[[VAL_29]], %[[VAL_9]] : index +// CHECK: %[[VAL_32:.*]] = load %[[VAL_12]]{{\[}}%[[VAL_31]]] : memref +// CHECK: %[[VAL_33:.*]]:2 = scf.while (%[[VAL_34:.*]] = %[[VAL_30]], %[[VAL_35:.*]] = %[[VAL_8]]) : (index, index) -> (index, index) { +// CHECK: %[[VAL_36:.*]] = cmpi ult, %[[VAL_34]], %[[VAL_32]] : index +// CHECK: scf.condition(%[[VAL_36]]) %[[VAL_34]], %[[VAL_35]] : index, index // CHECK: } do { -// CHECK: ^bb0(%[[VAL_36:.*]]: index, %[[VAL_37:.*]]: index): -// CHECK: %[[VAL_38:.*]] = load %[[VAL_12]]{{\[}}%[[VAL_36]]] : memref -// CHECK: %[[VAL_39:.*]] = cmpi eq, %[[VAL_38]], %[[VAL_37]] : index -// CHECK: scf.if %[[VAL_39]] { -// CHECK: %[[VAL_40:.*]] = load %[[VAL_13]]{{\[}}%[[VAL_36]]] : memref -// CHECK: %[[VAL_41:.*]] = load %[[VAL_14]]{{\[}}%[[VAL_23]], %[[VAL_26]], %[[VAL_37]]] : memref<32x16x8xf32> -// CHECK: %[[VAL_42:.*]] = addf %[[VAL_40]], %[[VAL_41]] : f32 -// CHECK: store %[[VAL_42]], %[[VAL_15]]{{\[}}%[[VAL_23]], %[[VAL_26]], %[[VAL_37]]] : memref<32x16x8xf32> +// CHECK: ^bb0(%[[VAL_37:.*]]: index, %[[VAL_38:.*]]: index): +// CHECK: %[[VAL_39:.*]] = load %[[VAL_13]]{{\[}}%[[VAL_37]]] : memref +// CHECK: %[[VAL_40:.*]] = cmpi eq, %[[VAL_39]], %[[VAL_38]] : index +// CHECK: scf.if %[[VAL_40]] { +// CHECK: %[[VAL_41:.*]] = load %[[VAL_14]]{{\[}}%[[VAL_37]]] : memref +// CHECK: %[[VAL_42:.*]] = load %[[VAL_15]]{{\[}}%[[VAL_24]], %[[VAL_27]], %[[VAL_38]]] : memref<32x16x8xf32> +// CHECK: %[[VAL_43:.*]] = addf %[[VAL_41]], %[[VAL_42]] : f32 +// CHECK: store %[[VAL_43]], %[[VAL_16]]{{\[}}%[[VAL_24]], %[[VAL_27]], %[[VAL_38]]] : memref<32x16x8xf32> // CHECK: } else { -// CHECK: scf.if %[[VAL_6]] { -// CHECK: %[[VAL_43:.*]] = load %[[VAL_14]]{{\[}}%[[VAL_23]], %[[VAL_26]], %[[VAL_37]]] : memref<32x16x8xf32> -// CHECK: store %[[VAL_43]], %[[VAL_15]]{{\[}}%[[VAL_23]], %[[VAL_26]], %[[VAL_37]]] : memref<32x16x8xf32> +// CHECK: scf.if %[[VAL_7]] { +// CHECK: %[[VAL_44:.*]] = load %[[VAL_15]]{{\[}}%[[VAL_24]], %[[VAL_27]], %[[VAL_38]]] : memref<32x16x8xf32> +// CHECK: store %[[VAL_44]], %[[VAL_16]]{{\[}}%[[VAL_24]], %[[VAL_27]], %[[VAL_38]]] : memref<32x16x8xf32> // CHECK: } else { // CHECK: } // CHECK: } -// CHECK: %[[VAL_44:.*]] = cmpi eq, %[[VAL_38]], %[[VAL_37]] : index -// CHECK: %[[VAL_45:.*]] = addi %[[VAL_36]], %[[VAL_8]] : index -// CHECK: %[[VAL_46:.*]] = select %[[VAL_44]], %[[VAL_45]], %[[VAL_36]] : index -// CHECK: %[[VAL_47:.*]] = addi %[[VAL_37]], %[[VAL_8]] : index -// CHECK: scf.yield %[[VAL_46]], %[[VAL_47]] : index, index +// CHECK: %[[VAL_45:.*]] = cmpi eq, %[[VAL_39]], %[[VAL_38]] : index +// CHECK: %[[VAL_46:.*]] = addi %[[VAL_37]], %[[VAL_9]] : index +// CHECK: %[[VAL_47:.*]] = select %[[VAL_45]], %[[VAL_46]], %[[VAL_37]] : index +// CHECK: %[[VAL_48:.*]] = addi %[[VAL_38]], %[[VAL_9]] : index +// CHECK: scf.yield %[[VAL_47]], %[[VAL_48]] : index, index // CHECK: } -// CHECK: scf.for %[[VAL_48:.*]] = %[[VAL_49:.*]]#1 to %[[VAL_5]] step %[[VAL_8]] { -// CHECK: %[[VAL_50:.*]] = load %[[VAL_14]]{{\[}}%[[VAL_23]], %[[VAL_26]], %[[VAL_48]]] : memref<32x16x8xf32> -// CHECK: store %[[VAL_50]], %[[VAL_15]]{{\[}}%[[VAL_23]], %[[VAL_26]], %[[VAL_48]]] : memref<32x16x8xf32> +// CHECK: scf.for %[[VAL_49:.*]] = %[[VAL_50:.*]]#1 to %[[VAL_6]] step %[[VAL_9]] { +// CHECK: %[[VAL_51:.*]] = load %[[VAL_15]]{{\[}}%[[VAL_24]], %[[VAL_27]], %[[VAL_49]]] : memref<32x16x8xf32> +// CHECK: store %[[VAL_51]], %[[VAL_16]]{{\[}}%[[VAL_24]], %[[VAL_27]], %[[VAL_49]]] : memref<32x16x8xf32> // CHECK: } // CHECK: } // CHECK: } else { -// CHECK: scf.if %[[VAL_6]] { -// CHECK: scf.for %[[VAL_51:.*]] = %[[VAL_7]] to %[[VAL_4]] step %[[VAL_8]] { -// CHECK: scf.for %[[VAL_52:.*]] = %[[VAL_7]] to %[[VAL_5]] step %[[VAL_8]] { -// CHECK: %[[VAL_53:.*]] = load %[[VAL_14]]{{\[}}%[[VAL_23]], %[[VAL_51]], %[[VAL_52]]] : memref<32x16x8xf32> -// CHECK: store %[[VAL_53]], %[[VAL_15]]{{\[}}%[[VAL_23]], %[[VAL_51]], %[[VAL_52]]] : memref<32x16x8xf32> +// CHECK: scf.if %[[VAL_7]] { +// CHECK: scf.for %[[VAL_52:.*]] = %[[VAL_8]] to %[[VAL_5]] step %[[VAL_9]] { +// CHECK: scf.for %[[VAL_53:.*]] = %[[VAL_8]] to %[[VAL_6]] step %[[VAL_9]] { +// CHECK: %[[VAL_54:.*]] = load %[[VAL_15]]{{\[}}%[[VAL_24]], %[[VAL_52]], %[[VAL_53]]] : memref<32x16x8xf32> +// CHECK: store %[[VAL_54]], %[[VAL_16]]{{\[}}%[[VAL_24]], %[[VAL_52]], %[[VAL_53]]] : memref<32x16x8xf32> // CHECK: } // CHECK: } // CHECK: } else { // CHECK: } // CHECK: } -// CHECK: %[[VAL_54:.*]] = cmpi eq, %[[VAL_24]], %[[VAL_23]] : index -// CHECK: %[[VAL_55:.*]] = addi %[[VAL_22]], %[[VAL_8]] : index -// CHECK: %[[VAL_56:.*]] = select %[[VAL_54]], %[[VAL_55]], %[[VAL_22]] : index -// CHECK: %[[VAL_57:.*]] = addi %[[VAL_23]], %[[VAL_8]] : index -// CHECK: scf.yield %[[VAL_56]], %[[VAL_57]] : index, index +// CHECK: %[[VAL_55:.*]] = cmpi eq, %[[VAL_25]], %[[VAL_24]] : index +// CHECK: %[[VAL_56:.*]] = addi %[[VAL_23]], %[[VAL_9]] : index +// CHECK: %[[VAL_57:.*]] = select %[[VAL_55]], %[[VAL_56]], %[[VAL_23]] : index +// CHECK: %[[VAL_58:.*]] = addi %[[VAL_24]], %[[VAL_9]] : index +// CHECK: scf.yield %[[VAL_57]], %[[VAL_58]] : index, index // CHECK: } -// CHECK: scf.for %[[VAL_58:.*]] = %[[VAL_59:.*]]#1 to %[[VAL_3]] step %[[VAL_8]] { -// CHECK: scf.for %[[VAL_60:.*]] = %[[VAL_7]] to %[[VAL_4]] step %[[VAL_8]] { -// CHECK: scf.for %[[VAL_61:.*]] = %[[VAL_7]] to %[[VAL_5]] step %[[VAL_8]] { -// CHECK: %[[VAL_62:.*]] = load %[[VAL_14]]{{\[}}%[[VAL_58]], %[[VAL_60]], %[[VAL_61]]] : memref<32x16x8xf32> -// CHECK: store %[[VAL_62]], %[[VAL_15]]{{\[}}%[[VAL_58]], %[[VAL_60]], %[[VAL_61]]] : memref<32x16x8xf32> +// CHECK: scf.for %[[VAL_59:.*]] = %[[VAL_60:.*]]#1 to %[[VAL_4]] step %[[VAL_9]] { +// CHECK: scf.for %[[VAL_61:.*]] = %[[VAL_8]] to %[[VAL_5]] step %[[VAL_9]] { +// CHECK: scf.for %[[VAL_62:.*]] = %[[VAL_8]] to %[[VAL_6]] step %[[VAL_9]] { +// CHECK: %[[VAL_63:.*]] = load %[[VAL_15]]{{\[}}%[[VAL_59]], %[[VAL_61]], %[[VAL_62]]] : memref<32x16x8xf32> +// CHECK: store %[[VAL_63]], %[[VAL_16]]{{\[}}%[[VAL_59]], %[[VAL_61]], %[[VAL_62]]] : memref<32x16x8xf32> // CHECK: } // CHECK: } // CHECK: } -// CHECK: %[[VAL_63:.*]] = tensor_load %[[VAL_15]] : memref<32x16x8xf32> -// CHECK: return %[[VAL_63]] : tensor<32x16x8xf32> +// CHECK: %[[VAL_64:.*]] = tensor_load %[[VAL_16]] : memref<32x16x8xf32> +// CHECK: return %[[VAL_64]] : tensor<32x16x8xf32> // CHECK: } -func @add_sds(%arga: tensor<32x16x8xf32>, %argb: tensor<32x16x8xf32>) -> tensor<32x16x8xf32> { +func @add_sds(%arga: tensor<32x16x8xf32>, %argb: tensor<32x16x8xf32>, %argx: tensor<32x16x8xf32>) -> tensor<32x16x8xf32> { %0 = linalg.generic #trait_sds ins(%arga, %argb: tensor<32x16x8xf32>, tensor<32x16x8xf32>) - outs(%arga : tensor<32x16x8xf32>) { - ^bb(%a: f32, %b: f32, %s : f32): + outs(%argx: tensor<32x16x8xf32>) { + ^bb(%a: f32, %b: f32, %x: f32): %0 = addf %a, %b : f32 linalg.yield %0 : f32 } -> tensor<32x16x8xf32> @@ -751,46 +762,47 @@ } // CHECK-LABEL: func @mul_sds( -// CHECK-SAME: %[[VAL_0:.*]]: tensor<32x16x8xf32>, -// CHECK-SAME: %[[VAL_1:.*]]: tensor<32x16x8xf32>) -> tensor<32x16x8xf32> { -// CHECK: %[[VAL_2:.*]] = constant 999 : index -// CHECK: %[[VAL_3:.*]] = constant 16 : index -// CHECK: %[[VAL_4:.*]] = constant 0 : index -// CHECK: %[[VAL_5:.*]] = constant 1 : index -// CHECK: %[[VAL_6:.*]] = alloca(%[[VAL_2]]) : memref -// CHECK: %[[VAL_7:.*]] = alloca(%[[VAL_2]]) : memref -// CHECK: %[[VAL_8:.*]] = alloca(%[[VAL_2]]) : memref -// CHECK: %[[VAL_9:.*]] = alloca(%[[VAL_2]]) : memref -// CHECK: %[[VAL_10:.*]] = alloca(%[[VAL_2]]) : memref -// CHECK: %[[VAL_11:.*]] = alloca() : memref<32x16x8xf32> +// CHECK-SAME: %[[VAL_0:.*0]]: tensor<32x16x8xf32>, +// CHECK-SAME: %[[VAL_1:.*1]]: tensor<32x16x8xf32>, +// CHECK-SAME: %[[VAL_2:.*2]]: tensor<32x16x8xf32>) -> tensor<32x16x8xf32> { +// CHECK: %[[VAL_3:.*]] = constant 999 : index +// CHECK: %[[VAL_4:.*]] = constant 16 : index +// CHECK: %[[VAL_5:.*]] = constant 0 : index +// CHECK: %[[VAL_6:.*]] = constant 1 : index +// CHECK: %[[VAL_7:.*]] = alloca(%[[VAL_3]]) : memref +// CHECK: %[[VAL_8:.*]] = alloca(%[[VAL_3]]) : memref +// CHECK: %[[VAL_9:.*]] = alloca(%[[VAL_3]]) : memref +// CHECK: %[[VAL_10:.*]] = alloca(%[[VAL_3]]) : memref +// CHECK: %[[VAL_11:.*]] = alloca(%[[VAL_3]]) : memref // CHECK: %[[VAL_12:.*]] = alloca() : memref<32x16x8xf32> -// CHECK: %[[VAL_13:.*]] = load %[[VAL_6]]{{\[}}%[[VAL_4]]] : memref -// CHECK: %[[VAL_14:.*]] = load %[[VAL_6]]{{\[}}%[[VAL_5]]] : memref -// CHECK: scf.for %[[VAL_15:.*]] = %[[VAL_13]] to %[[VAL_14]] step %[[VAL_5]] { -// CHECK: %[[VAL_16:.*]] = load %[[VAL_7]]{{\[}}%[[VAL_15]]] : memref -// CHECK: scf.for %[[VAL_17:.*]] = %[[VAL_4]] to %[[VAL_3]] step %[[VAL_5]] { -// CHECK: %[[VAL_18:.*]] = muli %[[VAL_15]], %[[VAL_3]] : index -// CHECK: %[[VAL_19:.*]] = addi %[[VAL_18]], %[[VAL_17]] : index -// CHECK: %[[VAL_20:.*]] = load %[[VAL_8]]{{\[}}%[[VAL_19]]] : memref -// CHECK: %[[VAL_21:.*]] = addi %[[VAL_19]], %[[VAL_5]] : index -// CHECK: %[[VAL_22:.*]] = load %[[VAL_8]]{{\[}}%[[VAL_21]]] : memref -// CHECK: scf.for %[[VAL_23:.*]] = %[[VAL_20]] to %[[VAL_22]] step %[[VAL_5]] { -// CHECK: %[[VAL_24:.*]] = load %[[VAL_9]]{{\[}}%[[VAL_23]]] : memref -// CHECK: %[[VAL_25:.*]] = load %[[VAL_10]]{{\[}}%[[VAL_23]]] : memref -// CHECK: %[[VAL_26:.*]] = load %[[VAL_11]]{{\[}}%[[VAL_16]], %[[VAL_17]], %[[VAL_24]]] : memref<32x16x8xf32> -// CHECK: %[[VAL_27:.*]] = mulf %[[VAL_25]], %[[VAL_26]] : f32 -// CHECK: store %[[VAL_27]], %[[VAL_12]]{{\[}}%[[VAL_16]], %[[VAL_17]], %[[VAL_24]]] : memref<32x16x8xf32> +// CHECK: %[[VAL_13:.*]] = alloca() : memref<32x16x8xf32> +// CHECK: %[[VAL_14:.*]] = load %[[VAL_7]]{{\[}}%[[VAL_5]]] : memref +// CHECK: %[[VAL_15:.*]] = load %[[VAL_7]]{{\[}}%[[VAL_6]]] : memref +// CHECK: scf.for %[[VAL_16:.*]] = %[[VAL_14]] to %[[VAL_15]] step %[[VAL_6]] { +// CHECK: %[[VAL_17:.*]] = load %[[VAL_8]]{{\[}}%[[VAL_16]]] : memref +// CHECK: scf.for %[[VAL_18:.*]] = %[[VAL_5]] to %[[VAL_4]] step %[[VAL_6]] { +// CHECK: %[[VAL_19:.*]] = muli %[[VAL_16]], %[[VAL_4]] : index +// CHECK: %[[VAL_20:.*]] = addi %[[VAL_19]], %[[VAL_18]] : index +// CHECK: %[[VAL_21:.*]] = load %[[VAL_9]]{{\[}}%[[VAL_20]]] : memref +// CHECK: %[[VAL_22:.*]] = addi %[[VAL_20]], %[[VAL_6]] : index +// CHECK: %[[VAL_23:.*]] = load %[[VAL_9]]{{\[}}%[[VAL_22]]] : memref +// CHECK: scf.for %[[VAL_24:.*]] = %[[VAL_21]] to %[[VAL_23]] step %[[VAL_6]] { +// CHECK: %[[VAL_25:.*]] = load %[[VAL_10]]{{\[}}%[[VAL_24]]] : memref +// CHECK: %[[VAL_26:.*]] = load %[[VAL_11]]{{\[}}%[[VAL_24]]] : memref +// CHECK: %[[VAL_27:.*]] = load %[[VAL_12]]{{\[}}%[[VAL_17]], %[[VAL_18]], %[[VAL_25]]] : memref<32x16x8xf32> +// CHECK: %[[VAL_28:.*]] = mulf %[[VAL_26]], %[[VAL_27]] : f32 +// CHECK: store %[[VAL_28]], %[[VAL_13]]{{\[}}%[[VAL_17]], %[[VAL_18]], %[[VAL_25]]] : memref<32x16x8xf32> // CHECK: } // CHECK: } // CHECK: } -// CHECK: %[[VAL_28:.*]] = tensor_load %[[VAL_12]] : memref<32x16x8xf32> -// CHECK: return %[[VAL_28]] : tensor<32x16x8xf32> +// CHECK: %[[VAL_29:.*]] = tensor_load %[[VAL_13]] : memref<32x16x8xf32> +// CHECK: return %[[VAL_29]] : tensor<32x16x8xf32> // CHECK: } -func @mul_sds(%arga: tensor<32x16x8xf32>, %argb: tensor<32x16x8xf32>) -> tensor<32x16x8xf32> { +func @mul_sds(%arga: tensor<32x16x8xf32>, %argb: tensor<32x16x8xf32>, %argx: tensor<32x16x8xf32>) -> tensor<32x16x8xf32> { %0 = linalg.generic #trait_sds ins(%arga, %argb: tensor<32x16x8xf32>, tensor<32x16x8xf32>) - outs(%arga : tensor<32x16x8xf32>) { - ^bb(%a: f32, %b: f32, %s : f32): + outs(%argx: tensor<32x16x8xf32>) { + ^bb(%a: f32, %b: f32, %x: f32): %0 = mulf %a, %b : f32 linalg.yield %0 : f32 } -> tensor<32x16x8xf32> @@ -813,105 +825,106 @@ } // CHECK-LABEL: func @add_ssd( -// CHECK-SAME: %[[VAL_0:.*]]: tensor<32x16x8xf32>, -// CHECK-SAME: %[[VAL_1:.*]]: tensor<32x16x8xf32>) -> tensor<32x16x8xf32> { -// CHECK: %[[VAL_2:.*]] = constant 999 : index -// CHECK: %[[VAL_3:.*]] = constant 32 : index -// CHECK: %[[VAL_4:.*]] = constant 16 : index -// CHECK: %[[VAL_5:.*]] = constant 8 : index -// CHECK: %[[VAL_6:.*]] = constant true -// CHECK: %[[VAL_7:.*]] = constant 0 : index -// CHECK: %[[VAL_8:.*]] = constant 1 : index -// CHECK: %[[VAL_9:.*]] = alloca(%[[VAL_2]]) : memref -// CHECK: %[[VAL_10:.*]] = alloca(%[[VAL_2]]) : memref -// CHECK: %[[VAL_11:.*]] = alloca(%[[VAL_2]]) : memref -// CHECK: %[[VAL_12:.*]] = alloca(%[[VAL_2]]) : memref -// CHECK: %[[VAL_13:.*]] = alloca(%[[VAL_2]]) : memref -// CHECK: %[[VAL_14:.*]] = alloca() : memref<32x16x8xf32> +// CHECK-SAME: %[[VAL_0:.*0]]: tensor<32x16x8xf32>, +// CHECK-SAME: %[[VAL_1:.*1]]: tensor<32x16x8xf32>, +// CHECK-SAME: %[[VAL_2:.*2]]: tensor<32x16x8xf32>) -> tensor<32x16x8xf32> { +// CHECK: %[[VAL_3:.*]] = constant 999 : index +// CHECK: %[[VAL_4:.*]] = constant 32 : index +// CHECK: %[[VAL_5:.*]] = constant 16 : index +// CHECK: %[[VAL_6:.*]] = constant 8 : index +// CHECK: %[[VAL_7:.*]] = constant true +// CHECK: %[[VAL_8:.*]] = constant 0 : index +// CHECK: %[[VAL_9:.*]] = constant 1 : index +// CHECK: %[[VAL_10:.*]] = alloca(%[[VAL_3]]) : memref +// CHECK: %[[VAL_11:.*]] = alloca(%[[VAL_3]]) : memref +// CHECK: %[[VAL_12:.*]] = alloca(%[[VAL_3]]) : memref +// CHECK: %[[VAL_13:.*]] = alloca(%[[VAL_3]]) : memref +// CHECK: %[[VAL_14:.*]] = alloca(%[[VAL_3]]) : memref // CHECK: %[[VAL_15:.*]] = alloca() : memref<32x16x8xf32> -// CHECK: %[[VAL_16:.*]] = load %[[VAL_9]]{{\[}}%[[VAL_7]]] : memref -// CHECK: %[[VAL_17:.*]] = load %[[VAL_9]]{{\[}}%[[VAL_8]]] : memref -// CHECK: %[[VAL_18:.*]]:2 = scf.while (%[[VAL_19:.*]] = %[[VAL_16]], %[[VAL_20:.*]] = %[[VAL_7]]) : (index, index) -> (index, index) { -// CHECK: %[[VAL_21:.*]] = cmpi ult, %[[VAL_19]], %[[VAL_17]] : index -// CHECK: scf.condition(%[[VAL_21]]) %[[VAL_19]], %[[VAL_20]] : index, index +// CHECK: %[[VAL_16:.*]] = alloca() : memref<32x16x8xf32> +// CHECK: %[[VAL_17:.*]] = load %[[VAL_10]]{{\[}}%[[VAL_8]]] : memref +// CHECK: %[[VAL_18:.*]] = load %[[VAL_10]]{{\[}}%[[VAL_9]]] : memref +// CHECK: %[[VAL_19:.*]]:2 = scf.while (%[[VAL_20:.*]] = %[[VAL_17]], %[[VAL_21:.*]] = %[[VAL_8]]) : (index, index) -> (index, index) { +// CHECK: %[[VAL_22:.*]] = cmpi ult, %[[VAL_20]], %[[VAL_18]] : index +// CHECK: scf.condition(%[[VAL_22]]) %[[VAL_20]], %[[VAL_21]] : index, index // CHECK: } do { -// CHECK: ^bb0(%[[VAL_22:.*]]: index, %[[VAL_23:.*]]: index): -// CHECK: %[[VAL_24:.*]] = load %[[VAL_10]]{{\[}}%[[VAL_22]]] : memref -// CHECK: %[[VAL_25:.*]] = cmpi eq, %[[VAL_24]], %[[VAL_23]] : index -// CHECK: scf.if %[[VAL_25]] { -// CHECK: %[[VAL_26:.*]] = load %[[VAL_11]]{{\[}}%[[VAL_22]]] : memref -// CHECK: %[[VAL_27:.*]] = addi %[[VAL_22]], %[[VAL_8]] : index -// CHECK: %[[VAL_28:.*]] = load %[[VAL_11]]{{\[}}%[[VAL_27]]] : memref -// CHECK: %[[VAL_29:.*]]:2 = scf.while (%[[VAL_30:.*]] = %[[VAL_26]], %[[VAL_31:.*]] = %[[VAL_7]]) : (index, index) -> (index, index) { -// CHECK: %[[VAL_32:.*]] = cmpi ult, %[[VAL_30]], %[[VAL_28]] : index -// CHECK: scf.condition(%[[VAL_32]]) %[[VAL_30]], %[[VAL_31]] : index, index +// CHECK: ^bb0(%[[VAL_23:.*]]: index, %[[VAL_24:.*]]: index): +// CHECK: %[[VAL_25:.*]] = load %[[VAL_11]]{{\[}}%[[VAL_23]]] : memref +// CHECK: %[[VAL_26:.*]] = cmpi eq, %[[VAL_25]], %[[VAL_24]] : index +// CHECK: scf.if %[[VAL_26]] { +// CHECK: %[[VAL_27:.*]] = load %[[VAL_12]]{{\[}}%[[VAL_23]]] : memref +// CHECK: %[[VAL_28:.*]] = addi %[[VAL_23]], %[[VAL_9]] : index +// CHECK: %[[VAL_29:.*]] = load %[[VAL_12]]{{\[}}%[[VAL_28]]] : memref +// CHECK: %[[VAL_30:.*]]:2 = scf.while (%[[VAL_31:.*]] = %[[VAL_27]], %[[VAL_32:.*]] = %[[VAL_8]]) : (index, index) -> (index, index) { +// CHECK: %[[VAL_33:.*]] = cmpi ult, %[[VAL_31]], %[[VAL_29]] : index +// CHECK: scf.condition(%[[VAL_33]]) %[[VAL_31]], %[[VAL_32]] : index, index // CHECK: } do { -// CHECK: ^bb0(%[[VAL_33:.*]]: index, %[[VAL_34:.*]]: index): -// CHECK: %[[VAL_35:.*]] = load %[[VAL_12]]{{\[}}%[[VAL_33]]] : memref -// CHECK: %[[VAL_36:.*]] = cmpi eq, %[[VAL_35]], %[[VAL_34]] : index -// CHECK: scf.if %[[VAL_36]] { -// CHECK: scf.for %[[VAL_37:.*]] = %[[VAL_7]] to %[[VAL_5]] step %[[VAL_8]] { -// CHECK: %[[VAL_38:.*]] = muli %[[VAL_33]], %[[VAL_5]] : index -// CHECK: %[[VAL_39:.*]] = addi %[[VAL_38]], %[[VAL_37]] : index -// CHECK: %[[VAL_40:.*]] = load %[[VAL_13]]{{\[}}%[[VAL_39]]] : memref -// CHECK: %[[VAL_41:.*]] = load %[[VAL_14]]{{\[}}%[[VAL_23]], %[[VAL_34]], %[[VAL_37]]] : memref<32x16x8xf32> -// CHECK: %[[VAL_42:.*]] = addf %[[VAL_40]], %[[VAL_41]] : f32 -// CHECK: store %[[VAL_42]], %[[VAL_15]]{{\[}}%[[VAL_23]], %[[VAL_34]], %[[VAL_37]]] : memref<32x16x8xf32> +// CHECK: ^bb0(%[[VAL_34:.*]]: index, %[[VAL_35:.*]]: index): +// CHECK: %[[VAL_36:.*]] = load %[[VAL_13]]{{\[}}%[[VAL_34]]] : memref +// CHECK: %[[VAL_37:.*]] = cmpi eq, %[[VAL_36]], %[[VAL_35]] : index +// CHECK: scf.if %[[VAL_37]] { +// CHECK: scf.for %[[VAL_38:.*]] = %[[VAL_8]] to %[[VAL_6]] step %[[VAL_9]] { +// CHECK: %[[VAL_39:.*]] = muli %[[VAL_34]], %[[VAL_6]] : index +// CHECK: %[[VAL_40:.*]] = addi %[[VAL_39]], %[[VAL_38]] : index +// CHECK: %[[VAL_41:.*]] = load %[[VAL_14]]{{\[}}%[[VAL_40]]] : memref +// CHECK: %[[VAL_42:.*]] = load %[[VAL_15]]{{\[}}%[[VAL_24]], %[[VAL_35]], %[[VAL_38]]] : memref<32x16x8xf32> +// CHECK: %[[VAL_43:.*]] = addf %[[VAL_41]], %[[VAL_42]] : f32 +// CHECK: store %[[VAL_43]], %[[VAL_16]]{{\[}}%[[VAL_24]], %[[VAL_35]], %[[VAL_38]]] : memref<32x16x8xf32> // CHECK: } // CHECK: } else { -// CHECK: scf.if %[[VAL_6]] { -// CHECK: scf.for %[[VAL_43:.*]] = %[[VAL_7]] to %[[VAL_5]] step %[[VAL_8]] { -// CHECK: %[[VAL_44:.*]] = load %[[VAL_14]]{{\[}}%[[VAL_23]], %[[VAL_34]], %[[VAL_43]]] : memref<32x16x8xf32> -// CHECK: store %[[VAL_44]], %[[VAL_15]]{{\[}}%[[VAL_23]], %[[VAL_34]], %[[VAL_43]]] : memref<32x16x8xf32> +// CHECK: scf.if %[[VAL_7]] { +// CHECK: scf.for %[[VAL_44:.*]] = %[[VAL_8]] to %[[VAL_6]] step %[[VAL_9]] { +// CHECK: %[[VAL_45:.*]] = load %[[VAL_15]]{{\[}}%[[VAL_24]], %[[VAL_35]], %[[VAL_44]]] : memref<32x16x8xf32> +// CHECK: store %[[VAL_45]], %[[VAL_16]]{{\[}}%[[VAL_24]], %[[VAL_35]], %[[VAL_44]]] : memref<32x16x8xf32> // CHECK: } // CHECK: } else { // CHECK: } // CHECK: } -// CHECK: %[[VAL_45:.*]] = cmpi eq, %[[VAL_35]], %[[VAL_34]] : index -// CHECK: %[[VAL_46:.*]] = addi %[[VAL_33]], %[[VAL_8]] : index -// CHECK: %[[VAL_47:.*]] = select %[[VAL_45]], %[[VAL_46]], %[[VAL_33]] : index -// CHECK: %[[VAL_48:.*]] = addi %[[VAL_34]], %[[VAL_8]] : index -// CHECK: scf.yield %[[VAL_47]], %[[VAL_48]] : index, index +// CHECK: %[[VAL_46:.*]] = cmpi eq, %[[VAL_36]], %[[VAL_35]] : index +// CHECK: %[[VAL_47:.*]] = addi %[[VAL_34]], %[[VAL_9]] : index +// CHECK: %[[VAL_48:.*]] = select %[[VAL_46]], %[[VAL_47]], %[[VAL_34]] : index +// CHECK: %[[VAL_49:.*]] = addi %[[VAL_35]], %[[VAL_9]] : index +// CHECK: scf.yield %[[VAL_48]], %[[VAL_49]] : index, index // CHECK: } -// CHECK: scf.for %[[VAL_49:.*]] = %[[VAL_50:.*]]#1 to %[[VAL_4]] step %[[VAL_8]] { -// CHECK: scf.for %[[VAL_51:.*]] = %[[VAL_7]] to %[[VAL_5]] step %[[VAL_8]] { -// CHECK: %[[VAL_52:.*]] = load %[[VAL_14]]{{\[}}%[[VAL_23]], %[[VAL_49]], %[[VAL_51]]] : memref<32x16x8xf32> -// CHECK: store %[[VAL_52]], %[[VAL_15]]{{\[}}%[[VAL_23]], %[[VAL_49]], %[[VAL_51]]] : memref<32x16x8xf32> +// CHECK: scf.for %[[VAL_50:.*]] = %[[VAL_51:.*]]#1 to %[[VAL_5]] step %[[VAL_9]] { +// CHECK: scf.for %[[VAL_52:.*]] = %[[VAL_8]] to %[[VAL_6]] step %[[VAL_9]] { +// CHECK: %[[VAL_53:.*]] = load %[[VAL_15]]{{\[}}%[[VAL_24]], %[[VAL_50]], %[[VAL_52]]] : memref<32x16x8xf32> +// CHECK: store %[[VAL_53]], %[[VAL_16]]{{\[}}%[[VAL_24]], %[[VAL_50]], %[[VAL_52]]] : memref<32x16x8xf32> // CHECK: } // CHECK: } // CHECK: } else { -// CHECK: scf.if %[[VAL_6]] { -// CHECK: scf.for %[[VAL_53:.*]] = %[[VAL_7]] to %[[VAL_4]] step %[[VAL_8]] { -// CHECK: scf.for %[[VAL_54:.*]] = %[[VAL_7]] to %[[VAL_5]] step %[[VAL_8]] { -// CHECK: %[[VAL_55:.*]] = load %[[VAL_14]]{{\[}}%[[VAL_23]], %[[VAL_53]], %[[VAL_54]]] : memref<32x16x8xf32> -// CHECK: store %[[VAL_55]], %[[VAL_15]]{{\[}}%[[VAL_23]], %[[VAL_53]], %[[VAL_54]]] : memref<32x16x8xf32> +// CHECK: scf.if %[[VAL_7]] { +// CHECK: scf.for %[[VAL_54:.*]] = %[[VAL_8]] to %[[VAL_5]] step %[[VAL_9]] { +// CHECK: scf.for %[[VAL_55:.*]] = %[[VAL_8]] to %[[VAL_6]] step %[[VAL_9]] { +// CHECK: %[[VAL_56:.*]] = load %[[VAL_15]]{{\[}}%[[VAL_24]], %[[VAL_54]], %[[VAL_55]]] : memref<32x16x8xf32> +// CHECK: store %[[VAL_56]], %[[VAL_16]]{{\[}}%[[VAL_24]], %[[VAL_54]], %[[VAL_55]]] : memref<32x16x8xf32> // CHECK: } // CHECK: } // CHECK: } else { // CHECK: } // CHECK: } -// CHECK: %[[VAL_56:.*]] = cmpi eq, %[[VAL_24]], %[[VAL_23]] : index -// CHECK: %[[VAL_57:.*]] = addi %[[VAL_22]], %[[VAL_8]] : index -// CHECK: %[[VAL_58:.*]] = select %[[VAL_56]], %[[VAL_57]], %[[VAL_22]] : index -// CHECK: %[[VAL_59:.*]] = addi %[[VAL_23]], %[[VAL_8]] : index -// CHECK: scf.yield %[[VAL_58]], %[[VAL_59]] : index, index +// CHECK: %[[VAL_57:.*]] = cmpi eq, %[[VAL_25]], %[[VAL_24]] : index +// CHECK: %[[VAL_58:.*]] = addi %[[VAL_23]], %[[VAL_9]] : index +// CHECK: %[[VAL_59:.*]] = select %[[VAL_57]], %[[VAL_58]], %[[VAL_23]] : index +// CHECK: %[[VAL_60:.*]] = addi %[[VAL_24]], %[[VAL_9]] : index +// CHECK: scf.yield %[[VAL_59]], %[[VAL_60]] : index, index // CHECK: } -// CHECK: scf.for %[[VAL_60:.*]] = %[[VAL_61:.*]]#1 to %[[VAL_3]] step %[[VAL_8]] { -// CHECK: scf.for %[[VAL_62:.*]] = %[[VAL_7]] to %[[VAL_4]] step %[[VAL_8]] { -// CHECK: scf.for %[[VAL_63:.*]] = %[[VAL_7]] to %[[VAL_5]] step %[[VAL_8]] { -// CHECK: %[[VAL_64:.*]] = load %[[VAL_14]]{{\[}}%[[VAL_60]], %[[VAL_62]], %[[VAL_63]]] : memref<32x16x8xf32> -// CHECK: store %[[VAL_64]], %[[VAL_15]]{{\[}}%[[VAL_60]], %[[VAL_62]], %[[VAL_63]]] : memref<32x16x8xf32> +// CHECK: scf.for %[[VAL_61:.*]] = %[[VAL_62:.*]]#1 to %[[VAL_4]] step %[[VAL_9]] { +// CHECK: scf.for %[[VAL_63:.*]] = %[[VAL_8]] to %[[VAL_5]] step %[[VAL_9]] { +// CHECK: scf.for %[[VAL_64:.*]] = %[[VAL_8]] to %[[VAL_6]] step %[[VAL_9]] { +// CHECK: %[[VAL_65:.*]] = load %[[VAL_15]]{{\[}}%[[VAL_61]], %[[VAL_63]], %[[VAL_64]]] : memref<32x16x8xf32> +// CHECK: store %[[VAL_65]], %[[VAL_16]]{{\[}}%[[VAL_61]], %[[VAL_63]], %[[VAL_64]]] : memref<32x16x8xf32> // CHECK: } // CHECK: } // CHECK: } -// CHECK: %[[VAL_65:.*]] = tensor_load %[[VAL_15]] : memref<32x16x8xf32> -// CHECK: return %[[VAL_65]] : tensor<32x16x8xf32> +// CHECK: %[[VAL_66:.*]] = tensor_load %[[VAL_16]] : memref<32x16x8xf32> +// CHECK: return %[[VAL_66]] : tensor<32x16x8xf32> // CHECK: } -func @add_ssd(%arga: tensor<32x16x8xf32>, %argb: tensor<32x16x8xf32>) -> tensor<32x16x8xf32> { +func @add_ssd(%arga: tensor<32x16x8xf32>, %argb: tensor<32x16x8xf32>, %argx: tensor<32x16x8xf32>) -> tensor<32x16x8xf32> { %0 = linalg.generic #trait_ssd ins(%arga, %argb: tensor<32x16x8xf32>, tensor<32x16x8xf32>) - outs(%arga : tensor<32x16x8xf32>) { - ^bb(%a: f32, %b: f32, %s : f32): + outs(%argx: tensor<32x16x8xf32>) { + ^bb(%a: f32, %b: f32, %x: f32): %0 = addf %a, %b : f32 linalg.yield %0 : f32 } -> tensor<32x16x8xf32> @@ -919,46 +932,47 @@ } // CHECK-LABEL: func @mul_ssd( -// CHECK-SAME: %[[VAL_0:.*]]: tensor<32x16x8xf32>, -// CHECK-SAME: %[[VAL_1:.*]]: tensor<32x16x8xf32>) -> tensor<32x16x8xf32> { -// CHECK: %[[VAL_2:.*]] = constant 999 : index -// CHECK: %[[VAL_3:.*]] = constant 8 : index -// CHECK: %[[VAL_4:.*]] = constant 0 : index -// CHECK: %[[VAL_5:.*]] = constant 1 : index -// CHECK: %[[VAL_6:.*]] = alloca(%[[VAL_2]]) : memref -// CHECK: %[[VAL_7:.*]] = alloca(%[[VAL_2]]) : memref -// CHECK: %[[VAL_8:.*]] = alloca(%[[VAL_2]]) : memref -// CHECK: %[[VAL_9:.*]] = alloca(%[[VAL_2]]) : memref -// CHECK: %[[VAL_10:.*]] = alloca(%[[VAL_2]]) : memref -// CHECK: %[[VAL_11:.*]] = alloca() : memref<32x16x8xf32> +// CHECK-SAME: %[[VAL_0:.*0]]: tensor<32x16x8xf32>, +// CHECK-SAME: %[[VAL_1:.*1]]: tensor<32x16x8xf32>, +// CHECK-SAME: %[[VAL_2:.*2]]: tensor<32x16x8xf32>) -> tensor<32x16x8xf32> { +// CHECK: %[[VAL_3:.*]] = constant 999 : index +// CHECK: %[[VAL_4:.*]] = constant 8 : index +// CHECK: %[[VAL_5:.*]] = constant 0 : index +// CHECK: %[[VAL_6:.*]] = constant 1 : index +// CHECK: %[[VAL_7:.*]] = alloca(%[[VAL_3]]) : memref +// CHECK: %[[VAL_8:.*]] = alloca(%[[VAL_3]]) : memref +// CHECK: %[[VAL_9:.*]] = alloca(%[[VAL_3]]) : memref +// CHECK: %[[VAL_10:.*]] = alloca(%[[VAL_3]]) : memref +// CHECK: %[[VAL_11:.*]] = alloca(%[[VAL_3]]) : memref // CHECK: %[[VAL_12:.*]] = alloca() : memref<32x16x8xf32> -// CHECK: %[[VAL_13:.*]] = load %[[VAL_6]]{{\[}}%[[VAL_4]]] : memref -// CHECK: %[[VAL_14:.*]] = load %[[VAL_6]]{{\[}}%[[VAL_5]]] : memref -// CHECK: scf.for %[[VAL_15:.*]] = %[[VAL_13]] to %[[VAL_14]] step %[[VAL_5]] { -// CHECK: %[[VAL_16:.*]] = load %[[VAL_7]]{{\[}}%[[VAL_15]]] : memref -// CHECK: %[[VAL_17:.*]] = load %[[VAL_8]]{{\[}}%[[VAL_15]]] : memref -// CHECK: %[[VAL_18:.*]] = addi %[[VAL_15]], %[[VAL_5]] : index -// CHECK: %[[VAL_19:.*]] = load %[[VAL_8]]{{\[}}%[[VAL_18]]] : memref -// CHECK: scf.for %[[VAL_20:.*]] = %[[VAL_17]] to %[[VAL_19]] step %[[VAL_5]] { -// CHECK: %[[VAL_21:.*]] = load %[[VAL_9]]{{\[}}%[[VAL_20]]] : memref -// CHECK: scf.for %[[VAL_22:.*]] = %[[VAL_4]] to %[[VAL_3]] step %[[VAL_5]] { -// CHECK: %[[VAL_23:.*]] = muli %[[VAL_20]], %[[VAL_3]] : index -// CHECK: %[[VAL_24:.*]] = addi %[[VAL_23]], %[[VAL_22]] : index -// CHECK: %[[VAL_25:.*]] = load %[[VAL_10]]{{\[}}%[[VAL_24]]] : memref -// CHECK: %[[VAL_26:.*]] = load %[[VAL_11]]{{\[}}%[[VAL_16]], %[[VAL_21]], %[[VAL_22]]] : memref<32x16x8xf32> -// CHECK: %[[VAL_27:.*]] = mulf %[[VAL_25]], %[[VAL_26]] : f32 -// CHECK: store %[[VAL_27]], %[[VAL_12]]{{\[}}%[[VAL_16]], %[[VAL_21]], %[[VAL_22]]] : memref<32x16x8xf32> +// CHECK: %[[VAL_13:.*]] = alloca() : memref<32x16x8xf32> +// CHECK: %[[VAL_14:.*]] = load %[[VAL_7]]{{\[}}%[[VAL_5]]] : memref +// CHECK: %[[VAL_15:.*]] = load %[[VAL_7]]{{\[}}%[[VAL_6]]] : memref +// CHECK: scf.for %[[VAL_16:.*]] = %[[VAL_14]] to %[[VAL_15]] step %[[VAL_6]] { +// CHECK: %[[VAL_17:.*]] = load %[[VAL_8]]{{\[}}%[[VAL_16]]] : memref +// CHECK: %[[VAL_18:.*]] = load %[[VAL_9]]{{\[}}%[[VAL_16]]] : memref +// CHECK: %[[VAL_19:.*]] = addi %[[VAL_16]], %[[VAL_6]] : index +// CHECK: %[[VAL_20:.*]] = load %[[VAL_9]]{{\[}}%[[VAL_19]]] : memref +// CHECK: scf.for %[[VAL_21:.*]] = %[[VAL_18]] to %[[VAL_20]] step %[[VAL_6]] { +// CHECK: %[[VAL_22:.*]] = load %[[VAL_10]]{{\[}}%[[VAL_21]]] : memref +// CHECK: scf.for %[[VAL_23:.*]] = %[[VAL_5]] to %[[VAL_4]] step %[[VAL_6]] { +// CHECK: %[[VAL_24:.*]] = muli %[[VAL_21]], %[[VAL_4]] : index +// CHECK: %[[VAL_25:.*]] = addi %[[VAL_24]], %[[VAL_23]] : index +// CHECK: %[[VAL_26:.*]] = load %[[VAL_11]]{{\[}}%[[VAL_25]]] : memref +// CHECK: %[[VAL_27:.*]] = load %[[VAL_12]]{{\[}}%[[VAL_17]], %[[VAL_22]], %[[VAL_23]]] : memref<32x16x8xf32> +// CHECK: %[[VAL_28:.*]] = mulf %[[VAL_26]], %[[VAL_27]] : f32 +// CHECK: store %[[VAL_28]], %[[VAL_13]]{{\[}}%[[VAL_17]], %[[VAL_22]], %[[VAL_23]]] : memref<32x16x8xf32> // CHECK: } // CHECK: } // CHECK: } -// CHECK: %[[VAL_28:.*]] = tensor_load %[[VAL_12]] : memref<32x16x8xf32> -// CHECK: return %[[VAL_28]] : tensor<32x16x8xf32> +// CHECK: %[[VAL_29:.*]] = tensor_load %[[VAL_13]] : memref<32x16x8xf32> +// CHECK: return %[[VAL_29]] : tensor<32x16x8xf32> // CHECK: } -func @mul_ssd(%arga: tensor<32x16x8xf32>, %argb: tensor<32x16x8xf32>) -> tensor<32x16x8xf32> { +func @mul_ssd(%arga: tensor<32x16x8xf32>, %argb: tensor<32x16x8xf32>, %argx: tensor<32x16x8xf32>) -> tensor<32x16x8xf32> { %0 = linalg.generic #trait_ssd ins(%arga, %argb: tensor<32x16x8xf32>, tensor<32x16x8xf32>) - outs(%arga : tensor<32x16x8xf32>) { - ^bb(%a: f32, %b: f32, %s : f32): + outs(%argx: tensor<32x16x8xf32>) { + ^bb(%a: f32, %b: f32, %x: f32): %0 = mulf %a, %b : f32 linalg.yield %0 : f32 } -> tensor<32x16x8xf32> @@ -981,131 +995,132 @@ } // CHECK-LABEL: func @add_sss( -// CHECK-SAME: %[[VAL_0:.*]]: tensor<32x16x8xf32>, -// CHECK-SAME: %[[VAL_1:.*]]: tensor<32x16x8xf32>) -> tensor<32x16x8xf32> { -// CHECK: %[[VAL_2:.*]] = constant 999 : index -// CHECK: %[[VAL_3:.*]] = constant 32 : index -// CHECK: %[[VAL_4:.*]] = constant 16 : index -// CHECK: %[[VAL_5:.*]] = constant 8 : index -// CHECK: %[[VAL_6:.*]] = constant true -// CHECK: %[[VAL_7:.*]] = constant 0 : index -// CHECK: %[[VAL_8:.*]] = constant 1 : index -// CHECK: %[[VAL_9:.*]] = alloca(%[[VAL_2]]) : memref -// CHECK: %[[VAL_10:.*]] = alloca(%[[VAL_2]]) : memref -// CHECK: %[[VAL_11:.*]] = alloca(%[[VAL_2]]) : memref -// CHECK: %[[VAL_12:.*]] = alloca(%[[VAL_2]]) : memref -// CHECK: %[[VAL_13:.*]] = alloca(%[[VAL_2]]) : memref -// CHECK: %[[VAL_14:.*]] = alloca(%[[VAL_2]]) : memref -// CHECK: %[[VAL_15:.*]] = alloca(%[[VAL_2]]) : memref -// CHECK: %[[VAL_16:.*]] = alloca() : memref<32x16x8xf32> +// CHECK-SAME: %[[VAL_0:.*0]]: tensor<32x16x8xf32>, +// CHECK-SAME: %[[VAL_1:.*1]]: tensor<32x16x8xf32>, +// CHECK-SAME: %[[VAL_2:.*2]]: tensor<32x16x8xf32>) -> tensor<32x16x8xf32> { +// CHECK: %[[VAL_3:.*]] = constant 999 : index +// CHECK: %[[VAL_4:.*]] = constant 32 : index +// CHECK: %[[VAL_5:.*]] = constant 16 : index +// CHECK: %[[VAL_6:.*]] = constant 8 : index +// CHECK: %[[VAL_7:.*]] = constant true +// CHECK: %[[VAL_8:.*]] = constant 0 : index +// CHECK: %[[VAL_9:.*]] = constant 1 : index +// CHECK: %[[VAL_10:.*]] = alloca(%[[VAL_3]]) : memref +// CHECK: %[[VAL_11:.*]] = alloca(%[[VAL_3]]) : memref +// CHECK: %[[VAL_12:.*]] = alloca(%[[VAL_3]]) : memref +// CHECK: %[[VAL_13:.*]] = alloca(%[[VAL_3]]) : memref +// CHECK: %[[VAL_14:.*]] = alloca(%[[VAL_3]]) : memref +// CHECK: %[[VAL_15:.*]] = alloca(%[[VAL_3]]) : memref +// CHECK: %[[VAL_16:.*]] = alloca(%[[VAL_3]]) : memref // CHECK: %[[VAL_17:.*]] = alloca() : memref<32x16x8xf32> -// CHECK: %[[VAL_18:.*]] = load %[[VAL_9]]{{\[}}%[[VAL_7]]] : memref -// CHECK: %[[VAL_19:.*]] = load %[[VAL_9]]{{\[}}%[[VAL_8]]] : memref -// CHECK: %[[VAL_20:.*]]:2 = scf.while (%[[VAL_21:.*]] = %[[VAL_18]], %[[VAL_22:.*]] = %[[VAL_7]]) : (index, index) -> (index, index) { -// CHECK: %[[VAL_23:.*]] = cmpi ult, %[[VAL_21]], %[[VAL_19]] : index -// CHECK: scf.condition(%[[VAL_23]]) %[[VAL_21]], %[[VAL_22]] : index, index +// CHECK: %[[VAL_18:.*]] = alloca() : memref<32x16x8xf32> +// CHECK: %[[VAL_19:.*]] = load %[[VAL_10]]{{\[}}%[[VAL_8]]] : memref +// CHECK: %[[VAL_20:.*]] = load %[[VAL_10]]{{\[}}%[[VAL_9]]] : memref +// CHECK: %[[VAL_21:.*]]:2 = scf.while (%[[VAL_22:.*]] = %[[VAL_19]], %[[VAL_23:.*]] = %[[VAL_8]]) : (index, index) -> (index, index) { +// CHECK: %[[VAL_24:.*]] = cmpi ult, %[[VAL_22]], %[[VAL_20]] : index +// CHECK: scf.condition(%[[VAL_24]]) %[[VAL_22]], %[[VAL_23]] : index, index // CHECK: } do { -// CHECK: ^bb0(%[[VAL_24:.*]]: index, %[[VAL_25:.*]]: index): -// CHECK: %[[VAL_26:.*]] = load %[[VAL_10]]{{\[}}%[[VAL_24]]] : memref -// CHECK: %[[VAL_27:.*]] = cmpi eq, %[[VAL_26]], %[[VAL_25]] : index -// CHECK: scf.if %[[VAL_27]] { -// CHECK: %[[VAL_28:.*]] = load %[[VAL_11]]{{\[}}%[[VAL_24]]] : memref -// CHECK: %[[VAL_29:.*]] = addi %[[VAL_24]], %[[VAL_8]] : index -// CHECK: %[[VAL_30:.*]] = load %[[VAL_11]]{{\[}}%[[VAL_29]]] : memref -// CHECK: %[[VAL_31:.*]]:2 = scf.while (%[[VAL_32:.*]] = %[[VAL_28]], %[[VAL_33:.*]] = %[[VAL_7]]) : (index, index) -> (index, index) { -// CHECK: %[[VAL_34:.*]] = cmpi ult, %[[VAL_32]], %[[VAL_30]] : index -// CHECK: scf.condition(%[[VAL_34]]) %[[VAL_32]], %[[VAL_33]] : index, index +// CHECK: ^bb0(%[[VAL_25:.*]]: index, %[[VAL_26:.*]]: index): +// CHECK: %[[VAL_27:.*]] = load %[[VAL_11]]{{\[}}%[[VAL_25]]] : memref +// CHECK: %[[VAL_28:.*]] = cmpi eq, %[[VAL_27]], %[[VAL_26]] : index +// CHECK: scf.if %[[VAL_28]] { +// CHECK: %[[VAL_29:.*]] = load %[[VAL_12]]{{\[}}%[[VAL_25]]] : memref +// CHECK: %[[VAL_30:.*]] = addi %[[VAL_25]], %[[VAL_9]] : index +// CHECK: %[[VAL_31:.*]] = load %[[VAL_12]]{{\[}}%[[VAL_30]]] : memref +// CHECK: %[[VAL_32:.*]]:2 = scf.while (%[[VAL_33:.*]] = %[[VAL_29]], %[[VAL_34:.*]] = %[[VAL_8]]) : (index, index) -> (index, index) { +// CHECK: %[[VAL_35:.*]] = cmpi ult, %[[VAL_33]], %[[VAL_31]] : index +// CHECK: scf.condition(%[[VAL_35]]) %[[VAL_33]], %[[VAL_34]] : index, index // CHECK: } do { -// CHECK: ^bb0(%[[VAL_35:.*]]: index, %[[VAL_36:.*]]: index): -// CHECK: %[[VAL_37:.*]] = load %[[VAL_12]]{{\[}}%[[VAL_35]]] : memref -// CHECK: %[[VAL_38:.*]] = cmpi eq, %[[VAL_37]], %[[VAL_36]] : index -// CHECK: scf.if %[[VAL_38]] { -// CHECK: %[[VAL_39:.*]] = load %[[VAL_13]]{{\[}}%[[VAL_35]]] : memref -// CHECK: %[[VAL_40:.*]] = addi %[[VAL_35]], %[[VAL_8]] : index -// CHECK: %[[VAL_41:.*]] = load %[[VAL_13]]{{\[}}%[[VAL_40]]] : memref -// CHECK: %[[VAL_42:.*]]:2 = scf.while (%[[VAL_43:.*]] = %[[VAL_39]], %[[VAL_44:.*]] = %[[VAL_7]]) : (index, index) -> (index, index) { -// CHECK: %[[VAL_45:.*]] = cmpi ult, %[[VAL_43]], %[[VAL_41]] : index -// CHECK: scf.condition(%[[VAL_45]]) %[[VAL_43]], %[[VAL_44]] : index, index +// CHECK: ^bb0(%[[VAL_36:.*]]: index, %[[VAL_37:.*]]: index): +// CHECK: %[[VAL_38:.*]] = load %[[VAL_13]]{{\[}}%[[VAL_36]]] : memref +// CHECK: %[[VAL_39:.*]] = cmpi eq, %[[VAL_38]], %[[VAL_37]] : index +// CHECK: scf.if %[[VAL_39]] { +// CHECK: %[[VAL_40:.*]] = load %[[VAL_14]]{{\[}}%[[VAL_36]]] : memref +// CHECK: %[[VAL_41:.*]] = addi %[[VAL_36]], %[[VAL_9]] : index +// CHECK: %[[VAL_42:.*]] = load %[[VAL_14]]{{\[}}%[[VAL_41]]] : memref +// CHECK: %[[VAL_43:.*]]:2 = scf.while (%[[VAL_44:.*]] = %[[VAL_40]], %[[VAL_45:.*]] = %[[VAL_8]]) : (index, index) -> (index, index) { +// CHECK: %[[VAL_46:.*]] = cmpi ult, %[[VAL_44]], %[[VAL_42]] : index +// CHECK: scf.condition(%[[VAL_46]]) %[[VAL_44]], %[[VAL_45]] : index, index // CHECK: } do { -// CHECK: ^bb0(%[[VAL_46:.*]]: index, %[[VAL_47:.*]]: index): -// CHECK: %[[VAL_48:.*]] = load %[[VAL_14]]{{\[}}%[[VAL_46]]] : memref -// CHECK: %[[VAL_49:.*]] = cmpi eq, %[[VAL_48]], %[[VAL_47]] : index -// CHECK: scf.if %[[VAL_49]] { -// CHECK: %[[VAL_50:.*]] = load %[[VAL_15]]{{\[}}%[[VAL_46]]] : memref -// CHECK: %[[VAL_51:.*]] = load %[[VAL_16]]{{\[}}%[[VAL_25]], %[[VAL_36]], %[[VAL_47]]] : memref<32x16x8xf32> -// CHECK: %[[VAL_52:.*]] = addf %[[VAL_50]], %[[VAL_51]] : f32 -// CHECK: store %[[VAL_52]], %[[VAL_17]]{{\[}}%[[VAL_25]], %[[VAL_36]], %[[VAL_47]]] : memref<32x16x8xf32> +// CHECK: ^bb0(%[[VAL_47:.*]]: index, %[[VAL_48:.*]]: index): +// CHECK: %[[VAL_49:.*]] = load %[[VAL_15]]{{\[}}%[[VAL_47]]] : memref +// CHECK: %[[VAL_50:.*]] = cmpi eq, %[[VAL_49]], %[[VAL_48]] : index +// CHECK: scf.if %[[VAL_50]] { +// CHECK: %[[VAL_51:.*]] = load %[[VAL_16]]{{\[}}%[[VAL_47]]] : memref +// CHECK: %[[VAL_52:.*]] = load %[[VAL_17]]{{\[}}%[[VAL_26]], %[[VAL_37]], %[[VAL_48]]] : memref<32x16x8xf32> +// CHECK: %[[VAL_53:.*]] = addf %[[VAL_51]], %[[VAL_52]] : f32 +// CHECK: store %[[VAL_53]], %[[VAL_18]]{{\[}}%[[VAL_26]], %[[VAL_37]], %[[VAL_48]]] : memref<32x16x8xf32> // CHECK: } else { -// CHECK: scf.if %[[VAL_6]] { -// CHECK: %[[VAL_53:.*]] = load %[[VAL_16]]{{\[}}%[[VAL_25]], %[[VAL_36]], %[[VAL_47]]] : memref<32x16x8xf32> -// CHECK: store %[[VAL_53]], %[[VAL_17]]{{\[}}%[[VAL_25]], %[[VAL_36]], %[[VAL_47]]] : memref<32x16x8xf32> +// CHECK: scf.if %[[VAL_7]] { +// CHECK: %[[VAL_54:.*]] = load %[[VAL_17]]{{\[}}%[[VAL_26]], %[[VAL_37]], %[[VAL_48]]] : memref<32x16x8xf32> +// CHECK: store %[[VAL_54]], %[[VAL_18]]{{\[}}%[[VAL_26]], %[[VAL_37]], %[[VAL_48]]] : memref<32x16x8xf32> // CHECK: } else { // CHECK: } // CHECK: } -// CHECK: %[[VAL_54:.*]] = cmpi eq, %[[VAL_48]], %[[VAL_47]] : index -// CHECK: %[[VAL_55:.*]] = addi %[[VAL_46]], %[[VAL_8]] : index -// CHECK: %[[VAL_56:.*]] = select %[[VAL_54]], %[[VAL_55]], %[[VAL_46]] : index -// CHECK: %[[VAL_57:.*]] = addi %[[VAL_47]], %[[VAL_8]] : index -// CHECK: scf.yield %[[VAL_56]], %[[VAL_57]] : index, index +// CHECK: %[[VAL_55:.*]] = cmpi eq, %[[VAL_49]], %[[VAL_48]] : index +// CHECK: %[[VAL_56:.*]] = addi %[[VAL_47]], %[[VAL_9]] : index +// CHECK: %[[VAL_57:.*]] = select %[[VAL_55]], %[[VAL_56]], %[[VAL_47]] : index +// CHECK: %[[VAL_58:.*]] = addi %[[VAL_48]], %[[VAL_9]] : index +// CHECK: scf.yield %[[VAL_57]], %[[VAL_58]] : index, index // CHECK: } -// CHECK: scf.for %[[VAL_58:.*]] = %[[VAL_59:.*]]#1 to %[[VAL_5]] step %[[VAL_8]] { -// CHECK: %[[VAL_60:.*]] = load %[[VAL_16]]{{\[}}%[[VAL_25]], %[[VAL_36]], %[[VAL_58]]] : memref<32x16x8xf32> -// CHECK: store %[[VAL_60]], %[[VAL_17]]{{\[}}%[[VAL_25]], %[[VAL_36]], %[[VAL_58]]] : memref<32x16x8xf32> +// CHECK: scf.for %[[VAL_59:.*]] = %[[VAL_60:.*]]#1 to %[[VAL_6]] step %[[VAL_9]] { +// CHECK: %[[VAL_61:.*]] = load %[[VAL_17]]{{\[}}%[[VAL_26]], %[[VAL_37]], %[[VAL_59]]] : memref<32x16x8xf32> +// CHECK: store %[[VAL_61]], %[[VAL_18]]{{\[}}%[[VAL_26]], %[[VAL_37]], %[[VAL_59]]] : memref<32x16x8xf32> // CHECK: } // CHECK: } else { -// CHECK: scf.if %[[VAL_6]] { -// CHECK: scf.for %[[VAL_61:.*]] = %[[VAL_7]] to %[[VAL_5]] step %[[VAL_8]] { -// CHECK: %[[VAL_62:.*]] = load %[[VAL_16]]{{\[}}%[[VAL_25]], %[[VAL_36]], %[[VAL_61]]] : memref<32x16x8xf32> -// CHECK: store %[[VAL_62]], %[[VAL_17]]{{\[}}%[[VAL_25]], %[[VAL_36]], %[[VAL_61]]] : memref<32x16x8xf32> +// CHECK: scf.if %[[VAL_7]] { +// CHECK: scf.for %[[VAL_62:.*]] = %[[VAL_8]] to %[[VAL_6]] step %[[VAL_9]] { +// CHECK: %[[VAL_63:.*]] = load %[[VAL_17]]{{\[}}%[[VAL_26]], %[[VAL_37]], %[[VAL_62]]] : memref<32x16x8xf32> +// CHECK: store %[[VAL_63]], %[[VAL_18]]{{\[}}%[[VAL_26]], %[[VAL_37]], %[[VAL_62]]] : memref<32x16x8xf32> // CHECK: } // CHECK: } else { // CHECK: } // CHECK: } -// CHECK: %[[VAL_63:.*]] = cmpi eq, %[[VAL_37]], %[[VAL_36]] : index -// CHECK: %[[VAL_64:.*]] = addi %[[VAL_35]], %[[VAL_8]] : index -// CHECK: %[[VAL_65:.*]] = select %[[VAL_63]], %[[VAL_64]], %[[VAL_35]] : index -// CHECK: %[[VAL_66:.*]] = addi %[[VAL_36]], %[[VAL_8]] : index -// CHECK: scf.yield %[[VAL_65]], %[[VAL_66]] : index, index +// CHECK: %[[VAL_64:.*]] = cmpi eq, %[[VAL_38]], %[[VAL_37]] : index +// CHECK: %[[VAL_65:.*]] = addi %[[VAL_36]], %[[VAL_9]] : index +// CHECK: %[[VAL_66:.*]] = select %[[VAL_64]], %[[VAL_65]], %[[VAL_36]] : index +// CHECK: %[[VAL_67:.*]] = addi %[[VAL_37]], %[[VAL_9]] : index +// CHECK: scf.yield %[[VAL_66]], %[[VAL_67]] : index, index // CHECK: } -// CHECK: scf.for %[[VAL_67:.*]] = %[[VAL_68:.*]]#1 to %[[VAL_4]] step %[[VAL_8]] { -// CHECK: scf.for %[[VAL_69:.*]] = %[[VAL_7]] to %[[VAL_5]] step %[[VAL_8]] { -// CHECK: %[[VAL_70:.*]] = load %[[VAL_16]]{{\[}}%[[VAL_25]], %[[VAL_67]], %[[VAL_69]]] : memref<32x16x8xf32> -// CHECK: store %[[VAL_70]], %[[VAL_17]]{{\[}}%[[VAL_25]], %[[VAL_67]], %[[VAL_69]]] : memref<32x16x8xf32> +// CHECK: scf.for %[[VAL_68:.*]] = %[[VAL_69:.*]]#1 to %[[VAL_5]] step %[[VAL_9]] { +// CHECK: scf.for %[[VAL_70:.*]] = %[[VAL_8]] to %[[VAL_6]] step %[[VAL_9]] { +// CHECK: %[[VAL_71:.*]] = load %[[VAL_17]]{{\[}}%[[VAL_26]], %[[VAL_68]], %[[VAL_70]]] : memref<32x16x8xf32> +// CHECK: store %[[VAL_71]], %[[VAL_18]]{{\[}}%[[VAL_26]], %[[VAL_68]], %[[VAL_70]]] : memref<32x16x8xf32> // CHECK: } // CHECK: } // CHECK: } else { -// CHECK: scf.if %[[VAL_6]] { -// CHECK: scf.for %[[VAL_71:.*]] = %[[VAL_7]] to %[[VAL_4]] step %[[VAL_8]] { -// CHECK: scf.for %[[VAL_72:.*]] = %[[VAL_7]] to %[[VAL_5]] step %[[VAL_8]] { -// CHECK: %[[VAL_73:.*]] = load %[[VAL_16]]{{\[}}%[[VAL_25]], %[[VAL_71]], %[[VAL_72]]] : memref<32x16x8xf32> -// CHECK: store %[[VAL_73]], %[[VAL_17]]{{\[}}%[[VAL_25]], %[[VAL_71]], %[[VAL_72]]] : memref<32x16x8xf32> +// CHECK: scf.if %[[VAL_7]] { +// CHECK: scf.for %[[VAL_72:.*]] = %[[VAL_8]] to %[[VAL_5]] step %[[VAL_9]] { +// CHECK: scf.for %[[VAL_73:.*]] = %[[VAL_8]] to %[[VAL_6]] step %[[VAL_9]] { +// CHECK: %[[VAL_74:.*]] = load %[[VAL_17]]{{\[}}%[[VAL_26]], %[[VAL_72]], %[[VAL_73]]] : memref<32x16x8xf32> +// CHECK: store %[[VAL_74]], %[[VAL_18]]{{\[}}%[[VAL_26]], %[[VAL_72]], %[[VAL_73]]] : memref<32x16x8xf32> // CHECK: } // CHECK: } // CHECK: } else { // CHECK: } // CHECK: } -// CHECK: %[[VAL_74:.*]] = cmpi eq, %[[VAL_26]], %[[VAL_25]] : index -// CHECK: %[[VAL_75:.*]] = addi %[[VAL_24]], %[[VAL_8]] : index -// CHECK: %[[VAL_76:.*]] = select %[[VAL_74]], %[[VAL_75]], %[[VAL_24]] : index -// CHECK: %[[VAL_77:.*]] = addi %[[VAL_25]], %[[VAL_8]] : index -// CHECK: scf.yield %[[VAL_76]], %[[VAL_77]] : index, index +// CHECK: %[[VAL_75:.*]] = cmpi eq, %[[VAL_27]], %[[VAL_26]] : index +// CHECK: %[[VAL_76:.*]] = addi %[[VAL_25]], %[[VAL_9]] : index +// CHECK: %[[VAL_77:.*]] = select %[[VAL_75]], %[[VAL_76]], %[[VAL_25]] : index +// CHECK: %[[VAL_78:.*]] = addi %[[VAL_26]], %[[VAL_9]] : index +// CHECK: scf.yield %[[VAL_77]], %[[VAL_78]] : index, index // CHECK: } -// CHECK: scf.for %[[VAL_78:.*]] = %[[VAL_79:.*]]#1 to %[[VAL_3]] step %[[VAL_8]] { -// CHECK: scf.for %[[VAL_80:.*]] = %[[VAL_7]] to %[[VAL_4]] step %[[VAL_8]] { -// CHECK: scf.for %[[VAL_81:.*]] = %[[VAL_7]] to %[[VAL_5]] step %[[VAL_8]] { -// CHECK: %[[VAL_82:.*]] = load %[[VAL_16]]{{\[}}%[[VAL_78]], %[[VAL_80]], %[[VAL_81]]] : memref<32x16x8xf32> -// CHECK: store %[[VAL_82]], %[[VAL_17]]{{\[}}%[[VAL_78]], %[[VAL_80]], %[[VAL_81]]] : memref<32x16x8xf32> +// CHECK: scf.for %[[VAL_79:.*]] = %[[VAL_80:.*]]#1 to %[[VAL_4]] step %[[VAL_9]] { +// CHECK: scf.for %[[VAL_81:.*]] = %[[VAL_8]] to %[[VAL_5]] step %[[VAL_9]] { +// CHECK: scf.for %[[VAL_82:.*]] = %[[VAL_8]] to %[[VAL_6]] step %[[VAL_9]] { +// CHECK: %[[VAL_83:.*]] = load %[[VAL_17]]{{\[}}%[[VAL_79]], %[[VAL_81]], %[[VAL_82]]] : memref<32x16x8xf32> +// CHECK: store %[[VAL_83]], %[[VAL_18]]{{\[}}%[[VAL_79]], %[[VAL_81]], %[[VAL_82]]] : memref<32x16x8xf32> // CHECK: } // CHECK: } // CHECK: } -// CHECK: %[[VAL_83:.*]] = tensor_load %[[VAL_17]] : memref<32x16x8xf32> -// CHECK: return %[[VAL_83]] : tensor<32x16x8xf32> +// CHECK: %[[VAL_84:.*]] = tensor_load %[[VAL_18]] : memref<32x16x8xf32> +// CHECK: return %[[VAL_84]] : tensor<32x16x8xf32> // CHECK: } -func @add_sss(%arga: tensor<32x16x8xf32>, %argb: tensor<32x16x8xf32>) -> tensor<32x16x8xf32> { +func @add_sss(%arga: tensor<32x16x8xf32>, %argb: tensor<32x16x8xf32>, %argx: tensor<32x16x8xf32>) -> tensor<32x16x8xf32> { %0 = linalg.generic #trait_sss ins(%arga, %argb: tensor<32x16x8xf32>, tensor<32x16x8xf32>) - outs(%arga : tensor<32x16x8xf32>) { - ^bb(%a: f32, %b: f32, %s : f32): + outs(%argx: tensor<32x16x8xf32>) { + ^bb(%a: f32, %b: f32, %x: f32): %0 = addf %a, %b : f32 linalg.yield %0 : f32 } -> tensor<32x16x8xf32> @@ -1113,49 +1128,50 @@ } // CHECK-LABEL: func @mul_sss( -// CHECK-SAME: %[[VAL_0:.*]]: tensor<32x16x8xf32>, -// CHECK-SAME: %[[VAL_1:.*]]: tensor<32x16x8xf32>) -> tensor<32x16x8xf32> { -// CHECK: %[[VAL_2:.*]] = constant 999 : index -// CHECK: %[[VAL_3:.*]] = constant 0 : index -// CHECK: %[[VAL_4:.*]] = constant 1 : index -// CHECK: %[[VAL_5:.*]] = alloca(%[[VAL_2]]) : memref -// CHECK: %[[VAL_6:.*]] = alloca(%[[VAL_2]]) : memref -// CHECK: %[[VAL_7:.*]] = alloca(%[[VAL_2]]) : memref -// CHECK: %[[VAL_8:.*]] = alloca(%[[VAL_2]]) : memref -// CHECK: %[[VAL_9:.*]] = alloca(%[[VAL_2]]) : memref -// CHECK: %[[VAL_10:.*]] = alloca(%[[VAL_2]]) : memref -// CHECK: %[[VAL_11:.*]] = alloca(%[[VAL_2]]) : memref -// CHECK: %[[VAL_12:.*]] = alloca() : memref<32x16x8xf32> +// CHECK-SAME: %[[VAL_0:.*0]]: tensor<32x16x8xf32>, +// CHECK-SAME: %[[VAL_1:.*1]]: tensor<32x16x8xf32>, +// CHECK-SAME: %[[VAL_2:.*2]]: tensor<32x16x8xf32>) -> tensor<32x16x8xf32> { +// CHECK: %[[VAL_3:.*]] = constant 999 : index +// CHECK: %[[VAL_4:.*]] = constant 0 : index +// CHECK: %[[VAL_5:.*]] = constant 1 : index +// CHECK: %[[VAL_6:.*]] = alloca(%[[VAL_3]]) : memref +// CHECK: %[[VAL_7:.*]] = alloca(%[[VAL_3]]) : memref +// CHECK: %[[VAL_8:.*]] = alloca(%[[VAL_3]]) : memref +// CHECK: %[[VAL_9:.*]] = alloca(%[[VAL_3]]) : memref +// CHECK: %[[VAL_10:.*]] = alloca(%[[VAL_3]]) : memref +// CHECK: %[[VAL_11:.*]] = alloca(%[[VAL_3]]) : memref +// CHECK: %[[VAL_12:.*]] = alloca(%[[VAL_3]]) : memref // CHECK: %[[VAL_13:.*]] = alloca() : memref<32x16x8xf32> -// CHECK: %[[VAL_14:.*]] = load %[[VAL_5]]{{\[}}%[[VAL_3]]] : memref -// CHECK: %[[VAL_15:.*]] = load %[[VAL_5]]{{\[}}%[[VAL_4]]] : memref -// CHECK: scf.for %[[VAL_16:.*]] = %[[VAL_14]] to %[[VAL_15]] step %[[VAL_4]] { -// CHECK: %[[VAL_17:.*]] = load %[[VAL_6]]{{\[}}%[[VAL_16]]] : memref -// CHECK: %[[VAL_18:.*]] = load %[[VAL_7]]{{\[}}%[[VAL_16]]] : memref -// CHECK: %[[VAL_19:.*]] = addi %[[VAL_16]], %[[VAL_4]] : index -// CHECK: %[[VAL_20:.*]] = load %[[VAL_7]]{{\[}}%[[VAL_19]]] : memref -// CHECK: scf.for %[[VAL_21:.*]] = %[[VAL_18]] to %[[VAL_20]] step %[[VAL_4]] { -// CHECK: %[[VAL_22:.*]] = load %[[VAL_8]]{{\[}}%[[VAL_21]]] : memref -// CHECK: %[[VAL_23:.*]] = load %[[VAL_9]]{{\[}}%[[VAL_21]]] : memref -// CHECK: %[[VAL_24:.*]] = addi %[[VAL_21]], %[[VAL_4]] : index -// CHECK: %[[VAL_25:.*]] = load %[[VAL_9]]{{\[}}%[[VAL_24]]] : memref -// CHECK: scf.for %[[VAL_26:.*]] = %[[VAL_23]] to %[[VAL_25]] step %[[VAL_4]] { -// CHECK: %[[VAL_27:.*]] = load %[[VAL_10]]{{\[}}%[[VAL_26]]] : memref -// CHECK: %[[VAL_28:.*]] = load %[[VAL_11]]{{\[}}%[[VAL_26]]] : memref -// CHECK: %[[VAL_29:.*]] = load %[[VAL_12]]{{\[}}%[[VAL_17]], %[[VAL_22]], %[[VAL_27]]] : memref<32x16x8xf32> -// CHECK: %[[VAL_30:.*]] = mulf %[[VAL_28]], %[[VAL_29]] : f32 -// CHECK: store %[[VAL_30]], %[[VAL_13]]{{\[}}%[[VAL_17]], %[[VAL_22]], %[[VAL_27]]] : memref<32x16x8xf32> +// CHECK: %[[VAL_14:.*]] = alloca() : memref<32x16x8xf32> +// CHECK: %[[VAL_15:.*]] = load %[[VAL_6]]{{\[}}%[[VAL_4]]] : memref +// CHECK: %[[VAL_16:.*]] = load %[[VAL_6]]{{\[}}%[[VAL_5]]] : memref +// CHECK: scf.for %[[VAL_17:.*]] = %[[VAL_15]] to %[[VAL_16]] step %[[VAL_5]] { +// CHECK: %[[VAL_18:.*]] = load %[[VAL_7]]{{\[}}%[[VAL_17]]] : memref +// CHECK: %[[VAL_19:.*]] = load %[[VAL_8]]{{\[}}%[[VAL_17]]] : memref +// CHECK: %[[VAL_20:.*]] = addi %[[VAL_17]], %[[VAL_5]] : index +// CHECK: %[[VAL_21:.*]] = load %[[VAL_8]]{{\[}}%[[VAL_20]]] : memref +// CHECK: scf.for %[[VAL_22:.*]] = %[[VAL_19]] to %[[VAL_21]] step %[[VAL_5]] { +// CHECK: %[[VAL_23:.*]] = load %[[VAL_9]]{{\[}}%[[VAL_22]]] : memref +// CHECK: %[[VAL_24:.*]] = load %[[VAL_10]]{{\[}}%[[VAL_22]]] : memref +// CHECK: %[[VAL_25:.*]] = addi %[[VAL_22]], %[[VAL_5]] : index +// CHECK: %[[VAL_26:.*]] = load %[[VAL_10]]{{\[}}%[[VAL_25]]] : memref +// CHECK: scf.for %[[VAL_27:.*]] = %[[VAL_24]] to %[[VAL_26]] step %[[VAL_5]] { +// CHECK: %[[VAL_28:.*]] = load %[[VAL_11]]{{\[}}%[[VAL_27]]] : memref +// CHECK: %[[VAL_29:.*]] = load %[[VAL_12]]{{\[}}%[[VAL_27]]] : memref +// CHECK: %[[VAL_30:.*]] = load %[[VAL_13]]{{\[}}%[[VAL_18]], %[[VAL_23]], %[[VAL_28]]] : memref<32x16x8xf32> +// CHECK: %[[VAL_31:.*]] = mulf %[[VAL_29]], %[[VAL_30]] : f32 +// CHECK: store %[[VAL_31]], %[[VAL_14]]{{\[}}%[[VAL_18]], %[[VAL_23]], %[[VAL_28]]] : memref<32x16x8xf32> // CHECK: } // CHECK: } // CHECK: } -// CHECK: %[[VAL_31:.*]] = tensor_load %[[VAL_13]] : memref<32x16x8xf32> -// CHECK: return %[[VAL_31]] : tensor<32x16x8xf32> +// CHECK: %[[VAL_32:.*]] = tensor_load %[[VAL_14]] : memref<32x16x8xf32> +// CHECK: return %[[VAL_32]] : tensor<32x16x8xf32> // CHECK: } -func @mul_sss(%arga: tensor<32x16x8xf32>, %argb: tensor<32x16x8xf32>) -> tensor<32x16x8xf32> { +func @mul_sss(%arga: tensor<32x16x8xf32>, %argb: tensor<32x16x8xf32>, %argx: tensor<32x16x8xf32>) -> tensor<32x16x8xf32> { %0 = linalg.generic #trait_sss ins(%arga, %argb: tensor<32x16x8xf32>, tensor<32x16x8xf32>) - outs(%arga : tensor<32x16x8xf32>) { - ^bb(%a: f32, %b: f32, %s : f32): + outs(%argx: tensor<32x16x8xf32>) { + ^bb(%a: f32, %b: f32, %x: f32): %0 = mulf %a, %b : f32 linalg.yield %0 : f32 } -> tensor<32x16x8xf32> @@ -1229,9 +1245,9 @@ %argc: tensor, %argd: tensor) -> tensor { %0 = linalg.generic #trait_kernel_3d - ins(%argb, %argc, %argd : tensor, tensor, tensor) + ins(%argb, %argc, %argd: tensor, tensor, tensor) outs(%arga : tensor) { - ^bb(%b: f32, %c: f32, %d : f32, %a : f32): + ^bb(%b: f32, %c: f32, %d: f32, %a: f32): %0 = mulf %b, %c : f32 %1 = mulf %0, %d : f32 %2 = addf %1, %a : f32 @@ -1260,37 +1276,37 @@ // CHECK: %[[VAL_3:.*]] = constant 0 : index // CHECK: %[[VAL_4:.*]] = constant 1 : index // CHECK: %[[VAL_5:.*]] = alloca(%[[VAL_2]]) : memref +// CHECK: %[[VAL_6:.*]] = alloca(%[[VAL_2]]) : memref // CHECK: %[[VAL_7:.*]] = alloca(%[[VAL_2]]) : memref -// CHECK: %[[VAL_9:.*]] = alloca(%[[VAL_2]]) : memref -// CHECK: %[[VAL_11:.*]] = alloca(%[[VAL_2]]) : memref -// CHECK: %[[VAL_12:.*]] = alloca() : memref -// CHECK: %[[VAL_13:.*]] = load %[[VAL_5]]{{\[}}%[[VAL_3]]] : memref -// CHECK: %[[VAL_14:.*]] = load %[[VAL_5]]{{\[}}%[[VAL_4]]] : memref -// CHECK: scf.for %[[VAL_15:.*]] = %[[VAL_13]] to %[[VAL_14]] step %[[VAL_4]] { -// CHECK: %[[VAL_16:.*]] = load %[[VAL_7]]{{\[}}%[[VAL_15]]] : memref -// CHECK: %[[VAL_17:.*]] = addi %[[VAL_15]], %[[VAL_4]] : index -// CHECK: %[[VAL_18:.*]] = load %[[VAL_7]]{{\[}}%[[VAL_17]]] : memref -// CHECK: scf.for %[[VAL_19:.*]] = %[[VAL_16]] to %[[VAL_18]] step %[[VAL_4]] { -// CHECK: %[[VAL_20:.*]] = load %[[VAL_9]]{{\[}}%[[VAL_19]]] : memref -// CHECK: %[[VAL_21:.*]] = addi %[[VAL_19]], %[[VAL_4]] : index -// CHECK: %[[VAL_22:.*]] = load %[[VAL_9]]{{\[}}%[[VAL_21]]] : memref -// CHECK: %[[VAL_23:.*]] = load %[[VAL_12]][] : memref -// CHECK: %[[VAL_24:.*]] = scf.for %[[VAL_25:.*]] = %[[VAL_20]] to %[[VAL_22]] step %[[VAL_4]] iter_args(%[[VAL_26:.*]] = %[[VAL_23]]) -> (f32) { -// CHECK: %[[VAL_27:.*]] = load %[[VAL_11]]{{\[}}%[[VAL_25]]] : memref -// CHECK: %[[VAL_28:.*]] = addf %[[VAL_26]], %[[VAL_27]] : f32 -// CHECK: scf.yield %[[VAL_28]] : f32 +// CHECK: %[[VAL_8:.*]] = alloca(%[[VAL_2]]) : memref +// CHECK: %[[VAL_9:.*]] = alloca() : memref +// CHECK: %[[VAL_10:.*]] = load %[[VAL_5]]{{\[}}%[[VAL_3]]] : memref +// CHECK: %[[VAL_11:.*]] = load %[[VAL_5]]{{\[}}%[[VAL_4]]] : memref +// CHECK: scf.for %[[VAL_12:.*]] = %[[VAL_10]] to %[[VAL_11]] step %[[VAL_4]] { +// CHECK: %[[VAL_13:.*]] = load %[[VAL_6]]{{\[}}%[[VAL_12]]] : memref +// CHECK: %[[VAL_14:.*]] = addi %[[VAL_12]], %[[VAL_4]] : index +// CHECK: %[[VAL_15:.*]] = load %[[VAL_6]]{{\[}}%[[VAL_14]]] : memref +// CHECK: scf.for %[[VAL_16:.*]] = %[[VAL_13]] to %[[VAL_15]] step %[[VAL_4]] { +// CHECK: %[[VAL_17:.*]] = load %[[VAL_7]]{{\[}}%[[VAL_16]]] : memref +// CHECK: %[[VAL_18:.*]] = addi %[[VAL_16]], %[[VAL_4]] : index +// CHECK: %[[VAL_19:.*]] = load %[[VAL_7]]{{\[}}%[[VAL_18]]] : memref +// CHECK: %[[VAL_20:.*]] = load %[[VAL_9]][] : memref +// CHECK: %[[VAL_21:.*]] = scf.for %[[VAL_22:.*]] = %[[VAL_17]] to %[[VAL_19]] step %[[VAL_4]] iter_args(%[[VAL_23:.*]] = %[[VAL_20]]) -> (f32) { +// CHECK: %[[VAL_24:.*]] = load %[[VAL_8]]{{\[}}%[[VAL_22]]] : memref +// CHECK: %[[VAL_25:.*]] = addf %[[VAL_23]], %[[VAL_24]] : f32 +// CHECK: scf.yield %[[VAL_25]] : f32 // CHECK: } -// CHECK: store %[[VAL_29:.*]], %[[VAL_12]][] : memref +// CHECK: store %[[VAL_26:.*]], %[[VAL_9]][] : memref // CHECK: } // CHECK: } -// CHECK: %[[VAL_30:.*]] = tensor_load %[[VAL_12]] : memref -// CHECK: return %[[VAL_30]] : tensor +// CHECK: %[[VAL_27:.*]] = tensor_load %[[VAL_9]] : memref +// CHECK: return %[[VAL_27]] : tensor // CHECK: } func @sum_reduction(%arga: tensor<10x20x30xf32>, %argx: tensor) -> tensor { %0 = linalg.generic #trait_sum_reduction - ins(%arga : tensor<10x20x30xf32>) - outs(%argx : tensor) { - ^bb(%a : f32, %x : f32): + ins(%arga: tensor<10x20x30xf32>) + outs(%argx: tensor) { + ^bb(%a: f32, %x: f32): %0 = addf %x, %a : f32 linalg.yield %0: f32 } -> tensor @@ -1347,7 +1363,7 @@ %argx: tensor) -> tensor { %0 = linalg.generic #trait_sum_reduction_inv ins(%arga, %argb : tensor, tensor) - outs(%argx : tensor) { + outs(%argx: tensor) { ^bb(%a : f32, %b : f32, %x : f32): %0 = mulf %a, %b : f32 %1 = addf %x, %0 : f32 @@ -1377,39 +1393,39 @@ // CHECK-SAME: %[[VAL_0:.*]]: tensor<10xf32>, // CHECK-SAME: %[[VAL_1:.*]]: tensor<20xf32>, // CHECK-SAME: %[[VAL_2:.*]]: tensor<30xf32>, -// CHECK-SAME: %[[SHAPE:.*]]: tensor<10x20x30xf32>) -> tensor<10x20x30xf32> { -// CHECK: %[[VAL_3:.*]] = constant 10 : index -// CHECK: %[[VAL_4:.*]] = constant 20 : index -// CHECK: %[[VAL_5:.*]] = constant 30 : index -// CHECK: %[[VAL_6:.*]] = constant 0 : index -// CHECK: %[[VAL_7:.*]] = constant 1 : index -// CHECK: %[[VAL_8:.*]] = alloca() : memref<10xf32> -// CHECK: %[[VAL_9:.*]] = alloca() : memref<20xf32> -// CHECK: %[[VAL_10:.*]] = alloca() : memref<30xf32> -// CHECK: %[[VAL_11:.*]] = alloca() : memref<10x20x30xf32> -// CHECK: scf.for %[[VAL_12:.*]] = %[[VAL_6]] to %[[VAL_3]] step %[[VAL_7]] { -// CHECK: %[[VAL_13:.*]] = load %[[VAL_8]]{{\[}}%[[VAL_12]]] : memref<10xf32> -// CHECK: scf.for %[[VAL_14:.*]] = %[[VAL_6]] to %[[VAL_4]] step %[[VAL_7]] { -// CHECK: %[[VAL_15:.*]] = load %[[VAL_9]]{{\[}}%[[VAL_14]]] : memref<20xf32> -// CHECK: scf.for %[[VAL_16:.*]] = %[[VAL_6]] to %[[VAL_5]] step %[[VAL_7]] { -// CHECK: %[[VAL_17:.*]] = mulf %[[VAL_13]], %[[VAL_15]] : f32 -// CHECK: %[[VAL_18:.*]] = load %[[VAL_10]]{{\[}}%[[VAL_16]]] : memref<30xf32> -// CHECK: %[[VAL_19:.*]] = mulf %[[VAL_17]], %[[VAL_18]] : f32 -// CHECK: store %[[VAL_19]], %[[VAL_11]]{{\[}}%[[VAL_12]], %[[VAL_14]], %[[VAL_16]]] : memref<10x20x30xf32> +// CHECK-SAME: %[[VAL_3:.*]]: tensor<10x20x30xf32>) -> tensor<10x20x30xf32> { +// CHECK: %[[VAL_4:.*]] = constant 10 : index +// CHECK: %[[VAL_5:.*]] = constant 20 : index +// CHECK: %[[VAL_6:.*]] = constant 30 : index +// CHECK: %[[VAL_7:.*]] = constant 0 : index +// CHECK: %[[VAL_8:.*]] = constant 1 : index +// CHECK: %[[VAL_9:.*]] = alloca() : memref<10xf32> +// CHECK: %[[VAL_10:.*]] = alloca() : memref<20xf32> +// CHECK: %[[VAL_11:.*]] = alloca() : memref<30xf32> +// CHECK: %[[VAL_12:.*]] = alloca() : memref<10x20x30xf32> +// CHECK: scf.for %[[VAL_13:.*]] = %[[VAL_7]] to %[[VAL_4]] step %[[VAL_8]] { +// CHECK: %[[VAL_14:.*]] = load %[[VAL_9]]{{\[}}%[[VAL_13]]] : memref<10xf32> +// CHECK: scf.for %[[VAL_15:.*]] = %[[VAL_7]] to %[[VAL_5]] step %[[VAL_8]] { +// CHECK: %[[VAL_16:.*]] = load %[[VAL_10]]{{\[}}%[[VAL_15]]] : memref<20xf32> +// CHECK: scf.for %[[VAL_17:.*]] = %[[VAL_7]] to %[[VAL_6]] step %[[VAL_8]] { +// CHECK: %[[VAL_18:.*]] = mulf %[[VAL_14]], %[[VAL_16]] : f32 +// CHECK: %[[VAL_19:.*]] = load %[[VAL_11]]{{\[}}%[[VAL_17]]] : memref<30xf32> +// CHECK: %[[VAL_20:.*]] = mulf %[[VAL_18]], %[[VAL_19]] : f32 +// CHECK: store %[[VAL_20]], %[[VAL_12]]{{\[}}%[[VAL_13]], %[[VAL_15]], %[[VAL_17]]] : memref<10x20x30xf32> // CHECK: } // CHECK: } // CHECK: } -// CHECK: %[[VAL_20:.*]] = tensor_load %[[VAL_11]] : memref<10x20x30xf32> -// CHECK: return %[[VAL_20]] : tensor<10x20x30xf32> +// CHECK: %[[VAL_21:.*]] = tensor_load %[[VAL_12]] : memref<10x20x30xf32> +// CHECK: return %[[VAL_21]] : tensor<10x20x30xf32> // CHECK: } func @invariants(%arga: tensor<10xf32>, %argb: tensor<20xf32>, %argc: tensor<30xf32>, - %shape : tensor<10x20x30xf32>) -> tensor<10x20x30xf32> { + %argx: tensor<10x20x30xf32>) -> tensor<10x20x30xf32> { %0 = linalg.generic #trait_invariants ins(%arga, %argb, %argc : tensor<10xf32>, tensor<20xf32>, tensor<30xf32>) - outs(%shape : tensor<10x20x30xf32>) { - ^bb(%a : f32, %b : f32, %c : f32, %s : f32): + outs(%argx : tensor<10x20x30xf32>) { + ^bb(%a : f32, %b : f32, %c : f32, %x : f32): %0 = mulf %a, %b : f32 %1 = mulf %0, %c : f32 linalg.yield %1: f32 diff --git a/mlir/test/Dialect/Linalg/sparse_invalid.mlir b/mlir/test/Dialect/Linalg/sparse_invalid.mlir --- a/mlir/test/Dialect/Linalg/sparse_invalid.mlir +++ b/mlir/test/Dialect/Linalg/sparse_invalid.mlir @@ -9,17 +9,16 @@ [ "S" ], // a [ "D" ] // x ], - iterator_types = ["parallel"] + iterator_types = ["parallel"], + doc = "x(i) = a(i) + b" } -func @invalid_memref(%arga: memref<32xf32>, %argb: f32, %shape: tensor<32xf32>) - -> tensor<32xf32> -{ +func @invalid_memref(%arga: memref<32xf32>, %argb: f32, %argx: tensor<32xf32>) -> tensor<32xf32> { // expected-error@+1 {{'linalg.generic' op expected sparse annotations on tensors only}} %0 = linalg.generic #trait_memref ins(%arga: memref<32xf32>) - outs(%shape: tensor<32xf32>) { - ^bb(%a: f32, %s: f32): + outs(%argx: tensor<32xf32>) { + ^bb(%a: f32, %x: f32): %0 = addf %a, %argb : f32 linalg.yield %0 : f32 } -> tensor<32xf32> @@ -38,15 +37,16 @@ [ "S" ], // b [ "D" ] // x ], - iterator_types = ["parallel"] + iterator_types = ["parallel"], + doc = "x(i) = a(i) + b" } -func @invalid_too_many(%arga: tensor<32xf32>, %argb: f32) -> tensor<32xf32> { +func @invalid_too_many(%arga: tensor<32xf32>, %argb: f32, %argx: tensor<32xf32>) -> tensor<32xf32> { // expected-error@+1 {{'linalg.generic' op expected one sparse annotation for each tensor}} %0 = linalg.generic #trait_too_many ins(%arga: tensor<32xf32>) - outs(%arga: tensor<32xf32>) { - ^bb(%a: f32, %s: f32): + outs(%argx: tensor<32xf32>) { + ^bb(%a: f32, %x: f32): %0 = addf %a, %argb : f32 linalg.yield %0 : f32 } -> tensor<32xf32> @@ -61,15 +61,16 @@ affine_map<(i) -> (i)> // x (out) ], sparse = [ 1, 2 ], - iterator_types = ["parallel"] + iterator_types = ["parallel"], + doc = "x(i) = a(i) + b" } -func @invalid_no_array(%arga: tensor<32xf32>, %argb: f32) -> tensor<32xf32> { +func @invalid_no_array(%arga: tensor<32xf32>, %argb: f32, %argx: tensor<32xf32>) -> tensor<32xf32> { // expected-error@+1 {{'linalg.generic' op expected sparse annotation array for tensor 0}} %0 = linalg.generic #trait_no_array ins(%arga: tensor<32xf32>) - outs(%arga: tensor<32xf32>) { - ^bb(%a: f32, %s: f32): + outs(%argx: tensor<32xf32>) { + ^bb(%a: f32, %x: f32): %0 = addf %a, %argb : f32 linalg.yield %0 : f32 } -> tensor<32xf32> @@ -87,15 +88,16 @@ [ "S" ], [ "D", "D" ] ], - iterator_types = ["parallel"] + iterator_types = ["parallel"], + doc = "x(i) = a(i) + b" } -func @invalid_wrong_rank(%arga: tensor<32xf32>, %argb: f32) -> tensor<32xf32> { +func @invalid_wrong_rank(%arga: tensor<32xf32>, %argb: f32, %argx: tensor<32xf32>) -> tensor<32xf32> { // expected-error@+1 {{'linalg.generic' op expected sparse annotation with rank 1 for tensor 1}} %0 = linalg.generic #trait_wrong_rank ins(%arga: tensor<32xf32>) - outs(%arga: tensor<32xf32>) { - ^bb(%a: f32, %s: f32): + outs(%argx: tensor<32xf32>) { + ^bb(%a: f32, %x: f32): %0 = addf %a, %argb : f32 linalg.yield %0 : f32 } -> tensor<32xf32> @@ -113,15 +115,16 @@ [ "S", 1 ], [ "D", "D" ] ], - iterator_types = ["parallel","parallel"] + iterator_types = ["parallel","parallel"], + doc = "x(i,j) = a(i,j) + b" } -func @invalid_no_string(%arga: tensor<32x16xf32>, %argb: f32) -> tensor<32x16xf32> { +func @invalid_no_string(%arga: tensor<32x16xf32>, %argb: f32, %argx: tensor<32x16xf32>) -> tensor<32x16xf32> { // expected-error@+1 {{'linalg.generic' op expected sparse annotation at position 1 for tensor 0}} %0 = linalg.generic #trait_no_string ins(%arga: tensor<32x16xf32>) - outs(%arga: tensor<32x16xf32>) { - ^bb(%a: f32, %s: f32): + outs(%argx: tensor<32x16xf32>) { + ^bb(%a: f32, %x: f32): %0 = addf %a, %argb : f32 linalg.yield %0 : f32 } -> tensor<32x16xf32> @@ -139,15 +142,16 @@ [ "S", "S" ], [ "D", "X" ] ], - iterator_types = ["parallel","parallel"] + iterator_types = ["parallel","parallel"], + doc = "x(i,j) = a(i,j) + b" } -func @invalid_wrong_symbol(%arga: tensor<32x16xf32>, %argb: f32) -> tensor<32x16xf32> { +func @invalid_wrong_symbol(%arga: tensor<32x16xf32>, %argb: f32, %argx: tensor<32x16xf32>) -> tensor<32x16xf32> { // expected-error@+1 {{'linalg.generic' op expected sparse annotation at position 1 for tensor 1}} %0 = linalg.generic #trait_wrong_symbol ins(%arga: tensor<32x16xf32>) - outs(%arga: tensor<32x16xf32>) { - ^bb(%a: f32, %s: f32): + outs(%argx: tensor<32x16xf32>) { + ^bb(%a: f32, %x: f32): %0 = addf %a, %argb : f32 linalg.yield %0 : f32 } -> tensor<32x16xf32> @@ -165,15 +169,16 @@ [ "S", "S" ], [ "D", "S" ] ], - iterator_types = ["parallel","parallel"] + iterator_types = ["parallel","parallel"], + doc = "x(i,j) = a(i,j) + b" } -func @invalid_no_sparse_output(%arga: tensor<32x16xf32>, %argb: f32) -> tensor<32x16xf32> { +func @invalid_no_sparse_output(%arga: tensor<32x16xf32>, %argb: f32, %argx: tensor<32x16xf32>) -> tensor<32x16xf32> { // expected-error@+1 {{'linalg.generic' op sparse output tensors not supported (yet)}} %0 = linalg.generic #trait_no_sparse_output ins(%arga: tensor<32x16xf32>) - outs(%arga: tensor<32x16xf32>) { - ^bb(%a: f32, %s: f32): + outs(%argx: tensor<32x16xf32>) { + ^bb(%a: f32, %x: f32): %0 = addf %a, %argb : f32 linalg.yield %0 : f32 } -> tensor<32x16xf32> diff --git a/mlir/test/Dialect/Linalg/sparse_nd.mlir b/mlir/test/Dialect/Linalg/sparse_nd.mlir --- a/mlir/test/Dialect/Linalg/sparse_nd.mlir +++ b/mlir/test/Dialect/Linalg/sparse_nd.mlir @@ -20,54 +20,55 @@ } // CHECK-LABEL: func @mul( -// CHECK-SAME: %[[VAL_0:.*]]: tensor<100x200x300x400x500x600x700x800xf32>, -// CHECK-SAME: %[[VAL_1:.*]]: tensor<100x200x300x400x500x600x700x800xf32>) -> tensor<100x200x300x400x500x600x700x800xf32> { -// CHECK: %[[VAL_2:.*]] = constant 999 : index -// CHECK: %[[VAL_3:.*]] = constant 100 : index -// CHECK: %[[VAL_4:.*]] = constant 200 : index -// CHECK: %[[VAL_5:.*]] = constant 300 : index -// CHECK: %[[VAL_6:.*]] = constant 600 : index -// CHECK: %[[VAL_7:.*]] = constant 700 : index -// CHECK: %[[VAL_8:.*]] = constant 800 : index -// CHECK: %[[VAL_9:.*]] = constant 0 : index -// CHECK: %[[VAL_10:.*]] = constant 1 : index -// CHECK: %[[VAL_11:.*]] = alloca() : memref<100x200x300x400x500x600x700x800xf32> -// CHECK: %[[VAL_12:.*]] = alloca(%[[VAL_2]]) : memref -// CHECK: %[[VAL_13:.*]] = alloca(%[[VAL_2]]) : memref -// CHECK: %[[VAL_14:.*]] = alloca(%[[VAL_2]]) : memref -// CHECK: %[[VAL_15:.*]] = alloca(%[[VAL_2]]) : memref -// CHECK: %[[VAL_16:.*]] = alloca(%[[VAL_2]]) : memref -// CHECK: %[[VAL_17:.*]] = alloca() : memref<100x200x300x400x500x600x700x800xf32> -// CHECK: scf.for %[[VAL_18:.*]] = %[[VAL_9]] to %[[VAL_8]] step %[[VAL_10]] { -// CHECK: scf.for %[[VAL_19:.*]] = %[[VAL_9]] to %[[VAL_7]] step %[[VAL_10]] { -// CHECK: %[[VAL_20:.*]] = muli %[[VAL_18]], %[[VAL_7]] : index -// CHECK: %[[VAL_21:.*]] = addi %[[VAL_20]], %[[VAL_19]] : index -// CHECK: scf.for %[[VAL_22:.*]] = %[[VAL_9]] to %[[VAL_6]] step %[[VAL_10]] { -// CHECK: %[[VAL_23:.*]] = muli %[[VAL_21]], %[[VAL_6]] : index -// CHECK: %[[VAL_24:.*]] = addi %[[VAL_23]], %[[VAL_22]] : index -// CHECK: %[[VAL_25:.*]] = load %[[VAL_12]]{{\[}}%[[VAL_24]]] : memref -// CHECK: %[[VAL_26:.*]] = addi %[[VAL_24]], %[[VAL_10]] : index -// CHECK: %[[VAL_27:.*]] = load %[[VAL_12]]{{\[}}%[[VAL_26]]] : memref -// CHECK: scf.for %[[VAL_28:.*]] = %[[VAL_25]] to %[[VAL_27]] step %[[VAL_10]] { -// CHECK: %[[VAL_29:.*]] = load %[[VAL_13]]{{\[}}%[[VAL_28]]] : memref -// CHECK: %[[VAL_30:.*]] = load %[[VAL_14]]{{\[}}%[[VAL_28]]] : memref -// CHECK: %[[VAL_31:.*]] = addi %[[VAL_28]], %[[VAL_10]] : index -// CHECK: %[[VAL_32:.*]] = load %[[VAL_14]]{{\[}}%[[VAL_31]]] : memref -// CHECK: scf.for %[[VAL_33:.*]] = %[[VAL_30]] to %[[VAL_32]] step %[[VAL_10]] { -// CHECK: %[[VAL_34:.*]] = load %[[VAL_15]]{{\[}}%[[VAL_33]]] : memref -// CHECK: scf.for %[[VAL_35:.*]] = %[[VAL_9]] to %[[VAL_5]] step %[[VAL_10]] { -// CHECK: %[[VAL_36:.*]] = muli %[[VAL_33]], %[[VAL_5]] : index -// CHECK: %[[VAL_37:.*]] = addi %[[VAL_36]], %[[VAL_35]] : index -// CHECK: scf.for %[[VAL_38:.*]] = %[[VAL_9]] to %[[VAL_4]] step %[[VAL_10]] { -// CHECK: %[[VAL_39:.*]] = muli %[[VAL_37]], %[[VAL_4]] : index -// CHECK: %[[VAL_40:.*]] = addi %[[VAL_39]], %[[VAL_38]] : index -// CHECK: scf.for %[[VAL_41:.*]] = %[[VAL_9]] to %[[VAL_3]] step %[[VAL_10]] { -// CHECK: %[[VAL_42:.*]] = muli %[[VAL_40]], %[[VAL_3]] : index -// CHECK: %[[VAL_43:.*]] = addi %[[VAL_42]], %[[VAL_41]] : index -// CHECK: %[[VAL_44:.*]] = load %[[VAL_11]]{{\[}}%[[VAL_41]], %[[VAL_38]], %[[VAL_35]], %[[VAL_34]], %[[VAL_29]], %[[VAL_22]], %[[VAL_19]], %[[VAL_18]]] : memref<100x200x300x400x500x600x700x800xf32> -// CHECK: %[[VAL_45:.*]] = load %[[VAL_16]]{{\[}}%[[VAL_43]]] : memref -// CHECK: %[[VAL_46:.*]] = mulf %[[VAL_44]], %[[VAL_45]] : f32 -// CHECK: store %[[VAL_46]], %[[VAL_17]]{{\[}}%[[VAL_41]], %[[VAL_38]], %[[VAL_35]], %[[VAL_34]], %[[VAL_29]], %[[VAL_22]], %[[VAL_19]], %[[VAL_18]]] : memref<100x200x300x400x500x600x700x800xf32> +// CHECK-SAME: %[[VAL_0:.*0]]: tensor<100x200x300x400x500x600x700x800xf32>, +// CHECK-SAME: %[[VAL_1:.*1]]: tensor<100x200x300x400x500x600x700x800xf32>, +// CHECK-SAME: %[[VAL_2:.*2]]: tensor<100x200x300x400x500x600x700x800xf32>) -> tensor<100x200x300x400x500x600x700x800xf32> { +// CHECK: %[[VAL_3:.*]] = constant 999 : index +// CHECK: %[[VAL_4:.*]] = constant 100 : index +// CHECK: %[[VAL_5:.*]] = constant 200 : index +// CHECK: %[[VAL_6:.*]] = constant 300 : index +// CHECK: %[[VAL_7:.*]] = constant 600 : index +// CHECK: %[[VAL_8:.*]] = constant 700 : index +// CHECK: %[[VAL_9:.*]] = constant 800 : index +// CHECK: %[[VAL_10:.*]] = constant 0 : index +// CHECK: %[[VAL_11:.*]] = constant 1 : index +// CHECK: %[[VAL_12:.*]] = alloca() : memref<100x200x300x400x500x600x700x800xf32> +// CHECK: %[[VAL_13:.*]] = alloca(%[[VAL_3]]) : memref +// CHECK: %[[VAL_14:.*]] = alloca(%[[VAL_3]]) : memref +// CHECK: %[[VAL_15:.*]] = alloca(%[[VAL_3]]) : memref +// CHECK: %[[VAL_16:.*]] = alloca(%[[VAL_3]]) : memref +// CHECK: %[[VAL_17:.*]] = alloca(%[[VAL_3]]) : memref +// CHECK: %[[VAL_18:.*]] = alloca() : memref<100x200x300x400x500x600x700x800xf32> +// CHECK: scf.for %[[VAL_19:.*]] = %[[VAL_10]] to %[[VAL_9]] step %[[VAL_11]] { +// CHECK: scf.for %[[VAL_20:.*]] = %[[VAL_10]] to %[[VAL_8]] step %[[VAL_11]] { +// CHECK: %[[VAL_21:.*]] = muli %[[VAL_19]], %[[VAL_8]] : index +// CHECK: %[[VAL_22:.*]] = addi %[[VAL_21]], %[[VAL_20]] : index +// CHECK: scf.for %[[VAL_23:.*]] = %[[VAL_10]] to %[[VAL_7]] step %[[VAL_11]] { +// CHECK: %[[VAL_24:.*]] = muli %[[VAL_22]], %[[VAL_7]] : index +// CHECK: %[[VAL_25:.*]] = addi %[[VAL_24]], %[[VAL_23]] : index +// CHECK: %[[VAL_26:.*]] = load %[[VAL_13]]{{\[}}%[[VAL_25]]] : memref +// CHECK: %[[VAL_27:.*]] = addi %[[VAL_25]], %[[VAL_11]] : index +// CHECK: %[[VAL_28:.*]] = load %[[VAL_13]]{{\[}}%[[VAL_27]]] : memref +// CHECK: scf.for %[[VAL_29:.*]] = %[[VAL_26]] to %[[VAL_28]] step %[[VAL_11]] { +// CHECK: %[[VAL_30:.*]] = load %[[VAL_14]]{{\[}}%[[VAL_29]]] : memref +// CHECK: %[[VAL_31:.*]] = load %[[VAL_15]]{{\[}}%[[VAL_29]]] : memref +// CHECK: %[[VAL_32:.*]] = addi %[[VAL_29]], %[[VAL_11]] : index +// CHECK: %[[VAL_33:.*]] = load %[[VAL_15]]{{\[}}%[[VAL_32]]] : memref +// CHECK: scf.for %[[VAL_34:.*]] = %[[VAL_31]] to %[[VAL_33]] step %[[VAL_11]] { +// CHECK: %[[VAL_35:.*]] = load %[[VAL_16]]{{\[}}%[[VAL_34]]] : memref +// CHECK: scf.for %[[VAL_36:.*]] = %[[VAL_10]] to %[[VAL_6]] step %[[VAL_11]] { +// CHECK: %[[VAL_37:.*]] = muli %[[VAL_34]], %[[VAL_6]] : index +// CHECK: %[[VAL_38:.*]] = addi %[[VAL_37]], %[[VAL_36]] : index +// CHECK: scf.for %[[VAL_39:.*]] = %[[VAL_10]] to %[[VAL_5]] step %[[VAL_11]] { +// CHECK: %[[VAL_40:.*]] = muli %[[VAL_38]], %[[VAL_5]] : index +// CHECK: %[[VAL_41:.*]] = addi %[[VAL_40]], %[[VAL_39]] : index +// CHECK: scf.for %[[VAL_42:.*]] = %[[VAL_10]] to %[[VAL_4]] step %[[VAL_11]] { +// CHECK: %[[VAL_43:.*]] = muli %[[VAL_41]], %[[VAL_4]] : index +// CHECK: %[[VAL_44:.*]] = addi %[[VAL_43]], %[[VAL_42]] : index +// CHECK: %[[VAL_45:.*]] = load %[[VAL_12]]{{\[}}%[[VAL_42]], %[[VAL_39]], %[[VAL_36]], %[[VAL_35]], %[[VAL_30]], %[[VAL_23]], %[[VAL_20]], %[[VAL_19]]] : memref<100x200x300x400x500x600x700x800xf32> +// CHECK: %[[VAL_46:.*]] = load %[[VAL_17]]{{\[}}%[[VAL_44]]] : memref +// CHECK: %[[VAL_47:.*]] = mulf %[[VAL_45]], %[[VAL_46]] : f32 +// CHECK: store %[[VAL_47]], %[[VAL_18]]{{\[}}%[[VAL_42]], %[[VAL_39]], %[[VAL_36]], %[[VAL_35]], %[[VAL_30]], %[[VAL_23]], %[[VAL_20]], %[[VAL_19]]] : memref<100x200x300x400x500x600x700x800xf32> // CHECK: } // CHECK: } // CHECK: } @@ -76,17 +77,18 @@ // CHECK: } // CHECK: } // CHECK: } -// CHECK: %[[VAL_47:.*]] = tensor_load %[[VAL_17]] : memref<100x200x300x400x500x600x700x800xf32> -// CHECK: return %[[VAL_47]] : tensor<100x200x300x400x500x600x700x800xf32> +// CHECK: %[[VAL_48:.*]] = tensor_load %[[VAL_18]] : memref<100x200x300x400x500x600x700x800xf32> +// CHECK: return %[[VAL_48]] : tensor<100x200x300x400x500x600x700x800xf32> // CHECK: } func @mul(%arga: tensor<100x200x300x400x500x600x700x800xf32>, - %argb: tensor<100x200x300x400x500x600x700x800xf32>) + %argb: tensor<100x200x300x400x500x600x700x800xf32>, + %argx: tensor<100x200x300x400x500x600x700x800xf32>) -> tensor<100x200x300x400x500x600x700x800xf32> { %0 = linalg.generic #trait_mul ins(%arga, %argb: tensor<100x200x300x400x500x600x700x800xf32>, tensor<100x200x300x400x500x600x700x800xf32>) - outs(%arga: tensor<100x200x300x400x500x600x700x800xf32>) { - ^bb(%a: f32, %b: f32, %s : f32): + outs(%argx: tensor<100x200x300x400x500x600x700x800xf32>) { + ^bb(%a: f32, %b: f32, %x: f32): %0 = mulf %a, %b : f32 linalg.yield %0 : f32 } -> tensor<100x200x300x400x500x600x700x800xf32> diff --git a/mlir/test/Dialect/Linalg/sparse_parallel.mlir b/mlir/test/Dialect/Linalg/sparse_parallel.mlir --- a/mlir/test/Dialect/Linalg/sparse_parallel.mlir +++ b/mlir/test/Dialect/Linalg/sparse_parallel.mlir @@ -48,11 +48,11 @@ // CHECK-PAR4: scf.parallel // CHECK-PAR4: return // -func @scale_dd(%scale: f32, %arga: tensor) -> tensor { +func @scale_dd(%scale: f32, %arga: tensor, %argx: tensor) -> tensor { %0 = linalg.generic #trait_dd ins(%arga: tensor) - outs(%arga: tensor) { - ^bb(%a: f32, %s: f32): + outs(%argx: tensor) { + ^bb(%a: f32, %x: f32): %0 = mulf %a, %scale : f32 linalg.yield %0 : f32 } -> tensor @@ -98,11 +98,11 @@ // CHECK-PAR4: scf.parallel // CHECK-PAR4: return // -func @scale_ss(%scale: f32, %arga: tensor) -> tensor { +func @scale_ss(%scale: f32, %arga: tensor, %argx: tensor) -> tensor { %0 = linalg.generic #trait_ss ins(%arga: tensor) - outs(%arga: tensor) { - ^bb(%a: f32, %s: f32): + outs(%argx: tensor) { + ^bb(%a: f32, %x: f32): %0 = mulf %a, %scale : f32 linalg.yield %0 : f32 } -> tensor diff --git a/mlir/test/Dialect/Linalg/sparse_storage.mlir b/mlir/test/Dialect/Linalg/sparse_storage.mlir --- a/mlir/test/Dialect/Linalg/sparse_storage.mlir +++ b/mlir/test/Dialect/Linalg/sparse_storage.mlir @@ -122,14 +122,13 @@ // CHECK-TYPE5: store %[[MUL]], %{{.*}}[%[[INDC]]] : memref<32xf64> // CHECK-TYPE5: } -func @mul_dd(%arga: tensor<32xf64>, %argb: tensor<32xf64>) -> tensor<32xf64> { +func @mul_dd(%arga: tensor<32xf64>, %argb: tensor<32xf64>, %argx: tensor<32xf64>) -> tensor<32xf64> { %0 = linalg.generic #trait_mul_1d ins(%arga, %argb: tensor<32xf64>, tensor<32xf64>) - outs(%arga : tensor<32xf64>) { - ^bb(%a: f64, %b: f64, %s: f64): + outs(%argx : tensor<32xf64>) { + ^bb(%a: f64, %b: f64, %x: f64): %0 = mulf %a, %b : f64 linalg.yield %0 : f64 } -> tensor<32xf64> return %0 : tensor<32xf64> } - diff --git a/mlir/test/Dialect/Linalg/sparse_vector.mlir b/mlir/test/Dialect/Linalg/sparse_vector.mlir --- a/mlir/test/Dialect/Linalg/sparse_vector.mlir +++ b/mlir/test/Dialect/Linalg/sparse_vector.mlir @@ -54,11 +54,11 @@ // CHECK-VEC2: } // CHECK-VEC2: return // -func @scale_d(%arga: tensor<1024xf32>, %scale: f32) -> tensor<1024xf32> { +func @scale_d(%arga: tensor<1024xf32>, %scale: f32, %argx: tensor<1024xf32>) -> tensor<1024xf32> { %0 = linalg.generic #trait_scale_d ins(%arga: tensor<1024xf32>) - outs(%arga: tensor<1024xf32>) { - ^bb(%a: f32, %s : f32): + outs(%argx: tensor<1024xf32>) { + ^bb(%a: f32, %x: f32): %0 = mulf %a, %scale : f32 linalg.yield %0 : f32 } -> tensor<1024xf32> @@ -134,11 +134,11 @@ // CHECK-VEC2: } // CHECK-VEC2: return // -func @mul_s(%arga: tensor<1024xf32>, %argb: tensor<1024xf32>) -> tensor<1024xf32> { +func @mul_s(%arga: tensor<1024xf32>, %argb: tensor<1024xf32>, %argx: tensor<1024xf32>) -> tensor<1024xf32> { %0 = linalg.generic #trait_mul_s ins(%arga, %argb: tensor<1024xf32>, tensor<1024xf32>) - outs(%arga: tensor<1024xf32>) { - ^bb(%a: f32, %b: f32, %s : f32): + outs(%argx: tensor<1024xf32>) { + ^bb(%a: f32, %b: f32, %x: f32): %0 = mulf %a, %b : f32 linalg.yield %0 : f32 } -> tensor<1024xf32> @@ -208,7 +208,7 @@ %0 = linalg.generic #trait_reduction_d ins(%arga, %argb: tensor<1024xf32>, tensor<1024xf32>) outs(%argx: tensor) { - ^bb(%a: f32, %b : f32, %x : f32): + ^bb(%a: f32, %b: f32, %x: f32): %0 = mulf %a, %b : f32 %1 = addf %x, %0 : f32 linalg.yield %1 : f32 @@ -288,8 +288,8 @@ // CHECK-VEC2: scf.for %[[j:.*]] = %[[q]] to %[[s]] step %[[c16]] { // CHECK-VEC2: %[[sub:.*]] = subi %[[s]], %[[j]] : index // CHECK-VEC2: %[[mask:.*]] = vector.create_mask %[[sub]] : vector<16xi1> -// CHECK-VEC2: %[[lj:.*]] = vector.maskedload %{{.*}}[%arg3], %[[mask]], %{{.*}} : memref, vector<16xi1>, vector<16xi32> into vector<16xi32> -// CHECK-VEC2: %[[la:.*]] = vector.maskedload %{{.*}}[%arg3], %[[mask]], %{{.*}} : memref, vector<16xi1>, vector<16xf32> into vector<16xf32> +// CHECK-VEC2: %[[lj:.*]] = vector.maskedload %{{.*}}[%[[j]]], %[[mask]], %{{.*}} : memref, vector<16xi1>, vector<16xi32> into vector<16xi32> +// CHECK-VEC2: %[[la:.*]] = vector.maskedload %{{.*}}[%[[j]]], %[[mask]], %{{.*}} : memref, vector<16xi1>, vector<16xf32> into vector<16xf32> // CHECK-VEC2: %[[lb:.*]] = vector.gather %{{.*}}[%[[lj]]], %[[mask]], %{{.*}} : memref<512x1024xf32>, vector<16xi32>, vector<16xi1>, vector<16xf32> into vector<16xf32> // CHECK-VEC2: %[[m:.*]] = mulf %[[la]], %[[lb]] : vector<16xf32> // CHECK-VEC2: vector.scatter %{{.*}}[%[[lj]]], %[[mask]], %[[m]] : memref<512x1024xf32>, vector<16xi32>, vector<16xi1>, vector<16xf32> @@ -297,11 +297,11 @@ // CHECK-VEC2: } // CHECK-VEC2: return // -func @mul_ds(%arga: tensor<512x1024xf32>, %argb: tensor<512x1024xf32>) -> tensor<512x1024xf32> { +func @mul_ds(%arga: tensor<512x1024xf32>, %argb: tensor<512x1024xf32>, %argx: tensor<512x1024xf32>) -> tensor<512x1024xf32> { %0 = linalg.generic #trait_mul_ds ins(%arga, %argb: tensor<512x1024xf32>, tensor<512x1024xf32>) - outs(%arga: tensor<512x1024xf32>) { - ^bb(%a: f32, %b: f32, %s : f32): + outs(%argx: tensor<512x1024xf32>) { + ^bb(%a: f32, %b: f32, %x: f32): %0 = mulf %a, %b : f32 linalg.yield %0 : f32 } -> tensor<512x1024xf32>