feat(profiler): implement generic PerfProfiler for MPC protocols#22
feat(profiler): implement generic PerfProfiler for MPC protocols#22theroguevigilante wants to merge 6 commits intoLFDT-Lockness:mfrom
Conversation
|
@theroguevigilante please give a heads up when starting on something. |
Signed-off-by: theroguevigilante <naimish82@proton.me>
219f030 to
da76e14
Compare
survived
left a comment
There was a problem hiding this comment.
Thanks for submitting the PR! Indeed it's better to give a heads up in advance, before you start working on it, to make sure no one else is working on it at the same time.
I have reviewed the wrapper, tests, and Cargo.toml changes (I didn't touch the stats yet), overall PR goes in right direction, but I'd like to propose some improvements:
Please, refer to the echo_broadcast as an example of the wrapper that profiler should follow:
- Wrapper should wrap and implement the
Mpctrait (your wrapper only wrapsMpcExecution). - Wrapper should be feature-gated. There should be feature called
perf-profiler. Profiler is only available when feature is on. Enabling the feature activates all the dependencies of the profiler (such asstd). There should be no difference in dependencies (before and after the PR) with that feature disabled. - There's no need to have
ProfilerExt
round_based::profiler::PerfProfiler::new(mpc)is just fine - There's a test that tests random beacon + echo_broadcast. Similarly, I suggest that you add a test that carries out a random beacon protocol with the perf profiler. In the end, it just prints the report.
Also, among other major suggestions, I propose to restructure the profiler and the tests, see my comment below.
|
Also, please don't do any force-pushes from now on. This breaks github's review diff algorithm. |
Sure, I am sorry for the force-push, I accidentally commited a file which, wasn't needed. I am going to take a look at the proposed changes and see what I can do and work on it. Thanks for the review. |
Signed-off-by: theroguevigilante <naimish82@proton.me>
|
Note that CI fails with |
Signed-off-by: theroguevigilante <naimish82@proton.me>
- Wrap `Mpc` trait to profile both setup and execution - Split I/O into sent, received, and yield (scheduler wait) - Use interior mutability (RefCell) to profile `&self` calls - Centralize merging logic in `PerfReport::apply_stats` - Remove redundant fields and deprecated `ProfilerExt` - Refactor existing tests to match new schema Signed-off-by: theroguevigilante <naimish82@proton.me>
|
@survived If you are able to review some of the changes please look at them, I am also considering to refactor the profiler into a structure that makes testing easier if I am not able to come up with any useful tests with the current profiler. |
- Switch to `Arc<Mutex<Vec<Event>>>` for thread-safe shared ownership - Implement `PerfProfilerHandle` to allow reporting after profiler drop - Update `PerfProfiler::new` to return `(Profiler, Handle)` - Add comprehensive Random Beacon simulation test in `perf_test.rs` - Verify timing accuracy for multi-round computation and I/O - Ensure `Mpc` setup and `MpcExecution` phases share the same event log Signed-off-by: theroguevigilante <naimish82@proton.me>
|
@survived is the latest test more aligned to what you had in mind? |
|
I am thinking of refactoring stats to not just report the mean, std_dev, p50, p75, p90 of the total_time, but the time that is being spent on computation, send, receive and yield. |
|
Apologies for the check failure, I forgot to sign off my second last commit. |
a415e12 to
4cb8ba0
Compare
Signed-off-by: theroguevigilante <naimish82@proton.me>
4cb8ba0 to
7ab4357
Compare
Description
Implements a generic PerfProfiler for MPC protocols by wrapping the MpcExecution trait. This allows for automated, round-by-round benchmarking of computation vs. I/O time without
protocol-specific instrumentation.
Key Features