diff --git a/compiler/tests/Support/support_unit_test.cpp b/compiler/tests/Support/support_unit_test.cpp index b8975782a..4adbbd6fe 100644 --- a/compiler/tests/Support/support_unit_test.cpp +++ b/compiler/tests/Support/support_unit_test.cpp @@ -8,57 +8,52 @@ namespace CL = mlir::concretelang; TEST(Support, client_parameters_json_serde) { mlir::concretelang::ClientParameters params0; params0.secretKeys = { - {mlir::concretelang::SMALL_KEY, {/*.size = */ 12}}, - {mlir::concretelang::BIG_KEY, {/*.size = */ 14}}, + {mlir::concretelang::SMALL_KEY, {/*.size = */ 12}}, + {mlir::concretelang::BIG_KEY, {/*.size = */ 14}}, }; params0.bootstrapKeys = { - { - "bsk_v0", { - /*.inputSecretKeyID = */ mlir::concretelang::SMALL_KEY, + {"bsk_v0", + {/*.inputSecretKeyID = */ mlir::concretelang::SMALL_KEY, /*.outputSecretKeyID = */ mlir::concretelang::BIG_KEY, /*.level = */ 1, /*.baseLog = */ 2, - /*.k = */ 3, - /*.variance = */ 0.001 - } - },{ - "wtf_bsk_v0", { - /*.inputSecretKeyID = */ mlir::concretelang::BIG_KEY, - /*.outputSecretKeyID = */ mlir::concretelang::SMALL_KEY, - /*.level = */ 3, - /*.baseLog = */ 2, - /*.k = */ 1, - /*.variance = */ 0.0001, - } - }, + /*.glweDimension = */ 3, + /*.variance = */ 0.001}}, + {"wtf_bsk_v0", + { + /*.inputSecretKeyID = */ mlir::concretelang::BIG_KEY, + /*.outputSecretKeyID = */ mlir::concretelang::SMALL_KEY, + /*.level = */ 3, + /*.baseLog = */ 2, + /*.glweDimension = */ 1, + /*.variance = */ 0.0001, + }}, }; params0.keyswitchKeys = { - { - "ksk_v0", { - /*.inputSecretKeyID = */ mlir::concretelang::BIG_KEY, - /*.outputSecretKeyID = */ mlir::concretelang::SMALL_KEY, - /*.level = */ 1, - /*.baseLog = */ 2, - /*.variance = */ 3, - } - } - }; + {"ksk_v0", + { + /*.inputSecretKeyID = */ mlir::concretelang::BIG_KEY, + /*.outputSecretKeyID = */ mlir::concretelang::SMALL_KEY, + /*.level = */ 1, + /*.baseLog = */ 2, + /*.variance = */ 3, + }}}; params0.inputs = { - { - /*.encryption = */ {{CL::SMALL_KEY, 0.01, {4}}}, - /*.shape = */ {32, {1, 2, 3, 4}, 1 * 2 * 3 * 4}, - }, - { - /*.encryption = */ {{CL::SMALL_KEY, 0.03, {5}}}, - /*.shape = */ {8, {4, 4, 4, 4}, 4 * 4 * 4 * 4}, - }, + { + /*.encryption = */ {{CL::SMALL_KEY, 0.01, {4}}}, + /*.shape = */ {32, {1, 2, 3, 4}, 1 * 2 * 3 * 4}, + }, + { + /*.encryption = */ {{CL::SMALL_KEY, 0.03, {5}}}, + /*.shape = */ {8, {4, 4, 4, 4}, 4 * 4 * 4 * 4}, + }, }; params0.outputs = { - { - /*.encryption = */ {{CL::SMALL_KEY, 0.03, {5}}}, - /*.shape = */ {8, {4, 4, 4, 4}, 4 * 4 * 4 * 4}, - }, - }; + { + /*.encryption = */ {{CL::SMALL_KEY, 0.03, {5}}}, + /*.shape = */ {8, {4, 4, 4, 4}, 4 * 4 * 4 * 4}, + }, + }; auto json = mlir::concretelang::toJSON(params0); std::string jsonStr; llvm::raw_string_ostream os(jsonStr); diff --git a/compiler/tests/unittest/end_to_end_jit_fhelinalg.cc b/compiler/tests/unittest/end_to_end_jit_fhelinalg.cc index f82647ac9..90700f574 100644 --- a/compiler/tests/unittest/end_to_end_jit_fhelinalg.cc +++ b/compiler/tests/unittest/end_to_end_jit_fhelinalg.cc @@ -68,10 +68,11 @@ TEST(End2EndJit_FHELinalg, add_eint_int_term_to_term_ret_lambda_argument) { ASSERT_EXPECTED_SUCCESS(res); - mlir::concretelang::TensorLambdaArgument> - &resp = (*res) - ->cast>>(); + mlir::concretelang::TensorLambdaArgument< + mlir::concretelang::IntLambdaArgument<>> &resp = + (*res) + ->cast>>(); ASSERT_EQ(resp.getDimensions().size(), (size_t)1); ASSERT_EQ(resp.getDimensions().at(0), 4); @@ -112,10 +113,11 @@ TEST(End2EndJit_FHELinalg, ASSERT_EXPECTED_SUCCESS(res); - mlir::concretelang::TensorLambdaArgument> - &resp = (*res) - ->cast>>(); + mlir::concretelang::TensorLambdaArgument< + mlir::concretelang::IntLambdaArgument<>> &resp = + (*res) + ->cast>>(); ASSERT_EQ(resp.getDimensions().size(), (size_t)3); ASSERT_EQ(resp.getDimensions().at(0), 4); @@ -1052,8 +1054,7 @@ TEST(End2EndJit_FHELinalg, apply_lookup_table) { } /////////////////////////////////////////////////////////////////////////////// -// FHELinalg apply_multi_lookup_table -// ///////////////////////////////////////////// +// FHELinalg apply_multi_lookup_table ///////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////// TEST(End2EndJit_FHELinalg, apply_multi_lookup_table) { @@ -1154,7 +1155,7 @@ TEST(End2EndJit_FHELinalg, apply_multi_lookup_table_with_boradcast) { } /////////////////////////////////////////////////////////////////////////////// -// FHELinalg apply_mapped_lookup_table ///////////////////////////////////////////// +// FHELinalg apply_mapped_lookup_table //////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////// TEST(End2EndJit_FHELinalg, apply_mapped_lookup_table_sequential) { @@ -1173,9 +1174,8 @@ TEST(End2EndJit_FHELinalg, apply_mapped_lookup_table_sequential) { {2, 3, 0}, }; uint64_t luts[9][4]{ - {3, 0, 0, 0}, {0, 3, 0, 0}, {0, 0, 3, 0}, - {0, 0, 0, 3}, {3, 0, 0, 0}, {0, 3, 0, 0}, - {0, 0, 3, 0}, {0, 0, 0, 3}, {3, 0, 0, 0}, + {3, 0, 0, 0}, {0, 3, 0, 0}, {0, 0, 3, 0}, {0, 0, 0, 3}, {3, 0, 0, 0}, + {0, 3, 0, 0}, {0, 0, 3, 0}, {0, 0, 0, 3}, {3, 0, 0, 0}, }; uint64_t map[3][3]{ {0, 1, 2}, @@ -1192,8 +1192,7 @@ TEST(End2EndJit_FHELinalg, apply_mapped_lookup_table_sequential) { tensorArgTy lutsArg(luts), mapArg(map); llvm::Expected> res = - lambda.operator()>( - {&tArg, &lutsArg, &mapArg}); + lambda.operator()>({&tArg, &lutsArg, &mapArg}); ASSERT_EXPECTED_SUCCESS(res); @@ -1223,9 +1222,8 @@ TEST(End2EndJit_FHELinalg, apply_mapped_lookup_table_same_lut) { {2, 3, 0}, }; uint64_t luts[9][4]{ - {0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}, - {0, 0, 0, 0}, {1, 2, 3, 1}, {0, 0, 0, 0}, - {0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}, + {0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}, {1, 2, 3, 1}, + {0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}, }; uint64_t map[3][3]{ {4, 4, 4}, @@ -1242,8 +1240,7 @@ TEST(End2EndJit_FHELinalg, apply_mapped_lookup_table_same_lut) { tensorArgTy lutsArg(luts), mapArg(map); llvm::Expected> res = - lambda.operator()>( - {&tArg, &lutsArg, &mapArg}); + lambda.operator()>({&tArg, &lutsArg, &mapArg}); ASSERT_EXPECTED_SUCCESS(res); @@ -1281,7 +1278,7 @@ func @main(%arg0: tensor<4x!FHE.eint<7>>, } /////////////////////////////////////////////////////////////////////////////// -// FHELinalg neg_eint ///////////////////////////////////////////// +// FHELinalg neg_eint ///////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////// TEST(End2EndJit_FHELinalg, neg_eint) { @@ -1447,7 +1444,7 @@ TEST(End2EndJit_Linalg, tensor_collapse_shape) { mlir::concretelang::JitCompilerEngine::Lambda lambda = checkedJit(R"XXX( func @main(%a: tensor<2x2x4x!FHE.eint<6>>) -> tensor<2x8x!FHE.eint<6>> { - %0 = linalg.tensor_collapse_shape %a [[0],[1,2]] : tensor<2x2x4x!FHE.eint<6>> into tensor<2x8x!FHE.eint<6>> + %0 = linalg.tensor_collapse_shape %a [[0],[1,2]] : tensor<2x2x4x!FHE.eint<6>> into tensor<2x8x!FHE.eint<6>> return %0 : tensor<2x8x!FHE.eint<6>> } )XXX"); @@ -1470,10 +1467,11 @@ func @main(%a: tensor<2x2x4x!FHE.eint<6>>) -> tensor<2x8x!FHE.eint<6>> { ASSERT_EXPECTED_SUCCESS(res); - mlir::concretelang::TensorLambdaArgument> - &resp = (*res) - ->cast>>(); + mlir::concretelang::TensorLambdaArgument< + mlir::concretelang::IntLambdaArgument<>> &resp = + (*res) + ->cast>>(); ASSERT_EQ(resp.getDimensions().size(), (size_t)2); ASSERT_EQ(resp.getDimensions().at(0), 2); @@ -1496,7 +1494,7 @@ TEST(End2EndJit_Linalg, tensor_expand_shape) { mlir::concretelang::JitCompilerEngine::Lambda lambda = checkedJit(R"XXX( func @main(%a: tensor<2x8x!FHE.eint<6>>) -> tensor<2x2x4x!FHE.eint<6>> { - %0 = linalg.tensor_expand_shape %a [[0],[1,2]] : tensor<2x8x!FHE.eint<6>> into tensor<2x2x4x!FHE.eint<6>> + %0 = linalg.tensor_expand_shape %a [[0],[1,2]] : tensor<2x8x!FHE.eint<6>> into tensor<2x2x4x!FHE.eint<6>> return %0 : tensor<2x2x4x!FHE.eint<6>> } )XXX"); @@ -1520,10 +1518,11 @@ func @main(%a: tensor<2x8x!FHE.eint<6>>) -> tensor<2x2x4x!FHE.eint<6>> { ASSERT_EXPECTED_SUCCESS(res); - mlir::concretelang::TensorLambdaArgument> - &resp = (*res) - ->cast>>(); + mlir::concretelang::TensorLambdaArgument< + mlir::concretelang::IntLambdaArgument<>> &resp = + (*res) + ->cast>>(); ASSERT_EQ(resp.getDimensions().size(), (size_t)3); ASSERT_EQ(resp.getDimensions().at(0), 2); diff --git a/compiler/tests/unittest/end_to_end_jit_lambda.cc b/compiler/tests/unittest/end_to_end_jit_lambda.cc index 91b2e86bc..de106e81d 100644 --- a/compiler/tests/unittest/end_to_end_jit_lambda.cc +++ b/compiler/tests/unittest/end_to_end_jit_lambda.cc @@ -2,8 +2,6 @@ #include "end_to_end_jit_test.h" -const mlir::concretelang::V0FHEConstraint defaultV0Constraints{10, 7}; - using Lambda = mlir::concretelang::JitCompilerEngine::Lambda;