mirror of
https://github.com/zama-ai/concrete.git
synced 2026-02-08 19:44:57 -05:00
feat(compiler/gpu): Integrate gpu crypto optimization
This commit is contained in:
committed by
Ayoub Benaissa
parent
a5047586f4
commit
d934553950
Submodule compiler/concrete-optimizer updated: 1f15162b39...a4a1f4b112
@@ -23,6 +23,7 @@ constexpr uint DEFAULT_SECURITY = 128;
|
||||
constexpr uint DEFAULT_FALLBACK_LOG_NORM_WOPPBS = 8;
|
||||
constexpr bool DEFAULT_DISPLAY = false;
|
||||
constexpr bool DEFAULT_STARTEGY_V0 = false;
|
||||
constexpr bool DEFAULT_USE_GPU_CONSTRAINTS = false;
|
||||
|
||||
struct Config {
|
||||
double p_error;
|
||||
@@ -31,11 +32,16 @@ struct Config {
|
||||
bool strategy_v0;
|
||||
std::uint64_t security;
|
||||
double fallback_log_norm_woppbs;
|
||||
bool use_gpu_constraints;
|
||||
};
|
||||
|
||||
constexpr Config DEFAULT_CONFIG = {
|
||||
UNSPECIFIED_P_ERROR, NO_GLOBAL_P_ERROR, DEFAULT_DISPLAY,
|
||||
DEFAULT_STARTEGY_V0, DEFAULT_SECURITY, DEFAULT_FALLBACK_LOG_NORM_WOPPBS};
|
||||
constexpr Config DEFAULT_CONFIG = {UNSPECIFIED_P_ERROR,
|
||||
NO_GLOBAL_P_ERROR,
|
||||
DEFAULT_DISPLAY,
|
||||
DEFAULT_STARTEGY_V0,
|
||||
DEFAULT_SECURITY,
|
||||
DEFAULT_FALLBACK_LOG_NORM_WOPPBS,
|
||||
DEFAULT_USE_GPU_CONSTRAINTS};
|
||||
|
||||
using Dag = rust::Box<concrete_optimizer::OperationDag>;
|
||||
using Solution = concrete_optimizer::v0::Solution;
|
||||
|
||||
@@ -198,6 +198,10 @@ llvm::Error CompilerEngine::determineFHEParameters(CompilationResult &res) {
|
||||
return llvm::Error::success();
|
||||
}
|
||||
CompilationFeedback feedback;
|
||||
// Make sure to use the gpu constraint of the optimizer if we use gpu
|
||||
// backend.
|
||||
compilerOptions.optimizerConfig.use_gpu_constraints =
|
||||
compilerOptions.emitGPUOps;
|
||||
auto v0Params = getParameter(descr.get().value(), feedback,
|
||||
compilerOptions.optimizerConfig);
|
||||
if (auto err = v0Params.takeError()) {
|
||||
|
||||
@@ -28,6 +28,7 @@ concrete_optimizer::Options options_from_config(optimizer::Config config) {
|
||||
options.security_level = config.security;
|
||||
options.maximum_acceptable_error_probability = config.p_error;
|
||||
options.default_log_norm2_woppbs = config.fallback_log_norm_woppbs;
|
||||
options.use_gpu_constraints = config.use_gpu_constraints;
|
||||
return options;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user