enhance(compiler/lowlfhe): Give the runtime context as function argument instead of a global variable (close #195)

This commit is contained in:
Quentin Bourgerie
2021-11-26 18:02:12 +01:00
parent 99fe188e66
commit fb58dcc59d
14 changed files with 201 additions and 164 deletions

View File

@@ -125,8 +125,11 @@ createClientParametersForV0(V0FHEContext fheContext, llvm::StringRef name,
// Create input and output circuit gate parameters
auto funcType = (*funcOp).getType();
for (auto inType : funcType.getInputs()) {
auto gate = gateFromMLIRType("big", precision, encryptionVariance, inType);
bool hasContext =
funcType.getInputs().back().isa<mlir::zamalang::LowLFHE::ContextType>();
for (auto inType = funcType.getInputs().begin();
inType < funcType.getInputs().end() - hasContext; inType++) {
auto gate = gateFromMLIRType("big", precision, encryptionVariance, *inType);
if (auto err = gate.takeError()) {
return std::move(err);
}