Skip to content

Commit

Permalink
EVA: Update README.md
Browse files Browse the repository at this point in the history
Signed-off-by: Andrzej Turko <[email protected]>
  • Loading branch information
a-turko authored and AlexanderViand-Intel committed Jan 3, 2024
1 parent 38c620f commit 3e13744
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions src/IR/EVA/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@ This is an implementation of EVA, a language for FHE proposed by Bathathri et al
All of the above operations operate on vectors, which need to have identical length across the whole program.
An important limitation is that there are no operations which
directly allow for combining values into a vector or retrieving scalars from the vectors.
This, however, can be achirved using rotations, multiplications by a constant and additions.
This, however, can be achieved using rotations, multiplications by a constant and additions.

Furthermore, it supports a few ciphertext maintenance operations.
Ciphertexts under consideration are polynomials modulo $Q$, which is a product of primes ($Q = q_1 * q_2 * ... * q_l$).
The encrypted value is kept as in a fixed point format: as an integer that has to be divided by a certain
factor (called scale) to achieve the actual value.

Because the range fpr integers in bounded, the scale needs to be kept under a certain limit.
Because the range for integers in bounded, the scale needs to be kept under a certain limit.
Also, there are certain requirements on the modulo and the scale given by the operations:

* ADD and SUB -- both operands need to have the same scale and modulo.
Expand All @@ -30,13 +30,13 @@ These are the supported ciphertext maintenance operations:
* RELINEARIZE -- decreases the degree of the ciphertexts (which are polynomials) to 1.
* MODSWITCH -- shortens the modulo chain by one (removes the last prime from the product $q_1 * q_2 * ... q_{l'}$).
* RESCALE -- decreases the scale of the ciphertext while also shortening the modulo chain by one.
* CONSTANT -- takes an value known at compile-time and ecrypts it using a given modulo and scale.
* CONSTANT -- takes an value known at compile-time and encrypts it using a given modulo and scale.

## Passes

We also implement passes proposed by Bathathri et al. that insert ciphertext maintenance operations.
This produces a program satisfying the aforementioned requirements on ciphertexts give by the operations
while keeping the scales below a certain (configurable) level and without sactificing too much performance.
while keeping the scales below a certain (configurable) level and without sacrificing too much performance.

Here follows the list of the passes in the recommended order of application:

Expand All @@ -47,10 +47,13 @@ heco --fhe2eva --cannonicalize < <path to the input file>
```

This pass translates a program in FHE dialect to the EVA dialect.
Unfortunetately, so far not all valid FHE programs are supported, yet.
Unfortunately, so far not all valid FHE programs are supported, yet.
Here is the list of limitations:
* All ciphertext values in the program have to be vectors of the same length equal to a power of two. As a result, combine, insert and extract operations are not supported.
* All ciphertext values in the program have to be vectors of the same length equal to a power of two.
As a result, combine, insert and extract operations are not supported.
Those operations are usually used to mark the possibility of some batching optimizations, so it would be useful to apply those before the EVA passes.
* Multiplication and addition must have exactly two operands.
This can be easily fixed by applying a preprocessing pass unrolling addition and multiplication operations.

### Waterline Rescale (evawaterline)
```
Expand All @@ -63,7 +66,7 @@ This way we guarantee that "meaningful", i.e. non rescale, operations only opera

This pass takes three optional arguments (when the argument is missing, pass takes a default value):
* source scale -- the scale of the source nodes (encrypted data taken by program as arguments).
* scale dtop -- the number by which the scale is divided by the rescale operation.
* scale drop -- the number by which the scale is divided by the rescale operation.
* waterline -- the threshold above which the rescale operations are inserted.

For convenience, we assume all of the above and the scale to be powers of two and we represent them as the exponents.
Expand All @@ -76,7 +79,7 @@ heco --evamatchscale="source_scale=<source scale> scale_drop=<scale drop> waterl
```

This pass ensures that operands of addition and subtraction operations have equal scales.
It's achieved by multiplying the one with smaller scale by a vector of ones whose encryption has the apprioriate scale.
It's achieved by multiplying the one with smaller scale by a vector of ones whose encryption has the appropriate scale.

This pass takes the same arguments as evawaterline (source scale, scale drop, waterline), which are used to calculate the
scales of partial results in the program.
Expand Down

0 comments on commit 3e13744

Please sign in to comment.