-
Notifications
You must be signed in to change notification settings - Fork 19
[Draft] Prototype of auto-annot
#327
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
Draft
moratorium08
wants to merge
37
commits into
rems-project:main
Choose a base branch
from
moratorium08:focus_context
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Conversation
This file contains hidden or 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
Thanks for the implementation and the overview of the state of the implementation. This is the sort of documentation we would need for merging this in and having it not bit-rot.
|
|
5b6ea44
to
9526604
Compare
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.
Note: You don’t need to look into the details of this implementation. This draft PR is not intended to be merged; it’s only for discussion of the future implementation.
I have implemented a prototype for "auto-annot" (only for focus).
The goal of this prototype is to automatically synthesize missing focus annotations for iterated resources by observing concrete executions of binaries instrumented by Fulminate, then infer a linear arithmetic term for the focused index from in-scope concrete values at each memory access. The overview of the pipeline is (i) well-formedness check (ii) Fulminate instrumentation with additional instrumentations (see below) (iii) Bennet tests, and (iv) Infer the focus from the execution.
What I have added are
auto-annot
I tried to avoid degrading the current Fulminate/Bennet as much as possible. To achieve this, I added a switch in Fulminate to check whether auto-annot is enabled. If auto-annot is disabled, the instrumented binary remains identical to the previous version. If any difference appears in that case, it should be due to a mistake on my part.
Fulminate Instrumentations
Basically, I added the machinery for dealing with focus context:
main
+ C-scope tracking for the context (push_focus_context/pop_focus_context at the beginning/end of each function)some iterated resource, but no focus is stated for the index).
register concrete resource ranges and element types at runtime.
type) so runtime knows which indices have already been focused.
They may (eventually) be replaced by Rini's future machinery for better error reporting.
Runtime Support
Running Example
If you run
cn auto-annot prog.c
where prog.c isYou will get the log like this in a tmp file:
Synthesis
Now assume we have samples like the above. Auto-annot takes such samples and tries to find integer coefficients (w0, {w_v}) such that
w0 + Σ(w_v * v) = !index
across all samples for a given site. In principle, there are many solutions in terms of a SAT problem, but for a better suggestion, I formalized the problem as an optimization to minimize the coefficients w_i as much as possible by using L1 norm. Currently, I'm using Z3 for the optimization, but there might be better choices.Limitations