-
Notifications
You must be signed in to change notification settings - Fork 71
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
feat: cache unsat queries using unsat core #311
Merged
Merged
Conversation
This file contains 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
daejunpark
force-pushed
the
feat/unsat-core
branch
3 times, most recently
from
June 24, 2024 09:49
79718a1
to
0f76f96
Compare
daejunpark
force-pushed
the
feat/unsat-core
branch
from
June 24, 2024 09:52
0f76f96
to
0fee51e
Compare
This reverts commit fadf912.
with open(dump_filename, "w") as f: | ||
if args.verbose >= 1: | ||
print(f"Writing SMT query to {dump_filename}") | ||
if args.cache_solver: | ||
f.write("(set-option :produce-unsat-cores true)\n") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is that a z3 specific option?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TIL: no it's not!
this is actually very impressive, hot damn |
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.
this pr implements a solver caching feature by utilizing the unsat core.
the key idea: when a query contains a known unsat core, it is also unsat, thus no need to run the smt solver.
when --cache-solver is enabled, the smt solver is asked to compute the unsat core for unsat queries. subsequent queries are then compared with the previously computed unsat cores before being sent to the solver, allowing us to skip solving if they have already been known as unsat.
caching is particularly beneficial when there are many similar paths. since similar paths may share the same unsat core, they can be discharged after only a single solving, rather than repeating the same solving process.
for example, in the snekmate erc721 test, the runtime reduces from 477.48s to 295.95s:
note: computing unsat cores incurs a performance overhead, so caching may not be beneficial for small tests.