Skip to content
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

Merged
merged 13 commits into from
Aug 22, 2024
Merged

Change Partition Operation #858

merged 13 commits into from
Aug 22, 2024

Conversation

youben11
Copy link
Member

No description provided.

Copy link
Contributor

@umut-sahin umut-sahin left a 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 👍

@youben11 youben11 force-pushed the tfhe-rs-compat-plug-opt branch 2 times, most recently from 035bd63 to be92025 Compare June 4, 2024 12:52
"int":$maxNoiseLevel,
"FloatAttr":$log2PFail,
"bool": $bigEncryptionKey,
DefaultValuedParameter<"int", "-1">: $ciphertextModulus
Copy link
Member

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.

Copy link
Member Author

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

Copy link
Member Author

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

@youben11 youben11 force-pushed the tfhe-rs-compat-plug-opt branch 3 times, most recently from 7f5524b to 15dbba8 Compare July 31, 2024 10:10
Copy link
Member

@BourgerieQuentin BourgerieQuentin left a 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 `>`";
Copy link
Member

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 ?

@@ -3973,4 +3983,92 @@ def zeros(self, resulting_type: ConversionType) -> Conversion:
original_bit_width=1,
)

def get_partition_name(self, partition: tfhers.TFHERSParams) -> str:
Copy link
Member

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.

Copy link
Member Author

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.

Copy link
Member

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:
Copy link
Member

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.

Copy link
Member

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,
Copy link
Member

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,

@youben11 youben11 force-pushed the tfhe-rs-compat-plug-opt branch from 9d888e6 to 189d273 Compare August 13, 2024 10:47
Copy link

@github-actions github-actions bot left a 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.

@youben11 youben11 force-pushed the tfhe-rs-compat-plug-opt branch 2 times, most recently from 70668b7 to 499cda9 Compare August 14, 2024 15:37
@youben11
Copy link
Member Author

@BourgerieQuentin regarding parameterization of TFHERSIntegerType:

  • I think the type is specialized and already has a specific encoding. Supporting other kind of integers would build on the Integer type instead of customizing this one.
  • The reason TFHERSParams are separated into a different object is to make it possible to import/export them separately. Maybe they can also be put into the int type? Also because they were too much initially

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:
Copy link
Member

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.

@youben11 youben11 force-pushed the tfhe-rs-compat-plug-opt branch from 9e77056 to 29811c9 Compare August 22, 2024 14:06
as test runs two times, once in mono, and once in multi, we can just
skip the test unless we are in multi
@youben11 youben11 force-pushed the tfhe-rs-compat-plug-opt branch from 29811c9 to 52736d4 Compare August 22, 2024 14:39
@youben11 youben11 merged commit 2e90f53 into main Aug 22, 2024
36 of 43 checks passed
@youben11 youben11 deleted the tfhe-rs-compat-plug-opt branch August 22, 2024 15:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants