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

Support TFHE-rs tensors #1130

Merged
merged 4 commits into from
Nov 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 11 additions & 7 deletions backends/concrete-cpu/implementation/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 5 additions & 7 deletions backends/concrete-cpu/implementation/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,7 @@ crate-type = ["lib", "staticlib"]


[dependencies]
concrete-csprng = { git = "https://github.com/zama-ai/tfhe-rs.git", rev = "483a4fe", optional = true, features = [
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We will need to update to 0.10 before next release (https://github.com/zama-ai/concrete-internal/issues/902)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this to let me know, or you want me to update it?

"generator_fallback",
] }
concrete-csprng = { version = "0.4.1", optional = true, features = ["generator_fallback"] }
concrete-cpu-noise-model = { path = "../noise-model/" }
concrete-security-curves = { path = "../../../tools/parameter-curves/concrete-security-curves-rust" }
libc = { version = "0.2", default-features = false }
Expand All @@ -31,16 +29,16 @@ serde = "~1"
rayon = { version = "1.6", optional = true }
once_cell = { version = "1.16", optional = true }

tfhe = { git = "https://github.com/zama-ai/tfhe-rs.git", rev = "483a4fe", features = ["integer"] }
tfhe = { version = "0.8.6", features = ["integer"] }

[target.x86_64-unknown-unix-gnu.dependencies]
tfhe = { git = "https://github.com/zama-ai/tfhe-rs.git", rev = "483a4fe", features = ["integer", "x86_64-unix"] }
tfhe = { version = "0.8.6", features = ["integer", "x86_64-unix"] }

[target.aarch64-unknown-unix-gnu.dependencies]
tfhe = { git = "https://github.com/zama-ai/tfhe-rs.git", rev = "483a4fe", features = ["integer", "aarch64-unix"] }
tfhe = { version = "0.8.6", features = ["integer", "aarch64-unix"] }

[target.x86_64-pc-windows-gnu.dependencies]
tfhe = { git = "https://github.com/zama-ai/tfhe-rs.git", rev = "483a4fe", features = ["integer", "x86_64"] }
tfhe = { version = "0.8.6", features = ["integer", "x86_64"] }

[features]
default = ["parallel", "std", "csprng"]
Expand Down
14 changes: 9 additions & 5 deletions backends/concrete-cpu/implementation/include/concrete-cpu.h
Original file line number Diff line number Diff line change
Expand Up @@ -372,12 +372,14 @@ void concrete_cpu_keyswitch_lwe_ciphertext_u64(uint64_t *ct_out,
size_t concrete_cpu_lwe_array_to_tfhers_int8(const uint64_t *lwe_vec_buffer,
uint8_t *buffer,
size_t buffer_len,
struct TfhersFheIntDescription fheint_desc);
size_t n_elem,
struct TfhersFheIntDescription desc);

size_t concrete_cpu_lwe_array_to_tfhers_uint8(const uint64_t *lwe_vec_buffer,
uint8_t *buffer,
size_t buffer_len,
struct TfhersFheIntDescription fheuint_desc);
size_t n_elem,
struct TfhersFheIntDescription desc);

size_t concrete_cpu_lwe_ciphertext_size_u64(size_t lwe_dimension);

Expand Down Expand Up @@ -418,16 +420,18 @@ size_t concrete_cpu_serialize_lwe_secret_key_u64(const uint64_t *lwe_sk,
uint8_t *out_buffer,
size_t out_buffer_len);

size_t concrete_cpu_tfhers_fheint_buffer_size_u64(size_t lwe_size, size_t n_cts);
size_t concrete_cpu_tfhers_fheint_buffer_size_u64(size_t lwe_size, size_t n_cts, size_t n_elem);

int64_t concrete_cpu_tfhers_int8_to_lwe_array(const uint8_t *serialized_data_ptr,
size_t serialized_data_len,
int64_t concrete_cpu_tfhers_int8_to_lwe_array(const uint8_t *buffer,
size_t buffer_len,
uint64_t *lwe_vec_buffer,
size_t n_elem,
struct TfhersFheIntDescription desc);

int64_t concrete_cpu_tfhers_uint8_to_lwe_array(const uint8_t *buffer,
size_t buffer_len,
uint64_t *lwe_vec_buffer,
size_t n_elem,
struct TfhersFheIntDescription desc);

size_t concrete_cpu_tfhers_unknown_noise_level(void);
Expand Down
Loading
Loading