Skip to content

Commit

Permalink
fix: defunctionalize pass on the caller runtime to apply (noir-lang/n…
Browse files Browse the repository at this point in the history
…oir#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)
  • Loading branch information
AztecBot committed Jan 18, 2025
2 parents 9f63bed + a72b1b8 commit 67d362a
Show file tree
Hide file tree
Showing 91 changed files with 5,249 additions and 509 deletions.
2 changes: 1 addition & 1 deletion .noir-sync-commit
Original file line number Diff line number Diff line change
@@ -1 +1 @@
ad5a9808ab7c2a89beadb6f95c664441ee27a5f8
dd7084545dfd93a07599fc10676b6c8ec1e3d458
110 changes: 104 additions & 6 deletions noir/noir-repo/.github/workflows/reports.yml
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,7 @@ jobs:

external_repo_compilation_and_execution_report:
needs: [build-nargo]
runs-on: ubuntu-latest
runs-on: ubuntu-22.04
timeout-minutes: 15
strategy:
fail-fast: false
Expand Down Expand Up @@ -425,9 +425,13 @@ jobs:
needs: [generate_compilation_and_execution_report, external_repo_compilation_and_execution_report]
# We want this job to run even if one variation of the matrix in `external_repo_compilation_and_execution_report` fails
if: always()
runs-on: ubuntu-latest
runs-on: ubuntu-22.04
permissions:
pull-requests: write
# deployments permission to deploy GitHub pages website
deployments: write
# contents permission to update benchmark contents in gh-pages branch
contents: write

steps:
- uses: actions/checkout@v4
Expand Down Expand Up @@ -464,9 +468,29 @@ jobs:
header: compilation
message: ${{ steps.compilation_report.outputs.markdown }}

- name: Convert to `benchmark-action` format
run: |
jq ".compilation_reports | map({name: .artifact_name, value: (.time[:-1] | tonumber), unit: \"s\"}) " ./compilation_report.json > time_bench.json
- name: Store benchmark result
continue-on-error: true
uses: benchmark-action/github-action-benchmark@4de1bed97a47495fc4c5404952da0499e31f5c29
with:
name: "Compilation Time"
tool: "customSmallerIsBetter"
output-file-path: ./time_bench.json
github-token: ${{ secrets.GITHUB_TOKEN }}
# We want this to only run on master to avoid garbage data from PRs being added.
auto-push: ${{ github.ref == 'refs/heads/master' }}
alert-threshold: "110%"
comment-on-alert: true
fail-on-alert: false
alert-comment-cc-users: "@TomAFrench"
max-items-in-chart: 50

external_repo_memory_report:
needs: [build-nargo]
runs-on: ubuntu-latest
runs-on: ubuntu-22.04
timeout-minutes: 30
strategy:
fail-fast: false
Expand Down Expand Up @@ -507,6 +531,7 @@ jobs:
path: scripts
sparse-checkout: |
test_programs/memory_report.sh
test_programs/parse_memory.sh
sparse-checkout-cone-mode: false

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

steps:
- uses: actions/checkout@v4
Expand Down Expand Up @@ -611,14 +641,38 @@ jobs:
header: compilation_memory
message: ${{ steps.compilation_mem_report.outputs.markdown }}

- name: Convert to `benchmark-action` format
run: |
jq ".memory_reports | map({name: .artifact_name, value: (.peak_memory | tonumber), unit: \"MB\"}) " ./memory_report.json > memory_bench.json
- name: Store benchmark result
continue-on-error: true
uses: benchmark-action/github-action-benchmark@4de1bed97a47495fc4c5404952da0499e31f5c29
with:
name: "Compilation Memory"
tool: "customSmallerIsBetter"
output-file-path: ./memory_bench.json
github-token: ${{ secrets.GITHUB_TOKEN }}
# We want this to only run on master to avoid garbage data from PRs being added.
auto-push: ${{ github.ref == 'refs/heads/master' }}
alert-threshold: "110%"
comment-on-alert: true
fail-on-alert: false
alert-comment-cc-users: "@TomAFrench"
max-items-in-chart: 50

upload_execution_memory_report:
name: Upload execution memory report
needs: [generate_memory_report, external_repo_memory_report]
# We want this job to run even if one variation of the matrix in `external_repo_memory_report` fails
if: always()
runs-on: ubuntu-latest
runs-on: ubuntu-22.04
permissions:
pull-requests: write
# deployments permission to deploy GitHub pages website
deployments: write
# contents permission to update benchmark contents in gh-pages branch
contents: write

steps:
- uses: actions/checkout@v4
Expand Down Expand Up @@ -657,14 +711,39 @@ jobs:
header: execution_memory
message: ${{ steps.execution_mem_report.outputs.markdown }}

- name: Convert to `benchmark-action` format
run: |
jq ".memory_reports | map({name: .artifact_name, value: (.peak_memory | tonumber), unit: \"MB\"}) " ./execution_memory_report.json > memory_bench.json
- name: Store benchmark result
continue-on-error: true
uses: benchmark-action/github-action-benchmark@4de1bed97a47495fc4c5404952da0499e31f5c29
with:
name: "Execution Memory"
tool: "customSmallerIsBetter"
output-file-path: ./memory_bench.json
github-token: ${{ secrets.GITHUB_TOKEN }}
# We want this to only run on master to avoid garbage data from PRs being added.
auto-push: ${{ github.ref == 'refs/heads/master' }}
alert-threshold: "110%"
comment-on-alert: true
fail-on-alert: false
alert-comment-cc-users: "@TomAFrench"
max-items-in-chart: 50


upload_execution_report:
name: Upload execution report
needs: [generate_compilation_and_execution_report, external_repo_compilation_and_execution_report]
# We want this job to run even if one variation of the matrix in `external_repo_compilation_and_execution_report` fails
if: always()
runs-on: ubuntu-latest
runs-on: ubuntu-22.04
permissions:
pull-requests: write
# deployments permission to deploy GitHub pages website
deployments: write
# contents permission to update benchmark contents in gh-pages branch
contents: write

steps:
- uses: actions/checkout@v4
Expand Down Expand Up @@ -701,3 +780,22 @@ jobs:
header: execution_time
message: ${{ steps.execution_report.outputs.markdown }}

- name: Convert to `benchmark-action` format
run: |
jq ".execution_reports | map({name: .artifact_name, value: (.time[:-1] | tonumber), unit: \"s\"}) " ./execution_report.json > time_bench.json
- name: Store benchmark result
continue-on-error: true
uses: benchmark-action/github-action-benchmark@4de1bed97a47495fc4c5404952da0499e31f5c29
with:
name: "Execution Time"
tool: "customSmallerIsBetter"
output-file-path: ./time_bench.json
github-token: ${{ secrets.GITHUB_TOKEN }}
# We want this to only run on master to avoid garbage data from PRs being added.
auto-push: ${{ github.ref == 'refs/heads/master' }}
alert-threshold: "110%"
comment-on-alert: true
fail-on-alert: false
alert-comment-cc-users: "@TomAFrench"
max-items-in-chart: 50
11 changes: 7 additions & 4 deletions noir/noir-repo/compiler/noirc_evaluator/src/acir/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2909,7 +2909,7 @@ mod test {
use std::collections::BTreeMap;

use crate::{
acir::BrilligStdlibFunc,
acir::{BrilligStdlibFunc, Function},
brillig::Brillig,
ssa::{
function_builder::FunctionBuilder,
Expand Down Expand Up @@ -3341,7 +3341,8 @@ 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();
ssa.globals = Function::new("globals".to_owned(), ssa.main_id);
let brillig = ssa.to_brillig(false);

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

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

let ssa = builder.finish();
let mut ssa = builder.finish();
ssa.globals = Function::new("globals".to_owned(), ssa.main_id);
// 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 @@ -3568,7 +3570,8 @@ 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();
ssa.globals = Function::new("globals".to_owned(), ssa.main_id);
// 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
14 changes: 12 additions & 2 deletions noir/noir-repo/compiler/noirc_evaluator/src/brillig/brillig_gen.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,21 @@ pub(crate) mod brillig_black_box;
pub(crate) mod brillig_block;
pub(crate) mod brillig_block_variables;
pub(crate) mod brillig_fn;
pub(crate) mod brillig_globals;
pub(crate) mod brillig_slice_ops;
mod constant_allocation;
mod variable_liveness;

use acvm::FieldElement;
use fxhash::FxHashMap as HashMap;

use self::{brillig_block::BrilligBlock, brillig_fn::FunctionContext};
use super::{
brillig_ir::{
artifact::{BrilligArtifact, BrilligParameter, GeneratedBrillig, Label},
BrilligContext,
},
Brillig,
Brillig, BrilligVariable, ValueId,
};
use crate::{
errors::InternalError,
Expand All @@ -25,6 +27,7 @@ use crate::{
pub(crate) fn convert_ssa_function(
func: &Function,
enable_debug_trace: bool,
globals: &HashMap<ValueId, BrilligVariable>,
) -> BrilligArtifact<FieldElement> {
let mut brillig_context = BrilligContext::new(enable_debug_trace);

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

for block in function_context.blocks.clone() {
BrilligBlock::compile(&mut function_context, &mut brillig_context, block, &func.dfg);
BrilligBlock::compile(
&mut function_context,
&mut brillig_context,
block,
&func.dfg,
globals,
);
}

let mut artifact = brillig_context.artifact();
Expand All @@ -53,6 +62,7 @@ pub(crate) fn gen_brillig_for(
arguments,
FunctionContext::return_values(func),
func.id(),
true,
);
entry_point.name = func.name().to_string();

Expand Down
Loading

0 comments on commit 67d362a

Please sign in to comment.