-
Notifications
You must be signed in to change notification settings - Fork 158
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Change Partition Operation #858
Conversation
0c87d72
to
e651fc9
Compare
compilers/concrete-compiler/compiler/include/concretelang/Dialect/FHE/IR/FHEOps.td
Show resolved
Hide resolved
compilers/concrete-compiler/compiler/lib/Conversion/FHETensorOpsToLinalg/TensorOpsToLinalg.cpp
Outdated
Show resolved
Hide resolved
compilers/concrete-compiler/compiler/include/concretelang/Dialect/FHE/IR/FHEOps.td
Show resolved
Hide resolved
compilers/concrete-compiler/compiler/include/concretelang/Dialect/FHE/IR/FHEOps.td
Show resolved
Hide resolved
compilers/concrete-compiler/compiler/lib/Dialect/FHE/Transforms/Optimizer.cpp
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a few suggestions on the Python side, looks good 👍
frontends/concrete-python/concrete/fhe/compilation/module_compiler.py
Outdated
Show resolved
Hide resolved
frontends/concrete-python/concrete/fhe/compilation/module_compiler.py
Outdated
Show resolved
Hide resolved
035bd63
to
be92025
Compare
compilers/concrete-compiler/compiler/include/concretelang/Dialect/FHE/IR/FHEOps.h
Outdated
Show resolved
Hide resolved
compilers/concrete-compiler/compiler/include/concretelang/Dialect/FHE/IR/FHEAttrs.td
Outdated
Show resolved
Hide resolved
"int":$maxNoiseLevel, | ||
"FloatAttr":$log2PFail, | ||
"bool": $bigEncryptionKey, | ||
DefaultValuedParameter<"int", "-1">: $ciphertextModulus |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is that possible to have verifier on the attr? I guess we should as example not support for ciphertextModulus != 64 at least at the beginning.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think it's possible AFAIK
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hasVerifier doesn't seem to be supported at least
compilers/concrete-compiler/compiler/include/concretelang/Dialect/FHE/IR/FHEOps.td
Show resolved
Hide resolved
compilers/concrete-compiler/compiler/include/concretelang/Dialect/FHE/IR/FHEAttrs.td
Show resolved
Hide resolved
7f5524b
to
15dbba8
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's wait to plug with the optimizer, I schedule a sync tomorrow to discuss of that PR
"int":$glweDim, | ||
"int":$polySize | ||
); | ||
let assemblyFormat = "`<` `name` $name `,` `lwe_dim` $lweDim `,` `glwe_dim` $glweDim `,` `poly_size` $polySize `>`"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
still missing noise level, right? (cc @rudy-6-4)
Maybe also we can name parameters n, k, N to be more compact ?
compilers/concrete-compiler/compiler/include/concretelang/Dialect/FHE/IR/FHEOps.td
Show resolved
Hide resolved
compilers/concrete-compiler/compiler/include/concretelang/Dialect/FHE/IR/FHEOps.td
Show resolved
Hide resolved
compilers/concrete-compiler/compiler/include/concretelang/Dialect/FHELinalg/IR/FHELinalgOps.td
Outdated
Show resolved
Hide resolved
compilers/concrete-compiler/compiler/lib/Bindings/Python/FHEModule.cpp
Outdated
Show resolved
Hide resolved
@@ -3973,4 +3983,92 @@ def zeros(self, resulting_type: ConversionType) -> Conversion: | |||
original_bit_width=1, | |||
) | |||
|
|||
def get_partition_name(self, partition: tfhers.TFHERSParams) -> str: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm wondering why you generates names, I fell it should be the responsability of the user to do it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
names are used to identify partitions, which is abstracted to the user. So generating unique names for a given set of parameters is how to differentiate between these partitions and I don't see why this should be left to the user.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see. Maybe the name should be optional (but is not a big deal to make it mandatory), I see some advantage to make it explicit, as example if we can specify name we can use concrete to switch from private thfe-rs key to an other which share the same parameters.
|
||
import numpy as np | ||
|
||
from ..dtypes import Integer | ||
|
||
|
||
class TFHERSParams: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe here we should have two part of parameters, one is for crypto parameters needed for changing partition (lwe_dim,glwe_dim,poly_size, ciphertext_modulus, noise_level) the other one is for the radix encoding (message_modulus, carry_modulus).
That will allow to separate the change_partition and the trans encoding between radix and native encoding, it will allow also the composability with other things than tfhe-rs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we could also maybe remove unnecessary parameters
params: TFHERSParams | ||
|
||
def __init__( | ||
self, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here it could a TFHERSIntergerType will be composed of crypto params and radix encoding parameter,
compilers/concrete-compiler/compiler/lib/Dialect/FHE/Transforms/Optimizer.cpp
Outdated
Show resolved
Hide resolved
9d888e6
to
189d273
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Benchmark
Benchmark suite | Current: 52736d4 | Previous: 29811c9 | Ratio |
---|---|---|---|
v0 PBS table generation |
60986750 ns/iter (± 3180220 ) |
61096369 ns/iter (± 3565593 ) |
1.00 |
v0 PBS simulate dag table generation |
40885868 ns/iter (± 2036630 ) |
40854653 ns/iter (± 272815 ) |
1.00 |
v0 WoP-PBS table generation |
49846938 ns/iter (± 1239929 ) |
50100311 ns/iter (± 2555686 ) |
0.99 |
This comment was automatically generated by workflow using github-action-benchmark.
70668b7
to
499cda9
Compare
@BourgerieQuentin regarding parameterization of
I may be missing something, but I don't see why we should separate them. Specially now. |
@@ -3973,4 +3983,92 @@ def zeros(self, resulting_type: ConversionType) -> Conversion: | |||
original_bit_width=1, | |||
) | |||
|
|||
def get_partition_name(self, partition: tfhers.TFHERSParams) -> str: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see. Maybe the name should be optional (but is not a big deal to make it mandatory), I see some advantage to make it explicit, as example if we can specify name we can use concrete to switch from private thfe-rs key to an other which share the same parameters.
we are checking if the selected parameter selection can handle tfhers integers
9e77056
to
29811c9
Compare
as test runs two times, once in mono, and once in multi, we can just skip the test unless we are in multi
29811c9
to
52736d4
Compare
No description provided.