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(brillig): SSA globals code gen #7021

Merged
merged 52 commits into from
Jan 17, 2025
Merged

Conversation

vezenovm
Copy link
Contributor

@vezenovm vezenovm commented Jan 10, 2025

Description

Problem*

Resolves #6801

Summary*

Implements globals from SSA in Brillig gen. We create a new memory space GlobalSpace at compile time. Globals are declared in the global space and the linker is then used to connect these with our SSA functions.

The global brillig variables that are allocated are then passed to every BrilligBlock. When converting SSA values for a function's block we check whether we have a global and if so, look for the appropriate register that keys into the appropriate slot in the global space.

Additional Context

Some slight regressions are expected. Some reasons for this are laid out here #7021 (comment).

Documentation*

Check one:

  • No documentation needed.
  • Documentation included in this PR.
  • [For Experimental Features] Documentation to be submitted in a separate PR.

PR Checklist*

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

vezenovm and others added 30 commits January 8, 2025 02:46
tooling/nargo/src/errors.rs Outdated Show resolved Hide resolved
@TomAFrench
Copy link
Member

I look to be getting failures post AztecProtocol/aztec-packages#10605.

I assume that this is from the roots global. This isn't used in brillig code currently so I imagine this would be solved by the die pass PR

That said, as we know all of the globals at compile time we should be able to expand the space allocated as necessary. If so can you create a follow up issue?

@vezenovm
Copy link
Contributor Author

vezenovm commented Jan 16, 2025

That said, as we know all of the globals at compile time we should be able to expand the space allocated as necessary. If so can you create a follow up issue?

Yeah I'll make an issue for the max global space to be determined by the program rather than a hardcoded value.

@vezenovm vezenovm requested a review from TomAFrench January 17, 2025 14:28
@vezenovm
Copy link
Contributor Author

That said, as we know all of the globals at compile time we should be able to expand the space allocated as necessary. If so can you create a follow up issue?

#7107

@TomAFrench TomAFrench added this pull request to the merge queue Jan 17, 2025
Merged via the queue into master with commit 82cb900 Jan 17, 2025
101 checks passed
@TomAFrench TomAFrench deleted the mv/ssa-globals-brillig-gen branch January 17, 2025 18:57
AztecBot added a commit to AztecProtocol/aztec-packages that referenced this pull request Jan 18, 2025
…oir-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)
AztecBot added a commit to AztecProtocol/aztec-packages that referenced this pull request Jan 18, 2025
…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)
AztecBot added a commit to AztecProtocol/aztec-packages that referenced this pull request Jan 19, 2025
…oir-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)
AztecBot added a commit to AztecProtocol/aztec-packages that referenced this pull request Jan 19, 2025
…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)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: ✅ Done
Development

Successfully merging this pull request may close these issues.

SSA: Global variables
3 participants