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: put RcTracker as part of the DIE context #7309

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

guipublic
Copy link
Contributor

Description

Problem*

Resolves #7246

Summary*

RcTracker is now part of the DIE context

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.

@guipublic guipublic requested review from aakoshh and AztecBot and removed request for AztecBot February 6, 2025 15:53
Copy link
Contributor

github-actions bot commented Feb 6, 2025

Changes to Brillig bytecode sizes

Generated at commit: 0af7645adf7a39cf8092ca8b61f494f43b5d94cc, compared to commit: 87196e9419f9c12bc7739024e2f649dcbd3e7340

🧾 Summary (10% most significant diffs)

Program Brillig opcodes (+/-) %
regression_11294_inliner_max +3 ❌ +1.15%
regression_11294_inliner_zero +3 ❌ +1.15%

Full diff report 👇
Program Brillig opcodes (+/-) %
regression_11294_inliner_max 264 (+3) +1.15%
regression_11294_inliner_zero 264 (+3) +1.15%
poseidon_bn254_hash_width_3_inliner_min 5,072 (+24) +0.48%
poseidon_bn254_hash_inliner_min 5,072 (+24) +0.48%
poseidonsponge_x5_254_inliner_zero 3,032 (+12) +0.40%
poseidonsponge_x5_254_inliner_min 3,180 (+12) +0.38%
regression_5252_inliner_zero 3,407 (+12) +0.35%
regression_5252_inliner_min 3,600 (+12) +0.33%

Copy link
Contributor

github-actions bot commented Feb 6, 2025

Changes to number of Brillig opcodes executed

Generated at commit: 0af7645adf7a39cf8092ca8b61f494f43b5d94cc, compared to commit: 87196e9419f9c12bc7739024e2f649dcbd3e7340

🧾 Summary (10% most significant diffs)

Program Brillig opcodes (+/-) %
regression_11294_inliner_max +3 ❌ +0.24%
regression_11294_inliner_zero +3 ❌ +0.24%

Full diff report 👇
Program Brillig opcodes (+/-) %
regression_11294_inliner_max 1,242 (+3) +0.24%
regression_11294_inliner_zero 1,242 (+3) +0.24%
poseidon_bn254_hash_inliner_min 185,997 (+24) +0.01%
poseidon_bn254_hash_width_3_inliner_min 185,997 (+24) +0.01%
regression_5252_inliner_zero 1,008,477 (+120) +0.01%
poseidonsponge_x5_254_inliner_zero 202,290 (+24) +0.01%
regression_5252_inliner_min 1,032,719 (+120) +0.01%
poseidonsponge_x5_254_inliner_min 206,613 (+24) +0.01%

github-actions[bot]

This comment was marked as resolved.

github-actions[bot]

This comment was marked as resolved.

@guipublic guipublic requested a review from a team February 7, 2025 15:01
@aakoshh
Copy link
Contributor

aakoshh commented Feb 7, 2025

I reckon it should be possible to make a unit test in die.rs which demonstrates what we are trying to achieve, something like this:

          let src = "
            brillig(inline) fn main f0 {
              b0(v0: &mut [Field; 3]):                
                v1 = load v0 -> [Field; 3]
                inc_rc v1
                jmp b1()
              b1():
                v1 = load v0 -> [Field; 3]
                v2 = array_set v1, index u32 0, value u32 0
                store v2 at v0
                return
            }
            ";

So there is one block that contains a mutation of the array, and another block that contains the inc_rc, and what we want to know is that the inc_rc is preserved, whereas perviously it would have been removed because the array is not removed.

There are two cases:

  1. The mutated array is returned, but not from the block where the inc_rc was, and therefore the inc_rc gets eliminated. In this case the "mark arrays in terminator as mutable" would have flagged it up if the inc_rc was in the same block, but not in the other block which doesn't contain the return. The fix is that we pass the array of mutable types between blocks.
  2. The mutated array is not, just reached through a reference like in this example, so the "mark terminator" doesn't do anything. In this case we need the mark_function_parameter_arrays_as_used as well.

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.

Sync temp fix 1
2 participants