chore: add another test for try_merge_only_changed_indices#8143
Closed
chore: add another test for try_merge_only_changed_indices#8143
Conversation
Contributor
There was a problem hiding this comment.
⚠️ 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: 431dd16 | Previous: 58f17b1 | Ratio |
|---|---|---|---|
test_report_noir-lang_noir_bigcurve_ |
283 s |
234 s |
1.21 |
This comment was automatically generated by workflow using github-action-benchmark.
CC: @TomAFrench
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Problem
Debugging AztecProtocol/aztec-packages#13677
Summary
Adds an SSA test where
try_merge_only_changed_indicescurrently happens, but didn't happen before #8070 was merged.The program that produces this SSA right before "Remove IfElse" is this one:
The above program is exactly
mock-private-kernel-init.The SSA before the "Remove IfElse" pass:
g0 = u32 2acir(inline) predicate_pure fn main f0 {
b0(v1: [Field; 2], v2: [Field; 2]):
v4 = array_get v1, index u32 0 -> Field
v6 = array_get v1, index u32 1 -> Field
v7 = array_get v2, index u32 0 -> Field
v8 = array_get v2, index u32 1 -> Field
v9 = make_array [v4, v6, v7, v8] : [Field; 4]
v11 = make_array [Field 0, Field 0, Field 0, Field 0] : [Field; 4]
v12 = make_array [Field 0, Field 0, Field 0, Field 0] : [Field; 4]
v13 = allocate -> &mut [Field; 4]
v14 = allocate -> &mut u32
v15 = allocate -> &mut [Field; 4]
v16 = allocate -> &mut u32
v17 = array_get v1, index u32 0 -> Field
v18 = eq v17, Field 0
v19 = not v18
enable_side_effects v19
v20 = array_get v1, index u32 0 -> Field
v21 = make_array [v20, Field 0, Field 0, Field 0] : [Field; 4]
v22 = if v19 then v21 else (if v18) v11
v23 = cast v19 as u32
v24 = cast v18 as u32
enable_side_effects u1 1
v26 = array_get v1, index u32 1 -> Field
v27 = eq v26, Field 0
v28 = not v27
enable_side_effects v28
v29 = array_get v1, index u32 1 -> Field
v31 = lt v23, u32 4
v32 = mul v31, v28
constrain v32 == v28, "push out of bounds"
v33 = lt v23, u32 4
v34 = mul v33, v28
constrain v34 == v28, "Index out of bounds"
v35 = array_set v22, index v23, value v29
v36 = add v23, u32 1
v37 = if v28 then v35 else (if v27) v22
v38 = cast v28 as u32
v39 = cast v27 as u32
v40 = unchecked_mul v38, v36
v41 = unchecked_mul v39, v23
v42 = unchecked_add v40, v41
enable_side_effects u1 1
v43 = array_get v2, index u32 0 -> Field
v44 = eq v43, Field 0
v45 = not v44
enable_side_effects v45
v46 = array_get v2, index u32 0 -> Field
v47 = make_array [v46, Field 0, Field 0, Field 0] : [Field; 4]
v48 = if v45 then v47 else (if v44) v12
v49 = cast v45 as u32
v50 = cast v44 as u32
enable_side_effects u1 1
v51 = array_get v2, index u32 1 -> Field
v52 = eq v51, Field 0
v53 = not v52
enable_side_effects v53
v54 = array_get v2, index u32 1 -> Field
v55 = lt v49, u32 4
v56 = mul v55, v53
constrain v56 == v53, "push out of bounds"
v57 = lt v49, u32 4
v58 = mul v57, v53
constrain v58 == v53, "Index out of bounds"
v59 = array_set v48, index v49, value v54
v60 = add v49, u32 1
v61 = if v53 then v59 else (if v52) v48
v62 = cast v53 as u32
v63 = cast v52 as u32
v64 = unchecked_mul v62, v60
v65 = unchecked_mul v63, v49
v66 = unchecked_add v64, v65
enable_side_effects u1 1
v67 = array_get v37, index u32 0 -> Field
v68 = array_get v37, index u32 1 -> Field
v69 = array_get v37, index u32 2 -> Field
v71 = array_get v37, index u32 3 -> Field
v72 = array_get v61, index u32 0 -> Field
v73 = array_get v61, index u32 1 -> Field
v74 = array_get v61, index u32 2 -> Field
v75 = array_get v61, index u32 3 -> Field
v76 = make_array [v67, v68, v69, v71, v72, v73, v74, v75] : [Field; 8]
return v76
}
The SSA after "Remove IfElse" in this PR is this:
The SSA after "Remove IfElse" right before #8070 was merged is instead this one:
What I'm trying to understand is whether it's okay for this optimization to kick in here... because when it does, it causes a failure when bumping Noir in Aztec-Packages.
Additional Context
Documentation*
Check one:
PR Checklist*
cargo fmton default settings.