mirror of
https://github.com/zama-ai/concrete.git
synced 2026-04-17 03:00:54 -04:00
fix(compiler/tests/bench): Add optimizer strategy to the name of benchs and tests
This commit is contained in:
@@ -82,7 +82,7 @@ constexpr bool DEFAULT_CACHE_ON_DISK = true;
|
||||
/// The strategy of the crypto optimization
|
||||
enum Strategy {
|
||||
/// V0 is a strategy based on the worst case atomic pattern
|
||||
V0,
|
||||
V0 = 0,
|
||||
/// DAG_MONO is a strategy that used the optimizer dag but resolve with a
|
||||
/// unique set of keyswitch and boostrap key
|
||||
DAG_MONO,
|
||||
@@ -91,6 +91,8 @@ enum Strategy {
|
||||
DAG_MULTI
|
||||
};
|
||||
|
||||
std::string const StrategyLabel[] = {"V0", "dag-mono", "dag-multi"};
|
||||
|
||||
constexpr Strategy DEFAULT_STRATEGY = Strategy::DAG_MONO;
|
||||
|
||||
struct Config {
|
||||
@@ -164,4 +166,17 @@ inline size_t getPolynomialSizeFromSolution(optimizer::Solution solution) {
|
||||
|
||||
} // namespace concretelang
|
||||
} // namespace mlir
|
||||
|
||||
static inline std::string toString(mlir::concretelang::optimizer::Strategy s) {
|
||||
if (s <= mlir::concretelang::optimizer::DAG_MULTI)
|
||||
return mlir::concretelang::optimizer::StrategyLabel[s];
|
||||
else
|
||||
return "unknown";
|
||||
}
|
||||
|
||||
static inline std::ostream &
|
||||
operator<<(std::ostream &OS, mlir::concretelang::optimizer::Strategy s) {
|
||||
return OS << toString(s);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -78,16 +78,19 @@ parseEndToEndCommandLine(int argc, char **argv) {
|
||||
"optimizer-strategy",
|
||||
llvm::cl::desc("Select the concrete optimizer strategy"),
|
||||
llvm::cl::init(optimizer::DEFAULT_STRATEGY),
|
||||
llvm::cl::values(clEnumValN(optimizer::Strategy::V0, "V0",
|
||||
llvm::cl::values(clEnumValN(optimizer::Strategy::V0,
|
||||
toString(optimizer::Strategy::V0),
|
||||
"Use the V0 optimizer strategy that use the "
|
||||
"worst case atomic pattern")),
|
||||
llvm::cl::values(clEnumValN(
|
||||
optimizer::Strategy::DAG_MONO, "dag-mono",
|
||||
optimizer::Strategy::DAG_MONO,
|
||||
toString(optimizer::Strategy::DAG_MONO),
|
||||
"Use the dag-mono optimizer strategy that solve the optimization "
|
||||
"problem using the fhe computation dag with ONE set of evaluation "
|
||||
"keys")),
|
||||
llvm::cl::values(clEnumValN(
|
||||
optimizer::Strategy::DAG_MULTI, "dag-multi",
|
||||
optimizer::Strategy::DAG_MULTI,
|
||||
toString(optimizer::Strategy::DAG_MULTI),
|
||||
"Use the dag-multi optimizer strategy that solve the optimization "
|
||||
"problem using the fhe computation dag with SEVERAL set of "
|
||||
"evaluation "
|
||||
@@ -147,6 +150,7 @@ parseEndToEndCommandLine(int argc, char **argv) {
|
||||
}
|
||||
|
||||
std::string getOptionsName(mlir::concretelang::CompilationOptions options) {
|
||||
namespace optimizer = mlir::concretelang::optimizer;
|
||||
std::ostringstream os;
|
||||
if (options.loopParallelize)
|
||||
os << "_loop";
|
||||
@@ -158,9 +162,12 @@ std::string getOptionsName(mlir::concretelang::CompilationOptions options) {
|
||||
if (ostr.size() == 0) {
|
||||
os << "_default";
|
||||
}
|
||||
if (options.optimizerConfig.security != 128) {
|
||||
if (options.optimizerConfig.security != optimizer::DEFAULT_CONFIG.security) {
|
||||
os << "_security" << options.optimizerConfig.security;
|
||||
}
|
||||
if (options.optimizerConfig.strategy != optimizer::DEFAULT_CONFIG.strategy) {
|
||||
os << "_" << options.optimizerConfig.strategy;
|
||||
}
|
||||
return os.str().substr(1);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user