From a5289a3145c9c46ec7b9e83442953a5c136fb40b Mon Sep 17 00:00:00 2001 From: Andi Drebes Date: Fri, 16 Sep 2022 15:31:01 +0200 Subject: [PATCH] enhance(tests): Add option use_default_fhe_constraints to YAML test descriptions This adds a new optional boolean parameter `use_default_fhe_constraints` to the YAML description of tests that causes the test backend to use the default FHE constraints if set to true. This is necessary for clear text tests, since automatic determination of FHE parameters by the `CompilerEngine` fails for programs not using encrypted integers and causes the program to abort. --- compiler/tests/end_to_end_fixture/EndToEndFixture.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/compiler/tests/end_to_end_fixture/EndToEndFixture.cpp b/compiler/tests/end_to_end_fixture/EndToEndFixture.cpp index 3dc3ca305..0e4e7f1af 100644 --- a/compiler/tests/end_to_end_fixture/EndToEndFixture.cpp +++ b/compiler/tests/end_to_end_fixture/EndToEndFixture.cpp @@ -8,6 +8,8 @@ using mlir::concretelang::StreamStringError; +const mlir::concretelang::V0FHEConstraint defaultV0Constraints{1, 1}; + // derived from https://stackoverflow.com/a/45869209 uint64_t solve_binomial_cdf_bigger_than(size_t n, double p_error, double p_mass) { @@ -247,6 +249,13 @@ template <> struct llvm::yaml::MappingTraits { io.mapRequired("description", desc.description); io.mapRequired("program", desc.program); io.mapRequired("tests", desc.tests); + + bool use_default_fhe_constraints = false; + io.mapOptional("use_default_fhe_constraints", use_default_fhe_constraints); + + if (use_default_fhe_constraints) + desc.v0Constraint = defaultV0Constraints; + std::vector v0parameter; io.mapOptional("v0-parameter", v0parameter); if (!v0parameter.empty()) {