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

refactor: KOS and preprocessing traits #155

Merged
merged 3 commits into from
Jun 12, 2024

Conversation

sinui0
Copy link
Collaborator

@sinui0 sinui0 commented Jun 10, 2024

This PR adds traits for the preprocessing model and also updates KOS to implement random OT for any Standard: Distribution<T> type.

Allocate trait rationale

It is difficult to properly model preprocessing in the case where a functionality is shared by multiple others. One approach would be to update the preprocess function so that it has a count argument then use some sort of async Barrier for synchronization. That approach doesn't work in the case where multiplexing isn't available (only 1 context).

The approach I settled on was to decouple reserving capacity step from execution of the preprocessing. The implemented model is 2 steps:

  1. A functionality is injected as a sub-protocol into other protocols. Those protocols themselves implement Allocate, which allocate what they need from the sub-protocol. This process does not requires synchronization.
  2. Once all protocols have allocated what they need, Preprocess is called which actually executes the preprocessing all batched together.

Modeling it this way works for both cases where a functionality is "shared" or owned directly by another protocol.

Side note: Once we have SoftSpoken which can be extended multiple times, we should be able to just share the base OT and perform OT extensions in parallel instead of this batching. This will remove the need for shared state synchronization and be more performant in terms of latency and compute.

@sinui0 sinui0 requested review from themighty1 and th4s June 10, 2024 16:30
Base automatically changed from refactor/kos-traits to threading-refactor June 11, 2024 06:09
Copy link
Member

@th4s th4s left a comment

Choose a reason for hiding this comment

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

Very nice 🚀

crates/mpz-common/src/lib.rs Outdated Show resolved Hide resolved
crates/mpz-share-conversion/src/sender.rs Show resolved Hide resolved
Copy link
Collaborator

@themighty1 themighty1 left a comment

Choose a reason for hiding this comment

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

ACK

@sinui0 sinui0 merged commit 6457aee into threading-refactor Jun 12, 2024
@sinui0 sinui0 deleted the refactor/kos-traits-2 branch June 12, 2024 17:08
@sinui0 sinui0 mentioned this pull request Jun 14, 2024
sinui0 added a commit that referenced this pull request Jun 25, 2024
* refactor: KOS and preprocessing traits

* add bounds to preprocess error

* rename pd field
sinui0 added a commit that referenced this pull request Jun 25, 2024
* refactor: KOS and preprocessing traits

* add bounds to preprocess error

* rename pd field
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.

3 participants