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

chore: resolve immutable array merge differences #1617

Merged
merged 5 commits into from
Jun 9, 2023

Conversation

joss-aztec
Copy link
Contributor

Description

Problem*

Resolves

Summary*

Merge from master

This PR sets out to

Example

Before:


After:


Documentation

  • This PR requires documentation updates when merged.

    • I will submit a noir-lang/docs PR.
    • I will request for and support Dev Rel's help in documenting this PR.

Additional Context

PR Checklist*

  • I have tested the changes locally.
  • I have formatted the changes with Prettier and/or cargo fmt on default settings.

jfecher and others added 4 commits June 8, 2023 20:47
* Represent SSA arrays with im::Vector

* Get tests passing

* Implement assign with immutable arrays

* Add constant folding pass

* Update comments

* Clippy

* Update comment

* Update type of array

* Update crates/noirc_evaluator/src/ssa_refactor/ir/instruction.rs

Co-authored-by: Tom French <[email protected]>

* Undo formatting changes in instruction.rs

* Massive acir_gen update

* Refactor acir array operations into a shared function

* Appease clippy

* Update to_radix and to_bits in acir_gen to return arrays

* Disable assert

* Fix convert_type for arrays

* Include AcirType in AcirValue::Var variant

* Fix black box functions

* Appease clippy

* Fix simple_radix

* Add doc comments

---------

Co-authored-by: Tom French <[email protected]>
…eld in unconstrained functions (#1583)

* make ranges be polymorphic integers

* make behavior consistent

* remove closure

* change index_type

* Update crates/noirc_frontend/src/hir/type_check/expr.rs

---------

Co-authored-by: jfecher <[email protected]>
@kevaundray kevaundray changed the title Joss/brillig main chore: resolve immutable array merge differences Jun 9, 2023
@kevaundray kevaundray merged commit 1a9d33c into kw/brillig-main Jun 9, 2023
@kevaundray kevaundray deleted the joss/brillig-main branch June 9, 2023 10:11
kevaundray added a commit that referenced this pull request Jun 9, 2023
* remove mac runner

* chore: generate brillig opcode for simple identity unconstrained function (#1536)

* feat(brillig): added arithmetic operations on brillig (#1565)

Co-authored-by: kevaundray <[email protected]>

* make ranges be polymorphic integers

* chore(brillig): Clean up handling of Binary operations (#1571)

* chore(ssa refactor): Rename Brillig example (#1563)

* chore(brillig): added tests for all field binary operations (#1586)

* chore(brillig): added tests for brillig integer operations (#1590)

* feat: process blocks and jumps when compiling brillig (#1591)

* process jumps between blocks

* fix jumps

* add doc comments

* cargo fmt

* code refactor

* update code comment

---------

Co-authored-by: kevaundray <[email protected]>

* feat: process blocks and jumps when compiling brillig (#1591)

* process jumps between blocks

* fix jumps

* add doc comments

* cargo fmt

* code refactor

* update code comment

---------

Co-authored-by: kevaundray <[email protected]>

* feat(brillig): parsing oracles/foreign calls (#1596)

* feat(brillig): start of oracles/foreign calls

* fix: broken tests

* Update execute.rs

* self.data -> self.vars

* chore(brillig): Add handling of the not instruction (#1609)

* make behavior consistent

* remove closure

* change index_type

* Update crates/noirc_frontend/src/hir/type_check/expr.rs

* feat(brillig): loops (#1610)

* make ranges be polymorphic integers

* feat: brillig loop support

* fix: fixed brillig returns and stop

* fix: do not apply constants folding to brillig fns

* chore: update acvm pointer, cleanup

* style: newline on cargo toml

* make behavior consistent

* remove closure

* change index_type

* Update crates/noirc_frontend/src/hir/type_check/expr.rs

* better debug information for unsupported instruction

* remove edge case for optimizations

* clippy fix

* patch infinite loop

---------

Co-authored-by: kevaundray <[email protected]>
Co-authored-by: jfecher <[email protected]>

* chore: resolve immutable array merge differences (#1617)

* chore(ssa refactor): Switch to immutable arrays (#1578)

* Represent SSA arrays with im::Vector

* Get tests passing

* Implement assign with immutable arrays

* Add constant folding pass

* Update comments

* Clippy

* Update comment

* Update type of array

* Update crates/noirc_evaluator/src/ssa_refactor/ir/instruction.rs

Co-authored-by: Tom French <[email protected]>

* Undo formatting changes in instruction.rs

* Massive acir_gen update

* Refactor acir array operations into a shared function

* Appease clippy

* Update to_radix and to_bits in acir_gen to return arrays

* Disable assert

* Fix convert_type for arrays

* Include AcirType in AcirValue::Var variant

* Fix black box functions

* Appease clippy

* Fix simple_radix

* Add doc comments

---------

Co-authored-by: Tom French <[email protected]>

* feat: Make for-loop range be a polymorphic integer instead of just Field in unconstrained functions (#1583)

* make ranges be polymorphic integers

* make behavior consistent

* remove closure

* change index_type

* Update crates/noirc_frontend/src/hir/type_check/expr.rs

---------

Co-authored-by: jfecher <[email protected]>

* chore(ssa refactor): fix brillig post master merge

* chore(ssa refactor): accidental merge undelete

---------

Co-authored-by: jfecher <[email protected]>
Co-authored-by: Tom French <[email protected]>
Co-authored-by: kevaundray <[email protected]>

* chore(ssa refactor): Add more documentation for truncation  (#1607)

* add more documentation

* small change

* Update crates/noirc_evaluator/src/ssa_refactor/acir_gen/acir_ir/generated_acir.rs

* Update .github/workflows/test.yml

* Update .github/workflows/test.yml

---------

Co-authored-by: guipublic <[email protected]>
Co-authored-by: Álvaro Rodríguez <[email protected]>
Co-authored-by: ludamad <[email protected]>
Co-authored-by: jfecher <[email protected]>
Co-authored-by: joss-aztec <[email protected]>
Co-authored-by: Tom French <[email protected]>
vezenovm added a commit that referenced this pull request Jun 9, 2023
* remove mac runner

* chore: generate brillig opcode for simple identity unconstrained function (#1536)

* feat(brillig): added arithmetic operations on brillig (#1565)

Co-authored-by: kevaundray <[email protected]>

* make ranges be polymorphic integers

* chore(brillig): Clean up handling of Binary operations (#1571)

* chore(ssa refactor): Rename Brillig example (#1563)

* chore(brillig): added tests for all field binary operations (#1586)

* chore(brillig): added tests for brillig integer operations (#1590)

* feat: process blocks and jumps when compiling brillig (#1591)

* process jumps between blocks

* fix jumps

* add doc comments

* cargo fmt

* code refactor

* update code comment

---------

Co-authored-by: kevaundray <[email protected]>

* feat: process blocks and jumps when compiling brillig (#1591)

* process jumps between blocks

* fix jumps

* add doc comments

* cargo fmt

* code refactor

* update code comment

---------

Co-authored-by: kevaundray <[email protected]>

* feat(brillig): start of oracles/foreign calls

* fix: broken tests

* feat(brillig): parsing oracles/foreign calls (#1596)

* feat(brillig): start of oracles/foreign calls

* fix: broken tests

* Update execute.rs

* feat: more foreign call work

* self.data -> self.vars

* chore(brillig): Add handling of the not instruction (#1609)

* test: brillig oracle

* Reinstate option

* make behavior consistent

* remove closure

* change index_type

* Update crates/noirc_frontend/src/hir/type_check/expr.rs

* feat(brillig): loops (#1610)

* make ranges be polymorphic integers

* feat: brillig loop support

* fix: fixed brillig returns and stop

* fix: do not apply constants folding to brillig fns

* chore: update acvm pointer, cleanup

* style: newline on cargo toml

* make behavior consistent

* remove closure

* change index_type

* Update crates/noirc_frontend/src/hir/type_check/expr.rs

* better debug information for unsupported instruction

* remove edge case for optimizations

* clippy fix

* patch infinite loop

---------

Co-authored-by: kevaundray <[email protected]>
Co-authored-by: jfecher <[email protected]>

* feat: Foreign calls compiling and basic print executed in nargo (#1612)

* get foreign calls compiling and basic print executed in nargo

* cargo clipy and cargo fmt

* missing

* Update crates/noirc_evaluator/src/brillig/brillig_gen.rs

* add issue num for logging

---------

Co-authored-by: kevaundray <[email protected]>

* chore: resolve immutable array merge differences (#1617)

* chore(ssa refactor): Switch to immutable arrays (#1578)

* Represent SSA arrays with im::Vector

* Get tests passing

* Implement assign with immutable arrays

* Add constant folding pass

* Update comments

* Clippy

* Update comment

* Update type of array

* Update crates/noirc_evaluator/src/ssa_refactor/ir/instruction.rs

Co-authored-by: Tom French <[email protected]>

* Undo formatting changes in instruction.rs

* Massive acir_gen update

* Refactor acir array operations into a shared function

* Appease clippy

* Update to_radix and to_bits in acir_gen to return arrays

* Disable assert

* Fix convert_type for arrays

* Include AcirType in AcirValue::Var variant

* Fix black box functions

* Appease clippy

* Fix simple_radix

* Add doc comments

---------

Co-authored-by: Tom French <[email protected]>

* feat: Make for-loop range be a polymorphic integer instead of just Field in unconstrained functions (#1583)

* make ranges be polymorphic integers

* make behavior consistent

* remove closure

* change index_type

* Update crates/noirc_frontend/src/hir/type_check/expr.rs

---------

Co-authored-by: jfecher <[email protected]>

* chore(ssa refactor): fix brillig post master merge

* chore(ssa refactor): accidental merge undelete

---------

Co-authored-by: jfecher <[email protected]>
Co-authored-by: Tom French <[email protected]>
Co-authored-by: kevaundray <[email protected]>

* chore(ssa refactor): Add more documentation for truncation  (#1607)

* add more documentation

* small change

* Update crates/noirc_evaluator/src/ssa_refactor/acir_gen/acir_ir/generated_acir.rs

* Update .github/workflows/test.yml

* Update .github/workflows/test.yml

* remove dbg

* change printer for foreign call

* Update crates/noirc_evaluator/src/ssa_refactor/ir/function.rs

* Update crates/noirc_evaluator/src/ssa_refactor/ir/instruction.rs

Co-authored-by: kevaundray <[email protected]>

* Update crates/noirc_evaluator/src/ssa_refactor/acir_gen/acir_ir/acir_variable.rs

---------

Co-authored-by: kevaundray <[email protected]>
Co-authored-by: guipublic <[email protected]>
Co-authored-by: Álvaro Rodríguez <[email protected]>
Co-authored-by: jfecher <[email protected]>
Co-authored-by: Maxim Vezenov <[email protected]>
Co-authored-by: joss-aztec <[email protected]>
Co-authored-by: Tom French <[email protected]>
kevaundray added a commit that referenced this pull request Jun 9, 2023
* remove mac runner

* chore: generate brillig opcode for simple identity unconstrained function (#1536)

* feat(brillig): added arithmetic operations on brillig (#1565)

Co-authored-by: kevaundray <[email protected]>

* make ranges be polymorphic integers

* chore(brillig): Clean up handling of Binary operations (#1571)

* chore(ssa refactor): Rename Brillig example (#1563)

* chore(brillig): added tests for all field binary operations (#1586)

* chore(brillig): added tests for brillig integer operations (#1590)

* feat: process blocks and jumps when compiling brillig (#1591)

* process jumps between blocks

* fix jumps

* add doc comments

* cargo fmt

* code refactor

* update code comment

---------

Co-authored-by: kevaundray <[email protected]>

* feat: process blocks and jumps when compiling brillig (#1591)

* process jumps between blocks

* fix jumps

* add doc comments

* cargo fmt

* code refactor

* update code comment

---------

Co-authored-by: kevaundray <[email protected]>

* feat(brillig): parsing oracles/foreign calls (#1596)

* feat(brillig): start of oracles/foreign calls

* fix: broken tests

* Update execute.rs

* support assert in brillig

* self.data -> self.vars

* Avoid not in the test

* chore(brillig): Add handling of the not instruction (#1609)

* make behavior consistent

* remove closure

* change index_type

* Update crates/noirc_frontend/src/hir/type_check/expr.rs

* feat(brillig): loops (#1610)

* make ranges be polymorphic integers

* feat: brillig loop support

* fix: fixed brillig returns and stop

* fix: do not apply constants folding to brillig fns

* chore: update acvm pointer, cleanup

* style: newline on cargo toml

* make behavior consistent

* remove closure

* change index_type

* Update crates/noirc_frontend/src/hir/type_check/expr.rs

* better debug information for unsupported instruction

* remove edge case for optimizations

* clippy fix

* patch infinite loop

---------

Co-authored-by: kevaundray <[email protected]>
Co-authored-by: jfecher <[email protected]>

* chore: resolve immutable array merge differences (#1617)

* chore(ssa refactor): Switch to immutable arrays (#1578)

* Represent SSA arrays with im::Vector

* Get tests passing

* Implement assign with immutable arrays

* Add constant folding pass

* Update comments

* Clippy

* Update comment

* Update type of array

* Update crates/noirc_evaluator/src/ssa_refactor/ir/instruction.rs

Co-authored-by: Tom French <[email protected]>

* Undo formatting changes in instruction.rs

* Massive acir_gen update

* Refactor acir array operations into a shared function

* Appease clippy

* Update to_radix and to_bits in acir_gen to return arrays

* Disable assert

* Fix convert_type for arrays

* Include AcirType in AcirValue::Var variant

* Fix black box functions

* Appease clippy

* Fix simple_radix

* Add doc comments

---------

Co-authored-by: Tom French <[email protected]>

* feat: Make for-loop range be a polymorphic integer instead of just Field in unconstrained functions (#1583)

* make ranges be polymorphic integers

* make behavior consistent

* remove closure

* change index_type

* Update crates/noirc_frontend/src/hir/type_check/expr.rs

---------

Co-authored-by: jfecher <[email protected]>

* chore(ssa refactor): fix brillig post master merge

* chore(ssa refactor): accidental merge undelete

---------

Co-authored-by: jfecher <[email protected]>
Co-authored-by: Tom French <[email protected]>
Co-authored-by: kevaundray <[email protected]>

* chore(ssa refactor): Add more documentation for truncation  (#1607)

* add more documentation

* small change

* Update crates/noirc_evaluator/src/ssa_refactor/acir_gen/acir_ir/generated_acir.rs

* Update .github/workflows/test.yml

* Update .github/workflows/test.yml

* Remove optimisation for handling assert

* add the assert jump to the list of jumps to fix

* add doc comment

---------

Co-authored-by: kevaundray <[email protected]>
Co-authored-by: Álvaro Rodríguez <[email protected]>
Co-authored-by: ludamad <[email protected]>
Co-authored-by: jfecher <[email protected]>
Co-authored-by: joss-aztec <[email protected]>
Co-authored-by: Tom French <[email protected]>
kevaundray added a commit that referenced this pull request Jun 17, 2023
* disable mac tests

* feat: added support for modulo ops on brillig (#1621)

* feat: added support for modulo ops

* chore: use ACVM 0.14.3

* revert change as its unrelated

* small comment refactor

---------

Co-authored-by: kevaundray <[email protected]>

* feat(brillig): foreign call/oracle compilation (#1600)

* remove mac runner

* chore: generate brillig opcode for simple identity unconstrained function (#1536)

* feat(brillig): added arithmetic operations on brillig (#1565)

Co-authored-by: kevaundray <[email protected]>

* make ranges be polymorphic integers

* chore(brillig): Clean up handling of Binary operations (#1571)

* chore(ssa refactor): Rename Brillig example (#1563)

* chore(brillig): added tests for all field binary operations (#1586)

* chore(brillig): added tests for brillig integer operations (#1590)

* feat: process blocks and jumps when compiling brillig (#1591)

* process jumps between blocks

* fix jumps

* add doc comments

* cargo fmt

* code refactor

* update code comment

---------

Co-authored-by: kevaundray <[email protected]>

* feat: process blocks and jumps when compiling brillig (#1591)

* process jumps between blocks

* fix jumps

* add doc comments

* cargo fmt

* code refactor

* update code comment

---------

Co-authored-by: kevaundray <[email protected]>

* feat(brillig): start of oracles/foreign calls

* fix: broken tests

* feat(brillig): parsing oracles/foreign calls (#1596)

* feat(brillig): start of oracles/foreign calls

* fix: broken tests

* Update execute.rs

* feat: more foreign call work

* self.data -> self.vars

* chore(brillig): Add handling of the not instruction (#1609)

* test: brillig oracle

* Reinstate option

* make behavior consistent

* remove closure

* change index_type

* Update crates/noirc_frontend/src/hir/type_check/expr.rs

* feat(brillig): loops (#1610)

* make ranges be polymorphic integers

* feat: brillig loop support

* fix: fixed brillig returns and stop

* fix: do not apply constants folding to brillig fns

* chore: update acvm pointer, cleanup

* style: newline on cargo toml

* make behavior consistent

* remove closure

* change index_type

* Update crates/noirc_frontend/src/hir/type_check/expr.rs

* better debug information for unsupported instruction

* remove edge case for optimizations

* clippy fix

* patch infinite loop

---------

Co-authored-by: kevaundray <[email protected]>
Co-authored-by: jfecher <[email protected]>

* feat: Foreign calls compiling and basic print executed in nargo (#1612)

* get foreign calls compiling and basic print executed in nargo

* cargo clipy and cargo fmt

* missing

* Update crates/noirc_evaluator/src/brillig/brillig_gen.rs

* add issue num for logging

---------

Co-authored-by: kevaundray <[email protected]>

* chore: resolve immutable array merge differences (#1617)

* chore(ssa refactor): Switch to immutable arrays (#1578)

* Represent SSA arrays with im::Vector

* Get tests passing

* Implement assign with immutable arrays

* Add constant folding pass

* Update comments

* Clippy

* Update comment

* Update type of array

* Update crates/noirc_evaluator/src/ssa_refactor/ir/instruction.rs

Co-authored-by: Tom French <[email protected]>

* Undo formatting changes in instruction.rs

* Massive acir_gen update

* Refactor acir array operations into a shared function

* Appease clippy

* Update to_radix and to_bits in acir_gen to return arrays

* Disable assert

* Fix convert_type for arrays

* Include AcirType in AcirValue::Var variant

* Fix black box functions

* Appease clippy

* Fix simple_radix

* Add doc comments

---------

Co-authored-by: Tom French <[email protected]>

* feat: Make for-loop range be a polymorphic integer instead of just Field in unconstrained functions (#1583)

* make ranges be polymorphic integers

* make behavior consistent

* remove closure

* change index_type

* Update crates/noirc_frontend/src/hir/type_check/expr.rs

---------

Co-authored-by: jfecher <[email protected]>

* chore(ssa refactor): fix brillig post master merge

* chore(ssa refactor): accidental merge undelete

---------

Co-authored-by: jfecher <[email protected]>
Co-authored-by: Tom French <[email protected]>
Co-authored-by: kevaundray <[email protected]>

* chore(ssa refactor): Add more documentation for truncation  (#1607)

* add more documentation

* small change

* Update crates/noirc_evaluator/src/ssa_refactor/acir_gen/acir_ir/generated_acir.rs

* Update .github/workflows/test.yml

* Update .github/workflows/test.yml

* remove dbg

* change printer for foreign call

* Update crates/noirc_evaluator/src/ssa_refactor/ir/function.rs

* Update crates/noirc_evaluator/src/ssa_refactor/ir/instruction.rs

Co-authored-by: kevaundray <[email protected]>

* Update crates/noirc_evaluator/src/ssa_refactor/acir_gen/acir_ir/acir_variable.rs

---------

Co-authored-by: kevaundray <[email protected]>
Co-authored-by: guipublic <[email protected]>
Co-authored-by: Álvaro Rodríguez <[email protected]>
Co-authored-by: jfecher <[email protected]>
Co-authored-by: Maxim Vezenov <[email protected]>
Co-authored-by: joss-aztec <[email protected]>
Co-authored-by: Tom French <[email protected]>

* feat: add support for assert in brillig (#1603)

* remove mac runner

* chore: generate brillig opcode for simple identity unconstrained function (#1536)

* feat(brillig): added arithmetic operations on brillig (#1565)

Co-authored-by: kevaundray <[email protected]>

* make ranges be polymorphic integers

* chore(brillig): Clean up handling of Binary operations (#1571)

* chore(ssa refactor): Rename Brillig example (#1563)

* chore(brillig): added tests for all field binary operations (#1586)

* chore(brillig): added tests for brillig integer operations (#1590)

* feat: process blocks and jumps when compiling brillig (#1591)

* process jumps between blocks

* fix jumps

* add doc comments

* cargo fmt

* code refactor

* update code comment

---------

Co-authored-by: kevaundray <[email protected]>

* feat: process blocks and jumps when compiling brillig (#1591)

* process jumps between blocks

* fix jumps

* add doc comments

* cargo fmt

* code refactor

* update code comment

---------

Co-authored-by: kevaundray <[email protected]>

* feat(brillig): parsing oracles/foreign calls (#1596)

* feat(brillig): start of oracles/foreign calls

* fix: broken tests

* Update execute.rs

* support assert in brillig

* self.data -> self.vars

* Avoid not in the test

* chore(brillig): Add handling of the not instruction (#1609)

* make behavior consistent

* remove closure

* change index_type

* Update crates/noirc_frontend/src/hir/type_check/expr.rs

* feat(brillig): loops (#1610)

* make ranges be polymorphic integers

* feat: brillig loop support

* fix: fixed brillig returns and stop

* fix: do not apply constants folding to brillig fns

* chore: update acvm pointer, cleanup

* style: newline on cargo toml

* make behavior consistent

* remove closure

* change index_type

* Update crates/noirc_frontend/src/hir/type_check/expr.rs

* better debug information for unsupported instruction

* remove edge case for optimizations

* clippy fix

* patch infinite loop

---------

Co-authored-by: kevaundray <[email protected]>
Co-authored-by: jfecher <[email protected]>

* chore: resolve immutable array merge differences (#1617)

* chore(ssa refactor): Switch to immutable arrays (#1578)

* Represent SSA arrays with im::Vector

* Get tests passing

* Implement assign with immutable arrays

* Add constant folding pass

* Update comments

* Clippy

* Update comment

* Update type of array

* Update crates/noirc_evaluator/src/ssa_refactor/ir/instruction.rs

Co-authored-by: Tom French <[email protected]>

* Undo formatting changes in instruction.rs

* Massive acir_gen update

* Refactor acir array operations into a shared function

* Appease clippy

* Update to_radix and to_bits in acir_gen to return arrays

* Disable assert

* Fix convert_type for arrays

* Include AcirType in AcirValue::Var variant

* Fix black box functions

* Appease clippy

* Fix simple_radix

* Add doc comments

---------

Co-authored-by: Tom French <[email protected]>

* feat: Make for-loop range be a polymorphic integer instead of just Field in unconstrained functions (#1583)

* make ranges be polymorphic integers

* make behavior consistent

* remove closure

* change index_type

* Update crates/noirc_frontend/src/hir/type_check/expr.rs

---------

Co-authored-by: jfecher <[email protected]>

* chore(ssa refactor): fix brillig post master merge

* chore(ssa refactor): accidental merge undelete

---------

Co-authored-by: jfecher <[email protected]>
Co-authored-by: Tom French <[email protected]>
Co-authored-by: kevaundray <[email protected]>

* chore(ssa refactor): Add more documentation for truncation  (#1607)

* add more documentation

* small change

* Update crates/noirc_evaluator/src/ssa_refactor/acir_gen/acir_ir/generated_acir.rs

* Update .github/workflows/test.yml

* Update .github/workflows/test.yml

* Remove optimisation for handling assert

* add the assert jump to the list of jumps to fix

* add doc comment

---------

Co-authored-by: kevaundray <[email protected]>
Co-authored-by: Álvaro Rodríguez <[email protected]>
Co-authored-by: ludamad <[email protected]>
Co-authored-by: jfecher <[email protected]>
Co-authored-by: joss-aztec <[email protected]>
Co-authored-by: Tom French <[email protected]>

* chore(ssa refactor): Separate Brillig only logic from Brillig-SSA generation logic (#1631)

* separate brillig only logic from logic that combines both brillig and ssa

* move operations related to brillig-ssa conversion to brillig_gen

* intermediate step -- make build work by leaking the abstraction

* refactor return instruction -- all of the implementation details about brillig are no longer in brillig_gen

* fix clippy

* add TODO

* move `convert_integer_mod` into BrilligIr

* encapsulate modulo operation in brillig_gen

* process binary instruction

* refactor const instruction

* make code surrounding jumps satisfy the abstraction

* move not instruction

* add foreign call instruction

* move load and store instructions to brillig_ir

* move truncate instruction

* move `mov`, `stop` and `allocate_array` methods

* fix clippy

* remove push_code method in brillig_gen

* move jump and jmpif instructions to brillig_ir

* clean up terminator instruction

* remove allow(deprecated) lint

* refactor document for link and link_with

* use .into so we can get rid of Value import

* add docs

* Update crates/noirc_evaluator/src/brillig/brillig_ir/artifact.rs

Co-authored-by: Álvaro Rodríguez <[email protected]>

* Update crates/noirc_evaluator/src/brillig/brillig_gen.rs

* make code a bit clearer

* fix clippy

---------

Co-authored-by: Álvaro Rodríguez <[email protected]>

* chore(ssa_refactor): Improve foreign call compilation (#1644)

* remove ForeignCall instruction from SSA

* remove unnecessary Oracle RuntimeType

* remove old comment

* feat: Brillig array inputs and outputs (#1630)

* first attempt at brillig multiple array inptus

* working array identity function for brillig

* cleanup dbgs

* remove unused imports

* remove dbg

* a little cleanup

* fix up foreign calls for array inputs and outputs

* fix outputs clippy err

* move conversion to RegisterValueOrArray to its own method

* missing &mut and TODO link

* PR comment for brillig output array types

* cleanup comment

* enable struct inputs/outputs

* cargo clippy

* chore(brillig): master into brillig main (#1663)

* fix(ssa refactor): resolve replaced value ids for printing (#1535)

* fix(ssa refactor): resolve replaced value ids for printing

* fix(ssa refactor): Expand PR #1535 to resolve ValueIds in all SSA passes (#1642)

* Expand PR

* chore(ssa refactor): more value id resolving

* chore(ssa refactor): another value id resolve

---------

Co-authored-by: Joss <[email protected]>

---------

Co-authored-by: jfecher <[email protected]>

* chore(ssa refactor): enable_side_effects instruction (#1547)

* chore(ssa refactor): enable_side_effects instruction

* chore(ssa refactor): fix and document enable_side_effects insertions

* chore(ssa refactor): rm comments

* fix(ssa refactor): redundant EnableSideEffects

* chore(ssa refactor): cp working tests (#1619)

* chore(ssa gen): ssa gen truncate instruction

* chore(ssa refactor): max bit size for subtract

* Update crates/noirc_evaluator/src/ssa_refactor/ssa_gen/context.rs

Co-authored-by: jfecher <[email protected]>

* chore(ssa refactor): truncate shift left

* chore(ssa refactor): Add integer modulus when truncating subtraction

* chore(ssa refactor): clippy

* chore(ssa refactor): fix left shift max bit size

* chore(ssa refactor): cp xor test

* chore(ssa refactor): cp working tests

* chore(ssa refactor): more working tests

* chore(ssa refactor): cp working test

---------

Co-authored-by: kevaundray <[email protected]>
Co-authored-by: jfecher <[email protected]>

* chore(ssa refactor): Remove unit values from SSA IR (#1646)

* Remove unit values

* Fix test

* Fix comment

* chore: Upgrade codespan dependencies (#1647)

* chore(ssa refactor): Implement dead instruction elimination pass (#1595)

* Add dead instruction elimination pass

* Enable the pass

* chore(ssa refactor): simple mut test

* chore(ssa refactor): fixup and add doc comments

* chore(ssa refactor): post merge fix

---------

Co-authored-by: Joss <[email protected]>

* chore(brillig): Update acvm dependency (#1653)

chore: update acvm dep

* refactor: remove unused assign

---------

Co-authored-by: joss-aztec <[email protected]>
Co-authored-by: jfecher <[email protected]>
Co-authored-by: kevaundray <[email protected]>
Co-authored-by: Blaine Bublitz <[email protected]>
Co-authored-by: Joss <[email protected]>

* feat(brillig): Added cast instruction (#1649)

* feat: added cast instruction

* docs: add comment on cast

* docs: added comment on cast instruction

* simplify convert_cast

* Alvaro to review

* feat: do casts as no ops instead

---------

Co-authored-by: kevaundray <[email protected]>

* feat(brillig): Add unique labeling and remove relative jumps (#1652)

* feat: added unique labeling

* refactor: remove relative jumps

* feat: add section/global labeling

* pr review

* Update crates/noirc_evaluator/src/brillig/brillig_gen/brillig_block.rs

* style: clippy

---------

Co-authored-by: kevaundray <[email protected]>

* fix `is_signed` method

* feat(brillig): added basic array operations (#1716)

* feat: added array operations

* docs: commented functions a bit

* Update crates/noirc_evaluator/src/brillig/brillig_ir.rs

* refactor: rename method

* refactor: simplify size calculations

* style: fmt

* feat(brillig): runtime memory allocation (#1732)

* feat: use dynamic memory allocation

* docs: update comments

* refactor: rename allocation methods

* docs: updated comment

* refactor: changes from peer review

* chore(brillig): Add a register abstraction/optimization (#1737)

* chore: brillig register abstraction

* chore: small refactor

* fix: latest_register starting value

* fix: comments

* chore: remove unused method

* fix: reintroduce a safety register alloc check

* merge fix: AcirType is now an enum

* merge fix: foreign calls

* fix: Oracle output resolution (#1740)

silly fix until we use enums for foreign call results

---------

Co-authored-by: Álvaro Rodríguez <[email protected]>
Co-authored-by: ludamad <[email protected]>
Co-authored-by: guipublic <[email protected]>
Co-authored-by: jfecher <[email protected]>
Co-authored-by: Maxim Vezenov <[email protected]>
Co-authored-by: joss-aztec <[email protected]>
Co-authored-by: Tom French <[email protected]>
Co-authored-by: Blaine Bublitz <[email protected]>
Co-authored-by: Joss <[email protected]>
github-merge-queue bot pushed a commit that referenced this pull request Jun 22, 2023
* disable mac tests

* feat: added support for modulo ops on brillig (#1621)

* feat: added support for modulo ops

* chore: use ACVM 0.14.3

* revert change as its unrelated

* small comment refactor

---------

Co-authored-by: kevaundray <[email protected]>

* feat(brillig): foreign call/oracle compilation (#1600)

* remove mac runner

* chore: generate brillig opcode for simple identity unconstrained function (#1536)

* feat(brillig): added arithmetic operations on brillig (#1565)

Co-authored-by: kevaundray <[email protected]>

* make ranges be polymorphic integers

* chore(brillig): Clean up handling of Binary operations (#1571)

* chore(ssa refactor): Rename Brillig example (#1563)

* chore(brillig): added tests for all field binary operations (#1586)

* chore(brillig): added tests for brillig integer operations (#1590)

* feat: process blocks and jumps when compiling brillig (#1591)

* process jumps between blocks

* fix jumps

* add doc comments

* cargo fmt

* code refactor

* update code comment

---------

Co-authored-by: kevaundray <[email protected]>

* feat: process blocks and jumps when compiling brillig (#1591)

* process jumps between blocks

* fix jumps

* add doc comments

* cargo fmt

* code refactor

* update code comment

---------

Co-authored-by: kevaundray <[email protected]>

* feat(brillig): start of oracles/foreign calls

* fix: broken tests

* feat(brillig): parsing oracles/foreign calls (#1596)

* feat(brillig): start of oracles/foreign calls

* fix: broken tests

* Update execute.rs

* feat: more foreign call work

* self.data -> self.vars

* chore(brillig): Add handling of the not instruction (#1609)

* test: brillig oracle

* Reinstate option

* make behavior consistent

* remove closure

* change index_type

* Update crates/noirc_frontend/src/hir/type_check/expr.rs

* feat(brillig): loops (#1610)

* make ranges be polymorphic integers

* feat: brillig loop support

* fix: fixed brillig returns and stop

* fix: do not apply constants folding to brillig fns

* chore: update acvm pointer, cleanup

* style: newline on cargo toml

* make behavior consistent

* remove closure

* change index_type

* Update crates/noirc_frontend/src/hir/type_check/expr.rs

* better debug information for unsupported instruction

* remove edge case for optimizations

* clippy fix

* patch infinite loop

---------

Co-authored-by: kevaundray <[email protected]>
Co-authored-by: jfecher <[email protected]>

* feat: Foreign calls compiling and basic print executed in nargo (#1612)

* get foreign calls compiling and basic print executed in nargo

* cargo clipy and cargo fmt

* missing

* Update crates/noirc_evaluator/src/brillig/brillig_gen.rs

* add issue num for logging

---------

Co-authored-by: kevaundray <[email protected]>

* chore: resolve immutable array merge differences (#1617)

* chore(ssa refactor): Switch to immutable arrays (#1578)

* Represent SSA arrays with im::Vector

* Get tests passing

* Implement assign with immutable arrays

* Add constant folding pass

* Update comments

* Clippy

* Update comment

* Update type of array

* Update crates/noirc_evaluator/src/ssa_refactor/ir/instruction.rs

Co-authored-by: Tom French <[email protected]>

* Undo formatting changes in instruction.rs

* Massive acir_gen update

* Refactor acir array operations into a shared function

* Appease clippy

* Update to_radix and to_bits in acir_gen to return arrays

* Disable assert

* Fix convert_type for arrays

* Include AcirType in AcirValue::Var variant

* Fix black box functions

* Appease clippy

* Fix simple_radix

* Add doc comments

---------

Co-authored-by: Tom French <[email protected]>

* feat: Make for-loop range be a polymorphic integer instead of just Field in unconstrained functions (#1583)

* make ranges be polymorphic integers

* make behavior consistent

* remove closure

* change index_type

* Update crates/noirc_frontend/src/hir/type_check/expr.rs

---------

Co-authored-by: jfecher <[email protected]>

* chore(ssa refactor): fix brillig post master merge

* chore(ssa refactor): accidental merge undelete

---------

Co-authored-by: jfecher <[email protected]>
Co-authored-by: Tom French <[email protected]>
Co-authored-by: kevaundray <[email protected]>

* chore(ssa refactor): Add more documentation for truncation  (#1607)

* add more documentation

* small change

* Update crates/noirc_evaluator/src/ssa_refactor/acir_gen/acir_ir/generated_acir.rs

* Update .github/workflows/test.yml

* Update .github/workflows/test.yml

* remove dbg

* change printer for foreign call

* Update crates/noirc_evaluator/src/ssa_refactor/ir/function.rs

* Update crates/noirc_evaluator/src/ssa_refactor/ir/instruction.rs

Co-authored-by: kevaundray <[email protected]>

* Update crates/noirc_evaluator/src/ssa_refactor/acir_gen/acir_ir/acir_variable.rs

---------

Co-authored-by: kevaundray <[email protected]>
Co-authored-by: guipublic <[email protected]>
Co-authored-by: Álvaro Rodríguez <[email protected]>
Co-authored-by: jfecher <[email protected]>
Co-authored-by: Maxim Vezenov <[email protected]>
Co-authored-by: joss-aztec <[email protected]>
Co-authored-by: Tom French <[email protected]>

* feat: add support for assert in brillig (#1603)

* remove mac runner

* chore: generate brillig opcode for simple identity unconstrained function (#1536)

* feat(brillig): added arithmetic operations on brillig (#1565)

Co-authored-by: kevaundray <[email protected]>

* make ranges be polymorphic integers

* chore(brillig): Clean up handling of Binary operations (#1571)

* chore(ssa refactor): Rename Brillig example (#1563)

* chore(brillig): added tests for all field binary operations (#1586)

* chore(brillig): added tests for brillig integer operations (#1590)

* feat: process blocks and jumps when compiling brillig (#1591)

* process jumps between blocks

* fix jumps

* add doc comments

* cargo fmt

* code refactor

* update code comment

---------

Co-authored-by: kevaundray <[email protected]>

* feat: process blocks and jumps when compiling brillig (#1591)

* process jumps between blocks

* fix jumps

* add doc comments

* cargo fmt

* code refactor

* update code comment

---------

Co-authored-by: kevaundray <[email protected]>

* feat(brillig): parsing oracles/foreign calls (#1596)

* feat(brillig): start of oracles/foreign calls

* fix: broken tests

* Update execute.rs

* support assert in brillig

* self.data -> self.vars

* Avoid not in the test

* chore(brillig): Add handling of the not instruction (#1609)

* make behavior consistent

* remove closure

* change index_type

* Update crates/noirc_frontend/src/hir/type_check/expr.rs

* feat(brillig): loops (#1610)

* make ranges be polymorphic integers

* feat: brillig loop support

* fix: fixed brillig returns and stop

* fix: do not apply constants folding to brillig fns

* chore: update acvm pointer, cleanup

* style: newline on cargo toml

* make behavior consistent

* remove closure

* change index_type

* Update crates/noirc_frontend/src/hir/type_check/expr.rs

* better debug information for unsupported instruction

* remove edge case for optimizations

* clippy fix

* patch infinite loop

---------

Co-authored-by: kevaundray <[email protected]>
Co-authored-by: jfecher <[email protected]>

* chore: resolve immutable array merge differences (#1617)

* chore(ssa refactor): Switch to immutable arrays (#1578)

* Represent SSA arrays with im::Vector

* Get tests passing

* Implement assign with immutable arrays

* Add constant folding pass

* Update comments

* Clippy

* Update comment

* Update type of array

* Update crates/noirc_evaluator/src/ssa_refactor/ir/instruction.rs

Co-authored-by: Tom French <[email protected]>

* Undo formatting changes in instruction.rs

* Massive acir_gen update

* Refactor acir array operations into a shared function

* Appease clippy

* Update to_radix and to_bits in acir_gen to return arrays

* Disable assert

* Fix convert_type for arrays

* Include AcirType in AcirValue::Var variant

* Fix black box functions

* Appease clippy

* Fix simple_radix

* Add doc comments

---------

Co-authored-by: Tom French <[email protected]>

* feat: Make for-loop range be a polymorphic integer instead of just Field in unconstrained functions (#1583)

* make ranges be polymorphic integers

* make behavior consistent

* remove closure

* change index_type

* Update crates/noirc_frontend/src/hir/type_check/expr.rs

---------

Co-authored-by: jfecher <[email protected]>

* chore(ssa refactor): fix brillig post master merge

* chore(ssa refactor): accidental merge undelete

---------

Co-authored-by: jfecher <[email protected]>
Co-authored-by: Tom French <[email protected]>
Co-authored-by: kevaundray <[email protected]>

* chore(ssa refactor): Add more documentation for truncation  (#1607)

* add more documentation

* small change

* Update crates/noirc_evaluator/src/ssa_refactor/acir_gen/acir_ir/generated_acir.rs

* Update .github/workflows/test.yml

* Update .github/workflows/test.yml

* Remove optimisation for handling assert

* add the assert jump to the list of jumps to fix

* add doc comment

---------

Co-authored-by: kevaundray <[email protected]>
Co-authored-by: Álvaro Rodríguez <[email protected]>
Co-authored-by: ludamad <[email protected]>
Co-authored-by: jfecher <[email protected]>
Co-authored-by: joss-aztec <[email protected]>
Co-authored-by: Tom French <[email protected]>

* chore(ssa refactor): Separate Brillig only logic from Brillig-SSA generation logic (#1631)

* separate brillig only logic from logic that combines both brillig and ssa

* move operations related to brillig-ssa conversion to brillig_gen

* intermediate step -- make build work by leaking the abstraction

* refactor return instruction -- all of the implementation details about brillig are no longer in brillig_gen

* fix clippy

* add TODO

* move `convert_integer_mod` into BrilligIr

* encapsulate modulo operation in brillig_gen

* process binary instruction

* refactor const instruction

* make code surrounding jumps satisfy the abstraction

* move not instruction

* add foreign call instruction

* move load and store instructions to brillig_ir

* move truncate instruction

* move `mov`, `stop` and `allocate_array` methods

* fix clippy

* remove push_code method in brillig_gen

* move jump and jmpif instructions to brillig_ir

* clean up terminator instruction

* remove allow(deprecated) lint

* refactor document for link and link_with

* use .into so we can get rid of Value import

* add docs

* Update crates/noirc_evaluator/src/brillig/brillig_ir/artifact.rs

Co-authored-by: Álvaro Rodríguez <[email protected]>

* Update crates/noirc_evaluator/src/brillig/brillig_gen.rs

* make code a bit clearer

* fix clippy

---------

Co-authored-by: Álvaro Rodríguez <[email protected]>

* chore(ssa_refactor): Improve foreign call compilation (#1644)

* remove ForeignCall instruction from SSA

* remove unnecessary Oracle RuntimeType

* remove old comment

* feat: Brillig array inputs and outputs (#1630)

* first attempt at brillig multiple array inptus

* working array identity function for brillig

* cleanup dbgs

* remove unused imports

* remove dbg

* a little cleanup

* fix up foreign calls for array inputs and outputs

* fix outputs clippy err

* move conversion to RegisterValueOrArray to its own method

* missing &mut and TODO link

* PR comment for brillig output array types

* cleanup comment

* enable struct inputs/outputs

* cargo clippy

* *WIP* call brillig function from brillig

* chore(brillig): master into brillig main (#1663)

* fix(ssa refactor): resolve replaced value ids for printing (#1535)

* fix(ssa refactor): resolve replaced value ids for printing

* fix(ssa refactor): Expand PR #1535 to resolve ValueIds in all SSA passes (#1642)

* Expand PR

* chore(ssa refactor): more value id resolving

* chore(ssa refactor): another value id resolve

---------

Co-authored-by: Joss <[email protected]>

---------

Co-authored-by: jfecher <[email protected]>

* chore(ssa refactor): enable_side_effects instruction (#1547)

* chore(ssa refactor): enable_side_effects instruction

* chore(ssa refactor): fix and document enable_side_effects insertions

* chore(ssa refactor): rm comments

* fix(ssa refactor): redundant EnableSideEffects

* chore(ssa refactor): cp working tests (#1619)

* chore(ssa gen): ssa gen truncate instruction

* chore(ssa refactor): max bit size for subtract

* Update crates/noirc_evaluator/src/ssa_refactor/ssa_gen/context.rs

Co-authored-by: jfecher <[email protected]>

* chore(ssa refactor): truncate shift left

* chore(ssa refactor): Add integer modulus when truncating subtraction

* chore(ssa refactor): clippy

* chore(ssa refactor): fix left shift max bit size

* chore(ssa refactor): cp xor test

* chore(ssa refactor): cp working tests

* chore(ssa refactor): more working tests

* chore(ssa refactor): cp working test

---------

Co-authored-by: kevaundray <[email protected]>
Co-authored-by: jfecher <[email protected]>

* chore(ssa refactor): Remove unit values from SSA IR (#1646)

* Remove unit values

* Fix test

* Fix comment

* chore: Upgrade codespan dependencies (#1647)

* chore(ssa refactor): Implement dead instruction elimination pass (#1595)

* Add dead instruction elimination pass

* Enable the pass

* chore(ssa refactor): simple mut test

* chore(ssa refactor): fixup and add doc comments

* chore(ssa refactor): post merge fix

---------

Co-authored-by: Joss <[email protected]>

* chore(brillig): Update acvm dependency (#1653)

chore: update acvm dep

* refactor: remove unused assign

---------

Co-authored-by: joss-aztec <[email protected]>
Co-authored-by: jfecher <[email protected]>
Co-authored-by: kevaundray <[email protected]>
Co-authored-by: Blaine Bublitz <[email protected]>
Co-authored-by: Joss <[email protected]>

* discriminate labels per function

* initial changes to get noir building using adam/foreign-call-vectors acvm branch

* include fix for array output from foreign calls

* fixed commit to reference remote patch

* small cleanup

* do not save the special registers

* cargo clippy

* towards dynamic arrays

* chore: bump acvm for better acvm vectors

* Towards brillig vectors

* push fix for test_brillig_ir_foreign_call_return_vector

* fix pseudo-noir in test

* add Trap opcode to make Brillig IR test more accurate

* move code from Adams and Guillaume's branch for BrilligIR

Co-authored-by: guipublic <[email protected]>
Co-authored-by: ludamad <[email protected]>

* add used registers method

Co-authored-by: ludamad <[email protected]>

* add method to handle calling normal functions and thread the function_id_to_block_id through necessary functions

* add unresolved_call method into artifact struct

* remove Vec::clone

* small clean-up:

- remove magic constant
- use mov_instruction method

* modify API for linking

* pass parameter length and return type length to BrilligContext

* move entry_point_instruction to artifact for now

* refactor API -- still has a lot of scaffolding

* remove pretty_print_opcode

* chore: high level brillig printorrr

* chore: move acvm

* feat: implement call semantics  (#1746)

* fix: entry point and exit point handling

* feat: function linking

* docs: added comments

* docs: more comments

* fix: correct_usize_op

* fix: fix moving registers to registers

* fix: fixed array handling across calls

* docs: improved error msgs

* Update

* post-merge fixes

* Post-merge brillig ir printer fixes

* fix: post-merge build

* chore: fixing diff. TODO not building

* Working build

* Foreign call test

* chore: fix deps

---------

Co-authored-by: kevaundray <[email protected]>
Co-authored-by: Álvaro Rodríguez <[email protected]>
Co-authored-by: guipublic <[email protected]>
Co-authored-by: jfecher <[email protected]>
Co-authored-by: Maxim Vezenov <[email protected]>
Co-authored-by: joss-aztec <[email protected]>
Co-authored-by: Tom French <[email protected]>
Co-authored-by: guipublic <[email protected]>
Co-authored-by: Blaine Bublitz <[email protected]>
Co-authored-by: Joss <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants