From: Aart Bik Date: Fri, 26 Feb 2021 22:59:32 +0000 (-0800) Subject: [mlir][sparse] fixed inaccury in maintaining universal index X-Git-Tag: llvmorg-14-init~13838 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=6afaea6682dc3b0eb7e125847934759be6d0fb5c;p=platform%2Fupstream%2Fllvm.git [mlir][sparse] fixed inaccury in maintaining universal index The universal index was maintained if dense indices were still in place, and lattice points followed. However, it should only be kept if any of those following lattice points actually consumes the universal index. This change also fixes an inaccuracy with a missing broadcast around vector invariant. Reviewed By: bixia Differential Revision: https://reviews.llvm.org/D97594 --- diff --git a/mlir/lib/Dialect/Linalg/Transforms/Sparsification.cpp b/mlir/lib/Dialect/Linalg/Transforms/Sparsification.cpp index efaaed6..75fb7f7 100644 --- a/mlir/lib/Dialect/Linalg/Transforms/Sparsification.cpp +++ b/mlir/lib/Dialect/Linalg/Transforms/Sparsification.cpp @@ -693,8 +693,11 @@ static Value genTensorLoad(Merger &merger, CodeGen &codegen, unsigned exp) { // Test if the load was hoisted to a higher loop nest. Value val = merger.exp(exp).val; - if (val) + if (val) { + if (codegen.curVecLength > 1 && !val.getType().isa()) + return genVectorInvariantValue(codegen, rewriter, val); return val; + } // Actual load. SmallVector args; unsigned tensor = merger.exp(exp).e0; @@ -1186,9 +1189,19 @@ static void genStmt(Merger &merger, CodeGen &codegen, PatternRewriter &rewriter, unsigned l0 = merger.set(lts)[0]; unsigned ldx = at == 0 ? -1u : topSort[at - 1]; genInvariants(merger, codegen, rewriter, op, exp, ldx, /*hoist=*/true); - bool needsUniv = genInit(merger, codegen, rewriter, op, topSort, at, - merger.lat(l0).bits) && - lsize > 1; + bool needsUniv = false; + if (genInit(merger, codegen, rewriter, op, topSort, at, + merger.lat(l0).bits)) { + // Maintain the universal index only if it is actually + // consumed by a subsequent lattice point. + for (unsigned i = 1; i < lsize; i++) { + unsigned li = merger.set(lts)[i]; + if (!merger.hasAnyDimOf(merger.lat(li).simple, Dim::kSparse)) { + needsUniv = true; + break; + } + } + } // Emit a loop for every lattice point L0 >= Li. for (unsigned i = 0; i < lsize; i++) { diff --git a/mlir/test/Dialect/Linalg/sparse_1d.mlir b/mlir/test/Dialect/Linalg/sparse_1d.mlir index 320dd95..1b445bc 100644 --- a/mlir/test/Dialect/Linalg/sparse_1d.mlir +++ b/mlir/test/Dialect/Linalg/sparse_1d.mlir @@ -714,54 +714,56 @@ func @mul_ss(%arga: tensor<32xf32>, %argb: tensor<32xf32>, %argx: tensor<32xf32> // CHECK: %[[VAL_15:.*]] = load %[[VAL_6]]{{\[}}%[[VAL_5]]] : memref // CHECK: %[[VAL_16:.*]] = load %[[VAL_9]]{{\[}}%[[VAL_4]]] : memref // CHECK: %[[VAL_17:.*]] = load %[[VAL_9]]{{\[}}%[[VAL_5]]] : memref -// CHECK: %[[VAL_18:.*]]:3 = scf.while (%[[VAL_19:.*]] = %[[VAL_14]], %[[VAL_20:.*]] = %[[VAL_16]], %[[VAL_21:.*]] = %[[VAL_4]]) : (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: %[[VAL_18:.*]]:2 = scf.while (%[[VAL_19:.*]] = %[[VAL_14]], %[[VAL_20:.*]] = %[[VAL_16]]) : (index, index) -> (index, index) { +// CHECK: %[[VAL_21:.*]] = cmpi ult, %[[VAL_19]], %[[VAL_15]] : index +// CHECK: %[[VAL_22:.*]] = cmpi ult, %[[VAL_20]], %[[VAL_17]] : index +// CHECK: %[[VAL_23:.*]] = and %[[VAL_21]], %[[VAL_22]] : i1 +// CHECK: scf.condition(%[[VAL_23]]) %[[VAL_19]], %[[VAL_20]] : index, index // CHECK: } do { -// CHECK: ^bb0(%[[VAL_25:.*]]: index, %[[VAL_26:.*]]: index, %[[VAL_27:.*]]: index): -// CHECK: %[[VAL_28:.*]] = load %[[VAL_7]]{{\[}}%[[VAL_25]]] : memref -// CHECK: %[[VAL_29:.*]] = load %[[VAL_10]]{{\[}}%[[VAL_26]]] : memref -// CHECK: %[[VAL_30:.*]] = cmpi eq, %[[VAL_28]], %[[VAL_27]] : index -// CHECK: %[[VAL_31:.*]] = cmpi eq, %[[VAL_29]], %[[VAL_27]] : index +// CHECK: ^bb0(%[[VAL_24:.*]]: index, %[[VAL_25:.*]]: index): +// CHECK: %[[VAL_26:.*]] = load %[[VAL_7]]{{\[}}%[[VAL_24]]] : memref +// CHECK: %[[VAL_27:.*]] = load %[[VAL_10]]{{\[}}%[[VAL_25]]] : memref +// CHECK: %[[VAL_28:.*]] = cmpi ult, %[[VAL_27]], %[[VAL_26]] : index +// CHECK: %[[VAL_29:.*]] = select %[[VAL_28]], %[[VAL_27]], %[[VAL_26]] : index +// CHECK: %[[VAL_30:.*]] = cmpi eq, %[[VAL_26]], %[[VAL_29]] : index +// CHECK: %[[VAL_31:.*]] = cmpi eq, %[[VAL_27]], %[[VAL_29]] : index // CHECK: %[[VAL_32:.*]] = and %[[VAL_30]], %[[VAL_31]] : i1 // CHECK: scf.if %[[VAL_32]] { -// CHECK: %[[VAL_33:.*]] = load %[[VAL_8]]{{\[}}%[[VAL_25]]] : memref +// CHECK: %[[VAL_33:.*]] = load %[[VAL_8]]{{\[}}%[[VAL_24]]] : memref // CHECK: %[[VAL_34:.*]] = mulf %[[VAL_33]], %[[VAL_2]] : f32 -// CHECK: %[[VAL_35:.*]] = load %[[VAL_11]]{{\[}}%[[VAL_26]]] : memref +// CHECK: %[[VAL_35:.*]] = load %[[VAL_11]]{{\[}}%[[VAL_25]]] : 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: store %[[VAL_37]], %[[VAL_13]]{{\[}}%[[VAL_29]]] : memref<16xf32> // CHECK: } else { -// CHECK: %[[VAL_38:.*]] = cmpi eq, %[[VAL_28]], %[[VAL_27]] : index +// CHECK: %[[VAL_38:.*]] = cmpi eq, %[[VAL_26]], %[[VAL_29]] : index // CHECK: scf.if %[[VAL_38]] { -// CHECK: %[[VAL_39:.*]] = load %[[VAL_8]]{{\[}}%[[VAL_25]]] : memref +// CHECK: %[[VAL_39:.*]] = load %[[VAL_8]]{{\[}}%[[VAL_24]]] : memref // CHECK: %[[VAL_40:.*]] = mulf %[[VAL_39]], %[[VAL_2]] : f32 -// CHECK: store %[[VAL_40]], %[[VAL_13]]{{\[}}%[[VAL_27]]] : memref<16xf32> +// CHECK: store %[[VAL_40]], %[[VAL_13]]{{\[}}%[[VAL_29]]] : memref<16xf32> // CHECK: } else { -// CHECK: %[[VAL_41:.*]] = cmpi eq, %[[VAL_29]], %[[VAL_27]] : index +// CHECK: %[[VAL_41:.*]] = cmpi eq, %[[VAL_27]], %[[VAL_29]] : index // CHECK: scf.if %[[VAL_41]] { -// CHECK: %[[VAL_42:.*]] = load %[[VAL_11]]{{\[}}%[[VAL_26]]] : memref +// CHECK: %[[VAL_42:.*]] = load %[[VAL_11]]{{\[}}%[[VAL_25]]] : memref // CHECK: %[[VAL_43:.*]] = mulf %[[VAL_42]], %[[VAL_2]] : f32 -// CHECK: store %[[VAL_43]], %[[VAL_13]]{{\[}}%[[VAL_27]]] : memref<16xf32> +// CHECK: store %[[VAL_43]], %[[VAL_13]]{{\[}}%[[VAL_29]]] : memref<16xf32> // CHECK: } else { // CHECK: } // CHECK: } // CHECK: } -// CHECK: %[[VAL_44:.*]] = cmpi eq, %[[VAL_28]], %[[VAL_27]] : index -// CHECK: %[[VAL_45:.*]] = addi %[[VAL_25]], %[[VAL_5]] : 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_5]] : index -// CHECK: %[[VAL_49:.*]] = select %[[VAL_47]], %[[VAL_48]], %[[VAL_26]] : index -// CHECK: %[[VAL_50:.*]] = addi %[[VAL_27]], %[[VAL_5]] : index -// CHECK: scf.yield %[[VAL_46]], %[[VAL_49]], %[[VAL_50]] : index, index, index +// CHECK: %[[VAL_44:.*]] = cmpi eq, %[[VAL_26]], %[[VAL_29]] : index +// CHECK: %[[VAL_45:.*]] = addi %[[VAL_24]], %[[VAL_5]] : index +// CHECK: %[[VAL_46:.*]] = select %[[VAL_44]], %[[VAL_45]], %[[VAL_24]] : index +// CHECK: %[[VAL_47:.*]] = cmpi eq, %[[VAL_27]], %[[VAL_29]] : index +// CHECK: %[[VAL_48:.*]] = addi %[[VAL_25]], %[[VAL_5]] : index +// CHECK: %[[VAL_49:.*]] = select %[[VAL_47]], %[[VAL_48]], %[[VAL_25]] : index +// CHECK: scf.yield %[[VAL_46]], %[[VAL_49]] : index, index // CHECK: } -// CHECK: scf.for %[[VAL_51:.*]] = %[[VAL_52:.*]]#0 to %[[VAL_15]] step %[[VAL_5]] { -// CHECK: %[[VAL_53:.*]] = load %[[VAL_8]]{{\[}}%[[VAL_51]]] : memref +// CHECK: scf.for %[[VAL_50:.*]] = %[[VAL_51:.*]]#0 to %[[VAL_15]] step %[[VAL_5]] { +// CHECK: %[[VAL_52:.*]] = load %[[VAL_7]]{{\[}}%[[VAL_50]]] : memref +// CHECK: %[[VAL_53:.*]] = load %[[VAL_8]]{{\[}}%[[VAL_50]]] : memref // CHECK: %[[VAL_54:.*]] = mulf %[[VAL_53]], %[[VAL_2]] : f32 -// CHECK: store %[[VAL_54]], %[[VAL_13]]{{\[}}%[[VAL_52]]#2] : memref<16xf32> +// CHECK: store %[[VAL_54]], %[[VAL_13]]{{\[}}%[[VAL_52]]] : memref<16xf32> // CHECK: } // CHECK: scf.for %[[VAL_55:.*]] = %[[VAL_56:.*]]#1 to %[[VAL_17]] step %[[VAL_5]] { // CHECK: %[[VAL_57:.*]] = load %[[VAL_10]]{{\[}}%[[VAL_55]]] : memref @@ -805,53 +807,55 @@ func @two_way_inv(%arga: tensor<16xf32>, %argb: tensor<16xf32>, %argc: f32, %arg // CHECK: %[[VAL_15:.*]] = load %[[VAL_6]]{{\[}}%[[VAL_5]]] : memref // CHECK: %[[VAL_16:.*]] = load %[[VAL_9]]{{\[}}%[[VAL_4]]] : memref // CHECK: %[[VAL_17:.*]] = load %[[VAL_9]]{{\[}}%[[VAL_5]]] : memref -// CHECK: %[[VAL_18:.*]]:3 = scf.while (%[[VAL_19:.*]] = %[[VAL_14]], %[[VAL_20:.*]] = %[[VAL_16]], %[[VAL_21:.*]] = %[[VAL_4]]) : (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: %[[VAL_18:.*]]:2 = scf.while (%[[VAL_19:.*]] = %[[VAL_14]], %[[VAL_20:.*]] = %[[VAL_16]]) : (index, index) -> (index, index) { +// CHECK: %[[VAL_21:.*]] = cmpi ult, %[[VAL_19]], %[[VAL_15]] : index +// CHECK: %[[VAL_22:.*]] = cmpi ult, %[[VAL_20]], %[[VAL_17]] : index +// CHECK: %[[VAL_23:.*]] = and %[[VAL_21]], %[[VAL_22]] : i1 +// CHECK: scf.condition(%[[VAL_23]]) %[[VAL_19]], %[[VAL_20]] : index, index // CHECK: } do { -// CHECK: ^bb0(%[[VAL_25:.*]]: index, %[[VAL_26:.*]]: index, %[[VAL_27:.*]]: index): -// CHECK: %[[VAL_28:.*]] = load %[[VAL_7]]{{\[}}%[[VAL_25]]] : memref -// CHECK: %[[VAL_29:.*]] = load %[[VAL_10]]{{\[}}%[[VAL_26]]] : memref -// CHECK: %[[VAL_30:.*]] = cmpi eq, %[[VAL_28]], %[[VAL_27]] : index -// CHECK: %[[VAL_31:.*]] = cmpi eq, %[[VAL_29]], %[[VAL_27]] : index +// CHECK: ^bb0(%[[VAL_24:.*]]: index, %[[VAL_25:.*]]: index): +// CHECK: %[[VAL_26:.*]] = load %[[VAL_7]]{{\[}}%[[VAL_24]]] : memref +// CHECK: %[[VAL_27:.*]] = load %[[VAL_10]]{{\[}}%[[VAL_25]]] : memref +// CHECK: %[[VAL_28:.*]] = cmpi ult, %[[VAL_27]], %[[VAL_26]] : index +// CHECK: %[[VAL_29:.*]] = select %[[VAL_28]], %[[VAL_27]], %[[VAL_26]] : index +// CHECK: %[[VAL_30:.*]] = cmpi eq, %[[VAL_26]], %[[VAL_29]] : index +// CHECK: %[[VAL_31:.*]] = cmpi eq, %[[VAL_27]], %[[VAL_29]] : index // CHECK: %[[VAL_32:.*]] = and %[[VAL_30]], %[[VAL_31]] : i1 // CHECK: scf.if %[[VAL_32]] { -// CHECK: %[[VAL_33:.*]] = load %[[VAL_8]]{{\[}}%[[VAL_25]]] : memref -// CHECK: %[[VAL_34:.*]] = load %[[VAL_11]]{{\[}}%[[VAL_26]]] : memref +// CHECK: %[[VAL_33:.*]] = load %[[VAL_8]]{{\[}}%[[VAL_24]]] : memref +// CHECK: %[[VAL_34:.*]] = load %[[VAL_11]]{{\[}}%[[VAL_25]]] : 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: store %[[VAL_36]], %[[VAL_13]]{{\[}}%[[VAL_29]]] : memref<16xf32> // CHECK: } else { -// CHECK: %[[VAL_37:.*]] = cmpi eq, %[[VAL_28]], %[[VAL_27]] : index +// CHECK: %[[VAL_37:.*]] = cmpi eq, %[[VAL_26]], %[[VAL_29]] : index // CHECK: scf.if %[[VAL_37]] { -// CHECK: %[[VAL_38:.*]] = load %[[VAL_8]]{{\[}}%[[VAL_25]]] : memref +// CHECK: %[[VAL_38:.*]] = load %[[VAL_8]]{{\[}}%[[VAL_24]]] : memref // CHECK: %[[VAL_39:.*]] = mulf %[[VAL_38]], %[[VAL_2]] : f32 -// CHECK: store %[[VAL_39]], %[[VAL_13]]{{\[}}%[[VAL_27]]] : memref<16xf32> +// CHECK: store %[[VAL_39]], %[[VAL_13]]{{\[}}%[[VAL_29]]] : memref<16xf32> // CHECK: } else { -// CHECK: %[[VAL_40:.*]] = cmpi eq, %[[VAL_29]], %[[VAL_27]] : index +// CHECK: %[[VAL_40:.*]] = cmpi eq, %[[VAL_27]], %[[VAL_29]] : index // CHECK: scf.if %[[VAL_40]] { -// CHECK: %[[VAL_41:.*]] = load %[[VAL_11]]{{\[}}%[[VAL_26]]] : memref +// CHECK: %[[VAL_41:.*]] = load %[[VAL_11]]{{\[}}%[[VAL_25]]] : memref // CHECK: %[[VAL_42:.*]] = mulf %[[VAL_41]], %[[VAL_2]] : f32 -// CHECK: store %[[VAL_42]], %[[VAL_13]]{{\[}}%[[VAL_27]]] : memref<16xf32> +// CHECK: store %[[VAL_42]], %[[VAL_13]]{{\[}}%[[VAL_29]]] : memref<16xf32> // CHECK: } else { // CHECK: } // CHECK: } // CHECK: } -// CHECK: %[[VAL_43:.*]] = cmpi eq, %[[VAL_28]], %[[VAL_27]] : index -// CHECK: %[[VAL_44:.*]] = addi %[[VAL_25]], %[[VAL_5]] : 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_5]] : index -// CHECK: %[[VAL_48:.*]] = select %[[VAL_46]], %[[VAL_47]], %[[VAL_26]] : index -// CHECK: %[[VAL_49:.*]] = addi %[[VAL_27]], %[[VAL_5]] : index -// CHECK: scf.yield %[[VAL_45]], %[[VAL_48]], %[[VAL_49]] : index, index, index +// CHECK: %[[VAL_43:.*]] = cmpi eq, %[[VAL_26]], %[[VAL_29]] : 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_27]], %[[VAL_29]] : index +// CHECK: %[[VAL_47:.*]] = addi %[[VAL_25]], %[[VAL_5]] : index +// CHECK: %[[VAL_48:.*]] = select %[[VAL_46]], %[[VAL_47]], %[[VAL_25]] : index +// CHECK: scf.yield %[[VAL_45]], %[[VAL_48]] : index, index // CHECK: } -// CHECK: scf.for %[[VAL_50:.*]] = %[[VAL_51:.*]]#0 to %[[VAL_15]] step %[[VAL_5]] { -// CHECK: %[[VAL_52:.*]] = load %[[VAL_8]]{{\[}}%[[VAL_50]]] : memref +// CHECK: scf.for %[[VAL_49:.*]] = %[[VAL_50:.*]]#0 to %[[VAL_15]] step %[[VAL_5]] { +// CHECK: %[[VAL_51:.*]] = load %[[VAL_7]]{{\[}}%[[VAL_49]]] : memref +// CHECK: %[[VAL_52:.*]] = load %[[VAL_8]]{{\[}}%[[VAL_49]]] : memref // CHECK: %[[VAL_53:.*]] = mulf %[[VAL_52]], %[[VAL_2]] : f32 -// CHECK: store %[[VAL_53]], %[[VAL_13]]{{\[}}%[[VAL_51]]#2] : memref<16xf32> +// CHECK: store %[[VAL_53]], %[[VAL_13]]{{\[}}%[[VAL_51]]] : memref<16xf32> // CHECK: } // CHECK: scf.for %[[VAL_54:.*]] = %[[VAL_55:.*]]#1 to %[[VAL_17]] step %[[VAL_5]] { // CHECK: %[[VAL_56:.*]] = load %[[VAL_10]]{{\[}}%[[VAL_54]]] : memref @@ -956,66 +960,67 @@ func @sum_reduction(%arga: tensor, %argx: tensor) -> tensor { // CHECK: %[[VAL_14:.*]] = load %[[VAL_5]]{{\[}}%[[VAL_4]]] : memref // CHECK: %[[VAL_15:.*]] = load %[[VAL_8]]{{\[}}%[[VAL_3]]] : memref // CHECK: %[[VAL_16:.*]] = load %[[VAL_8]]{{\[}}%[[VAL_4]]] : memref -// CHECK: %[[VAL_17:.*]]:3 = scf.while (%[[VAL_18:.*]] = %[[VAL_13]], %[[VAL_19:.*]] = %[[VAL_15]], %[[VAL_20:.*]] = %[[VAL_3]]) : (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: %[[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_24:.*]]: index, %[[VAL_25:.*]]: index, %[[VAL_26:.*]]: index): -// CHECK: %[[VAL_27:.*]] = load %[[VAL_6]]{{\[}}%[[VAL_24]]] : memref -// CHECK: %[[VAL_28:.*]] = load %[[VAL_9]]{{\[}}%[[VAL_25]]] : memref -// CHECK: %[[VAL_29:.*]] = cmpi eq, %[[VAL_27]], %[[VAL_26]] : index -// CHECK: %[[VAL_30:.*]] = cmpi eq, %[[VAL_28]], %[[VAL_26]] : index +// CHECK: ^bb0(%[[VAL_23:.*]]: index, %[[VAL_24:.*]]: index): +// CHECK: %[[VAL_25:.*]] = load %[[VAL_6]]{{\[}}%[[VAL_23]]] : memref +// CHECK: %[[VAL_26:.*]] = load %[[VAL_9]]{{\[}}%[[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_12]][] : memref -// CHECK: %[[VAL_33:.*]] = load %[[VAL_7]]{{\[}}%[[VAL_24]]] : memref -// CHECK: %[[VAL_34:.*]] = load %[[VAL_10]]{{\[}}%[[VAL_25]]] : memref +// CHECK: %[[VAL_33:.*]] = load %[[VAL_7]]{{\[}}%[[VAL_23]]] : memref +// CHECK: %[[VAL_34:.*]] = load %[[VAL_10]]{{\[}}%[[VAL_24]]] : memref // CHECK: %[[VAL_35:.*]] = addf %[[VAL_33]], %[[VAL_34]] : f32 // CHECK: %[[VAL_36:.*]] = addf %[[VAL_32]], %[[VAL_35]] : f32 // CHECK: store %[[VAL_36]], %[[VAL_12]][] : memref // CHECK: } else { -// CHECK: %[[VAL_37:.*]] = cmpi eq, %[[VAL_27]], %[[VAL_26]] : index +// CHECK: %[[VAL_37:.*]] = cmpi eq, %[[VAL_25]], %[[VAL_28]] : index // CHECK: scf.if %[[VAL_37]] { // CHECK: %[[VAL_38:.*]] = load %[[VAL_12]][] : memref -// CHECK: %[[VAL_39:.*]] = load %[[VAL_7]]{{\[}}%[[VAL_24]]] : memref +// CHECK: %[[VAL_39:.*]] = load %[[VAL_7]]{{\[}}%[[VAL_23]]] : memref // CHECK: %[[VAL_40:.*]] = addf %[[VAL_38]], %[[VAL_39]] : f32 // CHECK: store %[[VAL_40]], %[[VAL_12]][] : memref // CHECK: } else { -// CHECK: %[[VAL_41:.*]] = cmpi eq, %[[VAL_28]], %[[VAL_26]] : index +// CHECK: %[[VAL_41:.*]] = cmpi eq, %[[VAL_26]], %[[VAL_28]] : index // CHECK: scf.if %[[VAL_41]] { // CHECK: %[[VAL_42:.*]] = load %[[VAL_12]][] : memref -// CHECK: %[[VAL_43:.*]] = load %[[VAL_10]]{{\[}}%[[VAL_25]]] : memref +// CHECK: %[[VAL_43:.*]] = load %[[VAL_10]]{{\[}}%[[VAL_24]]] : memref // CHECK: %[[VAL_44:.*]] = addf %[[VAL_42]], %[[VAL_43]] : f32 // CHECK: store %[[VAL_44]], %[[VAL_12]][] : memref // CHECK: } else { // CHECK: } // CHECK: } // CHECK: } -// CHECK: %[[VAL_45:.*]] = cmpi eq, %[[VAL_27]], %[[VAL_26]] : index -// CHECK: %[[VAL_46:.*]] = addi %[[VAL_24]], %[[VAL_4]] : index -// CHECK: %[[VAL_47:.*]] = select %[[VAL_45]], %[[VAL_46]], %[[VAL_24]] : index -// CHECK: %[[VAL_48:.*]] = cmpi eq, %[[VAL_28]], %[[VAL_26]] : index -// CHECK: %[[VAL_49:.*]] = addi %[[VAL_25]], %[[VAL_4]] : index -// CHECK: %[[VAL_50:.*]] = select %[[VAL_48]], %[[VAL_49]], %[[VAL_25]] : index -// CHECK: %[[VAL_51:.*]] = addi %[[VAL_26]], %[[VAL_4]] : index -// CHECK: scf.yield %[[VAL_47]], %[[VAL_50]], %[[VAL_51]] : index, index, index +// CHECK: %[[VAL_45:.*]] = cmpi eq, %[[VAL_25]], %[[VAL_28]] : index +// CHECK: %[[VAL_46:.*]] = addi %[[VAL_23]], %[[VAL_4]] : index +// CHECK: %[[VAL_47:.*]] = select %[[VAL_45]], %[[VAL_46]], %[[VAL_23]] : index +// CHECK: %[[VAL_48:.*]] = cmpi eq, %[[VAL_26]], %[[VAL_28]] : index +// CHECK: %[[VAL_49:.*]] = addi %[[VAL_24]], %[[VAL_4]] : index +// CHECK: %[[VAL_50:.*]] = select %[[VAL_48]], %[[VAL_49]], %[[VAL_24]] : index +// CHECK: scf.yield %[[VAL_47]], %[[VAL_50]] : index, index // CHECK: } -// CHECK: %[[VAL_52:.*]] = load %[[VAL_12]][] : memref -// CHECK: %[[VAL_53:.*]] = scf.for %[[VAL_54:.*]] = %[[VAL_55:.*]]#0 to %[[VAL_14]] step %[[VAL_4]] iter_args(%[[VAL_56:.*]] = %[[VAL_52]]) -> (f32) { -// CHECK: %[[VAL_57:.*]] = load %[[VAL_7]]{{\[}}%[[VAL_54]]] : memref -// CHECK: %[[VAL_58:.*]] = addf %[[VAL_56]], %[[VAL_57]] : f32 -// CHECK: scf.yield %[[VAL_58]] : f32 +// CHECK: %[[VAL_51:.*]] = load %[[VAL_12]][] : memref +// CHECK: %[[VAL_52:.*]] = scf.for %[[VAL_53:.*]] = %[[VAL_54:.*]]#0 to %[[VAL_14]] step %[[VAL_4]] iter_args(%[[VAL_55:.*]] = %[[VAL_51]]) -> (f32) { +// CHECK: %[[VAL_56:.*]] = load %[[VAL_7]]{{\[}}%[[VAL_53]]] : memref +// CHECK: %[[VAL_57:.*]] = addf %[[VAL_55]], %[[VAL_56]] : f32 +// CHECK: scf.yield %[[VAL_57]] : f32 // CHECK: } -// CHECK: %[[VAL_59:.*]] = scf.for %[[VAL_60:.*]] = %[[VAL_61:.*]]#1 to %[[VAL_16]] step %[[VAL_4]] iter_args(%[[VAL_62:.*]] = %[[VAL_63:.*]]) -> (f32) { -// CHECK: %[[VAL_64:.*]] = load %[[VAL_10]]{{\[}}%[[VAL_60]]] : memref -// CHECK: %[[VAL_65:.*]] = addf %[[VAL_62]], %[[VAL_64]] : f32 -// CHECK: scf.yield %[[VAL_65]] : f32 +// CHECK: %[[VAL_58:.*]] = scf.for %[[VAL_59:.*]] = %[[VAL_60:.*]]#1 to %[[VAL_16]] step %[[VAL_4]] iter_args(%[[VAL_61:.*]] = %[[VAL_62:.*]]) -> (f32) { +// CHECK: %[[VAL_63:.*]] = load %[[VAL_10]]{{\[}}%[[VAL_59]]] : memref +// CHECK: %[[VAL_64:.*]] = addf %[[VAL_61]], %[[VAL_63]] : f32 +// CHECK: scf.yield %[[VAL_64]] : f32 // CHECK: } -// CHECK: store %[[VAL_66:.*]], %[[VAL_12]][] : memref -// CHECK: %[[VAL_67:.*]] = tensor_load %[[VAL_12]] : memref -// CHECK: return %[[VAL_67]] : tensor +// CHECK: store %[[VAL_65:.*]], %[[VAL_12]][] : memref +// CHECK: %[[VAL_66:.*]] = tensor_load %[[VAL_12]] : memref +// CHECK: return %[[VAL_66]] : tensor // CHECK: } func @sum_reduction_ss(%arga: tensor<16xf32>, %argb: tensor<16xf32>, @@ -1072,69 +1077,70 @@ func @sum_reduction_ss(%arga: tensor<16xf32>, // CHECK: %[[VAL_17:.*]] = load %[[VAL_6]]{{\[}}%[[VAL_5]]] : memref // CHECK: %[[VAL_18:.*]] = load %[[VAL_10]]{{\[}}%[[VAL_4]]] : memref // CHECK: %[[VAL_19:.*]] = load %[[VAL_10]]{{\[}}%[[VAL_5]]] : memref -// CHECK: %[[VAL_20:.*]]:3 = scf.while (%[[VAL_21:.*]] = %[[VAL_16]], %[[VAL_22:.*]] = %[[VAL_18]], %[[VAL_23:.*]] = %[[VAL_4]]) : (index, index, index) -> (index, index, index) { -// CHECK: %[[VAL_24:.*]] = cmpi ult, %[[VAL_21]], %[[VAL_17]] : index -// CHECK: %[[VAL_25:.*]] = cmpi ult, %[[VAL_22]], %[[VAL_19]] : index -// CHECK: %[[VAL_26:.*]] = and %[[VAL_24]], %[[VAL_25]] : i1 -// CHECK: scf.condition(%[[VAL_26]]) %[[VAL_21]], %[[VAL_22]], %[[VAL_23]] : index, index, index +// 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: } do { -// CHECK: ^bb0(%[[VAL_27:.*]]: index, %[[VAL_28:.*]]: index, %[[VAL_29:.*]]: index): -// CHECK: %[[VAL_30:.*]] = load %[[VAL_7]]{{\[}}%[[VAL_27]]] : memref -// CHECK: %[[VAL_31:.*]] = load %[[VAL_11]]{{\[}}%[[VAL_28]]] : memref -// CHECK: %[[VAL_32:.*]] = cmpi eq, %[[VAL_30]], %[[VAL_29]] : index -// CHECK: %[[VAL_33:.*]] = cmpi eq, %[[VAL_31]], %[[VAL_29]] : index +// CHECK: ^bb0(%[[VAL_26:.*]]: index, %[[VAL_27:.*]]: index): +// CHECK: %[[VAL_28:.*]] = load %[[VAL_7]]{{\[}}%[[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_14]][] : memref -// CHECK: %[[VAL_36:.*]] = load %[[VAL_8]]{{\[}}%[[VAL_27]]] : memref +// CHECK: %[[VAL_36:.*]] = load %[[VAL_8]]{{\[}}%[[VAL_26]]] : memref // CHECK: %[[VAL_37:.*]] = mulf %[[VAL_36]], %[[VAL_15]] : f32 -// CHECK: %[[VAL_38:.*]] = load %[[VAL_12]]{{\[}}%[[VAL_28]]] : memref +// CHECK: %[[VAL_38:.*]] = load %[[VAL_12]]{{\[}}%[[VAL_27]]] : memref // CHECK: %[[VAL_39:.*]] = addf %[[VAL_37]], %[[VAL_38]] : f32 // CHECK: %[[VAL_40:.*]] = addf %[[VAL_35]], %[[VAL_39]] : f32 // CHECK: store %[[VAL_40]], %[[VAL_14]][] : memref // CHECK: } else { -// CHECK: %[[VAL_41:.*]] = cmpi eq, %[[VAL_30]], %[[VAL_29]] : index +// CHECK: %[[VAL_41:.*]] = cmpi eq, %[[VAL_28]], %[[VAL_31]] : index // CHECK: scf.if %[[VAL_41]] { // CHECK: %[[VAL_42:.*]] = load %[[VAL_14]][] : memref -// CHECK: %[[VAL_43:.*]] = load %[[VAL_8]]{{\[}}%[[VAL_27]]] : memref +// CHECK: %[[VAL_43:.*]] = load %[[VAL_8]]{{\[}}%[[VAL_26]]] : memref // CHECK: %[[VAL_44:.*]] = mulf %[[VAL_43]], %[[VAL_15]] : f32 // CHECK: %[[VAL_45:.*]] = addf %[[VAL_42]], %[[VAL_44]] : f32 // CHECK: store %[[VAL_45]], %[[VAL_14]][] : memref // CHECK: } else { -// CHECK: %[[VAL_46:.*]] = cmpi eq, %[[VAL_31]], %[[VAL_29]] : index +// CHECK: %[[VAL_46:.*]] = cmpi eq, %[[VAL_29]], %[[VAL_31]] : index // CHECK: scf.if %[[VAL_46]] { // CHECK: %[[VAL_47:.*]] = load %[[VAL_14]][] : memref -// CHECK: %[[VAL_48:.*]] = load %[[VAL_12]]{{\[}}%[[VAL_28]]] : memref +// CHECK: %[[VAL_48:.*]] = load %[[VAL_12]]{{\[}}%[[VAL_27]]] : memref // CHECK: %[[VAL_49:.*]] = addf %[[VAL_47]], %[[VAL_48]] : f32 // CHECK: store %[[VAL_49]], %[[VAL_14]][] : memref // CHECK: } else { // CHECK: } // CHECK: } // CHECK: } -// CHECK: %[[VAL_50:.*]] = cmpi eq, %[[VAL_30]], %[[VAL_29]] : index -// CHECK: %[[VAL_51:.*]] = addi %[[VAL_27]], %[[VAL_5]] : index -// CHECK: %[[VAL_52:.*]] = select %[[VAL_50]], %[[VAL_51]], %[[VAL_27]] : index -// CHECK: %[[VAL_53:.*]] = cmpi eq, %[[VAL_31]], %[[VAL_29]] : index -// CHECK: %[[VAL_54:.*]] = addi %[[VAL_28]], %[[VAL_5]] : index -// CHECK: %[[VAL_55:.*]] = select %[[VAL_53]], %[[VAL_54]], %[[VAL_28]] : index -// CHECK: %[[VAL_56:.*]] = addi %[[VAL_29]], %[[VAL_5]] : index -// CHECK: scf.yield %[[VAL_52]], %[[VAL_55]], %[[VAL_56]] : index, index, index +// CHECK: %[[VAL_50:.*]] = cmpi eq, %[[VAL_28]], %[[VAL_31]] : index +// CHECK: %[[VAL_51:.*]] = addi %[[VAL_26]], %[[VAL_5]] : index +// CHECK: %[[VAL_52:.*]] = select %[[VAL_50]], %[[VAL_51]], %[[VAL_26]] : index +// CHECK: %[[VAL_53:.*]] = cmpi eq, %[[VAL_29]], %[[VAL_31]] : index +// CHECK: %[[VAL_54:.*]] = addi %[[VAL_27]], %[[VAL_5]] : index +// CHECK: %[[VAL_55:.*]] = select %[[VAL_53]], %[[VAL_54]], %[[VAL_27]] : index +// CHECK: scf.yield %[[VAL_52]], %[[VAL_55]] : index, index // CHECK: } -// CHECK: %[[VAL_57:.*]] = load %[[VAL_14]][] : memref -// CHECK: %[[VAL_58:.*]] = scf.for %[[VAL_59:.*]] = %[[VAL_60:.*]]#0 to %[[VAL_17]] step %[[VAL_5]] iter_args(%[[VAL_61:.*]] = %[[VAL_57]]) -> (f32) { -// CHECK: %[[VAL_62:.*]] = load %[[VAL_8]]{{\[}}%[[VAL_59]]] : memref -// CHECK: %[[VAL_63:.*]] = mulf %[[VAL_62]], %[[VAL_15]] : f32 -// CHECK: %[[VAL_64:.*]] = addf %[[VAL_61]], %[[VAL_63]] : f32 -// CHECK: scf.yield %[[VAL_64]] : f32 +// CHECK: %[[VAL_56:.*]] = load %[[VAL_14]][] : memref +// CHECK: %[[VAL_57:.*]] = scf.for %[[VAL_58:.*]] = %[[VAL_59:.*]]#0 to %[[VAL_17]] step %[[VAL_5]] iter_args(%[[VAL_60:.*]] = %[[VAL_56]]) -> (f32) { +// CHECK: %[[VAL_61:.*]] = load %[[VAL_8]]{{\[}}%[[VAL_58]]] : memref +// CHECK: %[[VAL_62:.*]] = mulf %[[VAL_61]], %[[VAL_15]] : f32 +// CHECK: %[[VAL_63:.*]] = addf %[[VAL_60]], %[[VAL_62]] : f32 +// CHECK: scf.yield %[[VAL_63]] : f32 // CHECK: } -// CHECK: %[[VAL_65:.*]] = scf.for %[[VAL_66:.*]] = %[[VAL_67:.*]]#1 to %[[VAL_19]] step %[[VAL_5]] iter_args(%[[VAL_68:.*]] = %[[VAL_69:.*]]) -> (f32) { -// CHECK: %[[VAL_70:.*]] = load %[[VAL_12]]{{\[}}%[[VAL_66]]] : memref -// CHECK: %[[VAL_71:.*]] = addf %[[VAL_68]], %[[VAL_70]] : f32 -// CHECK: scf.yield %[[VAL_71]] : f32 +// CHECK: %[[VAL_64:.*]] = scf.for %[[VAL_65:.*]] = %[[VAL_66:.*]]#1 to %[[VAL_19]] step %[[VAL_5]] iter_args(%[[VAL_67:.*]] = %[[VAL_68:.*]]) -> (f32) { +// CHECK: %[[VAL_69:.*]] = load %[[VAL_12]]{{\[}}%[[VAL_65]]] : memref +// CHECK: %[[VAL_70:.*]] = addf %[[VAL_67]], %[[VAL_69]] : f32 +// CHECK: scf.yield %[[VAL_70]] : f32 // CHECK: } -// CHECK: store %[[VAL_72:.*]], %[[VAL_14]][] : memref -// CHECK: %[[VAL_73:.*]] = tensor_load %[[VAL_14]] : memref -// CHECK: return %[[VAL_73]] : tensor +// CHECK: store %[[VAL_71:.*]], %[[VAL_14]][] : memref +// CHECK: %[[VAL_72:.*]] = tensor_load %[[VAL_14]] : memref +// CHECK: return %[[VAL_72]] : tensor // CHECK: } func @sum_reduction_inv(%arga: tensor<16xf32>, %argb: tensor, diff --git a/mlir/test/Dialect/Linalg/sparse_2d.mlir b/mlir/test/Dialect/Linalg/sparse_2d.mlir index 55beeeb..d560e04 100644 --- a/mlir/test/Dialect/Linalg/sparse_2d.mlir +++ b/mlir/test/Dialect/Linalg/sparse_2d.mlir @@ -1346,101 +1346,105 @@ func @sampled_dense_dense(%args: tensor, // CHECK: %[[VAL_43:.*]] = load %[[VAL_17]]{{\[}}%[[VAL_33]]] : memref // CHECK: %[[VAL_44:.*]] = addi %[[VAL_33]], %[[VAL_8]] : index // CHECK: %[[VAL_45:.*]] = load %[[VAL_17]]{{\[}}%[[VAL_44]]] : memref -// CHECK: %[[VAL_46:.*]]:4 = scf.while (%[[VAL_47:.*]] = %[[VAL_37]], %[[VAL_48:.*]] = %[[VAL_40]], %[[VAL_49:.*]] = %[[VAL_43]], %[[VAL_50:.*]] = %[[VAL_6]]) : (index, index, index, index) -> (index, index, index, index) { -// CHECK: %[[VAL_51:.*]] = cmpi ult, %[[VAL_47]], %[[VAL_39]] : index -// CHECK: %[[VAL_52:.*]] = cmpi ult, %[[VAL_48]], %[[VAL_42]] : index -// CHECK: %[[VAL_53:.*]] = and %[[VAL_51]], %[[VAL_52]] : i1 -// CHECK: %[[VAL_54:.*]] = cmpi ult, %[[VAL_49]], %[[VAL_45]] : index -// CHECK: %[[VAL_55:.*]] = and %[[VAL_53]], %[[VAL_54]] : i1 -// CHECK: scf.condition(%[[VAL_55]]) %[[VAL_47]], %[[VAL_48]], %[[VAL_49]], %[[VAL_50]] : index, index, index, index +// CHECK: %[[VAL_46:.*]]:3 = scf.while (%[[VAL_47:.*]] = %[[VAL_37]], %[[VAL_48:.*]] = %[[VAL_40]], %[[VAL_49:.*]] = %[[VAL_43]]) : (index, index, index) -> (index, index, index) { +// CHECK: %[[VAL_50:.*]] = cmpi ult, %[[VAL_47]], %[[VAL_39]] : index +// CHECK: %[[VAL_51:.*]] = cmpi ult, %[[VAL_48]], %[[VAL_42]] : index +// CHECK: %[[VAL_52:.*]] = and %[[VAL_50]], %[[VAL_51]] : i1 +// CHECK: %[[VAL_53:.*]] = cmpi ult, %[[VAL_49]], %[[VAL_45]] : index +// CHECK: %[[VAL_54:.*]] = and %[[VAL_52]], %[[VAL_53]] : i1 +// CHECK: scf.condition(%[[VAL_54]]) %[[VAL_47]], %[[VAL_48]], %[[VAL_49]] : index, index, index // CHECK: } do { -// CHECK: ^bb0(%[[VAL_56:.*]]: index, %[[VAL_57:.*]]: index, %[[VAL_58:.*]]: index, %[[VAL_59:.*]]: index): -// CHECK: %[[VAL_60:.*]] = load %[[VAL_12]]{{\[}}%[[VAL_56]]] : memref -// CHECK: %[[VAL_61:.*]] = load %[[VAL_15]]{{\[}}%[[VAL_57]]] : memref -// CHECK: %[[VAL_62:.*]] = load %[[VAL_18]]{{\[}}%[[VAL_58]]] : memref -// CHECK: %[[VAL_63:.*]] = cmpi eq, %[[VAL_60]], %[[VAL_59]] : index -// CHECK: %[[VAL_64:.*]] = cmpi eq, %[[VAL_61]], %[[VAL_59]] : index -// CHECK: %[[VAL_65:.*]] = and %[[VAL_63]], %[[VAL_64]] : i1 -// CHECK: %[[VAL_66:.*]] = cmpi eq, %[[VAL_62]], %[[VAL_59]] : index +// CHECK: ^bb0(%[[VAL_55:.*]]: index, %[[VAL_56:.*]]: index, %[[VAL_57:.*]]: index): +// CHECK: %[[VAL_58:.*]] = load %[[VAL_12]]{{\[}}%[[VAL_55]]] : memref +// CHECK: %[[VAL_59:.*]] = load %[[VAL_15]]{{\[}}%[[VAL_56]]] : memref +// CHECK: %[[VAL_60:.*]] = cmpi ult, %[[VAL_59]], %[[VAL_58]] : index +// CHECK: %[[VAL_61:.*]] = select %[[VAL_60]], %[[VAL_59]], %[[VAL_58]] : index +// CHECK: %[[VAL_62:.*]] = load %[[VAL_18]]{{\[}}%[[VAL_57]]] : memref +// CHECK: %[[VAL_63:.*]] = cmpi ult, %[[VAL_62]], %[[VAL_61]] : index +// CHECK: %[[VAL_64:.*]] = select %[[VAL_63]], %[[VAL_62]], %[[VAL_61]] : index +// CHECK: %[[VAL_65:.*]] = cmpi eq, %[[VAL_58]], %[[VAL_64]] : index +// CHECK: %[[VAL_66:.*]] = cmpi eq, %[[VAL_59]], %[[VAL_64]] : index // CHECK: %[[VAL_67:.*]] = and %[[VAL_65]], %[[VAL_66]] : i1 -// CHECK: scf.if %[[VAL_67]] { -// CHECK: %[[VAL_68:.*]] = load %[[VAL_24]]{{\[}}%[[VAL_33]]] : memref -// CHECK: %[[VAL_69:.*]] = load %[[VAL_13]]{{\[}}%[[VAL_56]]] : memref -// CHECK: %[[VAL_70:.*]] = load %[[VAL_16]]{{\[}}%[[VAL_57]]] : memref -// CHECK: %[[VAL_71:.*]] = mulf %[[VAL_69]], %[[VAL_70]] : f32 -// CHECK: %[[VAL_72:.*]] = mulf %[[VAL_71]], %[[VAL_36]] : f32 -// CHECK: %[[VAL_73:.*]] = mulf %[[VAL_72]], %[[VAL_25]] : f32 -// CHECK: %[[VAL_74:.*]] = load %[[VAL_19]]{{\[}}%[[VAL_58]]] : memref -// CHECK: %[[VAL_75:.*]] = addf %[[VAL_73]], %[[VAL_74]] : f32 -// CHECK: %[[VAL_76:.*]] = addf %[[VAL_68]], %[[VAL_75]] : f32 -// CHECK: store %[[VAL_76]], %[[VAL_24]]{{\[}}%[[VAL_33]]] : memref +// CHECK: %[[VAL_68:.*]] = cmpi eq, %[[VAL_62]], %[[VAL_64]] : index +// CHECK: %[[VAL_69:.*]] = and %[[VAL_67]], %[[VAL_68]] : i1 +// CHECK: scf.if %[[VAL_69]] { +// CHECK: %[[VAL_70:.*]] = load %[[VAL_24]]{{\[}}%[[VAL_33]]] : memref +// CHECK: %[[VAL_71:.*]] = load %[[VAL_13]]{{\[}}%[[VAL_55]]] : memref +// CHECK: %[[VAL_72:.*]] = load %[[VAL_16]]{{\[}}%[[VAL_56]]] : memref +// CHECK: %[[VAL_73:.*]] = mulf %[[VAL_71]], %[[VAL_72]] : f32 +// CHECK: %[[VAL_74:.*]] = mulf %[[VAL_73]], %[[VAL_36]] : f32 +// CHECK: %[[VAL_75:.*]] = mulf %[[VAL_74]], %[[VAL_25]] : f32 +// CHECK: %[[VAL_76:.*]] = load %[[VAL_19]]{{\[}}%[[VAL_57]]] : memref +// CHECK: %[[VAL_77:.*]] = addf %[[VAL_75]], %[[VAL_76]] : f32 +// CHECK: %[[VAL_78:.*]] = addf %[[VAL_70]], %[[VAL_77]] : f32 +// CHECK: store %[[VAL_78]], %[[VAL_24]]{{\[}}%[[VAL_33]]] : memref // CHECK: } else { -// CHECK: %[[VAL_77:.*]] = cmpi eq, %[[VAL_60]], %[[VAL_59]] : index -// CHECK: %[[VAL_78:.*]] = cmpi eq, %[[VAL_61]], %[[VAL_59]] : index -// CHECK: %[[VAL_79:.*]] = and %[[VAL_77]], %[[VAL_78]] : i1 -// CHECK: scf.if %[[VAL_79]] { -// CHECK: %[[VAL_80:.*]] = load %[[VAL_24]]{{\[}}%[[VAL_33]]] : memref -// CHECK: %[[VAL_81:.*]] = load %[[VAL_13]]{{\[}}%[[VAL_56]]] : memref -// CHECK: %[[VAL_82:.*]] = load %[[VAL_16]]{{\[}}%[[VAL_57]]] : memref -// CHECK: %[[VAL_83:.*]] = mulf %[[VAL_81]], %[[VAL_82]] : f32 -// CHECK: %[[VAL_84:.*]] = mulf %[[VAL_83]], %[[VAL_36]] : f32 -// CHECK: %[[VAL_85:.*]] = mulf %[[VAL_84]], %[[VAL_25]] : f32 -// CHECK: %[[VAL_86:.*]] = addf %[[VAL_80]], %[[VAL_85]] : f32 -// CHECK: store %[[VAL_86]], %[[VAL_24]]{{\[}}%[[VAL_33]]] : memref +// CHECK: %[[VAL_79:.*]] = cmpi eq, %[[VAL_58]], %[[VAL_64]] : index +// CHECK: %[[VAL_80:.*]] = cmpi eq, %[[VAL_59]], %[[VAL_64]] : index +// CHECK: %[[VAL_81:.*]] = and %[[VAL_79]], %[[VAL_80]] : i1 +// CHECK: scf.if %[[VAL_81]] { +// CHECK: %[[VAL_82:.*]] = load %[[VAL_24]]{{\[}}%[[VAL_33]]] : memref +// CHECK: %[[VAL_83:.*]] = load %[[VAL_13]]{{\[}}%[[VAL_55]]] : memref +// CHECK: %[[VAL_84:.*]] = load %[[VAL_16]]{{\[}}%[[VAL_56]]] : memref +// CHECK: %[[VAL_85:.*]] = mulf %[[VAL_83]], %[[VAL_84]] : f32 +// CHECK: %[[VAL_86:.*]] = mulf %[[VAL_85]], %[[VAL_36]] : f32 +// CHECK: %[[VAL_87:.*]] = mulf %[[VAL_86]], %[[VAL_25]] : f32 +// CHECK: %[[VAL_88:.*]] = addf %[[VAL_82]], %[[VAL_87]] : f32 +// CHECK: store %[[VAL_88]], %[[VAL_24]]{{\[}}%[[VAL_33]]] : memref // CHECK: } else { -// CHECK: %[[VAL_87:.*]] = cmpi eq, %[[VAL_62]], %[[VAL_59]] : index -// CHECK: scf.if %[[VAL_87]] { -// CHECK: %[[VAL_88:.*]] = load %[[VAL_24]]{{\[}}%[[VAL_33]]] : memref -// CHECK: %[[VAL_89:.*]] = load %[[VAL_19]]{{\[}}%[[VAL_58]]] : memref -// CHECK: %[[VAL_90:.*]] = addf %[[VAL_88]], %[[VAL_89]] : f32 -// CHECK: store %[[VAL_90]], %[[VAL_24]]{{\[}}%[[VAL_33]]] : memref +// CHECK: %[[VAL_89:.*]] = cmpi eq, %[[VAL_62]], %[[VAL_64]] : index +// CHECK: scf.if %[[VAL_89]] { +// CHECK: %[[VAL_90:.*]] = load %[[VAL_24]]{{\[}}%[[VAL_33]]] : memref +// CHECK: %[[VAL_91:.*]] = load %[[VAL_19]]{{\[}}%[[VAL_57]]] : memref +// CHECK: %[[VAL_92:.*]] = addf %[[VAL_90]], %[[VAL_91]] : f32 +// CHECK: store %[[VAL_92]], %[[VAL_24]]{{\[}}%[[VAL_33]]] : memref // CHECK: } else { // CHECK: } // CHECK: } // CHECK: } -// CHECK: %[[VAL_91:.*]] = cmpi eq, %[[VAL_60]], %[[VAL_59]] : index -// CHECK: %[[VAL_92:.*]] = addi %[[VAL_56]], %[[VAL_8]] : index -// CHECK: %[[VAL_93:.*]] = select %[[VAL_91]], %[[VAL_92]], %[[VAL_56]] : index -// CHECK: %[[VAL_94:.*]] = cmpi eq, %[[VAL_61]], %[[VAL_59]] : index -// CHECK: %[[VAL_95:.*]] = addi %[[VAL_57]], %[[VAL_8]] : index -// CHECK: %[[VAL_96:.*]] = select %[[VAL_94]], %[[VAL_95]], %[[VAL_57]] : index -// CHECK: %[[VAL_97:.*]] = cmpi eq, %[[VAL_62]], %[[VAL_59]] : index -// CHECK: %[[VAL_98:.*]] = addi %[[VAL_58]], %[[VAL_8]] : index -// CHECK: %[[VAL_99:.*]] = select %[[VAL_97]], %[[VAL_98]], %[[VAL_58]] : index -// CHECK: %[[VAL_100:.*]] = addi %[[VAL_59]], %[[VAL_8]] : index -// CHECK: scf.yield %[[VAL_93]], %[[VAL_96]], %[[VAL_99]], %[[VAL_100]] : index, index, index, index +// CHECK: %[[VAL_93:.*]] = cmpi eq, %[[VAL_58]], %[[VAL_64]] : index +// CHECK: %[[VAL_94:.*]] = addi %[[VAL_55]], %[[VAL_8]] : index +// CHECK: %[[VAL_95:.*]] = select %[[VAL_93]], %[[VAL_94]], %[[VAL_55]] : index +// CHECK: %[[VAL_96:.*]] = cmpi eq, %[[VAL_59]], %[[VAL_64]] : index +// CHECK: %[[VAL_97:.*]] = addi %[[VAL_56]], %[[VAL_8]] : index +// CHECK: %[[VAL_98:.*]] = select %[[VAL_96]], %[[VAL_97]], %[[VAL_56]] : index +// CHECK: %[[VAL_99:.*]] = cmpi eq, %[[VAL_62]], %[[VAL_64]] : index +// CHECK: %[[VAL_100:.*]] = addi %[[VAL_57]], %[[VAL_8]] : index +// CHECK: %[[VAL_101:.*]] = select %[[VAL_99]], %[[VAL_100]], %[[VAL_57]] : index +// CHECK: scf.yield %[[VAL_95]], %[[VAL_98]], %[[VAL_101]] : index, index, index // CHECK: } -// CHECK: %[[VAL_101:.*]]:3 = scf.while (%[[VAL_102:.*]] = %[[VAL_103:.*]]#0, %[[VAL_104:.*]] = %[[VAL_103]]#1, %[[VAL_105:.*]] = %[[VAL_103]]#3) : (index, index, index) -> (index, index, index) { -// CHECK: %[[VAL_106:.*]] = cmpi ult, %[[VAL_102]], %[[VAL_39]] : index -// CHECK: %[[VAL_107:.*]] = cmpi ult, %[[VAL_104]], %[[VAL_42]] : index +// CHECK: %[[VAL_102:.*]]:2 = scf.while (%[[VAL_103:.*]] = %[[VAL_104:.*]]#0, %[[VAL_105:.*]] = %[[VAL_104]]#1) : (index, index) -> (index, index) { +// CHECK: %[[VAL_106:.*]] = cmpi ult, %[[VAL_103]], %[[VAL_39]] : index +// CHECK: %[[VAL_107:.*]] = cmpi ult, %[[VAL_105]], %[[VAL_42]] : index // CHECK: %[[VAL_108:.*]] = and %[[VAL_106]], %[[VAL_107]] : i1 -// CHECK: scf.condition(%[[VAL_108]]) %[[VAL_102]], %[[VAL_104]], %[[VAL_105]] : index, index, index +// CHECK: scf.condition(%[[VAL_108]]) %[[VAL_103]], %[[VAL_105]] : index, index // CHECK: } do { -// CHECK: ^bb0(%[[VAL_109:.*]]: index, %[[VAL_110:.*]]: index, %[[VAL_111:.*]]: index): -// CHECK: %[[VAL_112:.*]] = load %[[VAL_12]]{{\[}}%[[VAL_109]]] : memref -// CHECK: %[[VAL_113:.*]] = load %[[VAL_15]]{{\[}}%[[VAL_110]]] : memref -// CHECK: %[[VAL_114:.*]] = cmpi eq, %[[VAL_112]], %[[VAL_111]] : index -// CHECK: %[[VAL_115:.*]] = cmpi eq, %[[VAL_113]], %[[VAL_111]] : index -// CHECK: %[[VAL_116:.*]] = and %[[VAL_114]], %[[VAL_115]] : i1 -// CHECK: scf.if %[[VAL_116]] { -// CHECK: %[[VAL_117:.*]] = load %[[VAL_24]]{{\[}}%[[VAL_33]]] : memref -// CHECK: %[[VAL_118:.*]] = load %[[VAL_13]]{{\[}}%[[VAL_109]]] : memref -// CHECK: %[[VAL_119:.*]] = load %[[VAL_16]]{{\[}}%[[VAL_110]]] : memref -// CHECK: %[[VAL_120:.*]] = mulf %[[VAL_118]], %[[VAL_119]] : f32 -// CHECK: %[[VAL_121:.*]] = mulf %[[VAL_120]], %[[VAL_36]] : f32 -// CHECK: %[[VAL_122:.*]] = mulf %[[VAL_121]], %[[VAL_25]] : f32 -// CHECK: %[[VAL_123:.*]] = addf %[[VAL_117]], %[[VAL_122]] : f32 -// CHECK: store %[[VAL_123]], %[[VAL_24]]{{\[}}%[[VAL_33]]] : memref +// CHECK: ^bb0(%[[VAL_109:.*]]: index, %[[VAL_110:.*]]: index): +// CHECK: %[[VAL_111:.*]] = load %[[VAL_12]]{{\[}}%[[VAL_109]]] : memref +// CHECK: %[[VAL_112:.*]] = load %[[VAL_15]]{{\[}}%[[VAL_110]]] : memref +// CHECK: %[[VAL_113:.*]] = cmpi ult, %[[VAL_112]], %[[VAL_111]] : index +// CHECK: %[[VAL_114:.*]] = select %[[VAL_113]], %[[VAL_112]], %[[VAL_111]] : index +// CHECK: %[[VAL_115:.*]] = cmpi eq, %[[VAL_111]], %[[VAL_114]] : index +// CHECK: %[[VAL_116:.*]] = cmpi eq, %[[VAL_112]], %[[VAL_114]] : index +// CHECK: %[[VAL_117:.*]] = and %[[VAL_115]], %[[VAL_116]] : i1 +// CHECK: scf.if %[[VAL_117]] { +// CHECK: %[[VAL_118:.*]] = load %[[VAL_24]]{{\[}}%[[VAL_33]]] : memref +// CHECK: %[[VAL_119:.*]] = load %[[VAL_13]]{{\[}}%[[VAL_109]]] : memref +// CHECK: %[[VAL_120:.*]] = load %[[VAL_16]]{{\[}}%[[VAL_110]]] : memref +// CHECK: %[[VAL_121:.*]] = mulf %[[VAL_119]], %[[VAL_120]] : f32 +// CHECK: %[[VAL_122:.*]] = mulf %[[VAL_121]], %[[VAL_36]] : f32 +// CHECK: %[[VAL_123:.*]] = mulf %[[VAL_122]], %[[VAL_25]] : f32 +// CHECK: %[[VAL_124:.*]] = addf %[[VAL_118]], %[[VAL_123]] : f32 +// CHECK: store %[[VAL_124]], %[[VAL_24]]{{\[}}%[[VAL_33]]] : memref // CHECK: } else { // CHECK: } -// CHECK: %[[VAL_124:.*]] = cmpi eq, %[[VAL_112]], %[[VAL_111]] : index -// CHECK: %[[VAL_125:.*]] = addi %[[VAL_109]], %[[VAL_8]] : index -// CHECK: %[[VAL_126:.*]] = select %[[VAL_124]], %[[VAL_125]], %[[VAL_109]] : index -// CHECK: %[[VAL_127:.*]] = cmpi eq, %[[VAL_113]], %[[VAL_111]] : index -// CHECK: %[[VAL_128:.*]] = addi %[[VAL_110]], %[[VAL_8]] : index -// CHECK: %[[VAL_129:.*]] = select %[[VAL_127]], %[[VAL_128]], %[[VAL_110]] : index -// CHECK: %[[VAL_130:.*]] = addi %[[VAL_111]], %[[VAL_8]] : index -// CHECK: scf.yield %[[VAL_126]], %[[VAL_129]], %[[VAL_130]] : index, index, index +// CHECK: %[[VAL_125:.*]] = cmpi eq, %[[VAL_111]], %[[VAL_114]] : index +// CHECK: %[[VAL_126:.*]] = addi %[[VAL_109]], %[[VAL_8]] : index +// CHECK: %[[VAL_127:.*]] = select %[[VAL_125]], %[[VAL_126]], %[[VAL_109]] : index +// CHECK: %[[VAL_128:.*]] = cmpi eq, %[[VAL_112]], %[[VAL_114]] : index +// CHECK: %[[VAL_129:.*]] = addi %[[VAL_110]], %[[VAL_8]] : index +// CHECK: %[[VAL_130:.*]] = select %[[VAL_128]], %[[VAL_129]], %[[VAL_110]] : index +// CHECK: scf.yield %[[VAL_127]], %[[VAL_130]] : index, index // CHECK: } // CHECK: %[[VAL_131:.*]] = load %[[VAL_24]]{{\[}}%[[VAL_33]]] : memref // CHECK: %[[VAL_132:.*]] = scf.for %[[VAL_133:.*]] = %[[VAL_134:.*]]#2 to %[[VAL_45]] step %[[VAL_8]] iter_args(%[[VAL_135:.*]] = %[[VAL_131]]) -> (f32) {