From 94b8070b3f7a1d34ba73f523f82e26d8f74101eb Mon Sep 17 00:00:00 2001 From: "Mayeul@Zama" Date: Fri, 19 Nov 2021 09:25:50 +0100 Subject: [PATCH] tests(compiler): make FileCheck tests stricter --- .../apply_multi_lut_to_linalg.mlir | 8 ++-- .../apply_multi_lut_to_linalg_broadcast.mlir | 8 ++-- .../tests/Dialect/HLFHE/Analysis/MANP.mlir | 42 +++++++++---------- .../Dialect/HLFHE/Analysis/MANP_linalg.mlir | 11 ++--- .../Dialect/HLFHE/Analysis/MANP_tensor.mlir | 14 +++---- .../apply_multi_lut_to_linalg.mlir | 8 ++-- .../apply_multi_lut_to_linalg_broadcast.mlir | 8 ++-- 7 files changed, 50 insertions(+), 49 deletions(-) diff --git a/compiler/tests/Conversion/HLFHELinalgToLinalg/apply_multi_lut_to_linalg.mlir b/compiler/tests/Conversion/HLFHELinalgToLinalg/apply_multi_lut_to_linalg.mlir index 57739e962..1e37a1cfb 100644 --- a/compiler/tests/Conversion/HLFHELinalgToLinalg/apply_multi_lut_to_linalg.mlir +++ b/compiler/tests/Conversion/HLFHELinalgToLinalg/apply_multi_lut_to_linalg.mlir @@ -8,13 +8,13 @@ //CHECK-NEXT: module { //CHECK-NEXT: func @multi_lut(%arg0: tensor<4x4x!MidLFHE.glwe<{_,_,_}{2}>>, %arg1: tensor<4x4x4xi64>) -> tensor<4x4x!MidLFHE.glwe<{_,_,_}{2}>> { //CHECK-NEXT: %[[V0:.*]] = linalg.init_tensor [4, 4] : tensor<4x4x!MidLFHE.glwe<{_,_,_}{2}>> -//CHECK-NEXT: %[[V1:.*]] = linalg.generic {indexing_maps = [#map0, #map1, #map2, #map3, #map4, #map0], iterator_types = ["parallel", "parallel"]} ins(%arg0, %arg1, %arg1, %arg1, %arg1 : tensor<4x4x!MidLFHE.glwe<{_,_,_}{2}>>, tensor<4x4x4xi64>, tensor<4x4x4xi64>, tensor<4x4x4xi64>, tensor<4x4x4xi64>) outs(%[[V0:.*]] : tensor<4x4x!MidLFHE.glwe<{_,_,_}{2}>>) { +//CHECK-NEXT: %[[V1:.*]] = linalg.generic {indexing_maps = [#map0, #map1, #map2, #map3, #map4, #map0], iterator_types = ["parallel", "parallel"]} ins(%arg0, %arg1, %arg1, %arg1, %arg1 : tensor<4x4x!MidLFHE.glwe<{_,_,_}{2}>>, tensor<4x4x4xi64>, tensor<4x4x4xi64>, tensor<4x4x4xi64>, tensor<4x4x4xi64>) outs(%[[V0]] : tensor<4x4x!MidLFHE.glwe<{_,_,_}{2}>>) { //CHECK-NEXT: ^bb0(%arg2: !MidLFHE.glwe<{_,_,_}{2}>, %arg3: i64, %arg4: i64, %arg5: i64, %arg6: i64, %arg7: !MidLFHE.glwe<{_,_,_}{2}>): // no predecessors //CHECK-NEXT: %[[V2:.*]] = tensor.from_elements %arg3, %arg4, %arg5, %arg6 : tensor<4xi64> -//CHECK-NEXT: %[[V3:.*]] = "MidLFHE.apply_lookup_table"(%arg2, %[[V2:.*]]) {baseLogBS = -1 : i32, baseLogKS = -1 : i32, k = -1 : i32, levelBS = -1 : i32, levelKS = -1 : i32, outputSizeKS = -1 : i32, polynomialSize = -1 : i32} : (!MidLFHE.glwe<{_,_,_}{2}>, tensor<4xi64>) -> !MidLFHE.glwe<{_,_,_}{2}> -//CHECK-NEXT: linalg.yield %[[V3:.*]] : !MidLFHE.glwe<{_,_,_}{2}> +//CHECK-NEXT: %[[V3:.*]] = "MidLFHE.apply_lookup_table"(%arg2, %[[V2]]) {baseLogBS = -1 : i32, baseLogKS = -1 : i32, k = -1 : i32, levelBS = -1 : i32, levelKS = -1 : i32, outputSizeKS = -1 : i32, polynomialSize = -1 : i32} : (!MidLFHE.glwe<{_,_,_}{2}>, tensor<4xi64>) -> !MidLFHE.glwe<{_,_,_}{2}> +//CHECK-NEXT: linalg.yield %[[V3]] : !MidLFHE.glwe<{_,_,_}{2}> //CHECK-NEXT: } -> tensor<4x4x!MidLFHE.glwe<{_,_,_}{2}>> -//CHECK-NEXT: return %[[V1:.*]] : tensor<4x4x!MidLFHE.glwe<{_,_,_}{2}>> +//CHECK-NEXT: return %[[V1]] : tensor<4x4x!MidLFHE.glwe<{_,_,_}{2}>> //CHECK-NEXT: } //CHECK-NEXT: } func @multi_lut(%arg0: tensor<4x4x!HLFHE.eint<2>>, %arg1: tensor<4x4x4xi64>) -> tensor<4x4x!HLFHE.eint<2>> { diff --git a/compiler/tests/Conversion/HLFHELinalgToLinalg/apply_multi_lut_to_linalg_broadcast.mlir b/compiler/tests/Conversion/HLFHELinalgToLinalg/apply_multi_lut_to_linalg_broadcast.mlir index cf1c6be97..19bad015d 100644 --- a/compiler/tests/Conversion/HLFHELinalgToLinalg/apply_multi_lut_to_linalg_broadcast.mlir +++ b/compiler/tests/Conversion/HLFHELinalgToLinalg/apply_multi_lut_to_linalg_broadcast.mlir @@ -8,13 +8,13 @@ //CHECK-NEXT: module { //CHECK-NEXT: func @multi_lut(%arg0: tensor<4x3x!MidLFHE.glwe<{_,_,_}{2}>>, %arg1: tensor<3x4xi64>) -> tensor<4x3x!MidLFHE.glwe<{_,_,_}{2}>> { //CHECK-NEXT: %[[V0:.*]] = linalg.init_tensor [4, 3] : tensor<4x3x!MidLFHE.glwe<{_,_,_}{2}>> -//CHECK-NEXT: %[[V1:.*]] = linalg.generic {indexing_maps = [#map0, #map1, #map2, #map3, #map4, #map0], iterator_types = ["parallel", "parallel"]} ins(%arg0, %arg1, %arg1, %arg1, %arg1 : tensor<4x3x!MidLFHE.glwe<{_,_,_}{2}>>, tensor<3x4xi64>, tensor<3x4xi64>, tensor<3x4xi64>, tensor<3x4xi64>) outs(%[[V0:.*]] : tensor<4x3x!MidLFHE.glwe<{_,_,_}{2}>>) { +//CHECK-NEXT: %[[V1:.*]] = linalg.generic {indexing_maps = [#map0, #map1, #map2, #map3, #map4, #map0], iterator_types = ["parallel", "parallel"]} ins(%arg0, %arg1, %arg1, %arg1, %arg1 : tensor<4x3x!MidLFHE.glwe<{_,_,_}{2}>>, tensor<3x4xi64>, tensor<3x4xi64>, tensor<3x4xi64>, tensor<3x4xi64>) outs(%[[V0]] : tensor<4x3x!MidLFHE.glwe<{_,_,_}{2}>>) { //CHECK-NEXT: ^bb0(%arg2: !MidLFHE.glwe<{_,_,_}{2}>, %arg3: i64, %arg4: i64, %arg5: i64, %arg6: i64, %arg7: !MidLFHE.glwe<{_,_,_}{2}>): // no predecessors //CHECK-NEXT: %[[V2:.*]] = tensor.from_elements %arg3, %arg4, %arg5, %arg6 : tensor<4xi64> -//CHECK-NEXT: %[[V3:.*]] = "MidLFHE.apply_lookup_table"(%arg2, %[[V2:.*]]) {baseLogBS = -1 : i32, baseLogKS = -1 : i32, k = -1 : i32, levelBS = -1 : i32, levelKS = -1 : i32, outputSizeKS = -1 : i32, polynomialSize = -1 : i32} : (!MidLFHE.glwe<{_,_,_}{2}>, tensor<4xi64>) -> !MidLFHE.glwe<{_,_,_}{2}> -//CHECK-NEXT: linalg.yield %[[V3:.*]] : !MidLFHE.glwe<{_,_,_}{2}> +//CHECK-NEXT: %[[V3:.*]] = "MidLFHE.apply_lookup_table"(%arg2, %[[V2]]) {baseLogBS = -1 : i32, baseLogKS = -1 : i32, k = -1 : i32, levelBS = -1 : i32, levelKS = -1 : i32, outputSizeKS = -1 : i32, polynomialSize = -1 : i32} : (!MidLFHE.glwe<{_,_,_}{2}>, tensor<4xi64>) -> !MidLFHE.glwe<{_,_,_}{2}> +//CHECK-NEXT: linalg.yield %[[V3]] : !MidLFHE.glwe<{_,_,_}{2}> //CHECK-NEXT: } -> tensor<4x3x!MidLFHE.glwe<{_,_,_}{2}>> -//CHECK-NEXT: return %[[V1:.*]] : tensor<4x3x!MidLFHE.glwe<{_,_,_}{2}>> +//CHECK-NEXT: return %[[V1]] : tensor<4x3x!MidLFHE.glwe<{_,_,_}{2}>> //CHECK-NEXT: } //CHECK-NEXT: } func @multi_lut(%arg0: tensor<4x3x!HLFHE.eint<2>>, %arg1: tensor<3x4xi64>) -> tensor<4x3x!HLFHE.eint<2>> { diff --git a/compiler/tests/Dialect/HLFHE/Analysis/MANP.mlir b/compiler/tests/Dialect/HLFHE/Analysis/MANP.mlir index 9a95b96c0..8ac034817 100644 --- a/compiler/tests/Dialect/HLFHE/Analysis/MANP.mlir +++ b/compiler/tests/Dialect/HLFHE/Analysis/MANP.mlir @@ -133,13 +133,13 @@ func @chain_add_eint_int(%e: !HLFHE.eint<2>) -> !HLFHE.eint<2> %cst2 = arith.constant 2 : i3 %cst3 = arith.constant 1 : i3 - // CHECK: %[[ret:.*]] = "HLFHE.add_eint_int"(%[[op0:.*]], %[[op1:.*]]) {MANP = 4 : ui{{[0-9]+}}} : (!HLFHE.eint<2>, i3) -> !HLFHE.eint<2> + // CHECK: %[[V0:.*]] = "HLFHE.add_eint_int"(%[[op0:.*]], %[[op1:.*]]) {MANP = 4 : ui{{[0-9]+}}} : (!HLFHE.eint<2>, i3) -> !HLFHE.eint<2> %0 = "HLFHE.add_eint_int"(%e, %cst0) : (!HLFHE.eint<2>, i3) -> !HLFHE.eint<2> - // CHECK-NEXT: %[[ret:.*]] = "HLFHE.add_eint_int"(%[[op0:.*]], %[[op1:.*]]) {MANP = 8 : ui{{[0-9]+}}} : (!HLFHE.eint<2>, i3) -> !HLFHE.eint<2> + // CHECK-NEXT: %[[V1:.*]] = "HLFHE.add_eint_int"(%[[V0]], %[[op1:.*]]) {MANP = 8 : ui{{[0-9]+}}} : (!HLFHE.eint<2>, i3) -> !HLFHE.eint<2> %1 = "HLFHE.add_eint_int"(%0, %cst1) : (!HLFHE.eint<2>, i3) -> !HLFHE.eint<2> - // CHECK-NEXT: %[[ret:.*]] = "HLFHE.add_eint_int"(%[[op0:.*]], %[[op1:.*]]) {MANP = 8 : ui{{[0-9]+}}} : (!HLFHE.eint<2>, i3) -> !HLFHE.eint<2> + // CHECK-NEXT: %[[V2:.*]] = "HLFHE.add_eint_int"(%[[V1]], %[[op1:.*]]) {MANP = 8 : ui{{[0-9]+}}} : (!HLFHE.eint<2>, i3) -> !HLFHE.eint<2> %2 = "HLFHE.add_eint_int"(%1, %cst2) : (!HLFHE.eint<2>, i3) -> !HLFHE.eint<2> - // CHECK-NEXT: %[[ret:.*]] = "HLFHE.add_eint_int"(%[[op0:.*]], %[[op1:.*]]) {MANP = 8 : ui{{[0-9]+}}} : (!HLFHE.eint<2>, i3) -> !HLFHE.eint<2> + // CHECK-NEXT: %[[V3:.*]] = "HLFHE.add_eint_int"(%[[V2]], %[[op1:.*]]) {MANP = 8 : ui{{[0-9]+}}} : (!HLFHE.eint<2>, i3) -> !HLFHE.eint<2> %3 = "HLFHE.add_eint_int"(%2, %cst3) : (!HLFHE.eint<2>, i3) -> !HLFHE.eint<2> return %3 : !HLFHE.eint<2> @@ -154,13 +154,13 @@ func @dag_add_eint_int(%e: !HLFHE.eint<2>) -> !HLFHE.eint<2> %Acst2 = arith.constant 2 : i3 %Acst3 = arith.constant 1 : i3 - // CHECK: %[[ret:.*]] = "HLFHE.add_eint_int"(%[[op0:.*]], %[[op1:.*]]) {MANP = 4 : ui{{[0-9]+}}} : (!HLFHE.eint<2>, i3) -> !HLFHE.eint<2> + // CHECK: %[[V0:.*]] = "HLFHE.add_eint_int"(%[[op0:.*]], %[[op1:.*]]) {MANP = 4 : ui{{[0-9]+}}} : (!HLFHE.eint<2>, i3) -> !HLFHE.eint<2> %A0 = "HLFHE.add_eint_int"(%e, %Acst0) : (!HLFHE.eint<2>, i3) -> !HLFHE.eint<2> - // CHECK-NEXT: %[[ret:.*]] = "HLFHE.add_eint_int"(%[[op0:.*]], %[[op1:.*]]) {MANP = 8 : ui{{[0-9]+}}} : (!HLFHE.eint<2>, i3) -> !HLFHE.eint<2> + // CHECK-NEXT: %[[V1:.*]] = "HLFHE.add_eint_int"(%[[V0]], %[[op1:.*]]) {MANP = 8 : ui{{[0-9]+}}} : (!HLFHE.eint<2>, i3) -> !HLFHE.eint<2> %A1 = "HLFHE.add_eint_int"(%A0, %Acst1) : (!HLFHE.eint<2>, i3) -> !HLFHE.eint<2> - // CHECK-NEXT: %[[ret:.*]] = "HLFHE.add_eint_int"(%[[op0:.*]], %[[op1:.*]]) {MANP = 8 : ui{{[0-9]+}}} : (!HLFHE.eint<2>, i3) -> !HLFHE.eint<2> + // CHECK-NEXT: %[[V2:.*]] = "HLFHE.add_eint_int"(%[[V1]], %[[op1:.*]]) {MANP = 8 : ui{{[0-9]+}}} : (!HLFHE.eint<2>, i3) -> !HLFHE.eint<2> %A2 = "HLFHE.add_eint_int"(%A1, %Acst2) : (!HLFHE.eint<2>, i3) -> !HLFHE.eint<2> - // CHECK-NEXT: %[[ret:.*]] = "HLFHE.add_eint_int"(%[[op0:.*]], %[[op1:.*]]) {MANP = 8 : ui{{[0-9]+}}} : (!HLFHE.eint<2>, i3) -> !HLFHE.eint<2> + // CHECK-NEXT: %[[V3:.*]] = "HLFHE.add_eint_int"(%[[V2]], %[[op1:.*]]) {MANP = 8 : ui{{[0-9]+}}} : (!HLFHE.eint<2>, i3) -> !HLFHE.eint<2> %A3 = "HLFHE.add_eint_int"(%A2, %Acst3) : (!HLFHE.eint<2>, i3) -> !HLFHE.eint<2> %Bcst0 = arith.constant 1 : i3 @@ -170,20 +170,20 @@ func @dag_add_eint_int(%e: !HLFHE.eint<2>) -> !HLFHE.eint<2> %Bcst4 = arith.constant 4 : i3 %Bcst5 = arith.constant 7 : i3 - // CHECK: %[[ret:.*]] = "HLFHE.add_eint_int"(%[[op0:.*]], %[[op1:.*]]) {MANP = 2 : ui{{[0-9]+}}} : (!HLFHE.eint<2>, i3) -> !HLFHE.eint<2> + // CHECK: %[[V0:.*]] = "HLFHE.add_eint_int"(%[[op0:.*]], %[[op1:.*]]) {MANP = 2 : ui{{[0-9]+}}} : (!HLFHE.eint<2>, i3) -> !HLFHE.eint<2> %B0 = "HLFHE.add_eint_int"(%e, %Bcst0) : (!HLFHE.eint<2>, i3) -> !HLFHE.eint<2> - // CHECK-NEXT: %[[ret:.*]] = "HLFHE.add_eint_int"(%[[op0:.*]], %[[op1:.*]]) {MANP = 6 : ui{{[0-9]+}}} : (!HLFHE.eint<2>, i3) -> !HLFHE.eint<2> + // CHECK-NEXT: %[[V1:.*]] = "HLFHE.add_eint_int"(%[[V0]], %[[op1:.*]]) {MANP = 6 : ui{{[0-9]+}}} : (!HLFHE.eint<2>, i3) -> !HLFHE.eint<2> %B1 = "HLFHE.add_eint_int"(%B0, %Bcst1) : (!HLFHE.eint<2>, i3) -> !HLFHE.eint<2> - // CHECK-NEXT: %[[ret:.*]] = "HLFHE.add_eint_int"(%[[op0:.*]], %[[op1:.*]]) {MANP = 6 : ui{{[0-9]+}}} : (!HLFHE.eint<2>, i3) -> !HLFHE.eint<2> + // CHECK-NEXT: %[[V2:.*]] = "HLFHE.add_eint_int"(%[[V1]], %[[op1:.*]]) {MANP = 6 : ui{{[0-9]+}}} : (!HLFHE.eint<2>, i3) -> !HLFHE.eint<2> %B2 = "HLFHE.add_eint_int"(%B1, %Bcst2) : (!HLFHE.eint<2>, i3) -> !HLFHE.eint<2> - // CHECK-NEXT: %[[ret:.*]] = "HLFHE.add_eint_int"(%[[op0:.*]], %[[op1:.*]]) {MANP = 9 : ui{{[0-9]+}}} : (!HLFHE.eint<2>, i3) -> !HLFHE.eint<2> + // CHECK-NEXT: %[[V3:.*]] = "HLFHE.add_eint_int"(%[[V2]], %[[op1:.*]]) {MANP = 9 : ui{{[0-9]+}}} : (!HLFHE.eint<2>, i3) -> !HLFHE.eint<2> %B3 = "HLFHE.add_eint_int"(%B2, %Bcst3) : (!HLFHE.eint<2>, i3) -> !HLFHE.eint<2> - // CHECK-NEXT: %[[ret:.*]] = "HLFHE.add_eint_int"(%[[op0:.*]], %[[op1:.*]]) {MANP = 10 : ui{{[0-9]+}}} : (!HLFHE.eint<2>, i3) -> !HLFHE.eint<2> + // CHECK-NEXT: %[[V4:.*]] = "HLFHE.add_eint_int"(%[[V3]], %[[op1:.*]]) {MANP = 10 : ui{{[0-9]+}}} : (!HLFHE.eint<2>, i3) -> !HLFHE.eint<2> %B4 = "HLFHE.add_eint_int"(%B3, %Bcst4) : (!HLFHE.eint<2>, i3) -> !HLFHE.eint<2> - // CHECK-NEXT: %[[ret:.*]] = "HLFHE.add_eint_int"(%[[op0:.*]], %[[op1:.*]]) {MANP = 13 : ui{{[0-9]+}}} : (!HLFHE.eint<2>, i3) -> !HLFHE.eint<2> + // CHECK-NEXT: %[[V5:.*]] = "HLFHE.add_eint_int"(%[[V4]], %[[op1:.*]]) {MANP = 13 : ui{{[0-9]+}}} : (!HLFHE.eint<2>, i3) -> !HLFHE.eint<2> %B5 = "HLFHE.add_eint_int"(%B4, %Bcst5) : (!HLFHE.eint<2>, i3) -> !HLFHE.eint<2> - // CHECK-NEXT: %[[ret:.*]] = "HLFHE.add_eint"(%[[op0:.*]], %[[op1:.*]]) {MANP = 15 : ui{{[0-9]+}}} : (!HLFHE.eint<2>, !HLFHE.eint<2>) -> !HLFHE.eint<2> + // CHECK-NEXT: %[[V6:.*]] = "HLFHE.add_eint"(%[[V5]], %[[op1:.*]]) {MANP = 15 : ui{{[0-9]+}}} : (!HLFHE.eint<2>, !HLFHE.eint<2>) -> !HLFHE.eint<2> %res = "HLFHE.add_eint"(%B5, %A3) : (!HLFHE.eint<2>, !HLFHE.eint<2>) -> !HLFHE.eint<2> return %A3 : !HLFHE.eint<2> @@ -193,16 +193,16 @@ func @dag_add_eint_int(%e: !HLFHE.eint<2>) -> !HLFHE.eint<2> func @chain_add_eint(%e0: !HLFHE.eint<2>, %e1: !HLFHE.eint<2>, %e2: !HLFHE.eint<2>, %e3: !HLFHE.eint<2>, %e4: !HLFHE.eint<2>) -> !HLFHE.eint<2> { - // CHECK: %[[ret:.*]] = "HLFHE.add_eint"(%[[op0:.*]], %[[op1:.*]]) {MANP = 2 : ui{{[0-9]+}}} : (!HLFHE.eint<2>, !HLFHE.eint<2>) -> !HLFHE.eint<2> + // CHECK: %[[V0:.*]] = "HLFHE.add_eint"(%[[op0:.*]], %[[op1:.*]]) {MANP = 2 : ui{{[0-9]+}}} : (!HLFHE.eint<2>, !HLFHE.eint<2>) -> !HLFHE.eint<2> %0 = "HLFHE.add_eint"(%e0, %e1) : (!HLFHE.eint<2>, !HLFHE.eint<2>) -> !HLFHE.eint<2> - // CHECK-NEXT: %[[ret:.*]] = "HLFHE.add_eint"(%[[op0:.*]], %[[op1:.*]]) {MANP = 2 : ui{{[0-9]+}}} : (!HLFHE.eint<2>, !HLFHE.eint<2>) -> !HLFHE.eint<2> + // CHECK-NEXT: %[[V1:.*]] = "HLFHE.add_eint"(%[[V0]], %[[op1:.*]]) {MANP = 2 : ui{{[0-9]+}}} : (!HLFHE.eint<2>, !HLFHE.eint<2>) -> !HLFHE.eint<2> %1 = "HLFHE.add_eint"(%0, %e2) : (!HLFHE.eint<2>, !HLFHE.eint<2>) -> !HLFHE.eint<2> - // CHECK-NEXT: %[[ret:.*]] = "HLFHE.add_eint"(%[[op0:.*]], %[[op1:.*]]) {MANP = 2 : ui{{[0-9]+}}} : (!HLFHE.eint<2>, !HLFHE.eint<2>) -> !HLFHE.eint<2> + // CHECK-NEXT: %[[V2:.*]] = "HLFHE.add_eint"(%[[V1]], %[[op1:.*]]) {MANP = 2 : ui{{[0-9]+}}} : (!HLFHE.eint<2>, !HLFHE.eint<2>) -> !HLFHE.eint<2> %2 = "HLFHE.add_eint"(%1, %e3) : (!HLFHE.eint<2>, !HLFHE.eint<2>) -> !HLFHE.eint<2> - // CHECK-NEXT: %[[ret:.*]] = "HLFHE.add_eint"(%[[op0:.*]], %[[op1:.*]]) {MANP = 3 : ui{{[0-9]+}}} : (!HLFHE.eint<2>, !HLFHE.eint<2>) -> !HLFHE.eint<2> + // CHECK-NEXT: %[[V3:.*]] = "HLFHE.add_eint"(%[[V2]], %[[op1:.*]]) {MANP = 3 : ui{{[0-9]+}}} : (!HLFHE.eint<2>, !HLFHE.eint<2>) -> !HLFHE.eint<2> %3 = "HLFHE.add_eint"(%2, %e4) : (!HLFHE.eint<2>, !HLFHE.eint<2>) -> !HLFHE.eint<2> return %3 : !HLFHE.eint<2> @@ -215,9 +215,9 @@ func @chain_add_eint_neg_eint(%e: !HLFHE.eint<2>) -> !HLFHE.eint<2> { %cst0 = arith.constant 3 : i3 - // CHECK: %[[ret:.*]] = "HLFHE.add_eint_int"(%[[op0:.*]], %[[op1:.*]]) {MANP = 4 : ui{{[0-9]+}}} : (!HLFHE.eint<2>, i3) -> !HLFHE.eint<2> + // CHECK: %[[V0:.*]] = "HLFHE.add_eint_int"(%[[op0:.*]], %[[op1:.*]]) {MANP = 4 : ui{{[0-9]+}}} : (!HLFHE.eint<2>, i3) -> !HLFHE.eint<2> %0 = "HLFHE.add_eint_int"(%e, %cst0) : (!HLFHE.eint<2>, i3) -> !HLFHE.eint<2> - // CHECK-NEXT: %[[ret:.*]] = "HLFHE.neg_eint"(%[[op0:.*]]) {MANP = 4 : ui{{[0-9]+}}} : (!HLFHE.eint<2>) -> !HLFHE.eint<2> + // CHECK-NEXT: %[[ret:.*]] = "HLFHE.neg_eint"(%[[V0]]) {MANP = 4 : ui{{[0-9]+}}} : (!HLFHE.eint<2>) -> !HLFHE.eint<2> %1 = "HLFHE.neg_eint"(%0) : (!HLFHE.eint<2>) -> !HLFHE.eint<2> return %1 : !HLFHE.eint<2> diff --git a/compiler/tests/Dialect/HLFHE/Analysis/MANP_linalg.mlir b/compiler/tests/Dialect/HLFHE/Analysis/MANP_linalg.mlir index 6135662e8..557803cec 100644 --- a/compiler/tests/Dialect/HLFHE/Analysis/MANP_linalg.mlir +++ b/compiler/tests/Dialect/HLFHE/Analysis/MANP_linalg.mlir @@ -117,6 +117,10 @@ func @chain_add_eint_int_neg_eint(%e: tensor<8x!HLFHE.eint<2>>) -> tensor<8x!HLF // ----- +///////////////////////////////////////////////// +// HLFHELinalg.apply_multi_lookup_table +///////////////////////////////////////////////// + func @apply_lookup_table(%t: tensor<3x3x!HLFHE.eint<2>>) -> tensor<3x3x!HLFHE.eint<3>> { %lut = arith.constant dense<[1,3,5,7]> : tensor<4xi64> // CHECK: %[[RES:.*]] = "HLFHELinalg.apply_lookup_table"(%[[T:.*]], %[[LUT:.*]]) {MANP = 1 : ui1} : (tensor<3x3x!HLFHE.eint<2>>, tensor<4xi64>) -> tensor<3x3x!HLFHE.eint<3>> @@ -130,16 +134,13 @@ func @apply_lookup_table_after_op(%t: tensor<8x!HLFHE.eint<2>>, %i: tensor<8xi3> %lut = arith.constant dense<[1,3,5,7]> : tensor<4xi64> // CHECK: %[[V0:.*]] = "HLFHELinalg.mul_eint_int"([[T:.*]], %[[I:.*]]) {MANP = 8 : ui{{[0-9]+}}} : (tensor<8x!HLFHE.eint<2>>, tensor<8xi3>) -> tensor<8x!HLFHE.eint<2>> %0 = "HLFHELinalg.mul_eint_int"(%t, %i) : (tensor<8x!HLFHE.eint<2>>, tensor<8xi3>) -> tensor<8x!HLFHE.eint<2>> - // CHECK-NEXT: %[[RES:.*]] = "HLFHELinalg.apply_lookup_table"(%[[V0:.*]], %[[LUT:.*]]) {MANP = 1 : ui1} : (tensor<8x!HLFHE.eint<2>>, tensor<4xi64>) -> tensor<8x!HLFHE.eint<3>> + // CHECK-NEXT: %[[RES:.*]] = "HLFHELinalg.apply_lookup_table"(%[[V0]], %[[LUT:.*]]) {MANP = 1 : ui1} : (tensor<8x!HLFHE.eint<2>>, tensor<4xi64>) -> tensor<8x!HLFHE.eint<3>> %res = "HLFHELinalg.apply_lookup_table"(%0, %lut) : (tensor<8x!HLFHE.eint<2>>, tensor<4xi64>) -> tensor<8x!HLFHE.eint<3>> return %res : tensor<8x!HLFHE.eint<3>> } // ----- -///////////////////////////////////////////////// -// HLFHELinalg.apply_multi_lookup_table -///////////////////////////////////////////////// func @apply_multi_lookup_table(%t: tensor<3x3x!HLFHE.eint<2>>, %luts: tensor<3x3x4xi64>) -> tensor<3x3x!HLFHE.eint<3>> { // CHECK: %[[RES:.*]] = "HLFHELinalg.apply_multi_lookup_table"(%[[T:.*]], %[[LUT:.*]]) {MANP = 1 : ui1} : (tensor<3x3x!HLFHE.eint<2>>, tensor<3x3x4xi64>) -> tensor<3x3x!HLFHE.eint<3>> @@ -152,7 +153,7 @@ func @apply_multi_lookup_table(%t: tensor<3x3x!HLFHE.eint<2>>, %luts: tensor<3x3 func @apply_multi_lookup_table_after_op(%t: tensor<8x!HLFHE.eint<2>>, %i: tensor<8xi3>, %luts: tensor<8x4xi64>) -> tensor<8x!HLFHE.eint<3>> { // CHECK: %[[V0:.*]] = "HLFHELinalg.mul_eint_int"([[T:.*]], %[[I:.*]]) {MANP = 8 : ui{{[0-9]+}}} : (tensor<8x!HLFHE.eint<2>>, tensor<8xi3>) -> tensor<8x!HLFHE.eint<2>> %0 = "HLFHELinalg.mul_eint_int"(%t, %i) : (tensor<8x!HLFHE.eint<2>>, tensor<8xi3>) -> tensor<8x!HLFHE.eint<2>> - // CHECK-NEXT: %[[RES:.*]] = "HLFHELinalg.apply_multi_lookup_table"(%[[V0:.*]], %[[LUT:.*]]) {MANP = 1 : ui1} : (tensor<8x!HLFHE.eint<2>>, tensor<8x4xi64>) -> tensor<8x!HLFHE.eint<3>> + // CHECK-NEXT: %[[RES:.*]] = "HLFHELinalg.apply_multi_lookup_table"(%[[V0]], %[[LUT:.*]]) {MANP = 1 : ui1} : (tensor<8x!HLFHE.eint<2>>, tensor<8x4xi64>) -> tensor<8x!HLFHE.eint<3>> %res = "HLFHELinalg.apply_multi_lookup_table"(%0, %luts) : (tensor<8x!HLFHE.eint<2>>, tensor<8x4xi64>) -> tensor<8x!HLFHE.eint<3>> return %res : tensor<8x!HLFHE.eint<3>> } diff --git a/compiler/tests/Dialect/HLFHE/Analysis/MANP_tensor.mlir b/compiler/tests/Dialect/HLFHE/Analysis/MANP_tensor.mlir index 906197cf6..fdcb6bc87 100644 --- a/compiler/tests/Dialect/HLFHE/Analysis/MANP_tensor.mlir +++ b/compiler/tests/Dialect/HLFHE/Analysis/MANP_tensor.mlir @@ -19,7 +19,7 @@ func @tensor_from_elements_2(%a: !HLFHE.eint<2>, %b: !HLFHE.eint<2>, %c: !HLFHE. %0 = "HLFHE.add_eint_int"(%a, %cst) : (!HLFHE.eint<2>, i3) -> !HLFHE.eint<2> // The MANP value is 4, i.e. the max of all of its operands - // CHECK: %[[V1:.*]] = tensor.from_elements %[[V0:.*]], %[[b:.*]], %[[c:.*]], %[[d:.*]] {MANP = 4 : ui{{[[0-9]+}}} : tensor<4x!HLFHE.eint<2>> + // CHECK: %[[V1:.*]] = tensor.from_elements %[[V0]], %[[b:.*]], %[[c:.*]], %[[d:.*]] {MANP = 4 : ui{{[[0-9]+}}} : tensor<4x!HLFHE.eint<2>> %1 = tensor.from_elements %0, %b, %c, %d : tensor<4x!HLFHE.eint<2>> return %1 : tensor<4x!HLFHE.eint<2>> @@ -47,9 +47,9 @@ func @tensor_extract_2(%a: !HLFHE.eint<2>) -> !HLFHE.eint<2> // CHECK: %[[V0:.*]] = "HLFHE.add_eint_int"(%[[a:.*]], %[[c1:.*]]) {MANP = 4 : ui{{[0-9]+}}} : (!HLFHE.eint<2>, i3) -> !HLFHE.eint<2> %0 = "HLFHE.add_eint_int"(%a, %c3) : (!HLFHE.eint<2>, i3) -> !HLFHE.eint<2> - // CHECK: %[[V1:.*]] = tensor.from_elements %[[V0:.*]], %[[a:.*]], %[[a:.*]], %[[a:.*]] {MANP = 4 : ui{{[[0-9]+}}} : tensor<4x!HLFHE.eint<2>> + // CHECK: %[[V1:.*]] = tensor.from_elements %[[V0]], %[[a:.*]], %[[a:.*]], %[[a:.*]] {MANP = 4 : ui{{[[0-9]+}}} : tensor<4x!HLFHE.eint<2>> %1 = tensor.from_elements %0, %a, %a, %a : tensor<4x!HLFHE.eint<2>> - // CHECK: %[[ret:.*]] = tensor.extract %[[t:.*]][%[[c3:.*]]] {MANP = 4 : ui{{[[0-9]+}}} : tensor<4x!HLFHE.eint<2>> + // CHECK: %[[ret:.*]] = tensor.extract %[[V1]][%[[c3:.*]]] {MANP = 4 : ui{{[[0-9]+}}} : tensor<4x!HLFHE.eint<2>> %2 = tensor.extract %1[%c1] : tensor<4x!HLFHE.eint<2>> return %2 : !HLFHE.eint<2> @@ -73,7 +73,7 @@ func @tensor_extract_slice_2(%a: !HLFHE.eint<2>) -> tensor<2x!HLFHE.eint<2>> // CHECK: %[[V0:.*]] = "HLFHE.add_eint_int"(%[[a:.*]], %[[c1:.*]]) {MANP = 4 : ui{{[0-9]+}}} : (!HLFHE.eint<2>, i3) -> !HLFHE.eint<2> %0 = "HLFHE.add_eint_int"(%a, %c3) : (!HLFHE.eint<2>, i3) -> !HLFHE.eint<2> - // CHECK: %[[V1:.*]] = tensor.from_elements %[[V0:.*]], %[[a:.*]], %[[a:.*]], %[[a:.*]] {MANP = 4 : ui{{[[0-9]+}}} : tensor<4x!HLFHE.eint<2>> + // CHECK: %[[V1:.*]] = tensor.from_elements %[[V0]], %[[a:.*]], %[[a:.*]], %[[a:.*]] {MANP = 4 : ui{{[[0-9]+}}} : tensor<4x!HLFHE.eint<2>> %1 = tensor.from_elements %0, %a, %a, %a : tensor<4x!HLFHE.eint<2>> // CHECK: tensor.extract_slice %[[V1]][2] [2] [1] {MANP = 4 : ui{{[0-9]+}}} : tensor<4x!HLFHE.eint<2>> to tensor<2x!HLFHE.eint<2>> %2 = tensor.extract_slice %1[2] [2] [1] : tensor<4x!HLFHE.eint<2>> to tensor<2x!HLFHE.eint<2>> @@ -103,16 +103,16 @@ func @tensor_insert_slice_2(%a: !HLFHE.eint<5>) -> tensor<4x!HLFHE.eint<5>> // CHECK: %[[V1:.*]] = "HLFHE.add_eint_int"(%[[a:.*]], %[[c6:.*]]) {MANP = 7 : ui{{[0-9]+}}} : (!HLFHE.eint<5>, i6) -> !HLFHE.eint<5> %v1 = "HLFHE.add_eint_int"(%a, %c6) : (!HLFHE.eint<5>, i6) -> !HLFHE.eint<5> - // CHECK: %[[T0:.*]] = tensor.from_elements %[[V0:.*]], %[[V0:.*]], %[[V0:.*]], %[[V0:.*]] {MANP = 4 : ui{{[[0-9]+}}} : tensor<4x!HLFHE.eint<5>> + // CHECK: %[[T0:.*]] = tensor.from_elements %[[V0]], %[[V0]], %[[V0]], %[[V0]] {MANP = 4 : ui{{[[0-9]+}}} : tensor<4x!HLFHE.eint<5>> %t0 = tensor.from_elements %v0, %v0, %v0, %v0 : tensor<4x!HLFHE.eint<5>> - // CHECK: %[[T1:.*]] = tensor.from_elements %[[V1:.*]], %[[V1:.*]] {MANP = 7 : ui{{[[0-9]+}}} : tensor<2x!HLFHE.eint<5>> + // CHECK: %[[T1:.*]] = tensor.from_elements %[[V1]], %[[V1]] {MANP = 7 : ui{{[[0-9]+}}} : tensor<2x!HLFHE.eint<5>> %t1 = tensor.from_elements %v1, %v1 : tensor<2x!HLFHE.eint<5>> // CHECK: %[[T2:.*]] = tensor.insert_slice %[[T1]] into %[[T0]][0] [2] [1] {MANP = 7 : ui{{[[0-9]+}}} : tensor<2x!HLFHE.eint<5>> into tensor<4x!HLFHE.eint<5>> %t2 = tensor.insert_slice %t1 into %t0[0] [2] [1] : tensor<2x!HLFHE.eint<5>> into tensor<4x!HLFHE.eint<5>> - // CHECK: %[[T3:.*]] = tensor.from_elements %[[V0:.*]], %[[V0:.*]] {MANP = 4 : ui{{[[0-9]+}}} : tensor<2x!HLFHE.eint<5>> + // CHECK: %[[T3:.*]] = tensor.from_elements %[[V0]], %[[V0]] {MANP = 4 : ui{{[[0-9]+}}} : tensor<2x!HLFHE.eint<5>> %t3 = tensor.from_elements %v0, %v0 : tensor<2x!HLFHE.eint<5>> // CHECK: %[[T4:.*]] = tensor.insert_slice %[[T3]] into %[[T2]][0] [2] [1] {MANP = 7 : ui{{[[0-9]+}}} : tensor<2x!HLFHE.eint<5>> into tensor<4x!HLFHE.eint<5>> diff --git a/compiler/tests/Dialect/HLFHELinalg/apply_multi_lut_to_linalg.mlir b/compiler/tests/Dialect/HLFHELinalg/apply_multi_lut_to_linalg.mlir index 57739e962..1e37a1cfb 100644 --- a/compiler/tests/Dialect/HLFHELinalg/apply_multi_lut_to_linalg.mlir +++ b/compiler/tests/Dialect/HLFHELinalg/apply_multi_lut_to_linalg.mlir @@ -8,13 +8,13 @@ //CHECK-NEXT: module { //CHECK-NEXT: func @multi_lut(%arg0: tensor<4x4x!MidLFHE.glwe<{_,_,_}{2}>>, %arg1: tensor<4x4x4xi64>) -> tensor<4x4x!MidLFHE.glwe<{_,_,_}{2}>> { //CHECK-NEXT: %[[V0:.*]] = linalg.init_tensor [4, 4] : tensor<4x4x!MidLFHE.glwe<{_,_,_}{2}>> -//CHECK-NEXT: %[[V1:.*]] = linalg.generic {indexing_maps = [#map0, #map1, #map2, #map3, #map4, #map0], iterator_types = ["parallel", "parallel"]} ins(%arg0, %arg1, %arg1, %arg1, %arg1 : tensor<4x4x!MidLFHE.glwe<{_,_,_}{2}>>, tensor<4x4x4xi64>, tensor<4x4x4xi64>, tensor<4x4x4xi64>, tensor<4x4x4xi64>) outs(%[[V0:.*]] : tensor<4x4x!MidLFHE.glwe<{_,_,_}{2}>>) { +//CHECK-NEXT: %[[V1:.*]] = linalg.generic {indexing_maps = [#map0, #map1, #map2, #map3, #map4, #map0], iterator_types = ["parallel", "parallel"]} ins(%arg0, %arg1, %arg1, %arg1, %arg1 : tensor<4x4x!MidLFHE.glwe<{_,_,_}{2}>>, tensor<4x4x4xi64>, tensor<4x4x4xi64>, tensor<4x4x4xi64>, tensor<4x4x4xi64>) outs(%[[V0]] : tensor<4x4x!MidLFHE.glwe<{_,_,_}{2}>>) { //CHECK-NEXT: ^bb0(%arg2: !MidLFHE.glwe<{_,_,_}{2}>, %arg3: i64, %arg4: i64, %arg5: i64, %arg6: i64, %arg7: !MidLFHE.glwe<{_,_,_}{2}>): // no predecessors //CHECK-NEXT: %[[V2:.*]] = tensor.from_elements %arg3, %arg4, %arg5, %arg6 : tensor<4xi64> -//CHECK-NEXT: %[[V3:.*]] = "MidLFHE.apply_lookup_table"(%arg2, %[[V2:.*]]) {baseLogBS = -1 : i32, baseLogKS = -1 : i32, k = -1 : i32, levelBS = -1 : i32, levelKS = -1 : i32, outputSizeKS = -1 : i32, polynomialSize = -1 : i32} : (!MidLFHE.glwe<{_,_,_}{2}>, tensor<4xi64>) -> !MidLFHE.glwe<{_,_,_}{2}> -//CHECK-NEXT: linalg.yield %[[V3:.*]] : !MidLFHE.glwe<{_,_,_}{2}> +//CHECK-NEXT: %[[V3:.*]] = "MidLFHE.apply_lookup_table"(%arg2, %[[V2]]) {baseLogBS = -1 : i32, baseLogKS = -1 : i32, k = -1 : i32, levelBS = -1 : i32, levelKS = -1 : i32, outputSizeKS = -1 : i32, polynomialSize = -1 : i32} : (!MidLFHE.glwe<{_,_,_}{2}>, tensor<4xi64>) -> !MidLFHE.glwe<{_,_,_}{2}> +//CHECK-NEXT: linalg.yield %[[V3]] : !MidLFHE.glwe<{_,_,_}{2}> //CHECK-NEXT: } -> tensor<4x4x!MidLFHE.glwe<{_,_,_}{2}>> -//CHECK-NEXT: return %[[V1:.*]] : tensor<4x4x!MidLFHE.glwe<{_,_,_}{2}>> +//CHECK-NEXT: return %[[V1]] : tensor<4x4x!MidLFHE.glwe<{_,_,_}{2}>> //CHECK-NEXT: } //CHECK-NEXT: } func @multi_lut(%arg0: tensor<4x4x!HLFHE.eint<2>>, %arg1: tensor<4x4x4xi64>) -> tensor<4x4x!HLFHE.eint<2>> { diff --git a/compiler/tests/Dialect/HLFHELinalg/apply_multi_lut_to_linalg_broadcast.mlir b/compiler/tests/Dialect/HLFHELinalg/apply_multi_lut_to_linalg_broadcast.mlir index cf1c6be97..19bad015d 100644 --- a/compiler/tests/Dialect/HLFHELinalg/apply_multi_lut_to_linalg_broadcast.mlir +++ b/compiler/tests/Dialect/HLFHELinalg/apply_multi_lut_to_linalg_broadcast.mlir @@ -8,13 +8,13 @@ //CHECK-NEXT: module { //CHECK-NEXT: func @multi_lut(%arg0: tensor<4x3x!MidLFHE.glwe<{_,_,_}{2}>>, %arg1: tensor<3x4xi64>) -> tensor<4x3x!MidLFHE.glwe<{_,_,_}{2}>> { //CHECK-NEXT: %[[V0:.*]] = linalg.init_tensor [4, 3] : tensor<4x3x!MidLFHE.glwe<{_,_,_}{2}>> -//CHECK-NEXT: %[[V1:.*]] = linalg.generic {indexing_maps = [#map0, #map1, #map2, #map3, #map4, #map0], iterator_types = ["parallel", "parallel"]} ins(%arg0, %arg1, %arg1, %arg1, %arg1 : tensor<4x3x!MidLFHE.glwe<{_,_,_}{2}>>, tensor<3x4xi64>, tensor<3x4xi64>, tensor<3x4xi64>, tensor<3x4xi64>) outs(%[[V0:.*]] : tensor<4x3x!MidLFHE.glwe<{_,_,_}{2}>>) { +//CHECK-NEXT: %[[V1:.*]] = linalg.generic {indexing_maps = [#map0, #map1, #map2, #map3, #map4, #map0], iterator_types = ["parallel", "parallel"]} ins(%arg0, %arg1, %arg1, %arg1, %arg1 : tensor<4x3x!MidLFHE.glwe<{_,_,_}{2}>>, tensor<3x4xi64>, tensor<3x4xi64>, tensor<3x4xi64>, tensor<3x4xi64>) outs(%[[V0]] : tensor<4x3x!MidLFHE.glwe<{_,_,_}{2}>>) { //CHECK-NEXT: ^bb0(%arg2: !MidLFHE.glwe<{_,_,_}{2}>, %arg3: i64, %arg4: i64, %arg5: i64, %arg6: i64, %arg7: !MidLFHE.glwe<{_,_,_}{2}>): // no predecessors //CHECK-NEXT: %[[V2:.*]] = tensor.from_elements %arg3, %arg4, %arg5, %arg6 : tensor<4xi64> -//CHECK-NEXT: %[[V3:.*]] = "MidLFHE.apply_lookup_table"(%arg2, %[[V2:.*]]) {baseLogBS = -1 : i32, baseLogKS = -1 : i32, k = -1 : i32, levelBS = -1 : i32, levelKS = -1 : i32, outputSizeKS = -1 : i32, polynomialSize = -1 : i32} : (!MidLFHE.glwe<{_,_,_}{2}>, tensor<4xi64>) -> !MidLFHE.glwe<{_,_,_}{2}> -//CHECK-NEXT: linalg.yield %[[V3:.*]] : !MidLFHE.glwe<{_,_,_}{2}> +//CHECK-NEXT: %[[V3:.*]] = "MidLFHE.apply_lookup_table"(%arg2, %[[V2]]) {baseLogBS = -1 : i32, baseLogKS = -1 : i32, k = -1 : i32, levelBS = -1 : i32, levelKS = -1 : i32, outputSizeKS = -1 : i32, polynomialSize = -1 : i32} : (!MidLFHE.glwe<{_,_,_}{2}>, tensor<4xi64>) -> !MidLFHE.glwe<{_,_,_}{2}> +//CHECK-NEXT: linalg.yield %[[V3]] : !MidLFHE.glwe<{_,_,_}{2}> //CHECK-NEXT: } -> tensor<4x3x!MidLFHE.glwe<{_,_,_}{2}>> -//CHECK-NEXT: return %[[V1:.*]] : tensor<4x3x!MidLFHE.glwe<{_,_,_}{2}>> +//CHECK-NEXT: return %[[V1]] : tensor<4x3x!MidLFHE.glwe<{_,_,_}{2}>> //CHECK-NEXT: } //CHECK-NEXT: } func @multi_lut(%arg0: tensor<4x3x!HLFHE.eint<2>>, %arg1: tensor<3x4xi64>) -> tensor<4x3x!HLFHE.eint<2>> {