mirror of
https://github.com/zama-ai/concrete.git
synced 2026-02-18 08:31:31 -05:00
Instead of having one `getSQManp` implementation per op with a lot of repetition, the noise calculation is now modular. - Ops that implements`UnaryEint`/`BinaryInt`/`BinaryEint` interfaces share the operand noise presence check. - For many scalar ops no further calculation is needed. If it's not the case, an op can override `sqMANP`. - Integer operand types lookups are abstracted into `BinaryInt::operandIntType()` - Finding largest operand value for a type is abstracted into `BinaryInt::operandMaxConstant` - Noise calculation for matmul ops is simplified and it's now general enough to work for `matmul_eint_int`, `matmul_int_eint` and `dot_eint_int` at once.
25 lines
789 B
C++
25 lines
789 B
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/FHE/Interfaces/FHEInterfacesInstances.h"
|
|
#include "concretelang/Dialect/FHE/IR/FHEDialect.h"
|
|
#include "concretelang/Dialect/FHE/Interfaces/FHEInterfaces.h"
|
|
#include "mlir/Dialect/Tensor/IR/Tensor.h"
|
|
|
|
namespace mlir {
|
|
namespace concretelang {
|
|
namespace FHE {
|
|
|
|
using namespace mlir::tensor;
|
|
|
|
void registerFheInterfacesExternalModels(DialectRegistry ®istry) {
|
|
registry.addExtension(+[](MLIRContext *ctx, TensorDialect *dialect) {
|
|
ExtractOp::attachInterface<UnaryEint>(*ctx);
|
|
});
|
|
}
|
|
} // namespace FHE
|
|
} // namespace concretelang
|
|
} // namespace mlir
|