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

Avoid spurious writes for invariants in base mutex-meet-tid #1653

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

sim642
Copy link
Member

@sim642 sim642 commented Jan 9, 2025

While describing the special invariant writes to globals for my thesis, I looked through all of the write_global implementations and noticed that some mutex-meet variants do not use the optimization:

  • base mutex-meet-tid,
  • relation mutex-meet,
  • relation mutex-meet-tid.

I have quickly added a test for base mutex-meet-tid which reveals precision loss from such spurious side effects. The PR also includes a quick fix for it by analogy, but I haven't thought about it much nor properly tested it.

If this is sound, then we should probably have this since it can improve both precision and performance.

@michael-schwarz
Copy link
Member

I'm not sure it is strictly an optimization unfortunately. I think the reason it is not done some of the times is code such as

lock(a);
g = ?;
while(g < 20)  { };
unlock(a);

which occurs quite a few times in SV-COMP snippets as assume_abort_if_not or similar. Here, it may be beneficial to actually consider this a write and later cause a side-effect and add it to LMust.

However, it should still be sound, so maybe we should just try to add it everywhere and then benchmark again?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants