Skip to content

support build virtual polynomials in expression style #937

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

Merged

Conversation

hero78119
Copy link
Collaborator

@hero78119 hero78119 commented May 5, 2025

To close #936

Design rationales

  • introduce VirtualPolynomialsBuilder to lift a witness of "ArcPoly" type to expression container, so they can involve into expression domain for calculation
  • apply VirtualPolynomialsBuilder in tower prover.
  • keep scalar in base field as possible via introducing Either<Base, Ext> type
  • reserve design for "eq" degree -1 optimisation

    this part work haven't done yet and set as future work :)

VirtualPolynomialsBuilder is more like a util function for ceno main sumcheck flow.
For GKR layer circuit in gk- iop #799 , the expression system will directly applied on chip-builder and skip VirtualPolynomialsBuilder

benchmark

there is no impact for e2e benchmark before/after this change, which is expected

2^20

fibonacci_max_steps_1048576/prove_fibonacci/fibonacci_max_steps_1048576
                        time:   [2.3583 s 2.3709 s 2.3848 s]
                        change: [-1.8405% -1.0740% -0.2480%] (p = 0.03 < 0.05)
                        Change within noise threshold.

2^21

fibonacci_max_steps_2097152/prove_fibonacci/fibonacci_max_steps_2097152
                        time:   [4.4650 s 4.4758 s 4.4867 s]
                        change: [-0.6673% -0.3122% +0.0493%] (p = 0.13 > 0.05)
                        No change in performance detected.

2^22

fibonacci_max_steps_4194304/prove_fibonacci/fibonacci_max_steps_4194304
                        time:   [9.0115 s 9.0574 s 9.1011 s]
                        change: [-1.0658% -0.3407% +0.3803%] (p = 0.40 > 0.05)
                        No change in performance detected.


impl<E: ExtensionField> Expression<E> {
pub(super) fn to_monomial_form_inner(&self) -> Self {
Self::combine(self.distribute()).into_iter().sum()
pub fn get_monomial_terms(&self) -> Vec<Term<Expression<E>, Expression<E>>> {
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

just renaming since "to_xxxx" usually means ownership change, thus get_xxxx more properly

@@ -895,31 +898,8 @@ impl<'a, E: ExtensionField> MultilinearExtension<E> for RangedMultilinearExtensi
unimplemented!()
}

fn fix_high_variables(&self, partial_point: &[E]) -> Self::Output {
Copy link
Collaborator Author

@hero78119 hero78119 May 8, 2025

Choose a reason for hiding this comment

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

this fix_high_variables implementation is unused and actually its wrong, for we need to consider (start,end) due to it's range poly. Thus here clean it up and mark unimplemented!()

products_sum += AdditiveVec(sum);
exit_span!(span);
products_sum
|mut uni_polys, (_half_eq_opt, MonomialTerms { terms })| {
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

No logic change here. Just rename
'products_sum' -> 'uni_polys'
'coefficient' -> scalar

products_sum += AdditiveVec(sum);
exit_span!(span);
products_sum
|mut uni_polys, (_half_eq_opt, MonomialTerms { terms })| {
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

same as above

No logic change here. Just rename
'products_sum' -> 'uni_polys'
'coefficient' -> scalar

@hero78119 hero78119 requested review from dreamATD and spherel May 8, 2025 10:43
@@ -1004,7 +1051,7 @@ pub mod fmt {
if only_one_limb {
data[0].to_string()
} else {
format!("{name}[{}]", data.join(","))
format!("[{}]", data.join(","))
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

we do not need original naming, due to plonky3 field already implement better formatter. This logic is only serve old goldilocks package

Copy link
Member

@spherel spherel left a comment

Choose a reason for hiding this comment

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

LGTM!

@hero78119 hero78119 added this pull request to the merge queue May 9, 2025
Merged via the queue into scroll-tech:master with commit 75d75ea May 9, 2025
4 checks passed
@hero78119 hero78119 deleted the feat/expression_based_virtualpoly branch May 9, 2025 08:00
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.

support build virtual polynomials in expression style
2 participants