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

Fix convergence problem due to unbounded growing of assertion tree #244

Merged
merged 3 commits into from
May 21, 2024

Conversation

sonalmahajan15
Copy link
Contributor

@sonalmahajan15 sonalmahajan15 commented May 15, 2024

This PR fixes the convergence issues causes by unbounded growing of assertion trees with assignments in a loop, such as in the simple example shown below.

func test() {
         a := &A{}
	for {
		a = a.f
	}
}

Here, the assertion tree should look like root -> varAssertionNode (a) -> fldAssertionNode (f). However, the assertion before was growing unboundedly (root -> a -> f -> f -> f -> ...) until the stableRoundLimit was hit. This simple function was taking 7 iterations to converge, while after the code change it now takes only 3 iterations to converge.

Taking this opportunity, I have also added tests for testing fixpoint convergence. For this, I refactored existing infrastructure for anonymous functions and generalized it.

Note: the goal of this PR is to improve performance only, and should not have any effect on the reported errors.

Copy link

codecov bot commented May 15, 2024

Codecov Report

Attention: Patch coverage is 92.68293% with 3 lines in your changes are missing coverage. Please review.

Project coverage is 87.55%. Comparing base (fe712a8) to head (8e70917).

Files Patch % Lines
assertion/function/assertiontree/backprop.go 57.14% 3 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #244      +/-   ##
==========================================
+ Coverage   87.50%   87.55%   +0.04%     
==========================================
  Files          61       62       +1     
  Lines        7798     7828      +30     
==========================================
+ Hits         6824     6854      +30     
  Misses        796      796              
  Partials      178      178              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link

Golden Test

Note

✅ NilAway errors reported on standard libraries are identical.

3296 errors on base branch (main, fe712a8)
3296 errors on test branch (1d7f65a)

Copy link
Contributor

@yuxincs yuxincs left a comment

Choose a reason for hiding this comment

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

Nice find and great refactor for test helpers!

@sonalmahajan15 sonalmahajan15 merged commit 482b433 into main May 21, 2024
8 checks passed
@sonalmahajan15 sonalmahajan15 deleted the sonalmahajan15/fix-unbounded-tree branch May 21, 2024 00:09
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.

None yet

2 participants