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

Sparsification of Affine Equality Matrix #1625

Merged
merged 279 commits into from
Feb 26, 2025

Conversation

GollokG
Copy link
Contributor

@GollokG GollokG commented Nov 5, 2024

This pull request contributes a sparsification of the AffineEqualityMatrix (affeq) and is based on the domain of @MartinWehking from this PR.

Following restructuring of the modules is introduced:

We added a second AffineEqualityDomain which exploits the sparsity of the affine equality matrices based on this observation by @DrMichaelPetter. A SparseMatrixFunctor and SparseVectorFunctor (as well as ArrayMatrixFunctor and ArrayVectorFunctor) were added for this purpose and replaced the general AbstractMatrix and AbstractVector. The AffineEqualityDomain is now implemented without relying on side effects.

The old AffineEqualityDomain using arrays was renamed to AffineEqualityDomainSideEffects which uses ArrayMatrixFunctor and ArrayVectorFunctor.
No new analysis was added to switch between versions. To switch to the old domain, use --disable ana.affeq.sparse.

The implementation of sparse matrix works as follows:

The sparse matrix is implemented in the ListMatrix module. Its type t is a list of sparseVectors representing the matrix' rows. sparseVector is implemented as an ordered list of tuples (index, value) for all non-zero entries.
Some functions are implemented for zero-preserving functions only. A function is zero-preserving iff it has a fixpoint at zero. These functions are implemented to gain performance when being used on sparseVectors.

This implementation is part of an assignment for the course Automated Bug Hunting and Beyond at TUM in the winter term 2024/25.

@sim642 sim642 self-requested a review February 24, 2025 17:13
@sim642
Copy link
Member

sim642 commented Feb 25, 2025

By the way, there are some unresolved comments from @DrMichaelPetter and @michael-schwarz among the long hidden part of this PR. I don't know if there's anything that should still be done w.r.t. those or are they irrelevant by now.

@DrMichaelPetter
Copy link
Collaborator

By the way, there are some unresolved comments from @DrMichaelPetter and @michael-schwarz among the long hidden part of this PR. I don't know if there's anything that should still be done w.r.t. those or are they irrelevant by now.

My remarks will be addressed in a future PR to fine-tune performance, @michael-schwarz issues are concerning the array implementation, which I would also address out of the scope of this course submission, in a cleanup-PR.

@sim642 sim642 added relational Relational analyses (Apron, affeq, lin2var) and removed in progress labels Feb 25, 2025
@sim642 sim642 added this to the v2.6.0 milestone Feb 25, 2025
Copy link
Collaborator

@DrMichaelPetter DrMichaelPetter left a comment

Choose a reason for hiding this comment

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

Ok, one last suggestion: it was probably our fault for not giving you a more precise feedback here: side-effects have a very very different association in the context of the goblint analyzer, and this association is quite dear to us. Let us instead call the property sparse instead of side_effects (which entails inverting the condition), and make the bracketed explanations the actual explanations.

Ideally, also the AffineEqualityDomainSideEffects would rather be the AffineEqualityDenseDomain.

However: With Simmo and me having more or less approved this PR, merging is at the tip of our fingers.

@CopperCableIsolator
Copy link
Contributor

The naming regarding the semantics for "side effects" should now be compliant with the goblint standard. I've tried my best to still convey fully the fact that these functions have an effect on the program state. Also the files have been renamed.

@michael-schwarz
Copy link
Member

Thanks! @CopperCableIsolator: I think you accidentally committed some files in the next to last commit?

@michael-schwarz
Copy link
Member

Also, I think the conf is not modified yet?

@DrMichaelPetter DrMichaelPetter merged commit f97e009 into goblint:master Feb 26, 2025
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature performance Analysis time, memory usage practical-course Practical Course at TUM relational Relational analyses (Apron, affeq, lin2var) student-job
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Affine Equalities Mostly Contain Only Small Portions of Actual Information
8 participants