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

feat: Sync from noir #10483

Merged
merged 28 commits into from
Dec 12, 2024
Merged
Changes from 1 commit
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
5432ee9
[1 changes]
AztecBot Dec 8, 2024
c80b654
chore: apply sync fixes
AztecBot Dec 8, 2024
d5dc851
Merge branch 'master' into sync-noir
TomAFrench Dec 9, 2024
22be332
[1 changes] feat: Order attribute execution by their source ordering …
AztecBot Dec 9, 2024
bed011d
chore: apply sync fixes
AztecBot Dec 9, 2024
8d3752e
feat: Order attribute execution by their source ordering (https://git…
AztecBot Dec 9, 2024
2445f7a
chore: pull across macro ordering changes (#10466)
TomAFrench Dec 9, 2024
74ae849
Merge branch 'master' into sync-noir
TomAFrench Dec 9, 2024
36fff22
Apply suggestions from code review
TomAFrench Dec 9, 2024
450f431
[1 changes] chore: free memory for silenced warnings early (https://g…
AztecBot Dec 10, 2024
2563f49
chore: apply sync fixes
AztecBot Dec 10, 2024
493106f
chore: free memory for silenced warnings early (https://github.com/no…
AztecBot Dec 10, 2024
4520593
.
TomAFrench Dec 10, 2024
a56d0d2
[1 changes] fix: Do not merge expressions that contain output witness…
AztecBot Dec 11, 2024
ceae8e1
chore: apply sync fixes
AztecBot Dec 11, 2024
7a66f06
fix: Do not merge expressions that contain output witnesses (https://…
AztecBot Dec 11, 2024
9c79a87
Merge branch 'master' into sync-noir
TomAFrench Dec 11, 2024
5e41b03
[1 changes] chore: Try replace callstack with a linked list (https://…
AztecBot Dec 11, 2024
f73299e
chore: apply sync fixes
AztecBot Dec 11, 2024
17e7f3b
chore: Try replace callstack with a linked list (https://github.com/n…
AztecBot Dec 11, 2024
1353980
Fix optimizer to keep track of chaning opcode locations
aakoshh Dec 12, 2024
dcb26c7
Merge branch 'sync-noir' of github.com:AztecProtocol/aztec-packages i…
aakoshh Dec 12, 2024
2abfafa
Early exit on 0
aakoshh Dec 12, 2024
97fd0e1
[1 changes] feat: several `nargo test` improvements (https://github.c…
AztecBot Dec 12, 2024
22818a6
chore: apply sync fixes
AztecBot Dec 12, 2024
5c54d74
feat: several `nargo test` improvements (https://github.com/noir-lang…
AztecBot Dec 12, 2024
5caae4e
chore: fix build
TomAFrench Dec 12, 2024
0e07fa3
.
TomAFrench Dec 12, 2024
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
Prev Previous commit
Next Next commit
[1 changes] feat: Order attribute execution by their source ordering (n…
…oir-lang/noir#6326)

feat(test): Check that `nargo::ops::transform_program` is idempotent (noir-lang/noir#6694)
feat: Sync from aztec-packages (noir-lang/noir#6730)
  • Loading branch information
AztecBot committed Dec 9, 2024
commit 22be3320fd53a5b77c5e88996fb6eb1e6352e96f
2 changes: 1 addition & 1 deletion .noir-sync-commit
Original file line number Diff line number Diff line change
@@ -1 +1 @@
31640e91ba75b9c5200ea66d1f54cc5185e0d196
852155dc1c4a910bf9cd4e7af334f3856c1c4643
49 changes: 29 additions & 20 deletions noir/noir-repo/.github/workflows/test-js-packages.yml
Original file line number Diff line number Diff line change
@@ -521,34 +521,43 @@ jobs:
working-directory: ./examples/codegen_verifier
run: ./test.sh

critical-library-list:
name: Load critical library list
runs-on: ubuntu-latest
outputs:
libraries: ${{ steps.get_critical_libraries.outputs.libraries }}

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Build list of libraries
id: get_critical_libraries
run: |
LIBRARIES=$(grep -Po "^https://github.com/\K.+" ./CRITICAL_NOIR_LIBRARIES | jq -R -s -c 'split("\n") | map(select(. != "")) | map({ repo: ., path: "./"})')
echo "libraries=$LIBRARIES"
echo "libraries=$LIBRARIES" >> $GITHUB_OUTPUT
env:
GH_TOKEN: ${{ github.token }}

external-repo-checks:
needs: [build-nargo]
needs: [build-nargo, critical-library-list]
runs-on: ubuntu-latest
# Only run when 'run-external-checks' label is present
if: contains(github.event.pull_request.labels.*.name, 'run-external-checks')
timeout-minutes: 30
strategy:
fail-fast: false
matrix:
project:
- { repo: noir-lang/ec, path: ./ }
- { repo: noir-lang/eddsa, path: ./ }
- { repo: noir-lang/mimc, path: ./ }
- { repo: noir-lang/noir_sort, path: ./ }
- { repo: noir-lang/noir-edwards, path: ./ }
- { repo: noir-lang/noir-bignum, path: ./ }
- { repo: noir-lang/noir_bigcurve, path: ./ }
- { repo: noir-lang/noir_base64, path: ./ }
- { repo: noir-lang/noir_string_search, path: ./ }
- { repo: noir-lang/sparse_array, path: ./ }
- { repo: noir-lang/noir_rsa, path: ./lib }
- { repo: AztecProtocol/aztec-packages, path: ./noir-projects/aztec-nr }
- { repo: AztecProtocol/aztec-packages, path: ./noir-projects/noir-contracts }
- { repo: AztecProtocol/aztec-packages, path: ./noir-projects/noir-protocol-circuits/crates/parity-lib }
- { repo: AztecProtocol/aztec-packages, path: ./noir-projects/noir-protocol-circuits/crates/private-kernel-lib }
- { repo: AztecProtocol/aztec-packages, path: ./noir-projects/noir-protocol-circuits/crates/reset-kernel-lib }
- { repo: AztecProtocol/aztec-packages, path: ./noir-projects/noir-protocol-circuits/crates/rollup-lib }
- { repo: AztecProtocol/aztec-packages, path: ./noir-projects/noir-protocol-circuits/crates/types }
project: ${{ fromJson( needs.critical-library-list.outputs.libraries )}}
include:
- project: { repo: AztecProtocol/aztec-packages, path: ./noir-projects/aztec-nr }
- project: { repo: AztecProtocol/aztec-packages, path: ./noir-projects/noir-contracts }
- project: { repo: AztecProtocol/aztec-packages, path: ./noir-projects/noir-protocol-circuits/crates/parity-lib }
- project: { repo: AztecProtocol/aztec-packages, path: ./noir-projects/noir-protocol-circuits/crates/private-kernel-lib }
- project: { repo: AztecProtocol/aztec-packages, path: ./noir-projects/noir-protocol-circuits/crates/reset-kernel-lib }
- project: { repo: AztecProtocol/aztec-packages, path: ./noir-projects/noir-protocol-circuits/crates/rollup-lib }
- project: { repo: AztecProtocol/aztec-packages, path: ./noir-projects/noir-protocol-circuits/crates/types }

name: Check external repo - ${{ matrix.project.repo }}
steps:
13 changes: 13 additions & 0 deletions noir/noir-repo/CRITICAL_NOIR_LIBRARIES
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
https://github.com/noir-lang/ec
https://github.com/noir-lang/eddsa
https://github.com/noir-lang/mimc
https://github.com/noir-lang/schnorr
https://github.com/noir-lang/noir_sort
https://github.com/noir-lang/noir-edwards
https://github.com/noir-lang/noir-bignum
https://github.com/noir-lang/noir_bigcurve
https://github.com/noir-lang/noir_base64
https://github.com/noir-lang/noir_string_search
https://github.com/noir-lang/sparse_array
https://github.com/noir-lang/noir_rsa
https://github.com/noir-lang/noir_json_parser
4 changes: 2 additions & 2 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: 1 addition & 1 deletion noir/noir-repo/acvm-repo/acvm/Cargo.toml
Original file line number Diff line number Diff line change
@@ -17,7 +17,7 @@ workspace = true
thiserror.workspace = true
tracing.workspace = true
serde.workspace = true

fxhash.workspace = true
acir.workspace = true
brillig_vm.workspace = true
acvm_blackbox_solver.workspace = true
41 changes: 35 additions & 6 deletions noir/noir-repo/acvm-repo/acvm/src/compiler/mod.rs
Original file line number Diff line number Diff line change
@@ -16,6 +16,10 @@ pub use simulator::CircuitSimulator;
use transformers::transform_internal;
pub use transformers::{transform, MIN_EXPRESSION_WIDTH};

/// We need multiple passes to stabilize the output.
/// The value was determined by running tests.
const MAX_OPTIMIZER_PASSES: usize = 3;

/// This module moves and decomposes acir opcodes. The transformation map allows consumers of this module to map
/// metadata they had about the opcodes to the new opcode structure generated after the transformation.
#[derive(Debug)]
@@ -28,9 +32,9 @@ impl AcirTransformationMap {
/// Builds a map from a vector of pointers to the old acir opcodes.
/// The index of the vector is the new opcode index.
/// The value of the vector is the old opcode index pointed.
fn new(acir_opcode_positions: Vec<usize>) -> Self {
fn new(acir_opcode_positions: &[usize]) -> Self {
let mut old_indices_to_new_indices = HashMap::with_capacity(acir_opcode_positions.len());
for (new_index, old_index) in acir_opcode_positions.into_iter().enumerate() {
for (new_index, old_index) in acir_opcode_positions.iter().copied().enumerate() {
old_indices_to_new_indices.entry(old_index).or_insert_with(Vec::new).push(new_index);
}
AcirTransformationMap { old_indices_to_new_indices }
@@ -72,17 +76,42 @@ fn transform_assert_messages<F: Clone>(
}

/// Applies [`ProofSystemCompiler`][crate::ProofSystemCompiler] specific optimizations to a [`Circuit`].
///
/// Runs multiple passes until the output stabilizes.
pub fn compile<F: AcirField>(
acir: Circuit<F>,
expression_width: ExpressionWidth,
) -> (Circuit<F>, AcirTransformationMap) {
let (acir, acir_opcode_positions) = optimize_internal(acir);
let mut pass = 0;
let mut prev_opcodes_hash = fxhash::hash64(&acir.opcodes);
let mut prev_acir = acir;

// For most test programs it would be enough to only loop `transform_internal`,
// but some of them don't stabilize unless we also repeat the backend agnostic optimizations.
let (mut acir, acir_opcode_positions) = loop {
let (acir, acir_opcode_positions) = optimize_internal(prev_acir);

// Stop if we have already done at least one transform and an extra optimization changed nothing.
if pass > 0 && prev_opcodes_hash == fxhash::hash64(&acir.opcodes) {
break (acir, acir_opcode_positions);
}

let (mut acir, acir_opcode_positions) =
transform_internal(acir, expression_width, acir_opcode_positions);
let (acir, acir_opcode_positions) =
transform_internal(acir, expression_width, acir_opcode_positions);

let opcodes_hash = fxhash::hash64(&acir.opcodes);

// Stop if the output hasn't change in this loop or we went too long.
if pass == MAX_OPTIMIZER_PASSES - 1 || prev_opcodes_hash == opcodes_hash {
break (acir, acir_opcode_positions);
}

let transformation_map = AcirTransformationMap::new(acir_opcode_positions);
pass += 1;
prev_acir = acir;
prev_opcodes_hash = opcodes_hash;
};

let transformation_map = AcirTransformationMap::new(&acir_opcode_positions);
acir.assert_messages = transform_assert_messages(acir.assert_messages, &transformation_map);

(acir, transformation_map)
Loading