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

fix(brillig): Globals entry point reachability analysis #7188

Merged
merged 32 commits into from
Jan 29, 2025
Merged
Show file tree
Hide file tree
Changes from 13 commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
17368c3
noir test for globals reachability
vezenovm Jan 22, 2025
c7970e8
initial fetching of brillig entry points and new used globals map
vezenovm Jan 23, 2025
d2d0851
merge conflicts w/ master
vezenovm Jan 23, 2025
54f0b4a
working entry point analysis, need unit tests still
vezenovm Jan 24, 2025
3634ce1
update entry point regression to be more extreme
vezenovm Jan 24, 2025
94906be
move Brillig globals logic into a context struct and cleanup regressi…
vezenovm Jan 24, 2025
0f83419
passing tests when we have inner calls with multiple entry points, ge…
vezenovm Jan 28, 2025
345acf9
nargo fmt
vezenovm Jan 28, 2025
f7a7ede
a little cleanup
vezenovm Jan 28, 2025
656610a
fix remaining bugs with when there is no globals for the entry point …
vezenovm Jan 28, 2025
4c718e9
add some unit tests for ssa globals gen
vezenovm Jan 28, 2025
c499c20
remove execution_success test
vezenovm Jan 28, 2025
a2333c6
Merge branch 'master' into mv/globals-entry-point-reachability
vezenovm Jan 28, 2025
945371a
Update compiler/noirc_evaluator/src/brillig/brillig_gen.rs
vezenovm Jan 28, 2025
0b9ab2c
Update compiler/noirc_evaluator/src/brillig/brillig_ir.rs
vezenovm Jan 28, 2025
ad3cc16
cleanup
vezenovm Jan 28, 2025
be649ff
cleanup and add some comments
vezenovm Jan 28, 2025
c6989de
more cleanup
vezenovm Jan 28, 2025
491a515
more comments
vezenovm Jan 28, 2025
128c3d2
cargo fmt
vezenovm Jan 28, 2025
4a513f6
Update compiler/noirc_evaluator/src/brillig/brillig_gen/brillig_globa…
vezenovm Jan 28, 2025
9bd96b8
Apply suggestions from code review
vezenovm Jan 28, 2025
ea24c1e
Update compiler/noirc_evaluator/src/brillig/brillig_gen/brillig_globa…
vezenovm Jan 29, 2025
e418cdf
Update compiler/noirc_evaluator/src/brillig/brillig_gen/brillig_globa…
vezenovm Jan 29, 2025
0ee729c
Update compiler/noirc_evaluator/src/brillig/brillig_gen/brillig_globa…
vezenovm Jan 29, 2025
4a05a1c
fmt
vezenovm Jan 29, 2025
bd2b4e7
some comments
vezenovm Jan 29, 2025
e6c2014
return map directly in get_brillig_globals
vezenovm Jan 29, 2025
d7294e8
to_brillig_with_globals
vezenovm Jan 29, 2025
346c5af
fix mut in tests'
vezenovm Jan 29, 2025
24c6f13
more fmt in tests
vezenovm Jan 29, 2025
abdf7b9
Merge branch 'master' into mv/globals-entry-point-reachability
vezenovm Jan 29, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions compiler/noirc_evaluator/src/acir/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3328,7 +3328,7 @@ mod test {
build_basic_foo_with_return(&mut builder, foo_id, true, InlineType::default());
build_basic_foo_with_return(&mut builder, bar_id, true, InlineType::default());

let ssa = builder.finish();
let mut ssa = builder.finish();
let brillig = ssa.to_brillig(false);

let (acir_functions, brillig_functions, _, _) = ssa
Expand Down Expand Up @@ -3466,7 +3466,7 @@ mod test {

build_basic_foo_with_return(&mut builder, foo_id, true, InlineType::default());

let ssa = builder.finish();
let mut ssa = builder.finish();
// We need to generate Brillig artifacts for the regular Brillig function and pass them to the ACIR generation pass.
let brillig = ssa.to_brillig(false);
println!("{}", ssa);
Expand Down Expand Up @@ -3555,7 +3555,7 @@ mod test {
// Build an ACIR function which has the same logic as the Brillig function above
build_basic_foo_with_return(&mut builder, bar_id, false, InlineType::Fold);

let ssa = builder.finish();
let mut ssa = builder.finish();
// We need to generate Brillig artifacts for the regular Brillig function and pass them to the ACIR generation pass.
let brillig = ssa.to_brillig(false);
println!("{}", ssa);
Expand Down Expand Up @@ -3673,7 +3673,7 @@ mod test {
return v3
}
";
let ssa = Ssa::from_str(src).unwrap();
let mut ssa = Ssa::from_str(src).unwrap();
let brillig = ssa.to_brillig(false);

let (mut acir_functions, _brillig_functions, _, _) = ssa
Expand Down Expand Up @@ -3711,7 +3711,7 @@ mod test {
return
}
";
let ssa = Ssa::from_str(src).unwrap();
let mut ssa = Ssa::from_str(src).unwrap();
let brillig = ssa.to_brillig(false);

let (acir_functions, _brillig_functions, _, _) = ssa
Expand Down
4 changes: 3 additions & 1 deletion compiler/noirc_evaluator/src/brillig/brillig_gen.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,12 +58,14 @@ pub(crate) fn gen_brillig_for(
brillig: &Brillig,
) -> Result<GeneratedBrillig<FieldElement>, InternalError> {
// Create the entry point artifact
let globals_memory_size = brillig.globals_memory_size.get(&func.id()).copied().unwrap_or(0);
// let globals_memory_size = brillig.globals_memory_size.get(&func.id()).copied();
vezenovm marked this conversation as resolved.
Show resolved Hide resolved
let mut entry_point = BrilligContext::new_entry_point_artifact(
arguments,
FunctionContext::return_values(func),
func.id(),
true,
brillig.globals_memory_size,
globals_memory_size,
);
entry_point.name = func.name().to_string();

Expand Down
Loading
Loading