Skip to content

Conversation

Sahilgill24
Copy link

@Sahilgill24 Sahilgill24 commented Sep 13, 2025

Motivation

solves #4

Description

Using plonky3 maybe-rayon crate as it provides same api for parallel and non-parallel case, thus helping to reduce the usage of the parallel flag.

Progress

rayon was replaced by p3-maybe-rayon currently in the following crates:-

  • witness
  • multilinear-extensions
  • mpcs
  • whir

For the whir crate all the imports can be replaced with the p3::maybe_rayon::prelude::* import, but as there are different variations of functions for the parallel and the non-parallel case for ex:- here so the removal of the #[cfg(feature = "parallel")] is a bit tricky here and might require some changes in the core functions.

@Sahilgill24
Copy link
Author

Hey @hero78119

I have updated some crates, could you take a look at the whir crate related issue I mentioned above and also review the Draft once.

@hero78119
Copy link
Collaborator

hero78119 commented Sep 17, 2025

Hey @hero78119

I have updated some crates, could you take a look at the whir crate related issue I mentioned above and also review the Draft once.

Hi @Sahilgill24 had a quick go-through and everything looks pretty neat to me! For WHIR what I suggested this PR can just cover change to use maybe-rayon on the place which both sequential/parallel share "almost" identical implementation. For some core function change, it will be nice to left to new issue + PR for handling :)

@Sahilgill24
Copy link
Author

Thanks alot for the review @hero78119 .

One last Query, In the trailing issue you had also mentioned not changing the dependancies for the sumcheck crate , should I do the changes for that crate as well.

I would also love to contribute more to new issues if there are any intermediate or beginner friendly ones.

@hero78119
Copy link
Collaborator

hero78119 commented Sep 18, 2025

One last Query, In the trailing issue you had also mentioned not changing the dependancies for the sumcheck crate , should I do the changes for that crate as well.

I would also love to contribute more to new issues if there are any intermediate or beginner friendly ones.

At that moment we are working on sumcheck refactoring thus suggest not touch this crate.
Now everything ready and feel free to also cover sumcheck crate 😄

Thanks for the interests and will try mark few more issues to be good-start-first :)

@Sahilgill24
Copy link
Author

Thanks alot @hero78119 , marking this ready for review.

@Sahilgill24 Sahilgill24 marked this pull request as ready for review September 18, 2025 08:06
Copy link
Collaborator

@hero78119 hero78119 left a comment

Choose a reason for hiding this comment

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

Hi, it seems to be some left-over (I checked via search the places where in use of "rayon" but no "maybe-rayon")

E.g.

use rayon::{
iter::{IndexedParallelIterator, IntoParallelRefIterator, IntoParallelRefMutIterator},
prelude::{IntoParallelIterator, ParallelIterator},
};

And probably so as other place. Would suggest to have a overall check and see whether other place got similar :)

Another place, as ceno are the major dependency of this repo, it will be nice if you can make a separate PR on ceno and point to your p3-maybe-rayon feature branch and see whether any broken during compiler & integration test.

@Sahilgill24
Copy link
Author

Sahilgill24 commented Sep 23, 2025

And probably so as other place. Would suggest to have a overall check and see whether other place got similar :)

Hey @hero78119 , I checked this once, for the sumcheck crate as you had mentioned that it was currently under progress, so I thought not to change it. It is otherwise a trivial change and I can do it.

fixed the whir crate imports along with fixing the linting issues. (which i should have checked earlier, mb)

Another place, as ceno are the major dependency of this repo, it will be nice if you can make a separate PR on ceno and point to your p3-maybe-rayon feature branch and see whether any broken during compiler & integration test.

Surely, will do this :)

@Sahilgill24
Copy link
Author

Sahilgill24 commented Sep 23, 2025

Hey @hero78119 , I fixed the use of all the unnecessary flags and the linting/formatting issues.

Also this could be added to the test documentation, for any other users who might want to check the tests and formatting related stuff, all these commands mirror the CI/CD pipeline.

cargo make tests
cargo make clippy 
cargo fmt --all --check 
taplo fmt --check --diff 

Copy link
Collaborator

@hero78119 hero78119 left a comment

Choose a reason for hiding this comment

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

Awesome job and all looks good to me!

I think one left over is testing with https://github.com/scroll-tech/ceno/

  1. assure ceno benchmark no impact, as now parallel flag is optional
  2. on test environment, unittest failed not involve messy "rayon" stacktrace => this is the major purpose of this PR to enable clean stacktrace on unittest, better for message debugging

Will be nice if there is a separate Ceno PR to test above, or I will verify it later before we proceed the merge :)

@Sahilgill24
Copy link
Author

Sahilgill24 commented Oct 1, 2025

Thanks for the review @hero78119 .

I think one left over is testing with https://github.com/scroll-tech/ceno/

  1. assure ceno benchmark no impact, as now parallel flag is optional
  2. on test environment, unittest failed not involve messy "rayon" stacktrace => this is the major purpose of this PR to enable clean stacktrace on unittest, better for message debugging

I shall make a separate PR on the Ceno repo for these additional tests and have also updated the branch to match the main.

@hero78119
Copy link
Collaborator

hero78119 commented Oct 2, 2025

Hi, I reviewed again and think it might need some cosmetics of this PR
I make them into a new commit hero78119@f18ce71 and feel free to cherry-pick

The major adjustment is for sumcheck crate, some style, e.g. with_min_len(), par_iter().chunks(), ... for those api are only in rayon version, so I just remove/rewrite them into the supported api from maybe-rayon

Besides, also refactor whir crate under "whir" features of mpcs. Per discussion earlier in this PR discussion thread, whir now only work on rayon mode and switch to maybe-rayon need some refactor.

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