mirror of
https://github.com/zama-ai/concrete.git
synced 2026-02-09 03:55:04 -05:00
feat(test): add option to provide manual crypto parameters for tests
This commit is contained in:
committed by
mayeul-zama
parent
d0d98c8228
commit
1e261dea7c
@@ -181,6 +181,29 @@ template <> struct llvm::yaml::MappingTraits<EndToEndDesc> {
|
||||
io.mapRequired("description", desc.description);
|
||||
io.mapRequired("program", desc.program);
|
||||
io.mapRequired("tests", desc.tests);
|
||||
std::vector<int64_t> v0parameter;
|
||||
io.mapOptional("v0-parameter", v0parameter);
|
||||
if (!v0parameter.empty()) {
|
||||
if (v0parameter.size() != 7) {
|
||||
io.setError("v0-parameter expect to be a list 7 elemnts "
|
||||
"[glweDimension, logPolynomialSize, nSmall, brLevel, "
|
||||
"brLobBase, ksLevel, ksLogBase]");
|
||||
}
|
||||
desc.v0Parameter = mlir::concretelang::V0Parameter(
|
||||
v0parameter[0], v0parameter[1], v0parameter[2], v0parameter[3],
|
||||
v0parameter[4], v0parameter[5], v0parameter[6]);
|
||||
}
|
||||
std::vector<int64_t> v0constraint;
|
||||
io.mapOptional("v0-constraint", v0constraint);
|
||||
if (!v0constraint.empty()) {
|
||||
if (v0constraint.size() != 2) {
|
||||
io.setError("v0-constraint expect to be a list 2 elemnts "
|
||||
"[p, norm2]");
|
||||
}
|
||||
desc.v0Constraint = mlir::concretelang::V0FHEConstraint();
|
||||
desc.v0Constraint->p = v0constraint[0];
|
||||
desc.v0Constraint->norm2 = v0constraint[1];
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -41,6 +41,8 @@ struct EndToEndDesc {
|
||||
std::string description;
|
||||
std::string program;
|
||||
std::vector<TestDescription> tests;
|
||||
llvm::Optional<mlir::concretelang::V0Parameter> v0Parameter;
|
||||
llvm::Optional<mlir::concretelang::V0FHEConstraint> v0Constraint;
|
||||
};
|
||||
|
||||
llvm::Expected<mlir::concretelang::LambdaArgument *>
|
||||
|
||||
@@ -12,8 +12,16 @@
|
||||
template <typename LambdaSupport>
|
||||
void compile_and_run(EndToEndDesc desc, LambdaSupport support) {
|
||||
|
||||
mlir::concretelang::CompilationOptions options("main");
|
||||
if (desc.v0Constraint.hasValue()) {
|
||||
options.v0FHEConstraints = *desc.v0Constraint;
|
||||
}
|
||||
if (desc.v0Parameter.hasValue()) {
|
||||
options.v0Parameter = *desc.v0Parameter;
|
||||
}
|
||||
|
||||
/* 1 - Compile the program */
|
||||
auto compilationResult = support.compile(desc.program);
|
||||
auto compilationResult = support.compile(desc.program, options);
|
||||
ASSERT_EXPECTED_SUCCESS(compilationResult);
|
||||
|
||||
/* 2 - Load the client parameters and build the keySet */
|
||||
|
||||
Reference in New Issue
Block a user