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

Logup cumsum constraint with cumsum_shift #978

Merged
merged 1 commit into from
Jan 15, 2025

Conversation

shaharsamocha7
Copy link
Collaborator

No description provided.

@reviewable-StarkWare
Copy link

This change is Reviewable

Copy link
Collaborator Author

shaharsamocha7 commented Jan 12, 2025

This was referenced Jan 12, 2025
@codecov-commenter
Copy link

codecov-commenter commented Jan 12, 2025

Codecov Report

Attention: Patch coverage is 94.82759% with 3 lines in your changes missing coverage. Please review.

Project coverage is 92.02%. Comparing base (3ae4395) to head (b5c7e2a).

Files with missing lines Patch % Lines
crates/prover/src/constraint_framework/logup.rs 94.73% 1 Missing and 1 partial ⚠️
crates/prover/src/constraint_framework/mod.rs 91.66% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##              dev     #978      +/-   ##
==========================================
- Coverage   92.33%   92.02%   -0.32%     
==========================================
  Files         105      105              
  Lines       14252    14274      +22     
  Branches    14252    14274      +22     
==========================================
- Hits        13159    13135      -24     
- Misses       1019     1064      +45     
- Partials       74       75       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Collaborator

@ohad-starkware ohad-starkware left a comment

Choose a reason for hiding this comment

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

Reviewed 1 of 7 files at r1.
Reviewable status: 1 of 7 files reviewed, 4 unresolved discussions (waiting on @shaharsamocha7)


crates/prover/src/constraint_framework/logup.rs line 66 at r1 (raw file):

        interaction: usize,
        total_sum: SecureField,
        claimed_sum: Option<ClaimedPrefixSum>,

doc why this remains here when only valid value is None


crates/prover/src/constraint_framework/logup.rs line 72 at r1 (raw file):

        assert!(
            claimed_sum.is_none(),
            "Claimed sum at internal index is not supported"

Suggestion:

            "Partial prefix-sum is not supported"

crates/prover/src/constraint_framework/logup.rs line 195 at r1 (raw file):

        let mut last_col_coords = self.trace.pop().unwrap().columns;

        // compute cumsum_shift.

Suggestion:

  // Compute cumsum_shift.

crates/prover/src/constraint_framework/logup.rs line 201 at r1 (raw file):

        let base_sums = packed_sums.map(|s| s.pointwise_sum());
        let total_sum = SecureField::from_m31_array(base_sums);
        let cumsum_shift = total_sum / BaseField::from_u32_unchecked(1 << self.log_size);

?

Suggestion:

        let coordinate_sums = last_col_coords.each_ref().map(|c| {
            c.data
                .iter()
                .copied()
                .sum::<PackedBaseField>()
                .pointwise_sum()
        });
        let total_sum = SecureField::from_m31_array(coordinate_sums);
        let cumsum_shift = total_sum / BaseField::from_u32_unchecked(1 << self.log_size);

crates/prover/src/constraint_framework/logup.rs line 206 at r1 (raw file):

            c.data
                .iter_mut()
                .for_each(|x| *x -= PackedBaseField::broadcast(cumsum_shift.to_m31_array()[i]))

broadcast outside of inner loop, it will look nicer


crates/prover/src/constraint_framework/mod.rs line 186 at r1 (raw file):

            assert!(!self.logup.is_finalized, "LogupAtRow was already finalized");

            assert!(

will we ever get to this assert?

@ohad-starkware
Copy link
Collaborator

crates/prover/src/constraint_framework/logup.rs line 66 at r1 (raw file):

Previously, ohad-starkware (Ohad) wrote…

doc why this remains here when only valid value is None

nvm won't give you trouble on this

@ohad-starkware
Copy link
Collaborator

crates/prover/src/constraint_framework/mod.rs line 186 at r1 (raw file):

Previously, ohad-starkware (Ohad) wrote…

will we ever get to this assert?

same

Copy link
Collaborator Author

@shaharsamocha7 shaharsamocha7 left a comment

Choose a reason for hiding this comment

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

:lgtm:

Reviewable status: 1 of 7 files reviewed, 2 unresolved discussions (waiting on @ohad-starkware)


crates/prover/src/constraint_framework/logup.rs line 66 at r1 (raw file):

Previously, ohad-starkware (Ohad) wrote…

nvm won't give you trouble on this

I delete it in the next pr.


crates/prover/src/constraint_framework/logup.rs line 206 at r1 (raw file):

Previously, ohad-starkware (Ohad) wrote…

broadcast outside of inner loop, it will look nicer

better?


crates/prover/src/constraint_framework/mod.rs line 186 at r1 (raw file):

Previously, ohad-starkware (Ohad) wrote…

same

next pr


crates/prover/src/constraint_framework/logup.rs line 195 at r1 (raw file):

        let mut last_col_coords = self.trace.pop().unwrap().columns;

        // compute cumsum_shift.

Done.

@shaharsamocha7 shaharsamocha7 force-pushed the 01-12-Logup_cumsum_constraint_with_cumsum_shift branch from ec20bc8 to bbbe8a7 Compare January 13, 2025 08:18
@ohad-starkware
Copy link
Collaborator

smar, ill start lgtming myself too

Copy link
Collaborator

@ohad-starkware ohad-starkware left a comment

Choose a reason for hiding this comment

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

Reviewed 4 of 7 files at r1, 2 of 2 files at r2, all commit messages.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @shaharsamocha7)

Copy link
Collaborator

@ohad-starkware ohad-starkware left a comment

Choose a reason for hiding this comment

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

:lgtm:

Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @shaharsamocha7)

Copy link
Collaborator Author

@shaharsamocha7 shaharsamocha7 left a comment

Choose a reason for hiding this comment

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

haha oops :)

Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @shaharsamocha7)

@shaharsamocha7 shaharsamocha7 force-pushed the 01-09-Remove_padding_examples branch from 1f7dbdd to bffd8f7 Compare January 14, 2025 12:44
@shaharsamocha7 shaharsamocha7 force-pushed the 01-12-Logup_cumsum_constraint_with_cumsum_shift branch from bbbe8a7 to 9e789d3 Compare January 14, 2025 12:44
Copy link
Collaborator

@ohad-starkware ohad-starkware left a comment

Choose a reason for hiding this comment

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

:lgtm:

Reviewed 3 of 3 files at r3, all commit messages.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @shaharsamocha7)

@shaharsamocha7 shaharsamocha7 force-pushed the 01-09-Remove_padding_examples branch from bffd8f7 to 2660828 Compare January 14, 2025 17:28
@shaharsamocha7 shaharsamocha7 force-pushed the 01-12-Logup_cumsum_constraint_with_cumsum_shift branch from 9e789d3 to 3ca832e Compare January 14, 2025 17:28
Copy link
Collaborator Author

shaharsamocha7 commented Jan 15, 2025

Merge activity

  • Jan 15, 3:47 AM EST: A user started a stack merge that includes this pull request via Graphite.
  • Jan 15, 3:49 AM EST: Graphite rebased this pull request as part of a merge.
  • Jan 15, 3:53 AM EST: A user merged this pull request with Graphite.

@shaharsamocha7 shaharsamocha7 changed the base branch from 01-09-Remove_padding_examples to graphite-base/978 January 15, 2025 08:47
@shaharsamocha7 shaharsamocha7 changed the base branch from graphite-base/978 to dev January 15, 2025 08:47
@shaharsamocha7 shaharsamocha7 force-pushed the 01-12-Logup_cumsum_constraint_with_cumsum_shift branch from 3ca832e to b5c7e2a Compare January 15, 2025 08:48
@shaharsamocha7 shaharsamocha7 merged commit 9316f98 into dev Jan 15, 2025
16 of 19 checks passed
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.

4 participants