-
Notifications
You must be signed in to change notification settings - Fork 157
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
function executor in string tests #1818
Conversation
impl<'a, F> FunctionExecutor<&'a mut RadixCiphertext, RadixCiphertext> for CpuFunctionExecutor<F> | ||
/// For unary operations | ||
/// | ||
/// Note, we need to `NotTuple` constraint to avoid conflicts with binary or ternary operations |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you show an example of a conflict case ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
impl<F, I1, O> FunctionExecutor<I1, O> for CpuFunctionExecutor<F>
where
F: Fn(&ServerKey, I1) -> O,
I1: NotTuple,
{
fn execute(&mut self, input: I1) -> O {
let sks = self.sks.as_ref().expect("setup was not properly called");
(self.func)(sks, input)
}
}
conflicts with
impl<F, I1, I2 O> FunctionExecutor<I1, O> for CpuFunctionExecutor<F>
where
F: Fn(&ServerKey, I1) -> O,
I1: NotTuple,
{
fn execute(&mut self, input: (I1, I2)) -> O {
let sks = self.sks.as_ref().expect("setup was not properly called");
(self.func)(sks, input)
}
}
Because the first case input: I1
conflicts with input: (I1, I2)
cargo build is red and there is a conflict |
d104914
to
a185223
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looked good to me, @tmontaigu if you have an opinion on the generic implementation for the CPU executor stuff
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see some P: Into<PBSParameters> + Clone
which surprisesme we need the clone
One minor thing that is not done on the integer tests, that slightly improves readability is to give an explicit name to the executor, e.g:
param: P,
mut eq_ingore_case_executor: T,
f: for<'a> fn(&'a str, &'a str) -> bool,
) {
//...
}
impl<'a, F> FunctionExecutor<&'a mut RadixCiphertext, RadixCiphertext> for CpuFunctionExecutor<F> | ||
/// For unary operations | ||
/// | ||
/// Note, we need to `NotTuple` constraint to avoid conflicts with binary or ternary operations |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
impl<F, I1, O> FunctionExecutor<I1, O> for CpuFunctionExecutor<F>
where
F: Fn(&ServerKey, I1) -> O,
I1: NotTuple,
{
fn execute(&mut self, input: I1) -> O {
let sks = self.sks.as_ref().expect("setup was not properly called");
(self.func)(sks, input)
}
}
conflicts with
impl<F, I1, I2 O> FunctionExecutor<I1, O> for CpuFunctionExecutor<F>
where
F: Fn(&ServerKey, I1) -> O,
I1: NotTuple,
{
fn execute(&mut self, input: (I1, I2)) -> O {
let sks = self.sks.as_ref().expect("setup was not properly called");
(self.func)(sks, input)
}
}
Because the first case input: I1
conflicts with input: (I1, I2)
fn setup(&mut self, _cks: &RadixClientKey, sks: Arc<ServerKey>) { | ||
self.sks = Some(sks); | ||
} | ||
pub(crate) trait NotTuple {} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👌
a185223
to
459520a
Compare
Renamed executors and |
b3d07ca
to
c525180
Compare
f9e7efa
to
9fe1dc5
Compare
9fe1dc5
to
1dc8d94
Compare
1dc8d94
to
a65fb98
Compare
No description provided.