Skip to content

feat: hoist safe casts from loops#9645

Merged
TomAFrench merged 4 commits intomasterfrom
tf/hoist-upcasts
Aug 29, 2025
Merged

feat: hoist safe casts from loops#9645
TomAFrench merged 4 commits intomasterfrom
tf/hoist-upcasts

Conversation

@TomAFrench
Copy link
Member

Description

Problem*

Resolves

Summary*

This PR experiments with hoisting upcasts more aggressively as described in #9644

Additional Context

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.

@github-actions
Copy link
Contributor

github-actions bot commented Aug 26, 2025

Changes to number of Brillig opcodes executed

Generated at commit: 863f99fcf04c6bd40f3436cacb25fec4ba982933, compared to commit: 585175e56f2c34f225fe6ac87a91f4962c61553d

🧾 Summary (10% most significant diffs)

Program Brillig opcodes (+/-) %
regression_5252_inliner_max -240 ✅ -0.03%
higher_order_functions_inliner_zero -20 ✅ -1.57%

Full diff report 👇
Program Brillig opcodes (+/-) %
poseidon_bn254_hash_width_3_inliner_zero 167,723 (-36) -0.02%
poseidon_bn254_hash_width_3_inliner_min 171,190 (-40) -0.02%
poseidon_bn254_hash_width_3_inliner_max 137,311 (-36) -0.03%
poseidonsponge_x5_254_inliner_min 188,397 (-52) -0.03%
regression_5252_inliner_min 940,337 (-260) -0.03%
poseidonsponge_x5_254_inliner_zero 186,492 (-52) -0.03%
regression_5252_inliner_zero 928,410 (-260) -0.03%
poseidonsponge_x5_254_inliner_max 152,857 (-48) -0.03%
regression_5252_inliner_max 759,768 (-240) -0.03%
higher_order_functions_inliner_zero 1,256 (-20) -1.57%

@github-actions
Copy link
Contributor

github-actions bot commented Aug 26, 2025

Changes to Brillig bytecode sizes

Generated at commit: 863f99fcf04c6bd40f3436cacb25fec4ba982933, compared to commit: 585175e56f2c34f225fe6ac87a91f4962c61553d

🧾 Summary (10% most significant diffs)

Program Brillig opcodes (+/-) %
higher_order_functions_inliner_zero -6 ✅ -0.82%

Full diff report 👇
Program Brillig opcodes (+/-) %
higher_order_functions_inliner_zero 726 (-6) -0.82%

Copy link
Contributor

@github-actions github-actions bot left a comment

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 'Test Suite Duration'.
Benchmark result of this commit is worse than the previous benchmark result exceeding threshold 1.20.

Benchmark suite Current: bfedb49 Previous: f30e342 Ratio
test_report_zkpassport_noir-ecdsa_ 3 s 2 s 1.50

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

CC: @TomAFrench

@TomAFrench
Copy link
Member Author

This is another place where we'd benefit from #8645

@TomAFrench TomAFrench marked this pull request as ready for review August 28, 2025 13:28
@TomAFrench TomAFrench requested a review from a team August 28, 2025 13:28
@TomAFrench TomAFrench enabled auto-merge August 29, 2025 11:18
@TomAFrench TomAFrench added this pull request to the merge queue Aug 29, 2025
Merged via the queue into master with commit 318ff16 Aug 29, 2025
122 checks passed
@TomAFrench TomAFrench deleted the tf/hoist-upcasts branch August 29, 2025 12:02
AztecBot pushed a commit to AztecProtocol/aztec-packages that referenced this pull request Sep 2, 2025
Automated pull of nightly from the [noir](https://github.com/noir-lang/noir) programming language, a dependency of Aztec.
BEGIN_COMMIT_OVERRIDE
chore: remove duplicated frontend tests (noir-lang/noir#9706)
chore: remove playwright workaround (noir-lang/noir#9704)
fix(licm): Use `Loop::header` in `Loop::is_fully_executed` (noir-lang/noir#9700)
chore: show which type is invalid as program input (noir-lang/noir#9701)
chore: bump deps (noir-lang/noir#9698)
chore: bump external pinned commits (noir-lang/noir#9693)
chore(licm): Break things up further in LICM (noir-lang/noir#9683)
chore(docs): spinning out bb docs (noir-lang/noir#9402)
fix(ssa)!: Signed shift overflow checks rhs < bit_size (noir-lang/noir#9685)
chore: add extra bitshifts tests (noir-lang/noir#9680)
feat: Propagate purities using SCCs (noir-lang/noir#9672)
chore: break `NodeInterner` into chunks (noir-lang/noir#9674)
fix(formatter): don't revert indentation increase after popping it (noir-lang/noir#9673)
feat: hoist safe casts from loops (noir-lang/noir#9645)
chore: fix clippy warnings (noir-lang/noir#9675)
chore(ssa): Refactor flattening (noir-lang/noir#9663)
chore(ssa): Greenlight `brillig_entry_points` and switch to centralized CallGraph (noir-lang/noir#9668)
chore: add two mem2reg regression tests where references are returned (noir-lang/noir#9670)
fix(mem2reg): reuse existing expression and add missing alias (noir-lang/noir#9664)
chore: add tests for bounded_vec (noir-lang/noir#9576)
chore: redact debug info and file maps from snapshots (noir-lang/noir#9666)
chore: pull out interpreter binary evaluation logic into pure functions (noir-lang/noir#9665)
feat: brillig functions can be pure if they are not entry points (noir-lang/noir#9659)
END_COMMIT_OVERRIDE

Co-authored-by: Tom French <15848336+TomAFrench@users.noreply.github.com>
AztecBot pushed a commit to AztecProtocol/aztec-packages that referenced this pull request Sep 2, 2025
Automated pull of nightly from the [noir](https://github.com/noir-lang/noir) programming language, a dependency of Aztec.
BEGIN_COMMIT_OVERRIDE
chore: remove duplicated frontend tests (noir-lang/noir#9706)
chore: remove playwright workaround (noir-lang/noir#9704)
fix(licm): Use `Loop::header` in `Loop::is_fully_executed` (noir-lang/noir#9700)
chore: show which type is invalid as program input (noir-lang/noir#9701)
chore: bump deps (noir-lang/noir#9698)
chore: bump external pinned commits (noir-lang/noir#9693)
chore(licm): Break things up further in LICM (noir-lang/noir#9683)
chore(docs): spinning out bb docs (noir-lang/noir#9402)
fix(ssa)!: Signed shift overflow checks rhs < bit_size (noir-lang/noir#9685)
chore: add extra bitshifts tests (noir-lang/noir#9680)
feat: Propagate purities using SCCs (noir-lang/noir#9672)
chore: break `NodeInterner` into chunks (noir-lang/noir#9674)
fix(formatter): don't revert indentation increase after popping it (noir-lang/noir#9673)
feat: hoist safe casts from loops (noir-lang/noir#9645)
chore: fix clippy warnings (noir-lang/noir#9675)
chore(ssa): Refactor flattening (noir-lang/noir#9663)
chore(ssa): Greenlight `brillig_entry_points` and switch to centralized CallGraph (noir-lang/noir#9668)
chore: add two mem2reg regression tests where references are returned (noir-lang/noir#9670)
fix(mem2reg): reuse existing expression and add missing alias (noir-lang/noir#9664)
chore: add tests for bounded_vec (noir-lang/noir#9576)
chore: redact debug info and file maps from snapshots (noir-lang/noir#9666)
chore: pull out interpreter binary evaluation logic into pure functions (noir-lang/noir#9665)
feat: brillig functions can be pure if they are not entry points (noir-lang/noir#9659)
END_COMMIT_OVERRIDE
github-merge-queue bot pushed a commit to AztecProtocol/aztec-packages that referenced this pull request Sep 2, 2025
Automated pull of nightly from the
[noir](https://github.com/noir-lang/noir) programming language, a
dependency of Aztec.
BEGIN_COMMIT_OVERRIDE
chore: remove duplicated frontend tests
(noir-lang/noir#9706)
chore: remove playwright workaround
(noir-lang/noir#9704)
fix(licm): Use `Loop::header` in `Loop::is_fully_executed`
(noir-lang/noir#9700)
chore: show which type is invalid as program input
(noir-lang/noir#9701)
chore: bump deps (noir-lang/noir#9698)
chore: bump external pinned commits
(noir-lang/noir#9693)
chore(licm): Break things up further in LICM
(noir-lang/noir#9683)
chore(docs): spinning out bb docs
(noir-lang/noir#9402)
fix(ssa)!: Signed shift overflow checks rhs < bit_size
(noir-lang/noir#9685)
chore: add extra bitshifts tests
(noir-lang/noir#9680)
feat: Propagate purities using SCCs
(noir-lang/noir#9672)
chore: break `NodeInterner` into chunks
(noir-lang/noir#9674)
fix(formatter): don't revert indentation increase after popping it
(noir-lang/noir#9673)
feat: hoist safe casts from loops
(noir-lang/noir#9645)
chore: fix clippy warnings (noir-lang/noir#9675)
chore(ssa): Refactor flattening
(noir-lang/noir#9663)
chore(ssa): Greenlight `brillig_entry_points` and switch to centralized
CallGraph (noir-lang/noir#9668)
chore: add two mem2reg regression tests where references are returned
(noir-lang/noir#9670)
fix(mem2reg): reuse existing expression and add missing alias
(noir-lang/noir#9664)
chore: add tests for bounded_vec
(noir-lang/noir#9576)
chore: redact debug info and file maps from snapshots
(noir-lang/noir#9666)
chore: pull out interpreter binary evaluation logic into pure functions
(noir-lang/noir#9665)
feat: brillig functions can be pure if they are not entry points
(noir-lang/noir#9659)
END_COMMIT_OVERRIDE
mralj pushed a commit to AztecProtocol/aztec-packages that referenced this pull request Oct 13, 2025
Automated pull of nightly from the [noir](https://github.com/noir-lang/noir) programming language, a dependency of Aztec.
BEGIN_COMMIT_OVERRIDE
chore: remove duplicated frontend tests (noir-lang/noir#9706)
chore: remove playwright workaround (noir-lang/noir#9704)
fix(licm): Use `Loop::header` in `Loop::is_fully_executed` (noir-lang/noir#9700)
chore: show which type is invalid as program input (noir-lang/noir#9701)
chore: bump deps (noir-lang/noir#9698)
chore: bump external pinned commits (noir-lang/noir#9693)
chore(licm): Break things up further in LICM (noir-lang/noir#9683)
chore(docs): spinning out bb docs (noir-lang/noir#9402)
fix(ssa)!: Signed shift overflow checks rhs < bit_size (noir-lang/noir#9685)
chore: add extra bitshifts tests (noir-lang/noir#9680)
feat: Propagate purities using SCCs (noir-lang/noir#9672)
chore: break `NodeInterner` into chunks (noir-lang/noir#9674)
fix(formatter): don't revert indentation increase after popping it (noir-lang/noir#9673)
feat: hoist safe casts from loops (noir-lang/noir#9645)
chore: fix clippy warnings (noir-lang/noir#9675)
chore(ssa): Refactor flattening (noir-lang/noir#9663)
chore(ssa): Greenlight `brillig_entry_points` and switch to centralized CallGraph (noir-lang/noir#9668)
chore: add two mem2reg regression tests where references are returned (noir-lang/noir#9670)
fix(mem2reg): reuse existing expression and add missing alias (noir-lang/noir#9664)
chore: add tests for bounded_vec (noir-lang/noir#9576)
chore: redact debug info and file maps from snapshots (noir-lang/noir#9666)
chore: pull out interpreter binary evaluation logic into pure functions (noir-lang/noir#9665)
feat: brillig functions can be pure if they are not entry points (noir-lang/noir#9659)
END_COMMIT_OVERRIDE
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.

2 participants