mirror of
https://github.com/zama-ai/concrete.git
synced 2026-02-10 04:35:03 -05:00
For now what it works are only levelled ops with user parameters. (take a look to the tests) Done: - Add parameters to the fhe parameters to support CRT-based large integers - Add command line options and tests options to allows the user to give those new parameters - Update the dialects and pipeline to handle new fhe parameters for CRT-based large integers - Update the client parameters and the client library to handle the CRT-based large integers Todo: - Plug the optimizer to compute the CRT-based large interger parameters - Plug the pbs for the CRT-based large integer
47 lines
1.4 KiB
C++
47 lines
1.4 KiB
C++
// Part of the Concrete Compiler Project, under the BSD3 License with Zama
|
|
// Exceptions. See
|
|
// https://github.com/zama-ai/concrete-compiler-internal/blob/main/LICENSE.txt
|
|
// for license information.
|
|
|
|
#include "concretelang/Dialect/TFHE/IR/TFHEDialect.h"
|
|
#include "concretelang/Dialect/TFHE/IR/TFHEOps.h"
|
|
#include "concretelang/Dialect/TFHE/IR/TFHETypes.h"
|
|
|
|
#define GET_TYPEDEF_CLASSES
|
|
#include "concretelang/Dialect/TFHE/IR/TFHEOpsTypes.cpp.inc"
|
|
|
|
#include "concretelang/Dialect/TFHE/IR/TFHEOpsDialect.cpp.inc"
|
|
|
|
#include "concretelang/Support/Constants.h"
|
|
|
|
using namespace mlir::concretelang::TFHE;
|
|
|
|
void TFHEDialect::initialize() {
|
|
addOperations<
|
|
#define GET_OP_LIST
|
|
#include "concretelang/Dialect/TFHE/IR/TFHEOps.cpp.inc"
|
|
>();
|
|
|
|
addTypes<
|
|
#define GET_TYPEDEF_LIST
|
|
#include "concretelang/Dialect/TFHE/IR/TFHEOpsTypes.cpp.inc"
|
|
>();
|
|
}
|
|
|
|
/// Verify that GLWE parameter are consistant
|
|
/// - The bits parameter is 64 (we support only this for v0)
|
|
::mlir::LogicalResult GLWECipherTextType::verify(
|
|
::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError,
|
|
signed dimension, signed polynomialSize, signed bits, signed p,
|
|
llvm::ArrayRef<int64_t>) {
|
|
if (bits != -1 && bits != 64) {
|
|
emitError() << "GLWE bits parameter can only be 64";
|
|
return ::mlir::failure();
|
|
}
|
|
if (p == 0) {
|
|
emitError() << "GLWE p parameter must be positive";
|
|
return mlir::failure();
|
|
}
|
|
return ::mlir::success();
|
|
}
|