Skip to content

Commit

Permalink
feat: add data for compressed list
Browse files Browse the repository at this point in the history
  • Loading branch information
nsarlin-zama committed Jul 18, 2024
1 parent d7c42a6 commit 163de4e
Show file tree
Hide file tree
Showing 17 changed files with 248 additions and 115 deletions.
73 changes: 52 additions & 21 deletions Cargo.lock

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

9 changes: 7 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ edition = "2021"
tfhe_0_6 = { version = "0.6", features = ["boolean", "integer", "shortint", "x86_64-unix", "experimental-force_fft_algo_dif4"], package = "tfhe", optional = true }
tfhe_0_7 = { version = "0.7", features = ["boolean", "integer", "shortint", "x86_64-unix", "experimental-force_fft_algo_dif4"], package = "tfhe", optional = true }

tfhe-versionable = { version = "0.1", optional = true }
tfhe-versionable_0_1 = { version = "0.1", optional = true, package = "tfhe-versionable" }
tfhe-versionable_0_2 = { version = "0.2", optional = true, package = "tfhe-versionable" }

# other deps
serde = { version = "1.0", features = ["derive"] }
Expand All @@ -22,12 +23,16 @@ ron = { version = "0.8", features = ["integer128"] }
ciborium = "0.2"
bincode = "1.3"

[patch.crates-io]
tfhe_0_7 = { git = "https://github.com/zama-ai/tfhe-rs", branch = "release/0.7.x", package = "tfhe"}
tfhe_versionable_0_2 = { git = "https://github.com/zama-ai/tfhe-rs", branch = "release/0.7.x", package = "tfhe-versionable" }

[[bin]]
name = "tfhe-backward-compat-data"
required-features = ["generate"]

[features]
default = ["generate"]

generate = ["dep:tfhe_0_6", "dep:tfhe_0_7", "dep:tfhe-versionable"]
generate = ["dep:tfhe_0_6", "dep:tfhe_0_7", "dep:tfhe-versionable_0_1", "dep:tfhe-versionable_0_2"]
load = ["dep:semver"]
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ Any commits to `main` should be backported to the latest version branch.
To re-generate the data, run the binary target for this project: `cargo run --release`. The prng is seeded with a fixed seed, so the data should be identical.

# Adding a test for an existing type
To add a new test for a type that is already tested, you need to create a const global variable with the metadata for that test. The type of metadata depends on the type being tested (for example, the metadata for a test of the `ClientKey' from the `high_level_api' is `HlClientKEy'). Then go to the `data_vvv.rs` file (where "vvv" is the TFHE-rs version of the tested data) and update the `gen_xxx_data` method (where "xxx" is the API layer of your test (hl, shortint, integer,...)). In this method, create the object you want to test and serialize it using the `store_versioned_test` method. Add the metadata of your test to the vector returned by this method.
To add a new test for a type that is already tested, you need to create a const global variable with the metadata for that test. The type of metadata depends on the type being tested (for example, the metadata for a test of the `ClientKey' from the `high_level_api' is `HlClientKEy'). Then go to the `data_vvv.rs` file (where "vvv" is the TFHE-rs version of the tested data) and update the `gen_xxx_data` method (where "xxx" is the API layer of your test (hl, shortint, integer,...)). In this method, create the object you want to test and serialize it using the `store_versioned_test` macro. Add the metadata of your test to the vector returned by this method.

The test will be automatically selected when you run TFHE-rs `make test_backward_compatibility`.

Expand Down Expand Up @@ -55,7 +55,7 @@ impl TfhersVersion for V0_6 {
let ct1 = fheint8::encrypt(HL_CT1_TEST.clear_value, &hl_client_key);

// 3. Store it
store_versioned_test(&ct1, &dir, &HL_CT1_TEST.test_filename);
store_versioned_test!(&ct1, &dir, &HL_CT1_TEST.test_filename);

// 4. Return the metadata
vec![
Expand Down
3 changes: 3 additions & 0 deletions data/0_7/high_level_api/client_key.cbor
Git LFS file not shown
3 changes: 0 additions & 3 deletions data/0_7/high_level_api/client_key.cbor.bcode

This file was deleted.

3 changes: 0 additions & 3 deletions data/0_7/high_level_api/client_key.cbor.cbor

This file was deleted.

Git LFS file not shown
3 changes: 3 additions & 0 deletions data/0_7/high_level_api/hl_compressed_heterogeneous_list.cbor
Git LFS file not shown
4 changes: 2 additions & 2 deletions data/0_7/high_level_api/hl_heterogeneous_list.bcode
Git LFS file not shown
4 changes: 2 additions & 2 deletions data/0_7/high_level_api/hl_heterogeneous_list.cbor
Git LFS file not shown
4 changes: 2 additions & 2 deletions data/0_7/high_level_api/hl_packed_heterogeneous_list.bcode
Git LFS file not shown
4 changes: 2 additions & 2 deletions data/0_7/high_level_api/hl_packed_heterogeneous_list.cbor
Git LFS file not shown
Loading

0 comments on commit 163de4e

Please sign in to comment.