Skip to content

feat: Propagate purities using SCCs#9672

Merged
vezenovm merged 17 commits intomasterfrom
mv/mutual-recursion-purity
Aug 29, 2025
Merged

feat: Propagate purities using SCCs#9672
vezenovm merged 17 commits intomasterfrom
mv/mutual-recursion-purity

Conversation

@vezenovm
Copy link
Contributor

@vezenovm vezenovm commented Aug 28, 2025

Description

Problem*

Resolves #9446

Summary*

After updating get_brillig_entry_points to use the centralized call graph structure I realized I was already computing the set of recursive functions using SCCs. So I figured we may as well switch to propagating purities using SCCs as that is the better standard for detecting mutually recursive cycles in modern compilers.

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.

@vezenovm vezenovm added the bench-show Display benchmark results on PR label Aug 28, 2025
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.

ACVM Benchmarks

Details
Benchmark suite Current: 55df6bc Previous: 52ded2b Ratio
purely_sequential_opcodes 257577 ns/iter (± 563) 260149 ns/iter (± 876) 0.99
perfectly_parallel_opcodes 224236 ns/iter (± 10324) 229771 ns/iter (± 4777) 0.98
perfectly_parallel_batch_inversion_opcodes 2796311 ns/iter (± 5020) 2800108 ns/iter (± 5665) 1.00

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

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.

Compilation Time

Details
Benchmark suite Current: 55df6bc Previous: 52ded2b Ratio
private-kernel-inner 1.828 s 1.814 s 1.01
private-kernel-reset 7.754 s 7.854 s 0.99
private-kernel-tail 1.37 s 1.386 s 0.99
rollup-base-private 16.72 s 15.72 s 1.06
rollup-base-public 13 s 13.28 s 0.98
rollup-block-root-empty 21.74 s 21.42 s 1.01
rollup-block-root-single-tx 197 s 205 s 0.96
rollup-block-root 207 s 218 s 0.95
rollup-merge 1.412 s 1.36 s 1.04
rollup-root 1.474 s 1.524 s 0.97
semaphore-depth-10 0.789 s 0.785 s 1.01
sha512-100-bytes 1.632 s 1.561 s 1.05

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

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.

Opcode count

Details
Benchmark suite Current: 55df6bc Previous: 52ded2b Ratio
private-kernel-inner 14792 opcodes 14792 opcodes 1
private-kernel-reset 68868 opcodes 68868 opcodes 1
private-kernel-tail 11177 opcodes 11177 opcodes 1
rollup-base-private 221335 opcodes 221335 opcodes 1
rollup-base-public 159954 opcodes 159954 opcodes 1
rollup-block-root-empty 68108 opcodes 68108 opcodes 1
rollup-block-root-single-tx 964515 opcodes 964515 opcodes 1
rollup-block-root 965801 opcodes 965801 opcodes 1
rollup-merge 1409 opcodes 1409 opcodes 1
rollup-root 2631 opcodes 2631 opcodes 1
semaphore-depth-10 5700 opcodes 5700 opcodes 1
sha512-100-bytes 13173 opcodes 13173 opcodes 1

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

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.

Artifact Size

Details
Benchmark suite Current: 55df6bc Previous: 52ded2b Ratio
private-kernel-inner 709.4 KB 709.4 KB 1
private-kernel-reset 2033.2 KB 2033.2 KB 1
private-kernel-tail 537 KB 537 KB 1
rollup-base-private 4320 KB 4320 KB 1
rollup-base-public 3334.6 KB 3334.6 KB 1
rollup-block-root-empty 3855 KB 3855 KB 1
rollup-block-root-single-tx 30753.6 KB 30753.6 KB 1
rollup-block-root 30787.4 KB 30787.4 KB 1
rollup-merge 188.2 KB 188.2 KB 1
rollup-root 391 KB 391 KB 1
semaphore-depth-10 631.5 KB 631.5 KB 1
sha512-100-bytes 525.5 KB 525.5 KB 1

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

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.

Execution Time

Details
Benchmark suite Current: 55df6bc Previous: 52ded2b Ratio
private-kernel-inner 0.015 s 0.016 s 0.94
private-kernel-reset 0.153 s 0.155 s 0.99
private-kernel-tail 0.01 s 0.01 s 1
rollup-base-private 0.267 s 0.266 s 1.00
rollup-base-public 0.159 s 0.166 s 0.96
rollup-block-root 13.2 s 13.3 s 0.99
rollup-merge 0.002 s 0.002 s 1
rollup-root 0.004 s 0.004 s 1
semaphore-depth-10 0.019 s 0.02 s 0.95
sha512-100-bytes 0.104 s 0.103 s 1.01

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

@vezenovm vezenovm marked this pull request as ready for review August 28, 2025 21:33
@vezenovm vezenovm requested a review from a team August 28, 2025 21:33
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.

Test Suite Duration

Details
Benchmark suite Current: 55df6bc Previous: 52ded2b Ratio
test_report_AztecProtocol_aztec-packages_noir-projects_aztec-nr 101 s 99 s 1.02
test_report_AztecProtocol_aztec-packages_noir-projects_noir-contracts 110 s 109 s 1.01
test_report_AztecProtocol_aztec-packages_noir-projects_noir-protocol-circuits_crates_blob 187 s 178 s 1.05
test_report_AztecProtocol_aztec-packages_noir-projects_noir-protocol-circuits_crates_private-kernel-lib 220 s 215 s 1.02
test_report_AztecProtocol_aztec-packages_noir-projects_noir-protocol-circuits_crates_reset-kernel-lib 33 s 32 s 1.03
test_report_AztecProtocol_aztec-packages_noir-projects_noir-protocol-circuits_crates_rollup-lib 622 s 603 s 1.03
test_report_AztecProtocol_aztec-packages_noir-projects_noir-protocol-circuits_crates_types 92 s 97 s 0.95
test_report_noir-lang_noir-bignum_ 134 s 136 s 0.99
test_report_noir-lang_noir_bigcurve_ 421 s 330 s 1.28
test_report_noir-lang_sha256_ 16 s 15 s 1.07
test_report_noir-lang_sha512_ 13 s 11 s 1.18
test_report_zkpassport_noir-ecdsa_ 2 s 1 s 2
test_report_zkpassport_noir_rsa_ 1 s 1 s 1

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

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.

Compilation Memory

Details
Benchmark suite Current: 55df6bc Previous: 52ded2b Ratio
private-kernel-inner 240.43 MB 240.49 MB 1.00
private-kernel-reset 550.05 MB 550.05 MB 1
private-kernel-tail 214.94 MB 214.94 MB 1
rollup-base-private 1350 MB 1350 MB 1
rollup-base-public 1400 MB 1400 MB 1
rollup-block-root-empty 1010 MB 1010 MB 1
rollup-block-root-single-tx 9690 MB 9690 MB 1
rollup-block-root 9690 MB 9690 MB 1
rollup-merge 331.51 MB 331.51 MB 1
rollup-root 342.28 MB 342.28 MB 1
semaphore_depth_10 105.65 MB 105.65 MB 1
sha512_100_bytes 234.79 MB 234.76 MB 1.00

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

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.

Execution Memory

Details
Benchmark suite Current: 55df6bc Previous: 52ded2b Ratio
private-kernel-inner 213.88 MB 213.88 MB 1
private-kernel-reset 247.08 MB 247.08 MB 1
private-kernel-tail 198.71 MB 198.71 MB 1
rollup-base-private 502.47 MB 502.47 MB 1
rollup-base-public 434.93 MB 434.93 MB 1
rollup-block-root 1500 MB 1500 MB 1
rollup-merge 329.26 MB 329.26 MB 1
rollup-root 331.79 MB 331.79 MB 1
semaphore_depth_10 70.43 MB 70.43 MB 1
sha512_100_bytes 57.32 MB 57.32 MB 1

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

Base automatically changed from mv/greenlight-brillig-entry-points to master August 28, 2025 23:17
Copy link
Collaborator

@asterite asterite left a comment

Choose a reason for hiding this comment

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

Looks good!

@vezenovm vezenovm enabled auto-merge August 29, 2025 14:05
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 'Execution Memory'.
Benchmark result of this commit is worse than the previous benchmark result exceeding threshold 1.20.

Benchmark suite Current: 58c599d Previous: 52ded2b Ratio
sha512_100_bytes 124.73 MB 57.32 MB 2.18

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

CC: @TomAFrench

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: 55df6bc Previous: 52ded2b Ratio
test_report_noir-lang_noir_bigcurve_ 421 s 330 s 1.28
test_report_zkpassport_noir-ecdsa_ 2 s 1 s 2

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

CC: @TomAFrench

@vezenovm vezenovm added this pull request to the merge queue Aug 29, 2025
Merged via the queue into master with commit 1b24d1c Aug 29, 2025
121 of 122 checks passed
@vezenovm vezenovm deleted the mv/mutual-recursion-purity branch August 29, 2025 15:08
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

bench-show Display benchmark results on PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

purity_analysis: mutually recursive functions are always impure

2 participants