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

Implement GrandProductOps for SIMD backend #640

Merged
merged 1 commit into from
Jul 25, 2024

Conversation

andrewmilson
Copy link
Contributor

@andrewmilson andrewmilson commented May 25, 2024

This change is Reviewable

@andrewmilson andrewmilson force-pushed the 05-24-Implement_GrandProductOps_for_SIMD_backend branch from 0d73973 to e17f7b8 Compare May 25, 2024 03:18
@codecov-commenter
Copy link

codecov-commenter commented May 25, 2024

Codecov Report

Attention: Patch coverage is 76.68712% with 38 lines in your changes missing coverage. Please review.

Project coverage is 93.16%. Comparing base (be26562) to head (0dc6a31).

Files Patch % Lines
crates/prover/src/core/backend/simd/lookups/gkr.rs 81.81% 21 Missing and 1 partial ⚠️
crates/prover/src/core/lookups/gkr_prover.rs 56.75% 16 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##              dev     #640      +/-   ##
==========================================
+ Coverage   93.05%   93.16%   +0.10%     
==========================================
  Files          86       86              
  Lines       11209    11364     +155     
  Branches    11209    11364     +155     
==========================================
+ Hits        10431    10587     +156     
+ Misses        685      682       -3     
- Partials       93       95       +2     

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

@andrewmilson andrewmilson force-pushed the 05-15-Implement_GkrOps_for_SIMD_backend branch from f7837b1 to 7878fb0 Compare June 13, 2024 03:40
@andrewmilson andrewmilson force-pushed the 05-24-Implement_GrandProductOps_for_SIMD_backend branch from e17f7b8 to 7ae75ab Compare June 13, 2024 03:40
@andrewmilson andrewmilson force-pushed the 05-15-Implement_GkrOps_for_SIMD_backend branch from 7878fb0 to 13b3e3c Compare June 13, 2024 04:09
@andrewmilson andrewmilson force-pushed the 05-24-Implement_GrandProductOps_for_SIMD_backend branch from 7ae75ab to c7b643e Compare June 13, 2024 04:09
@andrewmilson andrewmilson force-pushed the 05-15-Implement_GkrOps_for_SIMD_backend branch from 13b3e3c to ed308eb Compare June 13, 2024 15:36
@andrewmilson andrewmilson force-pushed the 05-24-Implement_GrandProductOps_for_SIMD_backend branch from c7b643e to 1910db0 Compare June 13, 2024 15:36
@andrewmilson andrewmilson force-pushed the 05-15-Implement_GkrOps_for_SIMD_backend branch from ed308eb to 0e58c2e Compare June 13, 2024 15:46
@andrewmilson andrewmilson force-pushed the 05-24-Implement_GrandProductOps_for_SIMD_backend branch from 1910db0 to 0757511 Compare June 13, 2024 15:46
@andrewmilson andrewmilson force-pushed the 05-15-Implement_GkrOps_for_SIMD_backend branch from 0e58c2e to 3b03377 Compare June 19, 2024 03:08
@andrewmilson andrewmilson force-pushed the 05-24-Implement_GrandProductOps_for_SIMD_backend branch from 0757511 to 953ed1c Compare June 19, 2024 03:08
@andrewmilson andrewmilson force-pushed the 05-15-Implement_GkrOps_for_SIMD_backend branch from 8de5550 to 51c9107 Compare July 11, 2024 14:40
@andrewmilson andrewmilson force-pushed the 05-24-Implement_GrandProductOps_for_SIMD_backend branch from f704c3f to 410fcd3 Compare July 11, 2024 14:40
@andrewmilson andrewmilson force-pushed the 05-15-Implement_GkrOps_for_SIMD_backend branch from 51c9107 to 78201c2 Compare July 15, 2024 13:02
@andrewmilson andrewmilson force-pushed the 05-24-Implement_GrandProductOps_for_SIMD_backend branch from 410fcd3 to 789e767 Compare July 15, 2024 13:02
@andrewmilson andrewmilson force-pushed the 05-15-Implement_GkrOps_for_SIMD_backend branch from 78201c2 to 27886bf Compare July 16, 2024 18:43
@andrewmilson andrewmilson force-pushed the 05-24-Implement_GrandProductOps_for_SIMD_backend branch 2 times, most recently from 58bc4df to 42e1c4a Compare July 16, 2024 19:24
@andrewmilson andrewmilson force-pushed the 05-15-Implement_GkrOps_for_SIMD_backend branch from 27886bf to 4d47325 Compare July 16, 2024 19:27
@andrewmilson andrewmilson force-pushed the 05-24-Implement_GrandProductOps_for_SIMD_backend branch 2 times, most recently from 3c315c4 to 490481c Compare July 16, 2024 19:28
Copy link
Contributor

@spapinistarkware spapinistarkware left a comment

Choose a reason for hiding this comment

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

Reviewed 5 of 7 files at r2, 3 of 3 files at r5, all commit messages.
Reviewable status: all files reviewed, 4 unresolved discussions (waiting on @andrewmilson and @shaharsamocha7)


crates/prover/src/core/backend/cpu/lookups/gkr.rs line 90 at r5 (raw file):

        // Note `inp(r, t, x) = eq(t, 0) * inp(r, 0, x) + eq(t, 1) * inp(r, 1, x)`
        //   => `inp(r, 2, x) = 2 * inp(r, 1, x) - inp(r, 0, x)`
        // TODO: Consider evaluation at `1/2` to save an addition operation since `inp(r, 1/2, x) =

Cool idea

Suggestion:

/ TODO(andrew): Consider e

crates/prover/src/core/backend/simd/lookups/gkr.rs line 120 at r5 (raw file):

// Can assume `len(layer) > N_LANES * 2`
fn next_grand_product_layer(layer: &Mle<SimdBackend, SecureField>) -> Layer<SimdBackend> {

Suggestion:

/// Assumpion: `len(layer) > N_LANES * 2`
fn next_grand_product_layer(layer: &Mle<SimdBackend, SecureField>) -> Layer<SimdBackend> {

crates/prover/src/core/backend/simd/lookups/mod.rs line 2 at r5 (raw file):

mod gkr;
// mod grandproduct;

Remove?


crates/prover/src/core/lookups/gkr_prover.rs line 6 at r5 (raw file):

use std::ops::Deref;

use educe::Educe;

What is this?

@andrewmilson andrewmilson force-pushed the 05-15-Implement_GkrOps_for_SIMD_backend branch from 4d47325 to 6cf72d3 Compare July 17, 2024 14:12
@andrewmilson andrewmilson force-pushed the 05-24-Implement_GrandProductOps_for_SIMD_backend branch from 490481c to 37bcff3 Compare July 17, 2024 14:12
@andrewmilson andrewmilson force-pushed the 05-15-Implement_GkrOps_for_SIMD_backend branch from 6cf72d3 to 6f4cd6f Compare July 17, 2024 14:37
@andrewmilson andrewmilson force-pushed the 05-24-Implement_GrandProductOps_for_SIMD_backend branch from 37bcff3 to e096de0 Compare July 17, 2024 14:37
@andrewmilson andrewmilson force-pushed the 05-15-Implement_GkrOps_for_SIMD_backend branch from 6f4cd6f to 5d63696 Compare July 17, 2024 18:09
@andrewmilson andrewmilson force-pushed the 05-24-Implement_GrandProductOps_for_SIMD_backend branch from e096de0 to 1df0a57 Compare July 17, 2024 18:09
Base automatically changed from 05-15-Implement_GkrOps_for_SIMD_backend to dev July 17, 2024 18:34
Copy link
Contributor Author

@andrewmilson andrewmilson left a comment

Choose a reason for hiding this comment

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

Reviewable status: 6 of 10 files reviewed, 4 unresolved discussions (waiting on @shaharsamocha7 and @spapinistarkware)


crates/prover/src/core/backend/cpu/lookups/gkr.rs line 90 at r5 (raw file):

Previously, spapinistarkware (Shahar Papini) wrote…

Cool idea

Done.


crates/prover/src/core/backend/simd/lookups/gkr.rs line 120 at r5 (raw file):

// Can assume `len(layer) > N_LANES * 2`
fn next_grand_product_layer(layer: &Mle<SimdBackend, SecureField>) -> Layer<SimdBackend> {

Done.


crates/prover/src/core/backend/simd/lookups/mod.rs line 2 at r5 (raw file):

Previously, spapinistarkware (Shahar Papini) wrote…

Remove?

Done.


crates/prover/src/core/lookups/gkr_prover.rs line 6 at r5 (raw file):

Previously, spapinistarkware (Shahar Papini) wrote…

What is this?

Gives us better derive macros for Clone Debug etc.
It gets around trait bound requirements of the default derive.

e.g.

#[derive(clone)]
struct Something<B: Backend> {
column: Col<B, SecureField>
}

This only implements Clone if B: Clone. But Col<B, SecureField> is Clone so B:Clone is a bad bound.

#[derive(Educe)]
#[educe(Clone)]
struct Something<B: Backend> {
column: Col<B, SecureField>
}

Understands that B doesn't have to be clone

@andrewmilson andrewmilson force-pushed the 05-24-Implement_GrandProductOps_for_SIMD_backend branch 2 times, most recently from 1a10524 to a454e56 Compare July 18, 2024 19:23
@andrewmilson andrewmilson force-pushed the 05-24-Implement_GrandProductOps_for_SIMD_backend branch from a454e56 to 0dc6a31 Compare July 21, 2024 02:22
Copy link
Contributor

@spapinistarkware spapinistarkware 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 6 of 6 files at r7, all commit messages.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @shaharsamocha7)

@andrewmilson andrewmilson merged commit 2c3d3ef into dev Jul 25, 2024
14 checks passed
@andrewmilson andrewmilson deleted the 05-24-Implement_GrandProductOps_for_SIMD_backend branch July 25, 2024 13:11
weikengchen added a commit to Bitcoin-Wildlife-Sanctuary/stwo that referenced this pull request Jul 27, 2024
* CircleDomainBitRevIterator (starkware-libs#757)

* Implement GrandProductOps for SIMD backend (starkware-libs#640)

* Update SecureFieldVec to SecureColumn in GKR (starkware-libs#758)

---------

Co-authored-by: Shahar Papini <[email protected]>
Co-authored-by: Andrew Milson <[email protected]>
This was referenced Aug 13, 2024
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.

3 participants