Skip to content
Open
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
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ members = [
"tfhe-fft",
"tfhe-ntt",
"tfhe-zk-pok",
"utils/benchmark_spec",
"utils/param_dedup",
"utils/tfhe-backward-compat-checker",
"utils/tfhe-backward-compat-data",
Expand Down
5 changes: 3 additions & 2 deletions tfhe-benchmark/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,15 @@ tfhe-csprng = { path = "../tfhe-csprng" }
cpu-time = "1.0"
num_cpus = "1.17"
gag = "1.0.0"
benchmark_spec = { version = "0.1.0", path = "../utils/benchmark_spec" }

[features]
default = ["avx512"]
boolean = ["tfhe/boolean"]
shortint = ["tfhe/shortint"]
integer = ["shortint", "tfhe/integer"]
gpu = ["tfhe/gpu"]
hpu = ["tfhe/hpu"]
gpu = ["tfhe/gpu", "benchmark_spec/gpu"]
hpu = ["tfhe/hpu", "benchmark_spec/hpu"]
hpu-v80 = ["tfhe/hpu-v80"]
internal-keycache = ["tfhe/internal-keycache"]
avx512 = ["tfhe/avx512"]
Expand Down
4 changes: 2 additions & 2 deletions tfhe-benchmark/benches/boolean/bench.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use benchmark::utilities::{write_to_json, CryptoParametersRecord, OperatorType};
use benchmark::utilities::{write_to_json_unchecked, CryptoParametersRecord, OperatorType};
use criterion::{black_box, criterion_group, criterion_main, Criterion};
use tfhe::boolean::client_key::ClientKey;
use tfhe::boolean::parameters::{
Expand Down Expand Up @@ -27,7 +27,7 @@ pub fn write_to_json_boolean<T: Into<CryptoParametersRecord<u32>>>(
params_alias: impl Into<String>,
display_name: impl Into<String>,
) {
write_to_json(
write_to_json_unchecked(
bench_id,
params,
params_alias,
Expand Down
19 changes: 10 additions & 9 deletions tfhe-benchmark/benches/core_crypto/ks_bench.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ use benchmark::params::{
benchmark_compression_parameters, benchmark_parameters, multi_bit_benchmark_parameters,
};
use benchmark::utilities::{
get_bench_type, get_param_type, write_to_json, BenchmarkType, CryptoParametersRecord,
OperatorType, ParamType,
get_param_type, write_to_json_unchecked, CryptoParametersRecord, OperatorType, ParamType,
};
use benchmark_spec::{get_bench_type, BenchmarkType};
use criterion::{black_box, Criterion, Throughput};
use itertools::Itertools;
use rayon::prelude::*;
Expand Down Expand Up @@ -146,7 +146,7 @@ fn keyswitch<Scalar: UnsignedTorus + CastInto<usize> + Serialize>(
};

let bit_size = (params.message_modulus.unwrap_or(2) as u32).ilog2();
write_to_json(
write_to_json_unchecked(
&bench_id,
*params,
name,
Expand Down Expand Up @@ -330,7 +330,7 @@ fn packing_keyswitch<Scalar, F>(
};

let bit_size = (params.message_modulus.unwrap_or(2) as u32).ilog2();
write_to_json(
write_to_json_unchecked(
&bench_id,
*params,
name,
Expand All @@ -346,10 +346,11 @@ fn packing_keyswitch<Scalar, F>(
mod cuda {
use benchmark::params::{benchmark_parameters, multi_bit_benchmark_parameters};
use benchmark::utilities::{
cuda_local_keys_core, cuda_local_streams_core, get_bench_type, throughput_num_threads,
write_to_json, BenchmarkType, CpuKeys, CpuKeysBuilder, CryptoParametersRecord, CudaIndexes,
cuda_local_keys_core, cuda_local_streams_core, throughput_num_threads,
write_to_json_unchecked, CpuKeys, CpuKeysBuilder, CryptoParametersRecord, CudaIndexes,
CudaLocalKeys, OperatorType,
};
use benchmark_spec::{get_bench_type, BenchmarkType};
use criterion::{black_box, Criterion, Throughput};
use itertools::Itertools;
use rayon::prelude::*;
Expand Down Expand Up @@ -496,7 +497,7 @@ mod cuda {
}

let bit_size = (params.message_modulus.unwrap_or(2) as u32).ilog2();
write_to_json(
write_to_json_unchecked(
&bench_id,
*params,
name,
Expand Down Expand Up @@ -630,7 +631,7 @@ mod cuda {
});

let bit_size = (params.message_modulus.unwrap_or(2) as u32).ilog2();
write_to_json(
write_to_json_unchecked(
&bench_id,
*params,
name,
Expand Down Expand Up @@ -873,7 +874,7 @@ mod cuda {
};

let bit_size = (params.message_modulus.unwrap_or(2) as u32).ilog2();
write_to_json(
write_to_json_unchecked(
&bench_id,
*params,
name,
Expand Down
17 changes: 9 additions & 8 deletions tfhe-benchmark/benches/core_crypto/ks_pbs_bench.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ use benchmark::params::{
};

use benchmark::utilities::{
get_bench_type, get_param_type, write_to_json, BenchmarkType, CryptoParametersRecord,
OperatorType, ParamType,
get_param_type, write_to_json_unchecked, CryptoParametersRecord, OperatorType, ParamType,
};
use benchmark_spec::{get_bench_type, BenchmarkType};
use criterion::{black_box, Criterion, Throughput};
use rayon::prelude::*;
use serde::Serialize;
Expand Down Expand Up @@ -269,7 +269,7 @@ fn ks_pbs<Scalar: UnsignedTorus + CastInto<usize> + Serialize>(
}

let bit_size = (params.message_modulus.unwrap_or(2) as u32).ilog2();
write_to_json(
write_to_json_unchecked(
&bench_id,
*params,
name,
Expand Down Expand Up @@ -505,7 +505,7 @@ fn multi_bit_ks_pbs<
};

let bit_size = params.message_modulus.unwrap().ilog2();
write_to_json(
write_to_json_unchecked(
&bench_id,
*params,
name,
Expand All @@ -521,10 +521,11 @@ fn multi_bit_ks_pbs<
mod cuda {
use super::{benchmark_parameters, multi_bit_benchmark_parameters_with_grouping};
use benchmark::utilities::{
cuda_local_keys_core, cuda_local_streams_core, get_bench_type, throughput_num_threads,
write_to_json, BenchmarkType, CpuKeys, CpuKeysBuilder, CryptoParametersRecord, CudaIndexes,
cuda_local_keys_core, cuda_local_streams_core, throughput_num_threads,
write_to_json_unchecked, CpuKeys, CpuKeysBuilder, CryptoParametersRecord, CudaIndexes,
CudaLocalKeys, OperatorType, GPU_MAX_SUPPORTED_POLYNOMIAL_SIZE,
};
use benchmark_spec::{get_bench_type, BenchmarkType};
use criterion::{black_box, Criterion, Throughput};
use rayon::prelude::*;
use serde::Serialize;
Expand Down Expand Up @@ -833,7 +834,7 @@ mod cuda {
};

let bit_size = (params.message_modulus.unwrap_or(2) as u32).ilog2();
write_to_json(
write_to_json_unchecked(
&bench_id,
*params,
name,
Expand Down Expand Up @@ -1143,7 +1144,7 @@ mod cuda {
};

let bit_size = params.message_modulus.unwrap().ilog2();
write_to_json(
write_to_json_unchecked(
&bench_id,
*params,
name,
Expand Down
13 changes: 7 additions & 6 deletions tfhe-benchmark/benches/core_crypto/pbs128_bench.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use benchmark::params_aliases::{
BENCH_NOISE_SQUASHING_PARAM_MESSAGE_2_CARRY_2_KS_PBS_TUNIFORM_2M128,
BENCH_PARAM_MESSAGE_2_CARRY_2_KS_PBS_TUNIFORM_2M128,
};
use benchmark::utilities::{write_to_json, CryptoParametersRecord, OperatorType};
use benchmark::utilities::{write_to_json_unchecked, CryptoParametersRecord, OperatorType};
use criterion::{black_box, Criterion};
use dyn_stack::PodStack;
use tfhe::core_crypto::fft_impl::fft128::crypto::bootstrap::bootstrap_scratch;
Expand Down Expand Up @@ -149,7 +149,7 @@ fn pbs_128(c: &mut Criterion) {
};

let bit_size = (message_modulus as u32).ilog2();
write_to_json(
write_to_json_unchecked(
&id,
params_record,
noise_params.name(),
Expand All @@ -163,10 +163,11 @@ fn pbs_128(c: &mut Criterion) {
#[cfg(feature = "gpu")]
mod cuda {
use benchmark::utilities::{
cuda_local_keys_core, cuda_local_streams_core, get_bench_type, throughput_num_threads,
write_to_json, BenchmarkType, CpuKeys, CpuKeysBuilder, CryptoParametersRecord, CudaIndexes,
cuda_local_keys_core, cuda_local_streams_core, throughput_num_threads,
write_to_json_unchecked, CpuKeys, CpuKeysBuilder, CryptoParametersRecord, CudaIndexes,
CudaLocalKeys, OperatorType,
};
use benchmark_spec::{get_bench_type, BenchmarkType};
use criterion::{black_box, Criterion, Throughput};
use rayon::prelude::*;
use tfhe::core_crypto::gpu::glwe_ciphertext_list::CudaGlweCiphertextList;
Expand Down Expand Up @@ -430,7 +431,7 @@ mod cuda {
};

let bit_size = (message_modulus as u32).ilog2();
write_to_json(
write_to_json_unchecked(
&bench_id,
params_record,
params_name,
Expand Down Expand Up @@ -695,7 +696,7 @@ mod cuda {
};

let bit_size = (message_modulus as u32).ilog2();
write_to_json(
write_to_json_unchecked(
&bench_id,
params_record,
params_name,
Expand Down
21 changes: 11 additions & 10 deletions tfhe-benchmark/benches/core_crypto/pbs_bench.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ use benchmark::params::{
multi_bit_benchmark_parameters_with_grouping, multi_bit_num_threads,
};
use benchmark::utilities::{
get_bench_type, get_param_type, write_to_json, BenchmarkType, CryptoParametersRecord,
OperatorType, ParamType,
get_param_type, write_to_json_unchecked, CryptoParametersRecord, OperatorType, ParamType,
};
use benchmark_spec::{get_bench_type, BenchmarkType};
use criterion::{black_box, Criterion, Throughput};
use rayon::prelude::*;
use serde::Serialize;
Expand Down Expand Up @@ -220,7 +220,7 @@ fn mem_optimized_pbs<Scalar: UnsignedTorus + CastInto<usize> + Serialize>(
};

let bit_size = (params.message_modulus.unwrap_or(2) as u32).ilog2();
write_to_json(
write_to_json_unchecked(
&bench_id,
*params,
name,
Expand Down Expand Up @@ -460,7 +460,7 @@ fn mem_optimized_batched_pbs<Scalar: UnsignedTorus + CastInto<usize> + Serialize
};

let bit_size = (params.message_modulus.unwrap_or(2) as u32).ilog2();
write_to_json(
write_to_json_unchecked(
&bench_id,
*params,
name,
Expand Down Expand Up @@ -656,7 +656,7 @@ fn multi_bit_pbs<
};

let bit_size = params.message_modulus.unwrap().ilog2();
write_to_json(
write_to_json_unchecked(
&bench_id,
*params,
name,
Expand Down Expand Up @@ -920,7 +920,7 @@ fn mem_optimized_pbs_ntt(c: &mut Criterion) {
};

let bit_size = (params.message_modulus.unwrap_or(2) as u32).ilog2();
write_to_json(
write_to_json_unchecked(
&bench_id,
*params,
name,
Expand All @@ -936,10 +936,11 @@ fn mem_optimized_pbs_ntt(c: &mut Criterion) {
mod cuda {
use benchmark::params::{benchmark_parameters, multi_bit_benchmark_parameters};
use benchmark::utilities::{
cuda_local_keys_core, cuda_local_streams_core, get_bench_type, throughput_num_threads,
write_to_json, BenchmarkType, CpuKeys, CpuKeysBuilder, CryptoParametersRecord, CudaIndexes,
cuda_local_keys_core, cuda_local_streams_core, throughput_num_threads,
write_to_json_unchecked, CpuKeys, CpuKeysBuilder, CryptoParametersRecord, CudaIndexes,
CudaLocalKeys, OperatorType, GPU_MAX_SUPPORTED_POLYNOMIAL_SIZE,
};
use benchmark_spec::{get_bench_type, BenchmarkType};
use criterion::{black_box, Criterion, Throughput};
use rayon::prelude::*;
use serde::Serialize;
Expand Down Expand Up @@ -1188,7 +1189,7 @@ mod cuda {
};

let bit_size = (params.message_modulus.unwrap_or(2) as u32).ilog2();
write_to_json(
write_to_json_unchecked(
&bench_id,
*params,
name,
Expand Down Expand Up @@ -1446,7 +1447,7 @@ mod cuda {
};

let bit_size = params.message_modulus.unwrap().ilog2();
write_to_json(
write_to_json_unchecked(
&bench_id,
*params,
name,
Expand Down
Loading
Loading