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

Max out the number of rows for OPRF step generation #823

Closed
wants to merge 3 commits into from

Conversation

taikiy
Copy link
Contributor

@taikiy taikiy commented Oct 31, 2023

OPRF protocol step generation needed to run #822. ipa::protocol::prf_sharding::UserNthPerStep depends on the maximum number of rows of any users in the input. In order to generate all possible combinations of the steps, we need to generate the max allowable number of rows for a user. The max allowable number should be the number specified by #[dynamic(...)] in UserNthRowStep enum. For now, we use records_per_user which can be specified when running the benchmark.

Note that this is a temporary solution. If the max number of rows become too large, we need a better way to generate the steps, likely by synthesizing the steps in the Step derive macro.

Comment on lines +118 to +122
let (single_user_mode, query_size) = if cfg!(feature = "step-trace") && args.oprf {
(true, usize::try_from(args.records_per_user).unwrap())
} else {
(false, args.query_size)
};
Copy link
Collaborator

Choose a reason for hiding this comment

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

Rather than use a boolean, you can use the IpaQueryStyle enum.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Oh wait, it looks like I misunderstood the meaning of "single_user_mode".

Comment on lines +58 to +60
pub number_of_users_in_flight: NonZeroU32,
#[cfg_attr(feature = "clap", arg(long, default_value = "false"))]
pub single_user_mode: bool,
Copy link
Collaborator

Choose a reason for hiding this comment

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

Do we need both? Can we just use a single param for this?

feature = "clap",
arg(long, default_value = "10", conflicts_with("single_user_mode"))
)]
pub number_of_users_in_flight: NonZeroU32,
Copy link
Collaborator

Choose a reason for hiding this comment

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

I recommend instead an interface of just:
pub num_users

@@ -241,8 +254,12 @@ impl<R: Rng> Iterator for EventGenerator<R> {
type Item = TestRawDataRecord;

fn next(&mut self) -> Option<Self::Item> {
const USERS_IN_FLIGHT: usize = 10;
Copy link
Collaborator

Choose a reason for hiding this comment

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

let users_in_flight = std::min(10, config.num_users);

} else {
usize::try_from(self.config.number_of_users_in_flight.get()).unwrap()
};
while self.users.len() < number_of_users_in_flight {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Maybe we move this into the constructor, and make it possible to configure it. Then this "replace" logic can just maintain self.users at a constant length.

@taikiy
Copy link
Contributor Author

taikiy commented Nov 14, 2023

#834 fixes the issue I wanted to address with this PR. Closing

@taikiy taikiy closed this Nov 14, 2023
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