chore(docs): uniformize paths in docs to use "-" instead of "_"
- this is to avoid conflicts with gitbook
9
Makefile
@@ -1106,6 +1106,10 @@ check_intra_md_links: install_mlc
|
||||
check_md_links: install_mlc
|
||||
mlc --match-file-extension tfhe/docs
|
||||
|
||||
.PHONY: check_doc_paths_use_dash # Check paths use "-" instead of "_" in docs for gitbook compatibility
|
||||
check_doc_paths_use_dash:
|
||||
python3 ./scripts/check_doc_paths_use_dash.py
|
||||
|
||||
.PHONY: check_parameter_export_ok # Checks exported "current" shortint parameter module is correct
|
||||
check_parameter_export_ok:
|
||||
python3 ./scripts/check_current_param_export.py
|
||||
@@ -1552,7 +1556,8 @@ sha256_bool: install_rs_check_toolchain
|
||||
|
||||
.PHONY: pcc # pcc stands for pre commit checks (except GPU)
|
||||
pcc: no_tfhe_typo no_dbg_log check_parameter_export_ok check_fmt check_typos lint_doc \
|
||||
check_md_docs_are_tested check_intra_md_links clippy_all check_compile_tests test_tfhe_lints \
|
||||
check_md_docs_are_tested check_intra_md_links check_doc_paths_use_dash \
|
||||
clippy_all check_compile_tests test_tfhe_lints \
|
||||
tfhe_lints
|
||||
|
||||
.PHONY: pcc_gpu # pcc stands for pre commit checks for GPU compilation
|
||||
@@ -1564,7 +1569,7 @@ pcc_hpu: clippy_hpu clippy_hpu_backend clippy_hpu_mockup test_integer_hpu_mockup
|
||||
|
||||
.PHONY: fpcc # pcc stands for pre commit checks, the f stands for fast
|
||||
fpcc: no_tfhe_typo no_dbg_log check_parameter_export_ok check_fmt check_typos lint_doc \
|
||||
check_md_docs_are_tested clippy_fast check_compile_tests
|
||||
check_md_docs_are_tested check_intra_md_links check_doc_paths_use_dash clippy_fast check_compile_tests
|
||||
|
||||
.PHONY: conformance # Automatically fix problems that can be fixed
|
||||
conformance: fix_newline fmt fmt_js
|
||||
|
||||
@@ -149,7 +149,7 @@ To run this code, use the following command:
|
||||
> Note that when running code that uses `TFHE-rs`, it is highly recommended
|
||||
to run in release mode with cargo's `--release` flag to have the best performances possible.
|
||||
|
||||
*Find an example with more explanations in [this part of the documentation](https://docs.zama.ai/tfhe-rs/get-started/quick_start)*
|
||||
*Find an example with more explanations in [this part of the documentation](https://docs.zama.ai/tfhe-rs/get-started/quick-start)*
|
||||
|
||||
<p align="right">
|
||||
<a href="#about" > ↑ Back to top </a>
|
||||
|
||||
51
scripts/check_doc_paths_use_dash.py
Normal file
@@ -0,0 +1,51 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
# Verify there are not underscores in docs dirs to avoid issues between github and gitbook.
|
||||
# The mix of both was creating more issues than necessary, so using the least common denominator of
|
||||
# the "-" instead of "_"
|
||||
|
||||
from pathlib import Path
|
||||
import os
|
||||
|
||||
DEBUG = False
|
||||
|
||||
|
||||
def main():
|
||||
curr_file_path = Path(__file__)
|
||||
root_dir = curr_file_path.parent.parent.resolve()
|
||||
docs_dir = root_dir / "tfhe/docs"
|
||||
|
||||
if not docs_dir.exists():
|
||||
raise ValueError(f"{docs_dir} does not exist")
|
||||
|
||||
problems = []
|
||||
|
||||
for idx, (subdirs, dirs, files) in enumerate(os.walk(docs_dir)):
|
||||
if DEBUG:
|
||||
print(idx, (subdirs, dirs, files))
|
||||
|
||||
subdirs = Path(subdirs).resolve()
|
||||
|
||||
for dir_ in dirs:
|
||||
if "_" in str(dir_):
|
||||
problems.append(
|
||||
f"Found dir: {dir_} in {subdirs} containing a '_' instead of a '-', "
|
||||
f"this is not allowed"
|
||||
)
|
||||
|
||||
for file in files:
|
||||
if "_" in str(file):
|
||||
problems.append(
|
||||
f"Found file: {file} in {subdirs} containing a '_' instead of a '-', "
|
||||
f"this is not allowed"
|
||||
)
|
||||
|
||||
if len(problems) != 0:
|
||||
for problem in problems:
|
||||
print(problem)
|
||||
|
||||
raise ValueError
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
@@ -7,7 +7,7 @@ const DIR_TO_IGNORE: [&str; 2] = [".git", "target"];
|
||||
|
||||
const FILES_TO_IGNORE: [&str; 9] = [
|
||||
// This contains fragments of code that are unrelated to TFHE-rs
|
||||
"tfhe/docs/tutorials/sha256_bool.md",
|
||||
"tfhe/docs/tutorials/sha256-bool.md",
|
||||
// TODO: This contains code that could be executed as a trivium docstring
|
||||
"apps/trivium/README.md",
|
||||
// TODO: should we test this ?
|
||||
@@ -119,7 +119,17 @@ pub fn check_tfhe_docs_are_tested() -> Result<(), Error> {
|
||||
}
|
||||
|
||||
for value_to_remove in FILES_TO_IGNORE {
|
||||
let path_to_remove = curr_dir.join(value_to_remove).canonicalize()?.to_path_buf();
|
||||
let file_to_ignore = curr_dir.join(value_to_remove);
|
||||
if !file_to_ignore.exists() {
|
||||
return Err(Error::new(
|
||||
ErrorKind::InvalidData,
|
||||
format!(
|
||||
"Encountered errors while ignoring files: {} does not exist",
|
||||
file_to_ignore.display()
|
||||
),
|
||||
));
|
||||
}
|
||||
let path_to_remove = file_to_ignore.canonicalize()?.to_path_buf();
|
||||
doc_files.remove(&path_to_remove);
|
||||
}
|
||||
|
||||
|
||||
|
Before Width: | Height: | Size: 15 KiB After Width: | Height: | Size: 15 KiB |
|
Before Width: | Height: | Size: 23 KiB After Width: | Height: | Size: 23 KiB |
|
Before Width: | Height: | Size: 10 KiB After Width: | Height: | Size: 10 KiB |
|
Before Width: | Height: | Size: 16 KiB After Width: | Height: | Size: 16 KiB |
|
Before Width: | Height: | Size: 13 KiB After Width: | Height: | Size: 13 KiB |
|
Before Width: | Height: | Size: 5.7 KiB After Width: | Height: | Size: 5.7 KiB |
|
Before Width: | Height: | Size: 5.7 KiB After Width: | Height: | Size: 5.7 KiB |
|
Before Width: | Height: | Size: 5.7 KiB After Width: | Height: | Size: 5.7 KiB |
|
Before Width: | Height: | Size: 32 KiB After Width: | Height: | Size: 32 KiB |
|
Before Width: | Height: | Size: 16 KiB After Width: | Height: | Size: 16 KiB |
|
Before Width: | Height: | Size: 13 KiB After Width: | Height: | Size: 13 KiB |
|
Before Width: | Height: | Size: 5.7 KiB After Width: | Height: | Size: 5.7 KiB |
|
Before Width: | Height: | Size: 5.7 KiB After Width: | Height: | Size: 5.7 KiB |
|
Before Width: | Height: | Size: 5.7 KiB After Width: | Height: | Size: 5.7 KiB |
|
Before Width: | Height: | Size: 16 KiB After Width: | Height: | Size: 16 KiB |
|
Before Width: | Height: | Size: 7.8 KiB After Width: | Height: | Size: 7.8 KiB |
|
Before Width: | Height: | Size: 32 KiB After Width: | Height: | Size: 32 KiB |
|
Before Width: | Height: | Size: 16 KiB After Width: | Height: | Size: 16 KiB |
|
Before Width: | Height: | Size: 22 KiB After Width: | Height: | Size: 22 KiB |
|
Before Width: | Height: | Size: 16 KiB After Width: | Height: | Size: 16 KiB |
|
Before Width: | Height: | Size: 20 KiB After Width: | Height: | Size: 20 KiB |
|
Before Width: | Height: | Size: 156 KiB After Width: | Height: | Size: 156 KiB |
@@ -17,19 +17,19 @@ layout:
|
||||
|
||||
TFHE-rs is a pure Rust implementation of TFHE for Boolean and integer arithmetics over encrypted data. It includes a Rust and C API, as well as a client-side WASM API.
|
||||
|
||||
TFHE-rs also includes a [GPU accelerated backend](configuration/gpu_acceleration/run_on_gpu.md) as well as an [HPU accelerated backend](configuration/hpu_acceleration/run_on_hpu.md).
|
||||
TFHE-rs also includes a [GPU accelerated backend](configuration/gpu-acceleration/run-on-gpu.md) as well as an [HPU accelerated backend](configuration/hpu-acceleration/run-on-hpu.md).
|
||||
|
||||
## Get started
|
||||
|
||||
Learn the basics of TFHE-rs, set it up, and make it run with ease.
|
||||
|
||||
<table data-view="cards"><thead><tr><th></th><th></th><th data-hidden data-card-target data-type="content-ref"></th><th data-hidden data-card-cover data-type="files"></th></tr></thead><tbody><tr><td><strong>What is TFHE-rs?</strong></td><td>Understand TFHE-rs library and basic cryptographic concepts</td><td><a href="getting_started/README.md">getting_started</a></td><td><a href=".gitbook/assets/start1.png">start1.png</a></td></tr><tr><td><strong>Installation</strong></td><td>Follow the step by step guide to import TFHE-rs in your project</td><td><a href="getting_started/installation.md">installation.md</a></td><td><a href=".gitbook/assets/start2.png">start2.png</a></td></tr><tr><td><strong>Quick start</strong></td><td>See a full example of using TFHE-rs to compute on encrypted data</td><td><a href="getting_started/quick_start.md">quick_start.md</a></td><td><a href=".gitbook/assets/start3.png">start3.png</a></td></tr></tbody></table>
|
||||
<table data-view="cards"><thead><tr><th></th><th></th><th data-hidden data-card-target data-type="content-ref"></th><th data-hidden data-card-cover data-type="files"></th></tr></thead><tbody><tr><td><strong>What is TFHE-rs?</strong></td><td>Understand TFHE-rs library and basic cryptographic concepts</td><td><a href="getting-started/README.md">getting-started</a></td><td><a href=".gitbook/assets/start1.png">start1.png</a></td></tr><tr><td><strong>Installation</strong></td><td>Follow the step by step guide to import TFHE-rs in your project</td><td><a href="getting-started/installation.md">installation.md</a></td><td><a href=".gitbook/assets/start2.png">start2.png</a></td></tr><tr><td><strong>Quick start</strong></td><td>See a full example of using TFHE-rs to compute on encrypted data</td><td><a href="getting-started/quick-start.md">quick-start.md</a></td><td><a href=".gitbook/assets/start3.png">start3.png</a></td></tr></tbody></table>
|
||||
|
||||
## Build with TFHE-rs
|
||||
|
||||
Start building with TFHE-rs by exploring its core features, discovering essential guides, and learning more with user-friendly tutorials.
|
||||
|
||||
<table data-view="cards"><thead><tr><th></th><th></th><th></th><th data-hidden data-card-cover data-type="files"></th></tr></thead><tbody><tr><td><strong>FHE Computations</strong></td><td>Run FHE computation on encrypted data.</td><td><ul><li><a href="fhe-computation/types/">Types </a></li><li><a href="fhe-computation/operations/">Operations</a></li></ul></td><td><a href=".gitbook/assets/build1.png">build1.png</a></td></tr><tr><td><strong>Configuration</strong></td><td>Advanced configuration for better performance.</td><td><ul><li><a href="configuration/rust_configuration.md">Advanced Rust </a></li><li><a href="configuration/gpu_acceleration/run_on_gpu.md">GPU acceleration</a></li><li><a href="configuration/hpu_acceleration/run_on_hpu.md">HPU acceleration</a></li></ul></td><td><a href=".gitbook/assets/build2.png">build2.png</a></td></tr><tr><td><strong>Integration</strong></td><td>Use TFHE-rs in different contexts or platforms..</td><td><ul><li><a href="integration/c_api.md">C API</a></li><li><a href="integration/js_on_wasm_api.md">JS on WASM API</a></li></ul></td><td><a href=".gitbook/assets/build3.png">build3.png</a></td></tr></tbody></table>
|
||||
<table data-view="cards"><thead><tr><th></th><th></th><th></th><th data-hidden data-card-cover data-type="files"></th></tr></thead><tbody><tr><td><strong>FHE Computations</strong></td><td>Run FHE computation on encrypted data.</td><td><ul><li><a href="fhe-computation/types/">Types </a></li><li><a href="fhe-computation/operations/">Operations</a></li></ul></td><td><a href=".gitbook/assets/build1.png">build1.png</a></td></tr><tr><td><strong>Configuration</strong></td><td>Advanced configuration for better performance.</td><td><ul><li><a href="configuration/rust-configuration.md">Advanced Rust </a></li><li><a href="configuration/gpu-acceleration/run-on-gpu.md">GPU acceleration</a></li><li><a href="configuration/hpu-acceleration/run-on-hpu.md">HPU acceleration</a></li></ul></td><td><a href=".gitbook/assets/build2.png">build2.png</a></td></tr><tr><td><strong>Integration</strong></td><td>Use TFHE-rs in different contexts or platforms..</td><td><ul><li><a href="integration/c-api.md">C API</a></li><li><a href="integration/js-on-wasm-api.md">JS on WASM API</a></li></ul></td><td><a href=".gitbook/assets/build3.png">build3.png</a></td></tr></tbody></table>
|
||||
|
||||
## Explore more
|
||||
|
||||
@@ -39,9 +39,9 @@ Access to additional resources and join the Zama community.
|
||||
|
||||
Explore step-by-step guides that walk you through real-world uses of TFHE-rs. 
|
||||
|
||||
* [Homomorphic parity bit](tutorials/parity_bit.md): Learn how to implement a parity bit calculation over encrypted data
|
||||
* [Homomorphic case changing on ASCII string](tutorials/ascii_fhe_string.md): See how to process string data securely by changing cases while keeping the data encrypted.
|
||||
* [SHA256 with Boolean API](tutorials/sha256_bool.md): Delve into a more complex example: implementing the SHA256 hash function entirely on encrypted boolean values.
|
||||
* [Homomorphic parity bit](tutorials/parity-bit.md): Learn how to implement a parity bit calculation over encrypted data
|
||||
* [Homomorphic case changing on ASCII string](tutorials/ascii-fhe-string.md): See how to process string data securely by changing cases while keeping the data encrypted.
|
||||
* [SHA256 with Boolean API](tutorials/sha256-bool.md): Delve into a more complex example: implementing the SHA256 hash function entirely on encrypted boolean values.
|
||||
* [All tutorials](tutorials/see-all-tutorials.md): A complete list of all available tutorials in one place.tutorials: A complete list of all available tutorials in one place.
|
||||
|
||||
### References & Explanations
|
||||
|
||||
@@ -4,20 +4,20 @@
|
||||
|
||||
## Get Started
|
||||
|
||||
* [What is TFHE-rs?](getting_started/README.md)
|
||||
* [Installation](getting_started/installation.md)
|
||||
* [Quick start](getting_started/quick_start.md)
|
||||
* [Benchmarks](getting_started/benchmarks/README.md)
|
||||
* [CPU Benchmarks](getting_started/benchmarks/cpu/README.md)
|
||||
* [Integer](getting_started/benchmarks/cpu/cpu_integer_operations.md)
|
||||
* [Programmable bootstrapping](getting_started/benchmarks/cpu/cpu_programmable_bootstrapping.md)
|
||||
* [GPU Benchmarks](getting_started/benchmarks/gpu/README.md)
|
||||
* [Integer](getting_started/benchmarks/gpu/gpu_integer_operations.md)
|
||||
* [Programmable bootstrapping](getting_started/benchmarks/gpu/gpu_programmable_bootstrapping.md)
|
||||
* [HPU Benchmarks](getting_started/benchmarks/hpu/README.md)
|
||||
* [Integer](getting_started/benchmarks/hpu/hpu_integer_operations.md)
|
||||
* [Zero-knowledge proof benchmarks](getting_started/benchmarks/zk_proof_benchmarks.md)
|
||||
* [Security and cryptography](getting_started/security_and_cryptography.md)
|
||||
* [What is TFHE-rs?](getting-started/README.md)
|
||||
* [Installation](getting-started/installation.md)
|
||||
* [Quick start](getting-started/quick-start.md)
|
||||
* [Benchmarks](getting-started/benchmarks/README.md)
|
||||
* [CPU Benchmarks](getting-started/benchmarks/cpu/README.md)
|
||||
* [Integer](getting-started/benchmarks/cpu/cpu-integer-operations.md)
|
||||
* [Programmable bootstrapping](getting-started/benchmarks/cpu/cpu-programmable-bootstrapping.md)
|
||||
* [GPU Benchmarks](getting-started/benchmarks/gpu/README.md)
|
||||
* [Integer](getting-started/benchmarks/gpu/gpu-integer-operations.md)
|
||||
* [Programmable bootstrapping](getting-started/benchmarks/gpu/gpu-programmable-bootstrapping.md)
|
||||
* [HPU Benchmarks](getting-started/benchmarks/hpu/README.md)
|
||||
* [Integer](getting-started/benchmarks/hpu/hpu-integer-operations.md)
|
||||
* [Zero-knowledge proof benchmarks](getting-started/benchmarks/zk-proof-benchmarks.md)
|
||||
* [Security and cryptography](getting-started/security-and-cryptography.md)
|
||||
|
||||
## FHE Computation
|
||||
|
||||
@@ -44,53 +44,53 @@
|
||||
* [Data handling](fhe-computation/data-handling/README.md)
|
||||
* [Compressing ciphertexts/keys](fhe-computation/data-handling/compress.md)
|
||||
* [Serialization/deserialization](fhe-computation/data-handling/serialization.md)
|
||||
* [Data versioning](fhe-computation/data-handling/data_versioning.md)
|
||||
* [Data versioning](fhe-computation/data-handling/data-versioning.md)
|
||||
* [Advanced features](fhe-computation/advanced-features/README.md)
|
||||
* [Encrypted pseudo random values](fhe-computation/advanced-features/encrypted-prf.md)
|
||||
* [Overflow detection](fhe-computation/advanced-features/overflow_operations.md)
|
||||
* [Public key encryption](fhe-computation/advanced-features/public_key.md)
|
||||
* [Trivial ciphertexts](fhe-computation/advanced-features/trivial_ciphertext.md)
|
||||
* [Overflow detection](fhe-computation/advanced-features/overflow-operations.md)
|
||||
* [Public key encryption](fhe-computation/advanced-features/public-key.md)
|
||||
* [Trivial ciphertexts](fhe-computation/advanced-features/trivial-ciphertext.md)
|
||||
* [Zero-knowledge proofs](fhe-computation/advanced-features/zk-pok.md)
|
||||
* [Multi-threading with Rayon crate](fhe-computation/advanced-features/rayon_crate.md)
|
||||
* [Multi-threading with Rayon crate](fhe-computation/advanced-features/rayon-crate.md)
|
||||
* [Noise squashing](fhe-computation/advanced-features/noise-squashing.md)
|
||||
* [Tooling](fhe-computation/tooling/README.md)
|
||||
* [PBS statistics](fhe-computation/tooling/pbs-stats.md)
|
||||
* [Generic trait bounds](fhe-computation/tooling/trait_bounds.md)
|
||||
* [Generic trait bounds](fhe-computation/tooling/trait-bounds.md)
|
||||
* [Debugging](fhe-computation/tooling/debug.md)
|
||||
|
||||
## Hardware acceleration
|
||||
* [GPU acceleration](configuration/gpu_acceleration/run_on_gpu.md)
|
||||
* [A simple example](configuration/gpu_acceleration/simple_example.md)
|
||||
* [Operations](configuration/gpu_acceleration/gpu_operations.md)
|
||||
* [Compressing ciphertexts](configuration/gpu_acceleration/compressing_ciphertexts.md)
|
||||
* [Array types](configuration/gpu_acceleration/array_type.md)
|
||||
* [ZK-POKs](configuration/gpu_acceleration/zk-pok.md)
|
||||
* [Multi-GPU support](configuration/gpu_acceleration/multi_gpu.md)
|
||||
* [HPU acceleration](configuration/hpu_acceleration/run_on_hpu.md)
|
||||
* [Benchmark](configuration/hpu_acceleration/benchmark.md)
|
||||
* [GPU acceleration](configuration/gpu-acceleration/run-on-gpu.md)
|
||||
* [A simple example](configuration/gpu-acceleration/simple-example.md)
|
||||
* [Operations](configuration/gpu-acceleration/gpu-operations.md)
|
||||
* [Compressing ciphertexts](configuration/gpu-acceleration/compressing-ciphertexts.md)
|
||||
* [Array types](configuration/gpu-acceleration/array-type.md)
|
||||
* [ZK-POKs](configuration/gpu-acceleration/zk-pok.md)
|
||||
* [Multi-GPU support](configuration/gpu-acceleration/multi-gpu.md)
|
||||
* [HPU acceleration](configuration/hpu-acceleration/run-on-hpu.md)
|
||||
* [Benchmark](configuration/hpu-acceleration/benchmark.md)
|
||||
|
||||
## Configuration
|
||||
|
||||
* [Advanced Rust setup](configuration/rust_configuration.md)
|
||||
* [Parallelized PBS](configuration/parallelized_pbs.md)
|
||||
* [Advanced Rust setup](configuration/rust-configuration.md)
|
||||
* [Parallelized PBS](configuration/parallelized-pbs.md)
|
||||
|
||||
## Integration
|
||||
|
||||
* [JS on WASM API](integration/js_on_wasm_api.md)
|
||||
* [High-level API in C](integration/c_api.md)
|
||||
* [JS on WASM API](integration/js-on-wasm-api.md)
|
||||
* [High-level API in C](integration/c-api.md)
|
||||
|
||||
## Tutorials
|
||||
|
||||
* [Homomorphic parity bit](tutorials/parity_bit.md)
|
||||
* [Homomorphic case changing on Ascii string](tutorials/ascii_fhe_string.md)
|
||||
* [SHA256 with Boolean API](tutorials/sha256_bool.md)
|
||||
* [Homomorphic parity bit](tutorials/parity-bit.md)
|
||||
* [Homomorphic case changing on Ascii string](tutorials/ascii-fhe-string.md)
|
||||
* [SHA256 with Boolean API](tutorials/sha256-bool.md)
|
||||
* [All tutorials](tutorials/see-all-tutorials.md)
|
||||
|
||||
## References
|
||||
|
||||
* [API references](https://docs.rs/tfhe/latest/tfhe/)
|
||||
* [Fine-grained APIs](references/fine-grained-apis/README.md)
|
||||
* [Quick start](references/fine-grained-apis/quick_start.md)
|
||||
* [Quick start](references/fine-grained-apis/quick-start.md)
|
||||
* [Boolean](references/fine-grained-apis/boolean/README.md)
|
||||
* [Operations](references/fine-grained-apis/boolean/operations.md)
|
||||
* [Cryptographic parameters](references/fine-grained-apis/boolean/parameters.md)
|
||||
|
||||
@@ -3,17 +3,17 @@
|
||||
**TFHE-rs** has a CUDA GPU backend that enables faster integer arithmetic operations on encrypted data, when compared to the default CPU backend. This guide explains how to update your existing program to leverage GPU acceleration, or to start a new program using GPU.
|
||||
|
||||
To explore a simple code example, go to:
|
||||
{% content-ref url="./simple_example.md" %} A simple TFHE-rs GPU example {% endcontent-ref %}
|
||||
{% content-ref url="./simple-example.md" %} A simple TFHE-rs GPU example {% endcontent-ref %}
|
||||
|
||||
## FHE performance on GPU
|
||||
|
||||
The GPU backend is **up to 4.2x faster** than the CPU one. For a comparison between CPU and GPU latencies, see the following page.
|
||||
{% content-ref url="../../getting_started/benchmarks/README.md" %} GPU vs CPU benchmarks {% endcontent-ref %}
|
||||
{% content-ref url="../../getting-started/benchmarks/README.md" %} GPU vs CPU benchmarks {% endcontent-ref %}
|
||||
|
||||
Different integer operations obtain different speedups. Please refer to the [detailed GPU benchmarks of FHE operations](../../getting_started/benchmarks/gpu/README.md) for detailed figures.
|
||||
Different integer operations obtain different speedups. Please refer to the [detailed GPU benchmarks of FHE operations](../../getting-started/benchmarks/gpu/README.md) for detailed figures.
|
||||
|
||||
{% hint style="warning" %}
|
||||
To reproduce TFHE-rs GPU benchmarks, see [this dedicated page](../../getting_started/benchmarks/gpu/gpu_programmable_bootstrapping.md). To obtain the best performance when running benchmarks, set the environment variable `CUDA_MODULE_LOADING=EAGER` to avoid CUDA API overheads during the first kernel execution. Bear in mind that GPU warmup is necessary before doing performance measurements.
|
||||
To reproduce TFHE-rs GPU benchmarks, see [this dedicated page](../../getting-started/benchmarks/gpu/gpu-programmable-bootstrapping.md). To obtain the best performance when running benchmarks, set the environment variable `CUDA_MODULE_LOADING=EAGER` to avoid CUDA API overheads during the first kernel execution. Bear in mind that GPU warmup is necessary before doing performance measurements.
|
||||
{% endhint %}
|
||||
|
||||
## GPU TFHE-rs features
|
||||
@@ -28,12 +28,12 @@ TFHE-rs uses dedicated parameters for the GPU in order to achieve optimal perfor
|
||||
|
||||
The GPU backend is designed to speed up server-side FHE operations and supports the following TFHE-rs features:
|
||||
|
||||
- [FHE ciphertext operations](./gpu_operations.md)
|
||||
- [Ciphertext compression](./compressing_ciphertexts.md)
|
||||
- [Ciphertext arrays](array_type.md)
|
||||
- [FHE ciphertext operations](./gpu-operations.md)
|
||||
- [Ciphertext compression](./compressing-ciphertexts.md)
|
||||
- [Ciphertext arrays](array-type.md)
|
||||
- [ZK-POK proof expansion](zk-pok.md)
|
||||
- [Noise Squashing](https://docs.rs/tfhe/latest/tfhe/struct.FheInt.html#method.squash_noise)
|
||||
- [Multi-GPU for throughput optimization](./multi_gpu.md)
|
||||
- [Multi-GPU for throughput optimization](./multi-gpu.md)
|
||||
|
||||
The following features are not supported:
|
||||
|
||||
@@ -67,7 +67,7 @@ To compile and execute GPU TFHE-rs programs, make sure your system has the follo
|
||||
* [gcc](https://gcc.gnu.org/) >= 8.0 - check this [page](https://gist.github.com/ax3l/9489132) for more details about nvcc/gcc compatible versions
|
||||
* [cmake](https://cmake.org/) >= 3.24
|
||||
* libclang, to match Rust bingen [requirements](https://rust-lang.github.io/rust-bindgen/requirements.html) >= 9.0
|
||||
* Rust version - see this [page](../rust_configuration.md)
|
||||
* Rust version - see this [page](../rust-configuration.md)
|
||||
|
||||
### 2. Import GPU-enabled TFHE-rs
|
||||
|
||||
@@ -10,7 +10,7 @@ This example shows how to use a single GPU to improve operation latency. It has
|
||||
|
||||
This example only performs an addition, but most FHE operations are supported on GPU. For a list see:
|
||||
|
||||
{% content-ref url="./gpu_operations.md" %} List of FHE operations on GPU {% endcontent-ref %}
|
||||
{% content-ref url="./gpu-operations.md" %} List of FHE operations on GPU {% endcontent-ref %}
|
||||
|
||||
## API elements discussed in this document
|
||||
|
||||
@@ -53,19 +53,19 @@ fn main() {
|
||||
}
|
||||
```
|
||||
|
||||
When the `"gpu"` feature is activated, calling: `let config = ConfigBuilder::default().build();` instantiates [cryptographic parameters that are different from the CPU ones](run_on_gpu.md#gpu-tfhe-rs-features).
|
||||
When the `"gpu"` feature is activated, calling: `let config = ConfigBuilder::default().build();` instantiates [cryptographic parameters that are different from the CPU ones](run-on-gpu.md#gpu-tfhe-rs-features).
|
||||
|
||||
## Breakdown of the GPU TFHE-rs program
|
||||
|
||||
### Key generation
|
||||
|
||||
Comparing to the [CPU example](../../getting_started/quick_start.md), in the code snippet above,
|
||||
Comparing to the [CPU example](../../getting-started/quick-start.md), in the code snippet above,
|
||||
the server-side must call `decompress_to_gpu` to enable GPU-execution for the ensuing operations on ciphertexts. This function assigns all available GPUs to the server key.
|
||||
```Rust
|
||||
let gpu_key = compressed_server_key.decompress_to_gpu();
|
||||
```
|
||||
Once the key is decompressed to GPU and set with `set_server_key`, operations on ciphertexts execute on the GPU. In the example above:
|
||||
- `compressed_server_key` is a [`CompressedServerKey`](https://docs.rs/tfhe/latest/tfhe/struct.CompressedServerKey.html), stored on CPU. The client-side should ensure this key is generated with [GPU cryptographic parameters](run_on_gpu.md#gpu-tfhe-rs-features).
|
||||
- `compressed_server_key` is a [`CompressedServerKey`](https://docs.rs/tfhe/latest/tfhe/struct.CompressedServerKey.html), stored on CPU. The client-side should ensure this key is generated with [GPU cryptographic parameters](run-on-gpu.md#gpu-tfhe-rs-features).
|
||||
- `gpu_key` is the [`CudaServerKey`](https://docs.rs/tfhe/latest/tfhe/struct.CudaServerKey.html) corresponding to `compressed_server_key` and is stored on the GPU assigned to it.
|
||||
- [`set_server_key`](https://docs.rs/tfhe/latest/tfhe/fn.set_server_key.html) sets either a CPU or GPU key. In this example, `compressed_server_key` and `gpu_key` have GPU cryptographic parameters. A GPU server key can enable automatic parallelization on multiple GPUs.
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
# Benchmarks
|
||||
|
||||
Please refer to the [HPU benchmarks](../../getting_started/benchmarks/hpu/README.md) for detailed performance benchmark results.
|
||||
Please refer to the [HPU benchmarks](../../getting-started/benchmarks/hpu/README.md) for detailed performance benchmark results.
|
||||
@@ -10,7 +10,7 @@ This guide explains how to update your existing program to leverage HPU accelera
|
||||
* A HPU bitstream that you can find (or build) in [HPU fpga repository](https://github.com/zama-ai/hpu_fpga) and load in V80 flash and FPGA using its [README](https://github.com/zama-ai/hpu_fpga/blob/main/README.md)
|
||||
* AMI linux device driver version from this [fork](https://github.com/zama-ai/AVED)
|
||||
* QDMA linux device driver version from this [fork](https://github.com/zama-ai/dma_ip_drivers)
|
||||
* Rust version - check this [page](../rust_configuration.md)
|
||||
* Rust version - check this [page](../rust-configuration.md)
|
||||
|
||||
## Importing to your project
|
||||
|
||||
@@ -38,7 +38,7 @@ For optimal performance when using **TFHE-rs**, run your code in release mode wi
|
||||
|
||||
### Configuring and creating keys.
|
||||
|
||||
Comparing to the [CPU example](../../getting_started/quick_start.md), HPU set up differs in the key creation and device registration, as detailed [here](run\_on\_hpu.md#setting-the-hpu)
|
||||
Comparing to the [CPU example](../../getting-started/quick-start.md), HPU set up differs in the key creation and device registration, as detailed [here](run-on-hpu.md#setting-the-hpu)
|
||||
|
||||
Here is a full example (combining the client and server parts):
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# Parallelized PBS
|
||||
|
||||
This document describes the implementation and benefits of parallelized [Programmable Bootstrapping](../getting_started/security_and_cryptography.md#programmable-bootstrapping-pbs) (PBS) in **TFHE-rs**, including code examples for using multi-bit PBS parameters and ensuring deterministic execution.
|
||||
This document describes the implementation and benefits of parallelized [Programmable Bootstrapping](../getting-started/security-and-cryptography.md#programmable-bootstrapping-pbs) (PBS) in **TFHE-rs**, including code examples for using multi-bit PBS parameters and ensuring deterministic execution.
|
||||
|
||||
## Parallelized Programmable Bootstrapping
|
||||
|
||||
@@ -156,4 +156,4 @@ pub fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
|
||||
## Benchmark
|
||||
|
||||
Please refer to the [Zero-knowledge proof benchmarks](../../getting_started/benchmarks/zk_proof_benchmarks.md) for detailed performance benchmark results.
|
||||
Please refer to the [Zero-knowledge proof benchmarks](../../getting-started/benchmarks/zk-proof-benchmarks.md) for detailed performance benchmark results.
|
||||
|
||||
@@ -4,7 +4,7 @@ This document explains how to initialize the configuration and generate keys.
|
||||
|
||||
The configuration specifies the selected data types and their custom crypto-parameters. You should only use custom parameters for advanced usage and/or testing.
|
||||
|
||||
To create a configuration, use the `ConfigBuilder` type. The following example shows the setup using 8-bit unsigned integers with default parameters. Additionally, ensure the `integers` feature is enabled, as indicated in the table on [this page](../../configuration/rust_configuration.md#homomorphic-types).
|
||||
To create a configuration, use the `ConfigBuilder` type. The following example shows the setup using 8-bit unsigned integers with default parameters. Additionally, ensure the `integers` feature is enabled, as indicated in the table on [this page](../../configuration/rust-configuration.md#homomorphic-types).
|
||||
|
||||
The configuration is initialized by creating a builder with all types deactivated. Then, the integer types with default parameters are activated, for using `FheUint8` values.
|
||||
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
# Cryptographic Parameters
|
||||
|
||||
This document explains how the choice of cryptographic parameters impacts both the security and efficiency of FHE algorithms. The chosen parameters determine the error probability (sometimes referred to failure probability) and overall performance of computations using fully homomorphic encryption. This error probability is due to the noisy nature of FHE computations (see [here](../../getting\_started/security\_and\_cryptography.md) for more details about the encryption process).
|
||||
This document explains how the choice of cryptographic parameters impacts both the security and efficiency of FHE algorithms. The chosen parameters determine the error probability (sometimes referred to failure probability) and overall performance of computations using fully homomorphic encryption. This error probability is due to the noisy nature of FHE computations (see [here](../../getting-started/security-and-cryptography.md) for more details about the encryption process).
|
||||
|
||||
All parameter sets provide at least 128-bits of security according to the [Lattice-Estimator](https://github.com/malb/lattice-estimator).
|
||||
|
||||
## Default parameters
|
||||
Currently, the default parameters use blocks that contain 2 bits of message and 2 bits of carry - a tweaked uniform (TUniform, defined [here](../../getting_started/security_and_cryptography.md#noise)) noise distribution, and have a bootstrapping failure probability $$p_{error} \le 2^{-128}$$.
|
||||
These are particularly suitable for applications that need to be secure in the IND-CPA^D model (see [here](../../getting_started/security_and_cryptography.md#security) for more details).
|
||||
Currently, the default parameters use blocks that contain 2 bits of message and 2 bits of carry - a tweaked uniform (TUniform, defined [here](../../getting-started/security-and-cryptography.md#noise)) noise distribution, and have a bootstrapping failure probability $$p_{error} \le 2^{-128}$$.
|
||||
These are particularly suitable for applications that need to be secure in the IND-CPA^D model (see [here](../../getting-started/security-and-cryptography.md#security) for more details).
|
||||
The GPU backend still uses an error probability smaller than $$2^{-64}$$ by default. Those will be updated soon.
|
||||
|
||||
When using the high-level API of **TFHE-rs**, you can create a key pair using the default recommended set of parameters. For example:
|
||||
|
||||
@@ -36,7 +36,7 @@ fn main() {
|
||||
The safe deserialization must take the output of a safe-serialization as input. During the process, the following validation occurs:
|
||||
|
||||
* **Type match**: deserializing `type A` from a serialized `type B` raises an error indicating "On deserialization, expected type A, got type B".
|
||||
* **Version compatibility**: data serialized in previous versions of **TFHE-rs** are automatically upgraded to the latest version using the [data versioning](data_versioning.md) feature.
|
||||
* **Version compatibility**: data serialized in previous versions of **TFHE-rs** are automatically upgraded to the latest version using the [data versioning](data-versioning.md) feature.
|
||||
* **Parameter compatibility**: deserializing an object of `type A` with one set of crypto parameters from an object of `type A` with another set of crypto parameters raises an error indicating "Deserialized object of type A not conformant with given parameter set"
|
||||
* If both parameter sets have the same LWE dimension for ciphertexts, a ciphertext from param 1 may not fail this deserialization check with param 2.
|
||||
* This check can't distinguish ciphertexts/server keys from independent client keys with the same parameters.
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
This document explains a feature to facilitate debugging.
|
||||
|
||||
Starting from **TFHE-rs 0.5**, [trivial ciphertexts](../advanced-features/trivial_ciphertext.md) introduce a new feature to facilitate debugging. This feature supports a debugger, print statements, and faster execution, significantly reducing waiting time and enhancing the development pace of FHE applications.
|
||||
Starting from **TFHE-rs 0.5**, [trivial ciphertexts](../advanced-features/trivial-ciphertext.md) introduce a new feature to facilitate debugging. This feature supports a debugger, print statements, and faster execution, significantly reducing waiting time and enhancing the development pace of FHE applications.
|
||||
|
||||
{% hint style="warning" %}
|
||||
Trivial ciphertexts are not secure. An application released/deployed in production must never receive trivial ciphertext from a client.
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# What is TFHE-rs?
|
||||
|
||||

|
||||

|
||||
|
||||
**TFHE-rs** is a pure Rust implementation of Fully Homomorphic Encryption over the Torus (TFHE) to perform Boolean and integer arithmetic on encrypted data.
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
# Benchmarks
|
||||
|
||||
This document summarizes the timings of some homomorphic operations over 64-bit encrypted integers, depending on the hardware. More details are given for [the CPU](cpu/README.md), [the GPU](gpu/README.md), [the HPU](hpu/README.md) or [zeros-knowledge proofs](zk_proof_benchmarks.md).
|
||||
This document summarizes the timings of some homomorphic operations over 64-bit encrypted integers, depending on the hardware. More details are given for [the CPU](cpu/README.md), [the GPU](gpu/README.md), [the HPU](hpu/README.md) or [zeros-knowledge proofs](zk-proof-benchmarks.md).
|
||||
|
||||
The cryptographic parameters used for benchmarking follow a tweaked uniform (TUniform) noise distribution instead of a Gaussian. The main advantage of this distribution is to be bounded, whereas the usual Gaussian one is not. In some practical cases, this can simplify the use of homomorphic computation. See the [noise section](../security_and_cryptography.md#noise) of the Security and cryptography documentation page for more information on the noise distributions.
|
||||
The cryptographic parameters used for benchmarking follow a tweaked uniform (TUniform) noise distribution instead of a Gaussian. The main advantage of this distribution is to be bounded, whereas the usual Gaussian one is not. In some practical cases, this can simplify the use of homomorphic computation. See the [noise section](../security-and-cryptography.md#noise) of the Security and cryptography documentation page for more information on the noise distributions.
|
||||
|
||||
You can get the parameters used for benchmarks by cloning the repository and checking out the commit you want to use (starting with the v0.8.0 release) and run the following make command:
|
||||
|
||||
@@ -19,4 +19,4 @@ Benchmarks in the Table below were launched on:
|
||||
* HPU: using 1xv80 Alveo board
|
||||
{% endhint %}
|
||||
|
||||

|
||||

|
||||
@@ -8,5 +8,5 @@ By their nature, homomorphic operations run slower than their cleartext equivale
|
||||
All CPU benchmarks were launched on an `AWS hpc7a.96xlarge` instance equipped with a 96-core `AMD EPYC 9R14 CPU @ 2.60GHz` and 740GB of RAM.
|
||||
{% endhint %}
|
||||
|
||||
* [Integer operations](cpu_integer_operations.md)
|
||||
* [Programmable Bootstrapping](cpu_programmable_bootstrapping.md)
|
||||
* [Integer operations](cpu-integer-operations.md)
|
||||
* [Programmable Bootstrapping](cpu-programmable-bootstrapping.md)
|
||||
@@ -14,15 +14,15 @@ The following tables benchmark the execution time of some operation sets using `
|
||||
|
||||
The next table shows the operation timings on CPU when all inputs are encrypted:
|
||||
|
||||

|
||||

|
||||
|
||||
The next table shows the operation timings on CPU when the left input is encrypted and the right is a clear scalar of the same size:
|
||||
|
||||

|
||||

|
||||
|
||||
All timings are based on parallelized Radix-based integer operations where each block is encrypted using the default parameters `PARAM_MESSAGE_2_CARRY_2_KS_PBS`. To ensure predictable timings, we perform operations in the `default` mode, which ensures that the input and output encoding are similar (i.e., the carries are always emptied).
|
||||
|
||||
You can minimize operational costs by selecting from 'unchecked', 'checked', or 'smart' modes from [the fine-grained APIs](../../../references/fine-grained-apis/quick_start.md), each balancing performance and correctness differently. For more details about parameters, see [here](../../../references/fine-grained-apis/shortint/parameters.md). You can find the benchmark results on GPU for all these operations on GPU [here](../../../getting_started/benchmarks/gpu/README.md) and on HPU [here](../../../configuration/hpu_acceleration/benchmark.md).
|
||||
You can minimize operational costs by selecting from 'unchecked', 'checked', or 'smart' modes from [the fine-grained APIs](../../../references/fine-grained-apis/quick-start.md), each balancing performance and correctness differently. For more details about parameters, see [here](../../../references/fine-grained-apis/shortint/parameters.md). You can find the benchmark results on GPU for all these operations on GPU [here](../../../getting-started/benchmarks/gpu/README.md) and on HPU [here](../../../configuration/hpu-acceleration/benchmark.md).
|
||||
|
||||
## Reproducing TFHE-rs benchmarks
|
||||
|
||||
@@ -13,15 +13,15 @@ Note that these benchmarks use Gaussian parameters. `MB-PBS` stands for multi-bi
|
||||
|
||||
## P-fail: $$2^{-40}$$
|
||||
|
||||

|
||||

|
||||
|
||||
## P-fail: $$2^{-64}$$
|
||||
|
||||

|
||||

|
||||
|
||||
## P-fail: $$2^{-128}$$
|
||||
|
||||

|
||||

|
||||
|
||||
## Reproducing TFHE-rs benchmarks
|
||||
|
||||
@@ -8,5 +8,5 @@ By their nature, homomorphic operations run slower than their cleartext equivale
|
||||
All GPU benchmarks were launched on H100 GPUs, and rely on the multithreaded PBS algorithm.
|
||||
{% endhint %}
|
||||
|
||||
* [Integer operations](gpu_integer_operations.md)
|
||||
* [Programmable Bootstrapping](gpu_programmable_bootstrapping.md)
|
||||
* [Integer operations](gpu-integer-operations.md)
|
||||
* [Programmable Bootstrapping](gpu-programmable-bootstrapping.md)
|
||||
@@ -13,11 +13,11 @@ The cryptographic parameters `PARAM_GPU_MULTI_BIT_GROUP_4_MESSAGE_2_CARRY_2_KS_P
|
||||
Below come the results for the execution on eight H100 using SXM technology.
|
||||
The following table shows the performance when the inputs of the benchmarked operation are encrypted:
|
||||
|
||||

|
||||

|
||||
|
||||
The following table shows the performance when the left input of the benchmarked operation is encrypted and the other is a clear scalar of the same size:
|
||||
|
||||

|
||||

|
||||
|
||||
## Reproducing TFHE-rs benchmarks
|
||||
|
||||
@@ -8,15 +8,15 @@ All GPU benchmarks were launched on H100 GPUs, and rely on the multithreaded PBS
|
||||
|
||||
## P-fail: $$2^{-40}$$
|
||||
|
||||

|
||||

|
||||
|
||||
## P-fail: $$2^{-64}$$
|
||||
|
||||

|
||||

|
||||
|
||||
## P-fail: $$2^{-128}$$
|
||||
|
||||

|
||||

|
||||
|
||||
## Reproducing TFHE-rs benchmarks
|
||||
|
||||
@@ -8,4 +8,4 @@ By their nature, homomorphic operations run slower than their cleartext equivale
|
||||
All HPU benchmarks were launched on AMD Alveo v80 FPGAs.
|
||||
{% endhint %}
|
||||
|
||||
* [Integer operations](hpu_integer_operations.md)
|
||||
* [Integer operations](hpu-integer-operations.md)
|
||||
@@ -12,11 +12,11 @@ The cryptographic parameters `HPU_PARAM_MESSAGE_2_CARRY_2_KS32_PBS_TUNIFORM_2M12
|
||||
Below are the results for the execution on a single Alveo v80 board.
|
||||
The following table shows the performance when the inputs of the benchmarked operation are encrypted:
|
||||
|
||||

|
||||

|
||||
|
||||
The following table shows the performance when the left input of the benchmarked operation is encrypted and the other is a clear scalar of the same size:
|
||||
|
||||

|
||||

|
||||
|
||||
## Reproducing TFHE-rs benchmarks
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# Zero-knowledge proof benchmarks
|
||||
|
||||
This document details the performance benchmarks of [zero-knowledge proofs](../../fhe-computation/advanced-features/zk-pok.md) for [compact public key encryption](../../fhe-computation/advanced-features/public_key.md) using **TFHE-rs**.
|
||||
This document details the performance benchmarks of [zero-knowledge proofs](../../fhe-computation/advanced-features/zk-pok.md) for [compact public key encryption](../../fhe-computation/advanced-features/public-key.md) using **TFHE-rs**.
|
||||
|
||||
Benchmarks for the zero-knowledge proofs have been run on a `m6i.4xlarge` with 16 cores to simulate a usual client configuration. The verifications are done on an `hpc7a.96xlarge` AWS instance to mimic a powerful server.
|
||||
|
||||
@@ -43,5 +43,5 @@ tfhe = { version = "~1.3.0", features = ["boolean", "shortint", "integer", "soft
|
||||
**TFHE-rs** now features hardware-accelerated backends.
|
||||
|
||||
You can refer to the:
|
||||
- [GPU backend instructions](../configuration/gpu_acceleration/run_on_gpu.md) to benefit from GPU accelerated primitives.
|
||||
- [HPU backend instructions](../configuration/hpu_acceleration/run_on_hpu.md) to benefit from custom FPGA accelerated primitives.
|
||||
- [GPU backend instructions](../configuration/gpu-acceleration/run-on-gpu.md) to benefit from GPU accelerated primitives.
|
||||
- [HPU backend instructions](../configuration/hpu-acceleration/run-on-hpu.md) to benefit from custom FPGA accelerated primitives.
|
||||
@@ -4,7 +4,7 @@ This document explains the basic steps of using the high-level API of **TFHE-rs.
|
||||
|
||||
## Setting up a Rust project
|
||||
|
||||
If you already know how to set up a Rust project, feel free to go directly to the next [section](quick_start.md#using-tfhe-rs-and-its-apis).
|
||||
If you already know how to set up a Rust project, feel free to go directly to the next [section](quick-start.md#using-tfhe-rs-and-its-apis).
|
||||
|
||||
First, install the Rust programming language tools. Visit https://rustup.rs/ and follow the instructions. For alternative installation methods, refer to the [official Rust installation page](https://rust-lang.github.io/rustup/installation/other.html).
|
||||
|
||||
@@ -116,4 +116,4 @@ fn main() {
|
||||
}
|
||||
```
|
||||
|
||||
You can learn more about homomorphic types and associated compilation features in the [configuration documentation.](../configuration/rust_configuration.md)
|
||||
You can learn more about homomorphic types and associated compilation features in the [configuration documentation.](../configuration/rust-configuration.md)
|
||||
@@ -23,7 +23,7 @@ $$plaintext = (\Delta * m) + e$$
|
||||
|
||||
$$m \in \mathbb{Z}_p$$
|
||||
|
||||

|
||||

|
||||
|
||||
To get a **ciphertext** from a **plaintext,** you must encrypt the plaintext using a secret key.
|
||||
|
||||
@@ -73,7 +73,7 @@ TFHE scheme draws this random noise either from:
|
||||
|
||||
The following figure illustrates how the extra bit of noise is incurred during an addition operation.
|
||||
|
||||

|
||||

|
||||
|
||||
**TFHE-rs** enables automatic noise management by performing bootstrapping operations to reset the noise.
|
||||
|
||||
@@ -91,7 +91,7 @@ Since encoded values have a fixed precision, operating on them can produce resul
|
||||
|
||||
For example, when adding two ciphertexts, the sum could exceed the range of either ciphertext, and thus necessitate a carry that would then be transferred onto the first padding bit. In the following figure, each plaintext over 32 bits has one bit of padding on its left (the most significant bit). After the addition, the padding bit gets consumed to accommodate the carry. We refer to this process as **consuming** bits of padding. Without any padding-left, further additions may not produce accurate results.
|
||||
|
||||

|
||||

|
||||
|
||||
## Security
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# Fine-grained APIs
|
||||
|
||||
* [Quick start](quick\_start.md)
|
||||
* [Quick start](quick-start.md)
|
||||
* [Boolean](boolean/)
|
||||
* [Shortint](shortint/)
|
||||
* [Integer](integer/)
|
||||
|
||||
@@ -6,7 +6,7 @@ The structure and operations related to integers are described in this section.
|
||||
|
||||
In `integer`, the encrypted data is split amongst many ciphertexts encrypted with the `shortint` library. Below is a scheme representing an integer composed by k shortint ciphertexts.
|
||||
|
||||

|
||||

|
||||
|
||||
This crate implements two ways to represent an integer:
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
# Tutorial
|
||||
|
||||
`tfhe::shortint` is dedicated to the manipulation of small unsigned integers that fit in a single [LWE ciphertext](../../../getting_started/security_and_cryptography.md#lwe-ciphertexts). The actual size depends on the chosen parameters, but is always smaller than 8 bits. For example, with the `PARAM_MESSAGE_2_CARRY_2_KS_PBS` parameters, you can encode messages of 2 bits inside a `shortint`.
|
||||
`tfhe::shortint` is dedicated to the manipulation of small unsigned integers that fit in a single [LWE ciphertext](../../../getting-started/security-and-cryptography.md#lwe-ciphertexts). The actual size depends on the chosen parameters, but is always smaller than 8 bits. For example, with the `PARAM_MESSAGE_2_CARRY_2_KS_PBS` parameters, you can encode messages of 2 bits inside a `shortint`.
|
||||
|
||||
The [integer](../integer/README.md) and [high-level](../quick_start.md#high-level-api) API leverage shortints to allow homomorphic computations over larger integers.
|
||||
The [integer](../integer/README.md) and [high-level](../quick-start.md#high-level-api) API leverage shortints to allow homomorphic computations over larger integers.
|
||||
|
||||
The steps to homomorphically evaluate a `shortint` circuit are described below.
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ In `shortint`, the encrypted data is stored in an LWE ciphertext.
|
||||
|
||||
Conceptually, the message stored in an LWE ciphertext is divided into a **carry buffer** and a **message buffer**.
|
||||
|
||||

|
||||

|
||||
|
||||
The message buffer is the space where the actual message is stored. This represents the modulus of the input messages (denoted by `MessageModulus` in the code). When doing computations on a ciphertext, the encrypted message can overflow the message modulus. The part of the message which exceeds the message modulus is stored in the carry buffer. The size of the carry buffer is defined by another modulus, called `CarryModulus`.
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# Cryptographic Parameters
|
||||
|
||||
All parameter sets provide at least 128-bits of security according to the [Lattice-Estimator](https://github.com/malb/lattice-estimator), with an error probability equal to $$2^{-64}$$ when using programmable bootstrapping. This error probability is due to the randomness added at each encryption (see [here](../../../getting\_started/security\_and\_cryptography.md) for more details about the encryption process).
|
||||
All parameter sets provide at least 128-bits of security according to the [Lattice-Estimator](https://github.com/malb/lattice-estimator), with an error probability equal to $$2^{-64}$$ when using programmable bootstrapping. This error probability is due to the randomness added at each encryption (see [here](../../../getting-started/security-and-cryptography.md) for more details about the encryption process).
|
||||
|
||||
## Parameters and message precision
|
||||
|
||||
@@ -34,7 +34,7 @@ fn main() {
|
||||
|
||||
## Impact of parameters on the operations
|
||||
|
||||
As shown [here](../../../getting_started/benchmarks/cpu/README.md), the choice of the parameter set impacts the operations available and their efficiency.
|
||||
As shown [here](../../../getting-started/benchmarks/cpu/README.md), the choice of the parameter set impacts the operations available and their efficiency.
|
||||
|
||||
### Generic bi-variate functions.
|
||||
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
|
||||
### Start here
|
||||
|
||||
* [Homomorphic parity bit](parity\_bit.md)
|
||||
* [Homomorphic case changing on Ascii string](ascii\_fhe\_string.md)
|
||||
* [SHA 256 with Boolean API](sha256\_bool.md)
|
||||
* [Homomorphic parity bit](parity-bit.md)
|
||||
* [Homomorphic case changing on Ascii string](ascii-fhe-string.md)
|
||||
* [SHA 256 with Boolean API](sha256-bool.md)
|
||||
|
||||
### Go further
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@ The SHA-256 function processes the input data in blocks or chunks of 512 bits. B
|
||||
2. Append "0" bits until exactly 64 bits remain to make the message length a multiple of 512
|
||||
3. Append the last 64 bits as a binary encoding of the original input length
|
||||
|
||||

|
||||

|
||||
|
||||
In this diagram, the numbers on the top represent the length of the padded input at each position. The formula L+1+k+64 ensures that the length reaches a multiple of 512, matching the required length of the padded input.
|
||||
|
||||
@@ -7,11 +7,11 @@ mod test_cpu_doc {
|
||||
|
||||
// CONFIGURATION
|
||||
doctest!(
|
||||
"../docs/configuration/parallelized_pbs.md",
|
||||
"../docs/configuration/parallelized-pbs.md",
|
||||
configuration_parallelized_pbs
|
||||
);
|
||||
doctest!(
|
||||
"../docs/configuration/rust_configuration.md",
|
||||
"../docs/configuration/rust-configuration.md",
|
||||
configuration_rust_configuration
|
||||
);
|
||||
|
||||
@@ -27,19 +27,19 @@ mod test_cpu_doc {
|
||||
advanced_features_noise_squashing
|
||||
);
|
||||
doctest!(
|
||||
"../docs/fhe-computation/advanced-features/overflow_operations.md",
|
||||
"../docs/fhe-computation/advanced-features/overflow-operations.md",
|
||||
advanced_features_overflow_operations
|
||||
);
|
||||
doctest!(
|
||||
"../docs/fhe-computation/advanced-features/public_key.md",
|
||||
"../docs/fhe-computation/advanced-features/public-key.md",
|
||||
advanced_features_public_key
|
||||
);
|
||||
doctest!(
|
||||
"../docs/fhe-computation/advanced-features/rayon_crate.md",
|
||||
"../docs/fhe-computation/advanced-features/rayon-crate.md",
|
||||
advanced_features_rayon_crate
|
||||
);
|
||||
doctest!(
|
||||
"../docs/fhe-computation/advanced-features/trivial_ciphertext.md",
|
||||
"../docs/fhe-computation/advanced-features/trivial-ciphertext.md",
|
||||
advanced_features_trivial_ciphertext
|
||||
);
|
||||
doctest!(
|
||||
@@ -76,7 +76,7 @@ mod test_cpu_doc {
|
||||
data_handling_compress
|
||||
);
|
||||
doctest!(
|
||||
"../docs/fhe-computation/data-handling/data_versioning.md",
|
||||
"../docs/fhe-computation/data-handling/data-versioning.md",
|
||||
data_handling_data_versioning
|
||||
);
|
||||
doctest!(
|
||||
@@ -125,7 +125,7 @@ mod test_cpu_doc {
|
||||
tooling_pbs_stats
|
||||
);
|
||||
doctest!(
|
||||
"../docs/fhe-computation/tooling/trait_bounds.md",
|
||||
"../docs/fhe-computation/tooling/trait-bounds.md",
|
||||
tooling_trait_bounds
|
||||
);
|
||||
|
||||
@@ -135,7 +135,7 @@ mod test_cpu_doc {
|
||||
|
||||
// GETTING STARTED
|
||||
doctest!(
|
||||
"../docs/getting_started/quick_start.md",
|
||||
"../docs/getting-started/quick-start.md",
|
||||
getting_started_quick_start
|
||||
);
|
||||
|
||||
@@ -143,7 +143,7 @@ mod test_cpu_doc {
|
||||
|
||||
// FINE GRAINED API
|
||||
doctest!(
|
||||
"../docs/references/fine-grained-apis/quick_start.md",
|
||||
"../docs/references/fine-grained-apis/quick-start.md",
|
||||
references_fine_grained_apis_quick_start
|
||||
);
|
||||
|
||||
@@ -209,10 +209,10 @@ mod test_cpu_doc {
|
||||
|
||||
// Tutorials
|
||||
doctest!(
|
||||
"../docs/tutorials/ascii_fhe_string.md",
|
||||
"../docs/tutorials/ascii-fhe-string.md",
|
||||
tutorials_ascii_fhe_string
|
||||
);
|
||||
doctest!("../docs/tutorials/parity_bit.md", tutorials_parity_bit);
|
||||
doctest!("../docs/tutorials/parity-bit.md", tutorials_parity_bit);
|
||||
}
|
||||
|
||||
#[cfg(feature = "gpu")]
|
||||
@@ -220,31 +220,31 @@ mod test_gpu_doc {
|
||||
use doc_comment::doctest;
|
||||
|
||||
doctest!(
|
||||
"../docs/configuration/gpu_acceleration/run_on_gpu.md",
|
||||
"../docs/configuration/gpu-acceleration/run-on-gpu.md",
|
||||
configuration_gpu_acceleration_run_on_gpu
|
||||
);
|
||||
doctest!(
|
||||
"../docs/configuration/gpu_acceleration/gpu_operations.md",
|
||||
"../docs/configuration/gpu-acceleration/gpu-operations.md",
|
||||
configuration_gpu_acceleration_gpu_operations
|
||||
);
|
||||
doctest!(
|
||||
"../docs/configuration/gpu_acceleration/compressing_ciphertexts.md",
|
||||
"../docs/configuration/gpu-acceleration/compressing-ciphertexts.md",
|
||||
configuration_gpu_acceleration_compressing_ciphertexts
|
||||
);
|
||||
doctest!(
|
||||
"../docs/configuration/gpu_acceleration/array_type.md",
|
||||
"../docs/configuration/gpu-acceleration/array-type.md",
|
||||
configuration_gpu_acceleration_array_type
|
||||
);
|
||||
doctest!(
|
||||
"../docs/configuration/gpu_acceleration/multi_gpu.md",
|
||||
"../docs/configuration/gpu-acceleration/multi-gpu.md",
|
||||
configuration_gpu_acceleration_multi_gpu_device_selection
|
||||
);
|
||||
doctest!(
|
||||
"../docs/configuration/gpu_acceleration/zk-pok.md",
|
||||
"../docs/configuration/gpu-acceleration/zk-pok.md",
|
||||
configuration_gpu_acceleration_zk_pok
|
||||
);
|
||||
doctest!(
|
||||
"../docs/configuration/gpu_acceleration/simple_example.md",
|
||||
"../docs/configuration/gpu-acceleration/simple-example.md",
|
||||
configuration_gpu_simple_example
|
||||
);
|
||||
}
|
||||
@@ -254,7 +254,7 @@ mod test_hpu_doc {
|
||||
use doc_comment::doctest;
|
||||
|
||||
doctest!(
|
||||
"../docs/configuration/hpu_acceleration/run_on_hpu.md",
|
||||
"../docs/configuration/hpu-acceleration/run-on-hpu.md",
|
||||
configuration_hpu_acceleration_run_on_hpu
|
||||
);
|
||||
}
|
||||
|
||||