feat(compiler): Add new action dump-sdfg

Add a new action `dump-sdfg` to `concretecompiler` that causes the IR
to be dumpred right after the extraction of SDFG operations.
This commit is contained in:
Andi Drebes
2022-12-01 14:00:46 +01:00
committed by Andi Drebes
parent 3da32560b7
commit ee2f743a78
3 changed files with 14 additions and 0 deletions

View File

@@ -184,6 +184,10 @@ public:
/// BConcrete operations
BCONCRETE,
/// Read sources and lower all FHE, TFHE and Concrete operations to
/// BConcrete, then extract SDFG operations
SDFG,
/// Read sources and lower all FHE, TFHE and Concrete
/// operations to canonical MLIR dialects. Cryptographic operations
/// are lowered to invocations of the concrete library.

View File

@@ -405,6 +405,10 @@ CompilerEngine::compile(llvm::SourceMgr &sm, Target target, OptionalLib lib) {
}
}
if (target == Target::SDFG) {
return std::move(res);
}
// BConcrete -> Canonical dialects
if (mlir::concretelang::pipeline::lowerBConcreteToStd(mlirContext, module,
enablePass)

View File

@@ -50,6 +50,7 @@ enum Action {
DUMP_CONCRETE,
DUMP_CONCRETEWITHLOOPS,
DUMP_BCONCRETE,
DUMP_SDFG,
DUMP_STD,
DUMP_LLVM_DIALECT,
DUMP_LLVM_IR,
@@ -128,6 +129,8 @@ static llvm::cl::opt<enum Action> action(
llvm::cl::values(
clEnumValN(Action::DUMP_BCONCRETE, "dump-bconcrete",
"Lower to Bufferized Concrete and dump result")),
llvm::cl::values(clEnumValN(Action::DUMP_SDFG, "dump-sdfg",
"Lower to SDFG operations annd dump result")),
llvm::cl::values(clEnumValN(Action::DUMP_STD, "dump-std",
"Lower to std and dump result")),
llvm::cl::values(clEnumValN(Action::DUMP_LLVM_DIALECT, "dump-llvm-dialect",
@@ -489,6 +492,9 @@ mlir::LogicalResult processInputBuffer(
case Action::DUMP_BCONCRETE:
target = mlir::concretelang::CompilerEngine::Target::BCONCRETE;
break;
case Action::DUMP_SDFG:
target = mlir::concretelang::CompilerEngine::Target::SDFG;
break;
case Action::DUMP_STD:
target = mlir::concretelang::CompilerEngine::Target::STD;
break;