Skip to content

Enable function specialization. #7720

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
merged 1 commit into from
May 22, 2025
Merged

Conversation

ilyalesokhin-starkware
Copy link
Contributor

No description provided.

@reviewable-StarkWare
Copy link

This change is Reviewable

Copy link
Contributor Author

ilyalesokhin-starkware commented Apr 29, 2025

@ilyalesokhin-starkware ilyalesokhin-starkware changed the base branch from ilya/specialized_func to graphite-base/7720 May 4, 2025 13:30
@ilyalesokhin-starkware ilyalesokhin-starkware changed the base branch from graphite-base/7720 to ilya/specialized_func May 6, 2025 11:39
@ilyalesokhin-starkware ilyalesokhin-starkware changed the base branch from ilya/specialized_func to graphite-base/7720 May 14, 2025 09:55
@ilyalesokhin-starkware ilyalesokhin-starkware changed the base branch from graphite-base/7720 to ilya/specialized_func May 15, 2025 19:07
@ilyalesokhin-starkware ilyalesokhin-starkware changed the base branch from ilya/specialized_func to graphite-base/7720 May 21, 2025 07:26
@ilyalesokhin-starkware ilyalesokhin-starkware changed the base branch from graphite-base/7720 to main May 21, 2025 10:39
Copy link
Collaborator

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

Reviewed 3 of 50 files at r2, all commit messages.
Reviewable status: 3 of 50 files reviewed, 2 unresolved discussions


crates/cairo-lang-lowering/src/db.rs line 316 at r2 (raw file):

    fn priv_should_inline(&self, function_id: ids::ConcreteFunctionWithBodyId) -> Maybe<bool>;

    // Internal query for a heuristic to decide if a given `function_id` should be specalized.

Suggestion:

    /// Returns whether a function should be specalized.

crates/cairo-lang-lowering/src/db.rs line 846 at r2 (raw file):

        panic!("Expected a specialized function");
    };
    // The size is 8/10*orig_size > specialized_size of the original size.

Suggestion:

    // The heuristic is that the size is 8/10*orig_size > specialized_size of the original size.

@ilyalesokhin-starkware ilyalesokhin-starkware force-pushed the ilya/specialized_func2 branch 2 times, most recently from 9b5ecd4 to da8940b Compare May 22, 2025 09:30
Copy link
Contributor Author

@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: 2 of 50 files reviewed, 2 unresolved discussions (waiting on @orizi)


crates/cairo-lang-lowering/src/db.rs line 316 at r2 (raw file):

    fn priv_should_inline(&self, function_id: ids::ConcreteFunctionWithBodyId) -> Maybe<bool>;

    // Internal query for a heuristic to decide if a given `function_id` should be specalized.

Done.


crates/cairo-lang-lowering/src/db.rs line 846 at r2 (raw file):

        panic!("Expected a specialized function");
    };
    // The size is 8/10*orig_size > specialized_size of the original size.

Done.

Copy link
Collaborator

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

Reviewed 9 of 50 files at r2, 1 of 1 files at r3.
Reviewable status: 12 of 50 files reviewed, 1 unresolved discussion


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

    }

    fn try_specialize_call(

doc

Copy link
Collaborator

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

Reviewed 38 of 50 files at r2.
Reviewable status: all files reviewed (commit messages unreviewed), 1 unresolved discussion (waiting on @ilyalesokhin-starkware)

Copy link
Collaborator

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

Reviewed 1 of 1 files at r4, all commit messages.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @ilyalesokhin-starkware)


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

    /// Returns None if the call should not be specialized.
    ///
    /// Specialization of the with the same base is currently not supported, and specialization

Suggestion:

/// Specialization of the ?what? with the same base 

Copy link
Collaborator

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

:lgtm:

Reviewed 5 of 5 files at r5, all commit messages.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @ilyalesokhin-starkware)

Copy link
Contributor Author

@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: 49 of 50 files reviewed, 1 unresolved discussion (waiting on @orizi)


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

Previously, orizi wrote…

doc

Done.


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

    /// Returns None if the call should not be specialized.
    ///
    /// Specialization of the with the same base is currently not supported, and specialization

Done.

Copy link
Collaborator

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

:lgtm:

Reviewed 1 of 1 files at r6, all commit messages.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @ilyalesokhin-starkware)

@ilyalesokhin-starkware ilyalesokhin-starkware added this pull request to the merge queue May 22, 2025
Merged via the queue into main with commit 4c21069 May 22, 2025
49 checks passed
@ilyalesokhin-starkware ilyalesokhin-starkware deleted the ilya/specialized_func2 branch May 22, 2025 14:56
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