-
Notifications
You must be signed in to change notification settings - Fork 26
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
feat(blockifier): compile cairo native runtime #1242
Conversation
8531d53
to
f579562
Compare
48f603c
to
0b5c809
Compare
f579562
to
74a49f6
Compare
Benchmark movements: |
Benchmark movements: |
38dd0d4
to
15a92fe
Compare
Benchmark movements: |
ca71081
to
24b1db8
Compare
Benchmark movements: |
b130151
to
f46f927
Compare
There was a problem hiding this 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 4 files reviewed, 1 unresolved discussion (waiting on @rodrigo-pino)
scripts/dependencies.sh
line 73 at r5 (raw file):
popd || exit 1 mv ./cairo_native/target/release/libcairo_native_runtime.a ./libcairo_native_runtime.so
Why did you rename the file extension .a
-> .so
?
Code quote:
mv ./cairo_native/target/release/libcairo_native_runtime.a ./libcairo_native_runtime.so
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed 1 of 2 files at r1, 2 of 2 files at r5, all commit messages.
Reviewable status: 3 of 4 files reviewed, 1 unresolved discussion (waiting on @rodrigo-pino)
0b5c809
to
adb1565
Compare
f46f927
to
cfe157b
Compare
Benchmark movements: full_committer_flow performance improved 😺 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: 1 of 4 files reviewed, all discussions resolved (waiting on @avi-starkware)
scripts/dependencies.sh
line 73 at r5 (raw file):
Previously, avi-starkware wrote…
Why did you rename the file extension
.a
->.so
?
Done
Benchmark movements: |
Previously, rodrigo-pino (Rodrigo) wrote…
Now it works thanks! Can you please add a comment documenting the need for this additional command? I played around with building the crate and rerunning it, and it seems that the When I experimented with Did you find a case where the script is not rerun in its current state? (I can see the script is rerun since |
Previously, avi-starkware wrote…
Regardless, this is non-blocking. |
There was a problem hiding this 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, 4 unresolved discussions (waiting on @alon-dotan-starkware, @noaov1, and @PearsonWhite)
crates/blockifier/build.rs
line 47 at r22 (raw file):
Can you please add a comment documenting the need for this additional command?
The error can be detected, would it be good enough suggesting the fix when facing it the first time?
Maybe setting the command as part of the dependencies.sh script? I am unsure how it would affect the CI. Will try this out as well (cc: @alon-dotan-starkware)
Regarding your last three paragraphs, I find it as an odd behaviour. After I implemented the solution I tested it locally and it worked as expected (tried each directive individually) and the build was successfully triggered each time. Then, tried two+ builds in a row and after the first one, the others were no-op (also verified that the libcairo_native_runtime.a
remained unmodified)
I'll ask for someone from the team to check if they have the same behaviour as your. We are all using macOS making our results biased. Can you see if your results persist on other Linux machines. (Thinking OS file system differences as a root cause). Finally, to completely rule out human error, are you sure that when running this script (as it is presented in this branch) twice in a row the second re-builds Native Runtime? Could you detect which directive of the three is causing the issue?
There was a problem hiding this 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, 5 unresolved discussions (waiting on @alon-dotan-starkware, @noaov1, and @PearsonWhite)
crates/blockifier/build.rs
line 47 at r22 (raw file):
Previously, rodrigo-pino (Rodrigo) wrote…
Can you please add a comment documenting the need for this additional command?
The error can be detected, would it be good enough suggesting the fix when facing it the first time?
Maybe setting the command as part of the dependencies.sh script? I am unsure how it would affect the CI. Will try this out as well (cc: @alon-dotan-starkware)Regarding your last three paragraphs, I find it as an odd behaviour. After I implemented the solution I tested it locally and it worked as expected (tried each directive individually) and the build was successfully triggered each time. Then, tried two+ builds in a row and after the first one, the others were no-op (also verified that the
libcairo_native_runtime.a
remained unmodified)I'll ask for someone from the team to check if they have the same behaviour as your. We are all using macOS making our results biased. Can you see if your results persist on other Linux machines. (Thinking OS file system differences as a root cause). Finally, to completely rule out human error, are you sure that when running this script (as it is presented in this branch) twice in a row the second re-builds Native Runtime? Could you detect which directive of the three is causing the issue?
...
This is a good idea! I think adding the explanation to the error message, as you suggested, would be sufficient. I'll do some more testing on the rerun behavior on my machine and other linux machines. |
There was a problem hiding this 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, 5 unresolved discussions (waiting on @alon-dotan-starkware, @noaov1, and @PearsonWhite)
crates/blockifier/build.rs
line 47 at r22 (raw file):
I'll do some more testing on the rerun behavior on my machine and other linux machines.
Thank you!
...
This previous message of mine was because I mistakenly set the thread as resolved 🤦♂️ , I've just noticed that it's meaning wasn't completely clear
0d70854
to
ced58fb
Compare
Artifacts upload triggered. View details here |
Benchmark movements: |
There was a problem hiding this 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 11 files reviewed, 2 unresolved discussions (waiting on @noaov1 and @PearsonWhite)
ced58fb
to
10efcfa
Compare
Artifacts upload triggered. View details here |
Benchmark movements: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed 1 of 2 files at r52, 9 of 10 files at r53, 1 of 1 files at r54, all commit messages.
Reviewable status: all files reviewed, 3 unresolved discussions (waiting on @alon-dotan-starkware, @PearsonWhite, and @rodrigo-pino)
taplo.toml
line 4 at r46 (raw file):
Previously, rodrigo-pino (Rodrigo) wrote…
All the other lints are working over it, taplo is the only one ignoring it. We can make a PR to Cairo Native that fix their taplo issues and then remove this exclusion later on
No need IMO
crates/blockifier/build.rs
line 59 at r54 (raw file):
println!("cargo::rerun-if-changed={}", runtime_expected_path.to_str().unwrap()); println!("cargo::rerun-if-env-changed={RUNTIME_LIBRARY}"); }
Why do we need both?
Code quote:
println!("cargo::rerun-if-changed={}", runtime_expected_path.to_str().unwrap());
println!("cargo::rerun-if-env-changed={RUNTIME_LIBRARY}");
}
crates/blockifier/build.rs
line 62 at r54 (raw file):
fn main() { if std::env::var("CARGO_FEATURE_CAIRO_NATIVE").is_ok() {
Can you please explain this check? (and maybe document)
Code quote:
if std::env::var("CARGO_FEATURE_CAIRO_NATIVE").is_ok() {
There was a problem hiding this 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, 2 unresolved discussions (waiting on @alon-dotan-starkware, @PearsonWhite, and @rodrigo-pino)
Instead of custom script, swapped for the addition of Cairo Native as a git submodule. The runtime will be compiled once the compilation is succesful. A known caveat of this approach (using build.rs) is that if there is nothing new to compile and the native_runtime.a library won't be recompiled, even if it was deleted or updated. Another caveat is that both the git submodule and Cairo Native dependency need be updated at the same time. We cannot directly set the submodule as a dependency because cairo native is also a workspace (such as this repo) and there cannot be two workspace roots.
10efcfa
to
4e9d2c2
Compare
Artifacts upload triggered. View details here |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: 10 of 11 files reviewed, 1 unresolved discussion (waiting on @alon-dotan-starkware, @noaov1, and @PearsonWhite)
crates/blockifier/build.rs
line 59 at r54 (raw file):
Previously, noaov1 (Noa Oved) wrote…
Why do we need both?
The first one in case the runtime gets deleted, since ti is a binary I think no one will be modifying it.
The second one is in case a developer changes the runtime library path to re-compile it in that location.
crates/blockifier/build.rs
line 62 at r54 (raw file):
Previously, noaov1 (Noa Oved) wrote…
Can you please explain this check? (and maybe document)
Done , explanation added as a comment
There was a problem hiding this 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 r55, all commit messages.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @alon-dotan-starkware and @PearsonWhite)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: complete! all files reviewed, all discussions resolved (waiting on @PearsonWhite)
Add the Cairo Native runtime binary to the root after executing
./scripts/dependencies.sh
This change is