Skip to content

Commit

Permalink
feat: Sync from noir (#11294)
Browse files Browse the repository at this point in the history
Automated pull of development from the
[noir](https://github.com/noir-lang/noir) programming language, a
dependency of Aztec.
BEGIN_COMMIT_OVERRIDE
chore: let `add_definition_location` take a Location
(noir-lang/noir#7185)
fix(LSP): correct signature for assert and assert_eq
(noir-lang/noir#7184)
chore(experimental): Prevent enum panics by returning Options where
possible instead of panicking
(noir-lang/noir#7180)
feat(experimental): Construct enum variants in expressions
(noir-lang/noir#7174)
feat: add `noir-inspector` (noir-lang/noir#7136)
fix: ensure canonical bits decomposition
(noir-lang/noir#7168)
fix: Keep `inc_rc` for array inputs during preprocessing
(noir-lang/noir#7163)
fix(docs): Update broken links to EC lib
(noir-lang/noir#7141)
feat: inline simple functions
(noir-lang/noir#7160)
feat(ssa): Expand feature set of the Brillig constraint check
(noir-lang/noir#7060)
fix(ssa): Resolve value before fetching from DFG in a couple cases
(noir-lang/noir#7169)
fix: `Function::is_no_predicates` always returned false for brillig f…
(noir-lang/noir#7167)
chore(refactor): Remove globals field on Ssa object and use only the
shared globals graph (noir-lang/noir#7156)
chore: let `Function::inlined` take a `should_inline_call` function
(noir-lang/noir#7149)
chore: add compile-time assertions on generic arguments of stdlib
functions (noir-lang/noir#6981)
fix: LSP hover over function with `&mut self`
(noir-lang/noir#7155)
feat(brillig): Set global memory size at program compile time
(noir-lang/noir#7151)
feat: LSP autocomplete module declaration
(noir-lang/noir#7154)
feat(ssa): Reuse constants from the globals graph when making constants
in a function DFG (noir-lang/noir#7153)
feat: LSP chain inlay hints
(noir-lang/noir#7152)
chore: turn on overflow checks in CI rust tests
(noir-lang/noir#7145)
fix(ssa): Use post order when mapping instructions in loop invariant
pass (noir-lang/noir#7140)
fix: preserve types when reading from calldata arrays
(noir-lang/noir#7144)
feat: Resolve enums & prepare type system
(noir-lang/noir#7115)
feat: `loop` must have at least one `break`
(noir-lang/noir#7126)
feat: parse globals in SSA parser
(noir-lang/noir#7112)
fix: allow calling trait impl method from struct if multiple impls exist
(noir-lang/noir#7124)
fix: avoid creating unnecessary memory blocks
(noir-lang/noir#7114)
chore: relax threshold for reporting regressions
(noir-lang/noir#7130)
fix: proper cleanup when breaking from comptime loop on error
(noir-lang/noir#7125)
fix: Prevent overlapping associated types impls
(noir-lang/noir#7047)
feat: unconstrained optimizations for BoundedVec
(noir-lang/noir#7119)
chore: mark libs good (noir-lang/noir#7123)
chore: remove comments for time/memory benchmarks
(noir-lang/noir#7121)
fix: don't always use an exclusive lock in `nargo check`
(noir-lang/noir#7120)
feat(ssa): Pass to preprocess functions
(noir-lang/noir#7072)
chore: Formatting issues / minor errors in the docs
(noir-lang/noir#7105)
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)
END_COMMIT_OVERRIDE

---------

Co-authored-by: Tom French <tom@tomfren.ch>
Co-authored-by: Tom French <15848336+TomAFrench@users.noreply.github.com>
Co-authored-by: aakoshh <akosh@aztecprotocol.com>
Co-authored-by: Akosh Farkash <aakoshh@gmail.com>
Co-authored-by: Maxim Vezenov <mvezenov@gmail.com>
  • Loading branch information
6 people authored Jan 30, 2025
1 parent 76f25b6 commit a7f8d96
Show file tree
Hide file tree
Showing 174 changed files with 6,996 additions and 1,888 deletions.
2 changes: 1 addition & 1 deletion .noir-sync-commit
Original file line number Diff line number Diff line change
@@ -1 +1 @@
c172880ae47ec4906cda662801bd4b7866c9586b
c44b62615f1c8ee657eedd82f2b80e2ec76c9078
3 changes: 2 additions & 1 deletion barretenberg/cpp/src/barretenberg/vm/avm/trace/trace.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,8 @@ void AvmTraceBuilder::pay_fee()
FF current_balance = read_hint.leaf_preimage.value;

const auto updated_balance = current_balance - tx_fee;
if (current_balance < tx_fee) {
// Comparison on Field gives inverted results, so we cast to uint128, which should be enough for fees.
if (static_cast<uint128_t>(current_balance) < static_cast<uint128_t>(tx_fee)) {
info("Not enough balance for fee payer to pay for transaction (got ", current_balance, " needs ", tx_fee);
throw std::runtime_error("Not enough balance for fee payer to pay for transaction");
}
Expand Down
214 changes: 117 additions & 97 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 @@ -421,53 +421,9 @@ jobs:
retention-days: 3
overwrite: true

upload_compilation_report:
name: Upload compilation 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
permissions:
pull-requests: write

steps:
- uses: actions/checkout@v4

- name: Download initial compilation report
uses: actions/download-artifact@v4
with:
name: in_progress_compilation_report

- name: Download matrix compilation reports
uses: actions/download-artifact@v4
with:
pattern: compilation_report_*
path: ./reports

- name: Merge compilation reports using jq
run: |
mv ./.github/scripts/merge-bench-reports.sh merge-bench-reports.sh
./merge-bench-reports.sh compilation_report
- name: Parse compilation report
id: compilation_report
uses: noir-lang/noir-bench-report@6ba151d7795042c4ff51864fbeb13c0a6a79246c
with:
report: compilation_report.json
header: |
Compilation Report
memory_report: false

- name: Add memory report to sticky comment
if: github.event_name == 'pull_request' || github.event_name == 'pull_request_target'
uses: marocchino/sticky-pull-request-comment@v2
with:
header: compilation
message: ${{ steps.compilation_report.outputs.markdown }}

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 @@ -508,6 +464,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 @@ -521,6 +478,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 @@ -568,14 +526,67 @@ jobs:
retention-days: 3
overwrite: true

upload_compilation_report:
name: Upload compilation 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-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

- name: Download initial compilation report
uses: actions/download-artifact@v4
with:
name: in_progress_compilation_report

- name: Download matrix compilation reports
uses: actions/download-artifact@v4
with:
pattern: compilation_report_*
path: ./reports

- name: Merge compilation reports using jq
run: |
mv ./.github/scripts/merge-bench-reports.sh merge-bench-reports.sh
./merge-bench-reports.sh compilation_report
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: "120%"
comment-on-alert: true
fail-on-alert: false
alert-comment-cc-users: "@TomAFrench"
max-items-in-chart: 50

upload_compilation_memory_report:
name: Upload compilation 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 All @@ -595,33 +606,36 @@ jobs:
run: |
mv ./.github/scripts/merge-bench-reports.sh merge-bench-reports.sh
./merge-bench-reports.sh memory_report
# Rename the memory report as to not clash with the compilation memory report file name
cp memory_report.json execution_memory_report.json
- name: Parse compilation memory report
id: compilation_mem_report
uses: noir-lang/noir-bench-report@6ba151d7795042c4ff51864fbeb13c0a6a79246c
with:
report: execution_memory_report.json
header: |
Compilation Memory Report
memory_report: true

- name: Add execution memory report to sticky comment
if: github.event_name == 'pull_request' || github.event_name == 'pull_request_target'
uses: marocchino/sticky-pull-request-comment@v2
with:
header: compilation_memory
message: ${{ steps.compilation_mem_report.outputs.markdown }}
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: "120%"
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 All @@ -643,31 +657,37 @@ jobs:
./merge-bench-reports.sh memory_report
# Rename the memory report as to not clash with the compilation memory report file name
cp memory_report.json execution_memory_report.json
jq ".memory_reports | map({name: .artifact_name, value: (.peak_memory | tonumber), unit: \"MB\"}) " ./execution_memory_report.json > memory_bench.json
- name: Parse execution memory report
id: execution_mem_report
uses: noir-lang/noir-bench-report@6ba151d7795042c4ff51864fbeb13c0a6a79246c
- name: Store benchmark result
continue-on-error: true
uses: benchmark-action/github-action-benchmark@4de1bed97a47495fc4c5404952da0499e31f5c29
with:
report: execution_memory_report.json
header: |
Execution Memory Report
memory_report: true
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: "120%"
comment-on-alert: true
fail-on-alert: false
alert-comment-cc-users: "@TomAFrench"
max-items-in-chart: 50

- name: Add execution memory report to sticky comment
if: github.event_name == 'pull_request' || github.event_name == 'pull_request_target'
uses: marocchino/sticky-pull-request-comment@v2
with:
header: execution_memory
message: ${{ steps.execution_mem_report.outputs.markdown }}

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 All @@ -687,20 +707,20 @@ jobs:
run: |
mv ./.github/scripts/merge-bench-reports.sh merge-bench-reports.sh
./merge-bench-reports.sh execution_report
- name: Parse execution report
id: execution_report
uses: noir-lang/noir-bench-report@6ba151d7795042c4ff51864fbeb13c0a6a79246c
with:
report: execution_report.json
header: |
Execution Report
execution_report: true

- name: Add memory report to sticky comment
if: github.event_name == 'pull_request' || github.event_name == 'pull_request_target'
uses: marocchino/sticky-pull-request-comment@v2
with:
header: execution_time
message: ${{ steps.execution_report.outputs.markdown }}

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: "120%"
comment-on-alert: true
fail-on-alert: false
alert-comment-cc-users: "@TomAFrench"
max-items-in-chart: 50
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ jobs:
tool: nextest@0.9.67

- name: Build and archive tests
run: cargo nextest archive --workspace --release --archive-file nextest-archive.tar.zst
run: cargo nextest archive --workspace --archive-file nextest-archive.tar.zst

- name: Upload archive to workflow
uses: actions/upload-artifact@v4
Expand Down
4 changes: 2 additions & 2 deletions noir/noir-repo/.github/workflows/test-rust-workspace.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:

- uses: Swatinem/rust-cache@v2
with:
key: x86_64-unknown-linux-gnu
key: x86_64-unknown-linux-gnu-debug
cache-on-failure: true
save-if: ${{ github.event_name != 'merge_group' }}

Expand All @@ -39,7 +39,7 @@ jobs:
tool: nextest@0.9.67

- name: Build and archive tests
run: cargo nextest archive --workspace --release --archive-file nextest-archive.tar.zst
run: cargo nextest archive --workspace --archive-file nextest-archive.tar.zst

- name: Upload archive to workflow
uses: actions/upload-artifact@v4
Expand Down
14 changes: 14 additions & 0 deletions noir/noir-repo/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions noir/noir-repo/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ members = [
"tooling/noirc_abi_wasm",
"tooling/acvm_cli",
"tooling/profiler",
"tooling/inspector",
# ACVM
"acvm-repo/acir_field",
"acvm-repo/acir",
Expand All @@ -40,6 +41,7 @@ default-members = [
"tooling/nargo_cli",
"tooling/acvm_cli",
"tooling/profiler",
"tooling/inspector",
]
resolver = "2"

Expand Down
4 changes: 2 additions & 2 deletions noir/noir-repo/compiler/noirc_driver/src/abi_gen.rs
Original file line number Diff line number Diff line change
Expand Up @@ -110,9 +110,9 @@ pub(super) fn abi_type_from_hir_type(context: &Context, typ: &Type) -> AbiType {
AbiType::String { length: size }
}

Type::Struct(def, args) => {
Type::DataType(def, args) => {
let struct_type = def.borrow();
let fields = struct_type.get_fields(args);
let fields = struct_type.get_fields(args).unwrap_or_default();
let fields =
vecmap(fields, |(name, typ)| (name, abi_type_from_hir_type(context, &typ)));
// For the ABI, we always want to resolve the struct paths from the root crate
Expand Down
Loading

1 comment on commit a7f8d96

@AztecBot
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Performance Alert ⚠️

Possible performance regression was detected for benchmark 'C++ Benchmark'.
Benchmark result of this commit is worse than the previous benchmark result exceeding threshold 1.05.

Benchmark suite Current: a7f8d96 Previous: 859c29b Ratio
wasmconstruct_proof_ultrahonk_power_of_2/20 14639.107864000001 ms/iter 13500.515418 ms/iter 1.08

This comment was automatically generated by workflow using github-action-benchmark.

CC: @ludamad @codygunton

Please sign in to comment.