Skip to content

Commit 259d125

Browse files
committed
fix(gpu): fix pbs and ks benchmarks
1 parent 2571196 commit 259d125

File tree

2 files changed

+18
-4
lines changed

2 files changed

+18
-4
lines changed

tfhe-benchmark/benches/core_crypto/ks_bench.rs

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ use benchmark::utilities::{
88
OperatorType,
99
};
1010
use criterion::{black_box, Criterion, Throughput};
11+
use itertools::Itertools;
1112
use rayon::prelude::*;
1213
use serde::Serialize;
1314
use std::env;
@@ -325,6 +326,7 @@ mod cuda {
325326
CudaLocalKeys, OperatorType,
326327
};
327328
use criterion::{black_box, Criterion, Throughput};
329+
use itertools::Itertools;
328330
use rayon::prelude::*;
329331
use serde::Serialize;
330332
use tfhe::core_crypto::gpu::glwe_ciphertext_list::CudaGlweCiphertextList;
@@ -750,8 +752,12 @@ mod cuda {
750752
pub fn cuda_multi_bit_ks_group() {
751753
let mut criterion: Criterion<_> =
752754
(Criterion::default().sample_size(2000)).configure_from_args();
753-
cuda_keyswitch(&mut criterion, &multi_bit_benchmark_parameters());
754-
cuda_packing_keyswitch(&mut criterion, &multi_bit_benchmark_parameters());
755+
let multi_bit_parameters = multi_bit_benchmark_parameters()
756+
.into_iter()
757+
.map(|(string, params, _)| (string, params))
758+
.collect_vec();
759+
cuda_keyswitch(&mut criterion, &multi_bit_parameters);
760+
cuda_packing_keyswitch(&mut criterion, &multi_bit_parameters);
755761
}
756762
}
757763

@@ -769,11 +775,16 @@ pub fn ks_group() {
769775
}
770776

771777
pub fn multi_bit_ks_group() {
778+
let multi_bit_parameters = multi_bit_benchmark_parameters()
779+
.into_iter()
780+
.map(|(string, params, _)| (string, params))
781+
.collect_vec();
782+
772783
let mut criterion: Criterion<_> = (Criterion::default()
773784
.sample_size(15)
774785
.measurement_time(std::time::Duration::from_secs(60)))
775786
.configure_from_args();
776-
keyswitch(&mut criterion, &multi_bit_benchmark_parameters());
787+
keyswitch(&mut criterion, &multi_bit_parameters);
777788
}
778789

779790
pub fn packing_ks_group() {

tfhe-benchmark/src/params.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,8 @@ pub mod shortint_params {
121121
)]
122122
}
123123

124-
pub fn multi_bit_benchmark_parameters() -> Vec<(String, CryptoParametersRecord<u64>)> {
124+
pub fn multi_bit_benchmark_parameters(
125+
) -> Vec<(String, CryptoParametersRecord<u64>, LweBskGroupingFactor)> {
125126
match get_parameters_set() {
126127
ParametersSet::Default => SHORTINT_MULTI_BIT_BENCH_PARAMS
127128
.iter()
@@ -131,6 +132,7 @@ pub mod shortint_params {
131132
<MultiBitPBSParameters as Into<AtomicPatternParameters>>::into(*params)
132133
.to_owned()
133134
.into(),
135+
params.grouping_factor,
134136
)
135137
})
136138
.collect(),
@@ -152,6 +154,7 @@ pub mod shortint_params {
152154
<MultiBitPBSParameters as Into<AtomicPatternParameters>>::into(*params)
153155
.to_owned()
154156
.into(),
157+
params.grouping_factor,
155158
)
156159
})
157160
.collect()

0 commit comments

Comments
 (0)