-
Notifications
You must be signed in to change notification settings - Fork 148
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
Add dynamic layout basic support #1824
Conversation
|
2ee787b
to
315594d
Compare
Benchmark Results for unmodified programs 🚀
|
4913d86
to
d03618c
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1824 +/- ##
==========================================
- Coverage 94.83% 94.79% -0.05%
==========================================
Files 101 101
Lines 39579 39836 +257
==========================================
+ Hits 37536 37762 +226
- Misses 2043 2074 +31
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
d03618c
to
864cdc5
Compare
864cdc5
to
adbba88
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.
Nice one @JulianGCalderon !
I really like the documentation
I just made some small comments an we will be good to go
|
||
# Build cases to execute | ||
CASES=( | ||
"cairo_programs/proof_programs/factorial.json;all_cairo" |
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.
Can you add 3 or 4 more programs 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.
Done
vm/src/vm/runners/cairo_runner.rs
Outdated
pub fn new_v2( | ||
program: &Program, | ||
layout: LayoutName, | ||
cairo_layout_params: Option<CairoLayoutParams>, |
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.
Can you change the name here to dynamic_layout_params, I think it is clearer
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.
Done
vm/src/cairo_run.rs
Outdated
@@ -26,6 +29,7 @@ pub struct CairoRunConfig<'a> { | |||
pub trace_enabled: bool, | |||
pub relocate_mem: bool, | |||
pub layout: LayoutName, | |||
pub cairo_layout_params: Option<CairoLayoutParams>, |
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.
same here, I think dynamic_layout_params
makes more clear to the user that is only needed in that cases
Also add a little comment here explaining like you did in the CairoRunner
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.
Done
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.
Could we update the Other CLI arguments
section of the README?
@pefontana @fmoletta I made the requested changes. |
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.
Nice one @JulianGCalderon !
Add dynamic layout support
This PR doesn't change any logic in the VM, it only changes some signatures to allow for dynamic layout parameters. The missing functionality is being developed in #1838.
It also adds a new job to the CI for testing dynamic layouts in different scenarios.
I separated it this way to make reviewing easier.
Description
This PR adds support for dynamic layout. When using dynamic layout, the actual parameters of the layout must be specified through a path to a JSON file in the command line arguments:
Or, with Cairo 1:
To add this functionality, the public API had to be changed. Now both
CairoRunner::new
andCairoRunner::new_v2
receive as their 3rd argument anOption<CairoLayoutParams>
. This must beSome
only when using dynamic layout. Most changes in this PR are a side effect of this modification.Even though this is not the most "rustic" solution, it was done this way to facilitate usage and minimize changes needed.
The JSON file has the following format. I left an example in the repository's root just in case, it can be moved or removed.
Checklist