-
Notifications
You must be signed in to change notification settings - Fork 146
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(compiler): generalize noise calculation in FHE/FHELinalg
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.
- Loading branch information
Showing
31 changed files
with
850 additions
and
1,227 deletions.
There are no files selected for viewing
1 change: 1 addition & 0 deletions
1
compilers/concrete-compiler/compiler/include/concretelang/Dialect/FHE/CMakeLists.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
add_subdirectory(Interfaces) | ||
add_subdirectory(Analysis) | ||
add_subdirectory(IR) | ||
add_subdirectory(Transforms) |
4 changes: 0 additions & 4 deletions
4
compilers/concrete-compiler/compiler/include/concretelang/Dialect/FHE/IR/CMakeLists.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 0 additions & 32 deletions
32
compilers/concrete-compiler/compiler/include/concretelang/Dialect/FHE/IR/FHEInterfaces.td
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 7 additions & 0 deletions
7
...ers/concrete-compiler/compiler/include/concretelang/Dialect/FHE/Interfaces/CMakeLists.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
set(LLVM_TARGET_DEFINITIONS FHEInterfaces.td) | ||
mlir_tablegen(FHETypesInterfaces.h.inc -gen-type-interface-decls) | ||
mlir_tablegen(FHETypesInterfaces.cpp.inc -gen-type-interface-defs) | ||
mlir_tablegen(FHEOpsInterfaces.h.inc -gen-op-interface-decls) | ||
mlir_tablegen(FHEOpsInterfaces.cpp.inc -gen-op-interface-defs) | ||
add_public_tablegen_target(MLIRFHEInterfacesIncGen) | ||
add_dependencies(mlir-generic-headers MLIRFHEInterfacesIncGen) |
20 changes: 20 additions & 0 deletions
20
...rs/concrete-compiler/compiler/include/concretelang/Dialect/FHE/Interfaces/FHEInterfaces.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
// 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. | ||
|
||
#ifndef CONCRETELANG_DIALECT_FHE_INTERFACES_FHEINTERFACES_H | ||
#define CONCRETELANG_DIALECT_FHE_INTERFACES_FHEINTERFACES_H | ||
|
||
#include "mlir/IR/BuiltinTypes.h" | ||
#include "mlir/IR/Dialect.h" | ||
|
||
#include "mlir/Dialect/Arith/IR/Arith.h" | ||
#include "mlir/IR/BuiltinOps.h" | ||
#include "mlir/IR/BuiltinTypes.h" | ||
#include "mlir/IR/Dialect.h" | ||
|
||
#include "concretelang/Dialect/FHE/Interfaces/FHEOpsInterfaces.h.inc" | ||
#include "concretelang/Dialect/FHE/Interfaces/FHETypesInterfaces.h.inc" | ||
|
||
#endif |
Oops, something went wrong.