Skip to content
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

Basic cpu iris search using HNSW #327

Merged
merged 11 commits into from
Sep 11, 2024
Merged

Basic cpu iris search using HNSW #327

merged 11 commits into from
Sep 11, 2024

Conversation

rdragos
Copy link
Collaborator

@rdragos rdragos commented Sep 5, 2024

Adds prototype of HNSW search using CPU.
Concretely:

  1. Uses HawkSearcher basic traits to implement HNSW over plaintext and secret shared data (using replicated secret sharing).
  2. Adds few non-blocking functions to the IrisWorker struct. In the future I believe all these functions are going to be async - to avoid calling blocking code.
  3. Adds code for preliminary HNSW benches.

@rdragos rdragos marked this pull request as ready for review September 9, 2024 14:21
@rdragos rdragos requested a review from dkales September 9, 2024 14:21
iris-mpc-cpu/Cargo.toml Outdated Show resolved Hide resolved
iris-mpc-cpu/Cargo.toml Outdated Show resolved Hide resolved
iris-mpc-cpu/src/protocol/dots.rs Show resolved Hide resolved
@@ -63,6 +63,32 @@ impl<N: NetworkTrait> IrisWorker<N> {
Ok(res)
}

pub(crate) async fn rep3_dot_non_blocking(
&mut self,
a: &VecShare<u16>,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think also the whole VecShare type can probably go here, since it is just a wrapper around Vec<Share<T>>. I think this was leftover from some experiments on holding the internal shares as two separate vectors of all a and all b sub-shares.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure what you mean here. There are some associated functions implemented for VecShare, which would make things a bit more difficult to change all VecShare to Vec<Share<_>>
Or do you mean passing a: VecShare<u16> instead of a: &VecShare<u16>?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would gladly change this to https://docs.rs/ndarray/latest/ndarray/index.html instead 😄 so we can get other vector operations for free hehe

iris-mpc-cpu/src/protocol/iris_worker.rs Show resolved Hide resolved
iris-mpc-cpu/src/hawkers/plaintext_store.rs Show resolved Hide resolved
iris-mpc-cpu/src/database_generators.rs Show resolved Hide resolved
iris-mpc-cpu/src/database_generators.rs Outdated Show resolved Hide resolved
iris-mpc-cpu/src/database_generators.rs Outdated Show resolved Hide resolved
Comment on lines +163 to +165
(*lock)
.rep3_lift_and_cross_mul(d1, t1 as u32, d2, t2 as u32)
.unwrap()
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think mixing async and sync stuff here is not what we want. I would spend some time and unify the networking stuff into only async calls and then not mix them.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree, will refactor this once we merge this in and grab this one: #354

Should solve all our issues related to locking

@dkales
Copy link
Collaborator

dkales commented Sep 11, 2024

So I guess the plan is to merge this and then build on it, improve the networking etc?

@rdragos
Copy link
Collaborator Author

rdragos commented Sep 11, 2024

That's correct 👍

@rdragos rdragos merged commit 6ec26a3 into main Sep 11, 2024
13 checks passed
@rdragos rdragos deleted the dragos/iris-hawk branch September 11, 2024 14:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants