diff --git a/tfhe-benchmark/src/high_level_api/benchmark_op.rs b/tfhe-benchmark/src/high_level_api/benchmark_op.rs index 003f6340d5..930403bdf0 100644 --- a/tfhe-benchmark/src/high_level_api/benchmark_op.rs +++ b/tfhe-benchmark/src/high_level_api/benchmark_op.rs @@ -16,14 +16,13 @@ pub trait BenchmarkOp { fn execute(&self, inputs: &Self::Inputs) -> Self::Output; } -pub struct UnaryOp { - pub func: F, +pub struct UnaryOp { + pub func: fn(&FheType) -> R, pub _encrypt: PhantomData, } -impl BenchmarkOp for UnaryOp +impl BenchmarkOp for UnaryOp where - F: Fn(&FheType) -> R, R: BenchWait, FheType: FheEncrypt + Send + Sync, Standard: Distribution, @@ -40,17 +39,15 @@ where } } -pub struct ScalarBinaryOp { - pub func: F, - pub rng_function: G, +pub struct ScalarBinaryOp { + pub func: fn(&FheType, &T) -> R, + pub rng_function: fn() -> T, pub _encrypt: PhantomData, } -impl BenchmarkOp for ScalarBinaryOp +impl BenchmarkOp for ScalarBinaryOp where - F: Fn(&FheType, &T) -> R, R: BenchWait, - G: Fn() -> T, FheType: FheEncrypt + Sync + Send, Standard: Distribution, T: Sync + Send, @@ -70,17 +67,16 @@ where } } -pub struct BinaryOp { - pub func: F, +pub struct BinaryOp { + pub func: fn(&FheType, &FheRhsType) -> R, pub _encrypt_lhs: PhantomData, pub _encrypt_rhs: PhantomData, pub _rhs_type: PhantomData, } -impl BenchmarkOp - for BinaryOp +impl BenchmarkOp + for BinaryOp where - F: Fn(&FheType, &FheRhsType) -> R, R: BenchWait, FheType: FheEncrypt + Sync + Send, FheRhsType: FheEncrypt + Sync + Send, @@ -102,14 +98,13 @@ where } } -pub struct TernaryOp { - pub func: F, +pub struct TernaryOp { + pub func: fn(&FheBool, &FheType, &FheType) -> R, pub _encrypt: PhantomData, } -impl BenchmarkOp for TernaryOp +impl BenchmarkOp for TernaryOp where - F: Fn(&FheBool, &FheType, &FheType) -> R, R: BenchWait, FheType: FheEncrypt + Sync + Send, Standard: Distribution, @@ -130,15 +125,14 @@ where } } -pub struct ArrayOp { - pub func: F, +pub struct ArrayOp { + pub func: fn(std::slice::Iter<'_, FheType>) -> FheType, pub array_size: usize, pub _encrypt: PhantomData, } -impl BenchmarkOp for ArrayOp +impl BenchmarkOp for ArrayOp where - F: for<'a> Fn(std::slice::Iter<'a, FheType>) -> FheType, FheType: FheEncrypt + Clone + BenchWait + Sync + Send, Standard: Distribution, {