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

Add PreProcessedColumn Trait #965

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from

Conversation

Gali-StarkWare
Copy link
Contributor

No description provided.

@reviewable-StarkWare
Copy link

This change is Reviewable

Copy link
Contributor Author

Gali-StarkWare commented Jan 8, 2025

@Gali-StarkWare Gali-StarkWare marked this pull request as ready for review January 8, 2025 08:12
@codecov-commenter
Copy link

codecov-commenter commented Jan 8, 2025

Codecov Report

Attention: Patch coverage is 0% with 6 lines in your changes missing coverage. Please review.

Project coverage is 92.23%. Comparing base (31e8dbc) to head (c7e7607).

Files with missing lines Patch % Lines
...r/src/constraint_framework/preprocessed_columns.rs 0.00% 6 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##              dev     #965      +/-   ##
==========================================
- Coverage   92.26%   92.23%   -0.04%     
==========================================
  Files         105      105              
  Lines       14293    14299       +6     
  Branches    14293    14299       +6     
==========================================
  Hits        13188    13188              
- Misses       1032     1038       +6     
  Partials       73       73              

☔ 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.

Reviewable status: 0 of 1 files reviewed, 3 unresolved discussions (waiting on @Gali-StarkWare and @shaharsamocha7)


crates/prover/src/constraint_framework/preprocessed_columns.rs line 24 at r1 (raw file):

pub trait PreprocessedColumnTrait: Debug {
    fn name(&self) -> &'static str;
    fn id(&self) -> String;

doc what is this used for, and what should the implementor be aware of

Code quote:

fn id(&self) -> String;

crates/prover/src/constraint_framework/preprocessed_columns.rs line 29 at r1 (raw file):

    fn packed_at(&self, vec_row: usize) -> PackedM31;
    // TODO: CPU logic.
    /// Generates a column according to the preprocessed column chosen.

crates/prover/src/constraint_framework/preprocessed_columns.rs line 38 at r1 (raw file):

}
impl Eq for dyn PreprocessedColumnTrait {}
impl Hash for dyn PreprocessedColumnTrait {

maybe hash is better off handled by the struct itself

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.

Reviewable status: 0 of 1 files reviewed, 4 unresolved discussions (waiting on @Gali-StarkWare and @shaharsamocha7)


crates/prover/src/constraint_framework/preprocessed_columns.rs line 22 at r1 (raw file):

// TODO(Gali): Rename to PrerocessedColumn.
pub trait PreprocessedColumnTrait: Debug {

I think this trait hides 2 separate functionalities within it,
one is a mapping from column to it's id, which is used primarily in the constraints part,
the other is tools for trace gen, which technically is possible to live without, and the place for those is not in this trait, or in the constraint framework at all (I know they are here now).
I'm asking myself (and you), why are they behind a trait? when you hold the column during tracegen, you know the concrete type, and can use it's methods without dyn or generics.
I'm suggesting leaving only name, id,logsize here, the packed at and gen can stay behind the impl of the concrete structs (which is the case currently).

Copy link
Contributor Author

@Gali-StarkWare Gali-StarkWare 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: 0 of 1 files reviewed, 4 unresolved discussions (waiting on @ohad-starkware and @shaharsamocha7)


crates/prover/src/constraint_framework/preprocessed_columns.rs line 22 at r1 (raw file):

Previously, ohad-starkware (Ohad) wrote…

I think this trait hides 2 separate functionalities within it,
one is a mapping from column to it's id, which is used primarily in the constraints part,
the other is tools for trace gen, which technically is possible to live without, and the place for those is not in this trait, or in the constraint framework at all (I know they are here now).
I'm asking myself (and you), why are they behind a trait? when you hold the column during tracegen, you know the concrete type, and can use it's methods without dyn or generics.
I'm suggesting leaving only name, id,logsize here, the packed at and gen can stay behind the impl of the concrete structs (which is the case currently).

Done. I'll also move the structs to the examples later in the stack


crates/prover/src/constraint_framework/preprocessed_columns.rs line 24 at r1 (raw file):

Previously, ohad-starkware (Ohad) wrote…

doc what is this used for, and what should the implementor be aware of

Done.


crates/prover/src/constraint_framework/preprocessed_columns.rs line 38 at r1 (raw file):

Previously, ohad-starkware (Ohad) wrote…

maybe hash is better off handled by the struct itself

Not sure this will work, will try and update here


crates/prover/src/constraint_framework/preprocessed_columns.rs line 29 at r1 (raw file):

    fn packed_at(&self, vec_row: usize) -> PackedM31;
    // TODO: CPU logic.
    /// Generates a column according to the preprocessed column chosen.

Done.

@Gali-StarkWare Gali-StarkWare force-pushed the gali/create_preprocessed_column_trait branch from 1bb5639 to 663fec9 Compare January 9, 2025 13:40
Copy link
Contributor Author

@Gali-StarkWare Gali-StarkWare 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: 0 of 1 files reviewed, 4 unresolved discussions (waiting on @ohad-starkware and @shaharsamocha7)


crates/prover/src/constraint_framework/preprocessed_columns.rs line 22 at r1 (raw file):

Previously, Gali-StarkWare wrote…

Done. I'll also move the structs to the examples later in the stack

Now I face a problem with gen_preprocessed_columns because it needs gen_column_simd() (in prove_state_machine)

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.

Reviewable status: 0 of 1 files reviewed, 3 unresolved discussions (waiting on @Gali-StarkWare and @shaharsamocha7)


crates/prover/src/constraint_framework/preprocessed_columns.rs line 22 at r1 (raw file):

Previously, Gali-StarkWare wrote…

Now I face a problem with gen_preprocessed_columns because it needs gen_column_simd() (in prove_state_machine)

change it


crates/prover/src/constraint_framework/preprocessed_columns.rs line 25 at r2 (raw file):

    /// Used for hashing and comparison of preprocessed columns.
    /// The id should be unique for each preprocessed column - one naive
    /// implementation is: "PreProcessedColumnName(PreProcessedColumnsVariables)".

Suggestion:

    /// Used to compare preprocessed columns.
    /// Column IDs must be unique in a given context. 

@Gali-StarkWare Gali-StarkWare force-pushed the gali/create_preprocessed_column_trait branch from 663fec9 to c3740fe Compare January 12, 2025 08:55
Copy link
Contributor Author

@Gali-StarkWare Gali-StarkWare 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: 0 of 1 files reviewed, 3 unresolved discussions (waiting on @ohad-starkware and @shaharsamocha7)


crates/prover/src/constraint_framework/preprocessed_columns.rs line 22 at r1 (raw file):

Previously, ohad-starkware (Ohad) wrote…

change it

Done.


crates/prover/src/constraint_framework/preprocessed_columns.rs line 25 at r2 (raw file):

    /// Used for hashing and comparison of preprocessed columns.
    /// The id should be unique for each preprocessed column - one naive
    /// implementation is: "PreProcessedColumnName(PreProcessedColumnsVariables)".

Done.

@ohad-starkware
Copy link
Collaborator

crates/prover/src/constraint_framework/preprocessed_columns.rs line 38 at r1 (raw file):

Previously, Gali-StarkWare wrote…

Not sure this will work, will try and update here

did you try?

Copy link
Contributor Author

@Gali-StarkWare Gali-StarkWare 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: 0 of 1 files reviewed, 3 unresolved discussions (waiting on @ohad-starkware and @shaharsamocha7)


crates/prover/src/constraint_framework/preprocessed_columns.rs line 38 at r1 (raw file):

Previously, ohad-starkware (Ohad) wrote…

did you try?

Yes, it cannot live together with the dyn trait

@Gali-StarkWare Gali-StarkWare force-pushed the gali/create_preprocessed_column_trait branch from c3740fe to c7e7607 Compare January 12, 2025 10:06
@ohad-starkware
Copy link
Collaborator

crates/prover/src/constraint_framework/preprocessed_columns.rs line 38 at r1 (raw file):

Previously, Gali-StarkWare wrote…

Yes, it cannot live together with the dyn trait

let's try to stop using hashmap and then you wont need it

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