Skip to content

Commit 67d362a

Browse files
author
AztecBot
committed
fix: defunctionalize pass on the caller runtime to apply (noir-lang/noir#7100)
feat: Parser and formatter support for `enum`s (noir-lang/noir#7110) feat(brillig): SSA globals code gen (noir-lang/noir#7021) feat: `loop` keyword in runtime and comptime code (noir-lang/noir#7096) chore: Add benchmarking dashboard (noir-lang/noir#7068) feat(experimental): try to infer lambda argument types inside calls (noir-lang/noir#7088) feat(ssa): Add flag to DIE pass to be able to keep `store` instructions (noir-lang/noir#7106) chore: Cookbook Onboard integration (noir-lang/noir#7044) chore: lock to ubuntu 22.04 (noir-lang/noir#7098) fix: Remove unused brillig functions (noir-lang/noir#7102) chore(ssa): Use correct prefix when printing array values in global space (noir-lang/noir#7095)
2 parents 9f63bed + a72b1b8 commit 67d362a

File tree

91 files changed

+5249
-509
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

91 files changed

+5249
-509
lines changed

.noir-sync-commit

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
ad5a9808ab7c2a89beadb6f95c664441ee27a5f8
1+
dd7084545dfd93a07599fc10676b6c8ec1e3d458

noir/noir-repo/.github/workflows/reports.yml

+104-6
Original file line numberDiff line numberDiff line change
@@ -315,7 +315,7 @@ jobs:
315315

316316
external_repo_compilation_and_execution_report:
317317
needs: [build-nargo]
318-
runs-on: ubuntu-latest
318+
runs-on: ubuntu-22.04
319319
timeout-minutes: 15
320320
strategy:
321321
fail-fast: false
@@ -425,9 +425,13 @@ jobs:
425425
needs: [generate_compilation_and_execution_report, external_repo_compilation_and_execution_report]
426426
# We want this job to run even if one variation of the matrix in `external_repo_compilation_and_execution_report` fails
427427
if: always()
428-
runs-on: ubuntu-latest
428+
runs-on: ubuntu-22.04
429429
permissions:
430430
pull-requests: write
431+
# deployments permission to deploy GitHub pages website
432+
deployments: write
433+
# contents permission to update benchmark contents in gh-pages branch
434+
contents: write
431435

432436
steps:
433437
- uses: actions/checkout@v4
@@ -464,9 +468,29 @@ jobs:
464468
header: compilation
465469
message: ${{ steps.compilation_report.outputs.markdown }}
466470

471+
- name: Convert to `benchmark-action` format
472+
run: |
473+
jq ".compilation_reports | map({name: .artifact_name, value: (.time[:-1] | tonumber), unit: \"s\"}) " ./compilation_report.json > time_bench.json
474+
475+
- name: Store benchmark result
476+
continue-on-error: true
477+
uses: benchmark-action/github-action-benchmark@4de1bed97a47495fc4c5404952da0499e31f5c29
478+
with:
479+
name: "Compilation Time"
480+
tool: "customSmallerIsBetter"
481+
output-file-path: ./time_bench.json
482+
github-token: ${{ secrets.GITHUB_TOKEN }}
483+
# We want this to only run on master to avoid garbage data from PRs being added.
484+
auto-push: ${{ github.ref == 'refs/heads/master' }}
485+
alert-threshold: "110%"
486+
comment-on-alert: true
487+
fail-on-alert: false
488+
alert-comment-cc-users: "@TomAFrench"
489+
max-items-in-chart: 50
490+
467491
external_repo_memory_report:
468492
needs: [build-nargo]
469-
runs-on: ubuntu-latest
493+
runs-on: ubuntu-22.04
470494
timeout-minutes: 30
471495
strategy:
472496
fail-fast: false
@@ -507,6 +531,7 @@ jobs:
507531
path: scripts
508532
sparse-checkout: |
509533
test_programs/memory_report.sh
534+
test_programs/parse_memory.sh
510535
sparse-checkout-cone-mode: false
511536

512537
- name: Checkout
@@ -520,6 +545,7 @@ jobs:
520545
working-directory: ./test-repo/${{ matrix.project.path }}
521546
run: |
522547
mv /home/runner/work/noir/noir/scripts/test_programs/memory_report.sh ./memory_report.sh
548+
mv /home/runner/work/noir/noir/scripts/test_programs/parse_memory.sh ./parse_memory.sh
523549
./memory_report.sh 1
524550
# Rename the memory report as the execution report is about to write to the same file
525551
cp memory_report.json compilation_memory_report.json
@@ -572,9 +598,13 @@ jobs:
572598
needs: [generate_memory_report, external_repo_memory_report]
573599
# We want this job to run even if one variation of the matrix in `external_repo_memory_report` fails
574600
if: always()
575-
runs-on: ubuntu-latest
601+
runs-on: ubuntu-22.04
576602
permissions:
577603
pull-requests: write
604+
# deployments permission to deploy GitHub pages website
605+
deployments: write
606+
# contents permission to update benchmark contents in gh-pages branch
607+
contents: write
578608

579609
steps:
580610
- uses: actions/checkout@v4
@@ -611,14 +641,38 @@ jobs:
611641
header: compilation_memory
612642
message: ${{ steps.compilation_mem_report.outputs.markdown }}
613643

644+
- name: Convert to `benchmark-action` format
645+
run: |
646+
jq ".memory_reports | map({name: .artifact_name, value: (.peak_memory | tonumber), unit: \"MB\"}) " ./memory_report.json > memory_bench.json
647+
648+
- name: Store benchmark result
649+
continue-on-error: true
650+
uses: benchmark-action/github-action-benchmark@4de1bed97a47495fc4c5404952da0499e31f5c29
651+
with:
652+
name: "Compilation Memory"
653+
tool: "customSmallerIsBetter"
654+
output-file-path: ./memory_bench.json
655+
github-token: ${{ secrets.GITHUB_TOKEN }}
656+
# We want this to only run on master to avoid garbage data from PRs being added.
657+
auto-push: ${{ github.ref == 'refs/heads/master' }}
658+
alert-threshold: "110%"
659+
comment-on-alert: true
660+
fail-on-alert: false
661+
alert-comment-cc-users: "@TomAFrench"
662+
max-items-in-chart: 50
663+
614664
upload_execution_memory_report:
615665
name: Upload execution memory report
616666
needs: [generate_memory_report, external_repo_memory_report]
617667
# We want this job to run even if one variation of the matrix in `external_repo_memory_report` fails
618668
if: always()
619-
runs-on: ubuntu-latest
669+
runs-on: ubuntu-22.04
620670
permissions:
621671
pull-requests: write
672+
# deployments permission to deploy GitHub pages website
673+
deployments: write
674+
# contents permission to update benchmark contents in gh-pages branch
675+
contents: write
622676

623677
steps:
624678
- uses: actions/checkout@v4
@@ -657,14 +711,39 @@ jobs:
657711
header: execution_memory
658712
message: ${{ steps.execution_mem_report.outputs.markdown }}
659713

714+
- name: Convert to `benchmark-action` format
715+
run: |
716+
jq ".memory_reports | map({name: .artifact_name, value: (.peak_memory | tonumber), unit: \"MB\"}) " ./execution_memory_report.json > memory_bench.json
717+
718+
- name: Store benchmark result
719+
continue-on-error: true
720+
uses: benchmark-action/github-action-benchmark@4de1bed97a47495fc4c5404952da0499e31f5c29
721+
with:
722+
name: "Execution Memory"
723+
tool: "customSmallerIsBetter"
724+
output-file-path: ./memory_bench.json
725+
github-token: ${{ secrets.GITHUB_TOKEN }}
726+
# We want this to only run on master to avoid garbage data from PRs being added.
727+
auto-push: ${{ github.ref == 'refs/heads/master' }}
728+
alert-threshold: "110%"
729+
comment-on-alert: true
730+
fail-on-alert: false
731+
alert-comment-cc-users: "@TomAFrench"
732+
max-items-in-chart: 50
733+
734+
660735
upload_execution_report:
661736
name: Upload execution report
662737
needs: [generate_compilation_and_execution_report, external_repo_compilation_and_execution_report]
663738
# We want this job to run even if one variation of the matrix in `external_repo_compilation_and_execution_report` fails
664739
if: always()
665-
runs-on: ubuntu-latest
740+
runs-on: ubuntu-22.04
666741
permissions:
667742
pull-requests: write
743+
# deployments permission to deploy GitHub pages website
744+
deployments: write
745+
# contents permission to update benchmark contents in gh-pages branch
746+
contents: write
668747

669748
steps:
670749
- uses: actions/checkout@v4
@@ -701,3 +780,22 @@ jobs:
701780
header: execution_time
702781
message: ${{ steps.execution_report.outputs.markdown }}
703782

783+
- name: Convert to `benchmark-action` format
784+
run: |
785+
jq ".execution_reports | map({name: .artifact_name, value: (.time[:-1] | tonumber), unit: \"s\"}) " ./execution_report.json > time_bench.json
786+
787+
- name: Store benchmark result
788+
continue-on-error: true
789+
uses: benchmark-action/github-action-benchmark@4de1bed97a47495fc4c5404952da0499e31f5c29
790+
with:
791+
name: "Execution Time"
792+
tool: "customSmallerIsBetter"
793+
output-file-path: ./time_bench.json
794+
github-token: ${{ secrets.GITHUB_TOKEN }}
795+
# We want this to only run on master to avoid garbage data from PRs being added.
796+
auto-push: ${{ github.ref == 'refs/heads/master' }}
797+
alert-threshold: "110%"
798+
comment-on-alert: true
799+
fail-on-alert: false
800+
alert-comment-cc-users: "@TomAFrench"
801+
max-items-in-chart: 50

noir/noir-repo/compiler/noirc_evaluator/src/acir/mod.rs

+7-4
Original file line numberDiff line numberDiff line change
@@ -2909,7 +2909,7 @@ mod test {
29092909
use std::collections::BTreeMap;
29102910

29112911
use crate::{
2912-
acir::BrilligStdlibFunc,
2912+
acir::{BrilligStdlibFunc, Function},
29132913
brillig::Brillig,
29142914
ssa::{
29152915
function_builder::FunctionBuilder,
@@ -3341,7 +3341,8 @@ mod test {
33413341
build_basic_foo_with_return(&mut builder, foo_id, true, InlineType::default());
33423342
build_basic_foo_with_return(&mut builder, bar_id, true, InlineType::default());
33433343

3344-
let ssa = builder.finish();
3344+
let mut ssa = builder.finish();
3345+
ssa.globals = Function::new("globals".to_owned(), ssa.main_id);
33453346
let brillig = ssa.to_brillig(false);
33463347

33473348
let (acir_functions, brillig_functions, _, _) = ssa
@@ -3479,7 +3480,8 @@ mod test {
34793480

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

3482-
let ssa = builder.finish();
3483+
let mut ssa = builder.finish();
3484+
ssa.globals = Function::new("globals".to_owned(), ssa.main_id);
34833485
// We need to generate Brillig artifacts for the regular Brillig function and pass them to the ACIR generation pass.
34843486
let brillig = ssa.to_brillig(false);
34853487
println!("{}", ssa);
@@ -3568,7 +3570,8 @@ mod test {
35683570
// Build an ACIR function which has the same logic as the Brillig function above
35693571
build_basic_foo_with_return(&mut builder, bar_id, false, InlineType::Fold);
35703572

3571-
let ssa = builder.finish();
3573+
let mut ssa = builder.finish();
3574+
ssa.globals = Function::new("globals".to_owned(), ssa.main_id);
35723575
// We need to generate Brillig artifacts for the regular Brillig function and pass them to the ACIR generation pass.
35733576
let brillig = ssa.to_brillig(false);
35743577
println!("{}", ssa);

noir/noir-repo/compiler/noirc_evaluator/src/brillig/brillig_gen.rs

+12-2
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,21 @@ pub(crate) mod brillig_black_box;
22
pub(crate) mod brillig_block;
33
pub(crate) mod brillig_block_variables;
44
pub(crate) mod brillig_fn;
5+
pub(crate) mod brillig_globals;
56
pub(crate) mod brillig_slice_ops;
67
mod constant_allocation;
78
mod variable_liveness;
89

910
use acvm::FieldElement;
11+
use fxhash::FxHashMap as HashMap;
1012

1113
use self::{brillig_block::BrilligBlock, brillig_fn::FunctionContext};
1214
use super::{
1315
brillig_ir::{
1416
artifact::{BrilligArtifact, BrilligParameter, GeneratedBrillig, Label},
1517
BrilligContext,
1618
},
17-
Brillig,
19+
Brillig, BrilligVariable, ValueId,
1820
};
1921
use crate::{
2022
errors::InternalError,
@@ -25,6 +27,7 @@ use crate::{
2527
pub(crate) fn convert_ssa_function(
2628
func: &Function,
2729
enable_debug_trace: bool,
30+
globals: &HashMap<ValueId, BrilligVariable>,
2831
) -> BrilligArtifact<FieldElement> {
2932
let mut brillig_context = BrilligContext::new(enable_debug_trace);
3033

@@ -35,7 +38,13 @@ pub(crate) fn convert_ssa_function(
3538
brillig_context.call_check_max_stack_depth_procedure();
3639

3740
for block in function_context.blocks.clone() {
38-
BrilligBlock::compile(&mut function_context, &mut brillig_context, block, &func.dfg);
41+
BrilligBlock::compile(
42+
&mut function_context,
43+
&mut brillig_context,
44+
block,
45+
&func.dfg,
46+
globals,
47+
);
3948
}
4049

4150
let mut artifact = brillig_context.artifact();
@@ -53,6 +62,7 @@ pub(crate) fn gen_brillig_for(
5362
arguments,
5463
FunctionContext::return_values(func),
5564
func.id(),
65+
true,
5666
);
5767
entry_point.name = func.name().to_string();
5868

0 commit comments

Comments
 (0)