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

Relation analysis with immutable and lazy data structures #743

Merged
merged 3 commits into from
Oct 3, 2024

Conversation

natgavrilenko
Copy link
Collaborator

No description provided.

Comment on lines +210 to +211
// Force adding must edges to match the result of native analysis
// TODO: Is it really necessary? Method getEventGraph appends them anyway

Choose a reason for hiding this comment

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

Do you mean that without this changes we get different sets for native and analysis, but you believe we could get rid of all the addAll(eg) in both cases without affecting correctness?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

To me it looks inconsistent (and possibly redundant) that must edges of an axiom relation are added during the computation of encode sets and again in the "getEventGraph" method. But it is not related to the lazy relation analysis.

Copy link
Collaborator

@ThomasHaas ThomasHaas Sep 30, 2024

Choose a reason for hiding this comment

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

This comes from an ambiguity in our modelling. In reality, you have "active sets" which refers to sets of clauses/constraints that need to get respected (i.e., they are not trivially satisfiable) and "relevant literals" which can affect the truth-value of an active constraint.
In the mathematically precise sense, the axioms generate some encoding of arbitrary shape that refers to variables (edges) and all those variables are "relevant". For each relevant variable, its defining constraint now becomes active, which in turn causes other variables to become relevant and this propagates recursively downwards.
Our current modelling uses "encode sets" to kinda refer to both "relevant literals" and "active constraints" though it mostly means the latter (i.e, a Map<Definition, EventGraph> would be more correct). And for active constraints, you can actually have an active defining constraint for a variable that is statically known (i.e., inside must or outside may) and that is why "encodeSet" does not always satisfy the expected must-set \subseteq encodeSet \subseteq may-set inequality.

That being said, the method axiom.getEncodeGraph actually refers to "relevant variables" of the axiom (I know, this is confusing) and there we can indeed (I believe) make sure to never include statically known variables.
Due to the ambiguity, we have thus far allowed axiom.getEncodeGraph to contain statically known variables though.

In short, you can remove must-edges from the encode set of axioms if you want.

Copy link
Owner

Choose a reason for hiding this comment

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

@natgavrilenko can you please remove those both here and in the native analysis?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I would prefer to keep things separately. This commit is for a lazy relation analysis. If someone wants to make changes to the native analysis, better to do it in a different commit.

Copy link
Owner

Choose a reason for hiding this comment

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

But then this commit should not add unnecessary code (as suggested by the comment in the commit)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

??? without this the lazy sets will not match the native sets

Copy link
Owner

Choose a reason for hiding this comment

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

Then the claim that this commit has nothing to do with the native analysis does not hold and this needs to be fixed.

Copy link
Collaborator

Choose a reason for hiding this comment

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

What needs to be fixed? Removing the must-sets also in the native analysis? I think it is fair to not touch the native analysis in this PR, take it as ground truth, and let the lazy analysis mimic its results (as it is done now).

Copy link
Owner

Choose a reason for hiding this comment

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

I think it is a bad idea adding useless stuff to a new implementation just to mimic the behavior of another fishy implementation. But if you both agree that it it's not worth to properly fix this now, I will not object further.

Copy link
Collaborator

@ThomasHaas ThomasHaas left a comment

Choose a reason for hiding this comment

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

I saw that you make use of a lot of parallel operations and ConcurrentHashMap. Do you by chance have any data/estimate (even anecdotal is fine) on how much this improves performance compared to the standard sequential operations?

@natgavrilenko
Copy link
Collaborator Author

natgavrilenko commented Oct 1, 2024

I saw that you make use of a lot of parallel operations and ConcurrentHashMap. Do you by chance have any data/estimate (even anecdotal is fine) on how much this improves performance compared to the standard sequential operations?

Depends on the tests and the hardware. For small litmus tests there can be overhead. In the "worst" examples (not a part of dartagnan tests), I saw up to 10 times speedup for some relations.

@ThomasHaas
Copy link
Collaborator

Ok, that sounds great. I guess the speedup can be almost linear in the number of available/used threads when doing bulk copying.

@hernanponcedeleon hernanponcedeleon merged commit b7e7fa9 into development Oct 3, 2024
1 check passed
@hernanponcedeleon hernanponcedeleon deleted the lra-new branch October 3, 2024 06:16
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.

3 participants