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

chore(cairo_native): make the starknet-native-compile crate a part of the workspace #3021

Open
wants to merge 1 commit into
base: main-v0.13.4
Choose a base branch
from

Conversation

avi-starkware
Copy link
Collaborator

@avi-starkware avi-starkware commented Dec 30, 2024

No description provided.

@reviewable-StarkWare
Copy link

This change is Reviewable

@avi-starkware avi-starkware changed the base branch from main to main-v0.13.4 December 30, 2024 13:04
@avi-starkware avi-starkware changed the title avi/fix native compiler binary crate chore(cairo_native): make the starknet-native-compile crate a part of the workspace Dec 30, 2024
Copy link
Collaborator

@noaov1 noaov1 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 5 files at r1, all commit messages.
Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @avi-starkware, @meship-starkware, and @Yoni-Starkware)


Cargo.toml line 60 at r1 (raw file):

]

exclude = ["crates/bin/starknet-native-compile"]

What does it mean?

Code quote:

exclude = ["crates/bin/starknet-native-compile"]

crates/bin/starknet-native-compile/src/utils.rs line 1 at r1 (raw file):

#[cfg(feature = "cairo_native")]

Is it necessary, considering the file already has the feature flag above its declaration? 🤔

Code quote:

#[cfg(feature = "cairo_native")]

Copy link
Collaborator

@noaov1 noaov1 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: all files reviewed, 3 unresolved discussions (waiting on @avi-starkware, @meship-starkware, and @Yoni-Starkware)


crates/bin/starknet-native-compile/Cargo.toml line 11 at r1 (raw file):

[features]
cairo_native = [

How do you make sure that the starknet_sierra_compile crate uses this crate with the cairo_native feature flag?

Code quote:

cairo_native = [

Copy link

Benchmark movements:
full_committer_flow performance regressed!
full_committer_flow time: [30.320 ms 30.358 ms 30.397 ms]
change: [+1.8628% +2.0649% +2.2621%] (p = 0.00 < 0.05)
Performance has regressed.
Found 4 outliers among 100 measurements (4.00%)
4 (4.00%) high mild

@avi-starkware avi-starkware force-pushed the avi/fix-native-compiler-binary-crate branch from e03856d to 7a03873 Compare December 30, 2024 13:36
@avi-starkware
Copy link
Collaborator Author

crates/bin/starknet-native-compile/Cargo.toml line 11 at r1 (raw file):

Previously, noaov1 (Noa Oved) wrote…

How do you make sure that the starknet_sierra_compile crate uses this crate with the cairo_native feature flag?

starknet_sierra_compile does not depend on this crate directly it builds it via cargo install, so I just add the feature as an argument in cargo install

@avi-starkware
Copy link
Collaborator Author

Cargo.toml line 60 at r1 (raw file):

Previously, noaov1 (Noa Oved) wrote…

What does it mean?

It just means that the crate is not part of the workspace and will not be compiled automatically when running cargo build from the root dir. I did this to avoid having the entire workspace depend on cairo_native.

Copy link

Benchmark movements:
full_committer_flow performance regressed!
full_committer_flow time: [30.362 ms 30.405 ms 30.452 ms]
change: [+2.0768% +2.4169% +2.7186%] (p = 0.00 < 0.05)
Performance has regressed.
Found 5 outliers among 100 measurements (5.00%)
3 (3.00%) high mild
2 (2.00%) high severe

Copy link
Contributor

@meship-starkware meship-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 5 of 5 files at r1, 1 of 1 files at r2, all commit messages.
Reviewable status: all files reviewed, 3 unresolved discussions (waiting on @avi-starkware, @noaov1, and @Yoni-Starkware)

Copy link
Collaborator

@noaov1 noaov1 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 r2, all commit messages.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @avi-starkware and @Yoni-Starkware)

@avi-starkware
Copy link
Collaborator Author

crates/bin/starknet-native-compile/src/utils.rs line 1 at r1 (raw file):

Previously, noaov1 (Noa Oved) wrote…

Is it necessary, considering the file already has the feature flag above its declaration? 🤔

If we don't put this over each import that is only used with the feature flag, we will get an unused_import clippy error

@avi-starkware avi-starkware force-pushed the avi/fix-native-compiler-binary-crate branch 2 times, most recently from 952e380 to a88df6a Compare January 6, 2025 08:08
Copy link
Collaborator

@noaov1 noaov1 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 @Yoni-Starkware)

@avi-starkware avi-starkware force-pushed the avi/fix-native-compiler-binary-crate branch 4 times, most recently from 6eb4b19 to 8d48934 Compare January 6, 2025 13:29
@avi-starkware avi-starkware force-pushed the avi/fix-native-compiler-binary-crate branch 2 times, most recently from c5a8c5a to b3f6e8e Compare February 2, 2025 15:14
Copy link

github-actions bot commented Feb 2, 2025

Benchmark movements:
tree_computation_flow performance improved 😺
tree_computation_flow time: [34.766 ms 34.845 ms 34.955 ms]
change: [-3.9875% -2.4322% -1.0505%] (p = 0.00 < 0.05)
Performance has improved.
Found 5 outliers among 100 measurements (5.00%)
2 (2.00%) high mild
3 (3.00%) high severe

@avi-starkware avi-starkware force-pushed the avi/fix-native-compiler-binary-crate branch 2 times, most recently from 797dbab to 5a9235b Compare February 2, 2025 16:18
Copy link
Collaborator

@dorimedini-starkware dorimedini-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 r5, 6 of 6 files at r6, all commit messages.
Reviewable status: 8 of 11 files reviewed, 1 unresolved discussion (waiting on @avi-starkware, @meship-starkware, @noaov1, and @Yoni-Starkware)


crates/starknet_sierra_multicompile/build.rs line 18 at r6 (raw file):

}

const REQUIRED_CAIRO_LANG_VERSION: &str = "2.10.0-rc.1";

ok for the current scope, but... this dep is flaky. is there anything that will prevent a dev from changing the compiler crate deps in the root cargo.toml to a version other than this one?

Code quote:

const REQUIRED_CAIRO_LANG_VERSION: &str = "2.10.0-rc.1";

crates/starknet_sierra_multicompile/build.rs line 20 at r6 (raw file):

const REQUIRED_CAIRO_LANG_VERSION: &str = "2.10.0-rc.1";
#[cfg(feature = "cairo_native")]
const REQUIRED_CAIRO_NATIVE_VERSION: &str = env!("CARGO_PKG_VERSION");

this is resolved at compile-time, right?
what does this resolve to during cargo install from crates.io?

Code quote:

env!("CARGO_PKG_VERSION");

crates/bin/starknet-native-compile/src/main.rs line 61 at r6 (raw file):

        });
    }
}

probably simpler to split into modules... WDYT?

Suggestion:

#[cfg(feature = "cairo_native")]
pub mod cairo_native_main;

fn main() {
    #[cfg(not(feature = "cairo_native"))]
    {
        eprintln!(
            "The `starknet-native-compile` binary was compiled without the 'cairo_native' feature."
        );
        process::exit(1);
    }
    #[cfg(feature = "cairo_native")]
    cairo_native_main::main()
}

@avi-starkware avi-starkware force-pushed the avi/fix-native-compiler-binary-crate branch from 5a9235b to b71a8fa Compare February 2, 2025 17:13
Copy link
Collaborator

@dorimedini-starkware dorimedini-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 5 of 5 files at r7, all commit messages.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @avi-starkware and @Yoni-Starkware)


crates/starknet_sierra_multicompile/Cargo.toml line 37 at r7 (raw file):

[build-dependencies]
starknet-native-compile.path = "../bin/starknet-native-compile"

build.rs does not run in cargo install, right?

Code quote:

starknet-native-compile.path = "../bin/starknet-native-compile"

Copy link
Contributor

@meship-starkware meship-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 r5, 3 of 6 files at r6, 4 of 5 files at r7, all commit messages.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @avi-starkware and @Yoni-Starkware)

@avi-starkware avi-starkware force-pushed the avi/fix-native-compiler-binary-crate branch from b71a8fa to 7a4b217 Compare February 5, 2025 09:20
Copy link
Collaborator Author

@avi-starkware avi-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: all files reviewed, 1 unresolved discussion (waiting on @dorimedini-starkware and @Yoni-Starkware)


crates/bin/starknet-native-compile/src/main.rs line 61 at r6 (raw file):

Previously, dorimedini-starkware wrote…

probably simpler to split into modules... WDYT?

Done.


crates/starknet_sierra_multicompile/build.rs line 18 at r6 (raw file):

Previously, dorimedini-starkware wrote…

ok for the current scope, but... this dep is flaky. is there anything that will prevent a dev from changing the compiler crate deps in the root cargo.toml to a version other than this one?

We will let the people working on the gateway decide how to manage this version.


crates/starknet_sierra_multicompile/build.rs line 20 at r6 (raw file):

Previously, dorimedini-starkware wrote…

this is resolved at compile-time, right?
what does this resolve to during cargo install from crates.io?

It will be resolved at compile time to the version of the workspace


crates/starknet_sierra_multicompile/Cargo.toml line 37 at r7 (raw file):

Previously, dorimedini-starkware wrote…

build.rs does not run in cargo install, right?

This is an artificial dependency - it doesn't do anything
It is there just to add the dependency to the dependency tree

@avi-starkware avi-starkware force-pushed the avi/fix-native-compiler-binary-crate branch from 7a4b217 to 4319405 Compare February 5, 2025 09:53
Copy link
Collaborator

@dorimedini-starkware dorimedini-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 4 files at r8, 4 of 4 files at r9, all commit messages.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @Yoni-Starkware)


crates/starknet_sierra_multicompile/build.rs line 20 at r6 (raw file):

Previously, avi-starkware (Avi Cohen) wrote…

It will be resolved at compile time to the version of the workspace

discussed offline (tl;dr: still unclear what happens when externals do cargo install)

@avi-starkware avi-starkware force-pushed the avi/fix-native-compiler-binary-crate branch from 4319405 to 902b823 Compare February 5, 2025 09:58
Copy link
Collaborator Author

@avi-starkware avi-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: 11 of 13 files reviewed, all discussions resolved (waiting on @dorimedini-starkware and @Yoni-Starkware)


crates/starknet_sierra_multicompile/build.rs line 20 at r6 (raw file):

Previously, dorimedini-starkware wrote…

discussed offline (tl;dr: still unclear what happens when externals do cargo install)

I changed the version to be explicit, and I will make another PR that adds a test that the version in this constant is the same as the workspace version.

Copy link
Collaborator

@dorimedini-starkware dorimedini-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 2 of 2 files at r10, all commit messages.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @Yoni-Starkware)

@avi-starkware avi-starkware force-pushed the avi/fix-native-compiler-binary-crate branch from 902b823 to d9e3101 Compare February 5, 2025 13:18
Copy link
Contributor

@meship-starkware meship-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 3 of 4 files at r8, 1 of 4 files at r9, 2 of 2 files at r10, all commit messages.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @Yoni-Starkware)

Copy link
Collaborator

@noaov1 noaov1 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 8 files at r4, 1 of 7 files at r5, 2 of 6 files at r6, 1 of 5 files at r7, 3 of 4 files at r8, 4 of 4 files at r9, 2 of 2 files at r10, all commit messages.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @Yoni-Starkware)

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.

5 participants