-
Notifications
You must be signed in to change notification settings - Fork 28
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(cairo_native): add synchronous sierra to native compilation flow #2771
feat(cairo_native): add synchronous sierra to native compilation flow #2771
Conversation
1aa10c9
to
6487719
Compare
Artifacts upload workflows: |
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 r1, all commit messages.
Reviewable status: all files reviewed, 6 unresolved discussions (waiting on @avi-starkware, @avivg-starkware, @meship-starkware, and @Yoni-Starkware)
crates/blockifier/src/state/contract_class_manager.rs
line 60 at r1 (raw file):
/// The sierra-to-native compiler. #[cfg(feature = "cairo_native")] compiler: Option<Arc<dyn SierraToNativeCompiler>>,
Why is it an Arc? process_compilation_request
can get a reference.
Why do the ContractClassManager
has to hold it in case of a compilation thread?
Code quote:
compiler: Option<Arc<dyn SierraToNativeCompiler>>,
crates/blockifier/src/state/contract_class_manager.rs
line 104 at r1 (raw file):
std::thread::spawn({ let contract_caches = contract_caches.clone(); let compiler = compiler.clone();
Why is the clone needed?
Code quote:
let compiler = compiler.clone();
crates/blockifier/src/state/contract_class_manager.rs
line 118 at r1 (raw file):
/// Sends a compilation request. Two cases: /// 1. If `config.wait_on_native_compilation` is `true`, sends the request to the compilation
No?
Suggestion:
/// 1. If `config.wait_on_native_compilation` is `false`, sends the request to the compilation
crates/blockifier/src/state/contract_class_manager.rs
line 125 at r1 (raw file):
pub fn send_compilation_request(&self, request: CompilationRequest) { assert!(self.config.run_cairo_native, "Native compilation is disabled."); self.cache_request_contracts(&request);
As discussed, can be deleted.
Code quote:
self.cache_request_contracts(&request);
crates/blockifier/src/state/contract_class_manager.rs
line 137 at r1 (raw file):
sender.try_send(request).unwrap_or_else(|err| match err { TrySendError::Full((class_hash, _, _)) => { error!(
Can you please explain what this macro does?
Code quote:
error!(
crates/blockifier/src/state/contract_class_manager.rs
line 215 at r1 (raw file):
fn process_compilation_request( contract_caches: ContractCaches, compiler: Arc<dyn SierraToNativeCompiler>,
Suggestion:
compiler: &impl SierraToNativeCompiler,
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 @avivg-starkware, @meship-starkware, @noaov1, and @Yoni-Starkware)
crates/blockifier/src/state/contract_class_manager.rs
line 60 at r1 (raw file):
Previously, noaov1 (Noa Oved) wrote…
Why is it an Arc?
process_compilation_request
can get a reference.
Why do theContractClassManager
has to hold it in case of a compilation thread?
I can lose the dyn
and give a concrete type here, or use a generic T
implementing the trait, But if we don't want to do that, Arc
is the only way. Option<impl SierraToNativeCompiler>
does not work.
Box
doesn't work since we want ContractClassManager
to implement Clone.
Regarding the second question, the ContractClassManager
does not need to hold the compiler in that case. I removed that.
crates/blockifier/src/state/contract_class_manager.rs
line 104 at r1 (raw file):
Previously, noaov1 (Noa Oved) wrote…
Why is the clone needed?
It isn't.
Removed
crates/blockifier/src/state/contract_class_manager.rs
line 118 at r1 (raw file):
Previously, noaov1 (Noa Oved) wrote…
No?
Done
crates/blockifier/src/state/contract_class_manager.rs
line 125 at r1 (raw file):
Previously, noaov1 (Noa Oved) wrote…
As discussed, can be deleted.
I am doing it in the PR unifying the caches
crates/blockifier/src/state/contract_class_manager.rs
line 137 at r1 (raw file):
Previously, noaov1 (Noa Oved) wrote…
Can you please explain what this macro does?
It prints an error message to stderr
using a configurable logger.
crates/blockifier/src/state/contract_class_manager.rs
line 215 at r1 (raw file):
fn process_compilation_request( contract_caches: ContractCaches, compiler: Arc<dyn SierraToNativeCompiler>,
This doesn't work since we can't put the impl SierraToNativeCompile
inside an Option
(in the ContractClassManager
struct)
Previously, avi-starkware wrote…
Should I write |
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 @avi-starkware, @avivg-starkware, @meship-starkware, and @Yoni-Starkware)
crates/blockifier/src/state/contract_class_manager.rs
line 60 at r1 (raw file):
Option<impl SierraToNativeCompiler>
does not work.
Can you please elaborate?
crates/blockifier/src/state/contract_class_manager.rs
line 137 at r1 (raw file):
Previously, avi-starkware wrote…
Should I write
log::error!()
to make it clearer?
Oh, I see. I prefer that, but I leave it up to you.
6487719
to
57524a5
Compare
Previously, noaov1 (Noa Oved) wrote…
I get the following error if I try to do that :
|
57524a5
to
e309bb9
Compare
Previously, noaov1 (Noa Oved) wrote…
Done. |
e309bb9
to
4ad2f79
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.
Reviewed all commit messages.
Reviewable status: 0 of 1 files reviewed, 5 unresolved discussions (waiting on @avivg-starkware, @noaov1, and @Yoni-Starkware)
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 r2.
Reviewable status: all files reviewed, 5 unresolved discussions (waiting on @avivg-starkware, @noaov1, and @Yoni-Starkware)
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 r2, all commit messages.
Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @avivg-starkware and @Yoni-Starkware)
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 r2, all commit messages.
Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @avivg-starkware and @Yoni-Starkware)
No description provided.