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

Made non-copy variable not be forwarded in const folding. #6324

Merged
merged 3 commits into from
Sep 1, 2024

Conversation

orizi
Copy link
Collaborator

@orizi orizi commented Sep 1, 2024

Fixes #6321.


Stack:

⚠️ Part of a stack created by spr. Do not merge manually using the UI - doing so may have unexpected results.


This change is Reviewable

Copy link
Collaborator Author

@orizi orizi 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 2 files reviewed, 1 unresolved discussion (waiting on @ilyalesokhin-starkware)


crates/cairo-lang-lowering/src/optimizations/test_data/const_folding line 3019 at r1 (raw file):

  (v3: (core::felt252, core::dict::Felt252Dict::<core::felt252>), v4: @(core::felt252, core::dict::Felt252Dict::<core::felt252>)) <- snapshot(v2)
  (v5: core::felt252, v6: core::dict::Felt252Dict::<core::felt252>) <- struct_destructure(v3)
  (v7: core::dict::SquashedFelt252Dict::<core::felt252>) <- core::dict::Felt252DictImpl::<core::felt252, core::Felt252Felt252DictValue>::squash(v6)

before the fix.

Suggestion:

  (v7: core::dict::SquashedFelt252Dict::<core::felt252>) <- core::dict::Felt252DictImpl::<core::felt252, core::Felt252Felt252DictValue>::squash(v1)

@orizi orizi force-pushed the spr/main/e27aec6c branch from c96d9ab to c1f8b63 Compare September 1, 2024 11:03
@ilyalesokhin-starkware
Copy link
Contributor

crates/cairo-lang-lowering/src/optimizations/const_folding.rs line 29 at r2 (raw file):

/// Keeps track of equivalent values that a variables might be replaced with.
/// Note: We don't keep track of types as we assume the usage is always correct.

is this comment still relevent?

Code quote:

/// Note: We don't keep track of types as we assume the usage is always correct.

@ilyalesokhin-starkware
Copy link
Contributor

crates/cairo-lang-lowering/src/optimizations/const_folding.rs line 40 at r2 (raw file):

    /// The variable is a struct of other variables.
    Struct(Vec<VarInfo>),
    /// A placeholder for building constructing a struct containing a const, for the unknown parts.

?

Code quote:

building constructing

@ilyalesokhin-starkware
Copy link
Contributor

crates/cairo-lang-lowering/src/optimizations/const_folding.rs line 41 at r2 (raw file):

    Struct(Vec<VarInfo>),
    /// A placeholder for building constructing a struct containing a const, for the unknown parts.
    Placeholder,

Maybe None or undefined?

Code quote:

Placeholder

Copy link
Collaborator Author

@orizi orizi 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 2 files reviewed, 4 unresolved discussions (waiting on @ilyalesokhin-starkware)


crates/cairo-lang-lowering/src/optimizations/const_folding.rs line 29 at r2 (raw file):

Previously, ilyalesokhin-starkware wrote…

is this comment still relevent?

it didn't use to be - but it is now (since we added the snapshots)


crates/cairo-lang-lowering/src/optimizations/const_folding.rs line 40 at r2 (raw file):

Previously, ilyalesokhin-starkware wrote…

?

Done.


crates/cairo-lang-lowering/src/optimizations/const_folding.rs line 41 at r2 (raw file):

Previously, ilyalesokhin-starkware wrote…

Maybe None or undefined?

Done.

@orizi orizi force-pushed the spr/main/e27aec6c branch from c1f8b63 to bd9d06f Compare September 1, 2024 11:53
Copy link
Contributor

@ilyalesokhin-starkware ilyalesokhin-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 2 files reviewed, 3 unresolved discussions (waiting on @orizi)


crates/cairo-lang-lowering/src/optimizations/const_folding.rs line 40 at r2 (raw file):

Previously, orizi wrote…

Done.

fix comment as well.

Copy link
Collaborator Author

@orizi orizi 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 2 files reviewed, 3 unresolved discussions (waiting on @ilyalesokhin-starkware)


crates/cairo-lang-lowering/src/optimizations/const_folding.rs line 40 at r2 (raw file):

Previously, ilyalesokhin-starkware wrote…

fix comment as well.

Done.

@orizi orizi force-pushed the spr/main/e27aec6c branch from bd9d06f to f02212a Compare September 1, 2024 12:04
@ilyalesokhin-starkware
Copy link
Contributor

crates/cairo-lang-lowering/src/optimizations/const_folding.rs line 39 at r4 (raw file):

    Snapshot(Box<VarInfo>),
    /// The variable is a struct of other variables.
    Struct(Vec<VarInfo>),

consider using option instead of untracked.

Suggestion:

 Struct(Vec<Option<VarInfo>>),

@ilyalesokhin-starkware
Copy link
Contributor

crates/cairo-lang-lowering/src/optimizations/const_folding.rs line 40 at r4 (raw file):

    /// The variable is a struct of other variables.
    Struct(Vec<VarInfo>),
    /// A marker for inner `VarInfo`s to be untracked - enables building recursive `VarInfo`s

Suggestion:

Enables building VarInfo::Structs where some of the members are untracked.

Copy link
Collaborator Author

@orizi orizi 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 2 files reviewed, 3 unresolved discussions (waiting on @ilyalesokhin-starkware)


crates/cairo-lang-lowering/src/optimizations/const_folding.rs line 39 at r4 (raw file):

Previously, ilyalesokhin-starkware wrote…

consider using option instead of untracked.

Done.


crates/cairo-lang-lowering/src/optimizations/const_folding.rs line 40 at r4 (raw file):

    /// The variable is a struct of other variables.
    Struct(Vec<VarInfo>),
    /// A marker for inner `VarInfo`s to be untracked - enables building recursive `VarInfo`s

No longer relevant.

@orizi orizi force-pushed the spr/main/e27aec6c branch from f02212a to 7567292 Compare September 1, 2024 12:33
Copy link
Contributor

@ilyalesokhin-starkware ilyalesokhin-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 1 of 1 files at r5.
Reviewable status: 1 of 2 files reviewed, 1 unresolved discussion

@orizi orizi changed the base branch from spr/main/7ba5d6ef to main September 1, 2024 12:50
@orizi orizi added this pull request to the merge queue Sep 1, 2024
Merged via the queue into main with commit 79853c7 Sep 1, 2024
86 of 87 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.

2 participants