-
Notifications
You must be signed in to change notification settings - Fork 19
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: Add fine grained control over mem_omega rewriting [7/?] #238
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
1b6fcff
to
c900995
Compare
1ec9e8f
to
9e2e462
Compare
shigoel
reviewed
Oct 28, 2024
shigoel
reviewed
Oct 28, 2024
shigoel
reviewed
Oct 28, 2024
9e2e462
to
ec8d4a8
Compare
In the next step, this will allow simp_mem to filter hypotheses it sends over to mem_omega. This lays out the full scope of control we'll implement for `simp_mem`. chore: add removing hyps and wildcard hyp for mem_omega chore: make memcpyvcg much faster by using mem_omega with [...] judiciously
ec8d4a8
to
0151df0
Compare
shigoel
approved these changes
Oct 31, 2024
shigoel
pushed a commit
that referenced
this pull request
Nov 1, 2024
### Description: This adapts changes made in #238 for `mem_omega` into `simp_mem`. This adds a ITP style mode into `simp_mem`, which receives user guidance and attempts to proceed according to user input. It throws errors if the goal state does not match the expected goal state. If the goal state matches, it tries to dischange side conditions automatically. Failing this, it creates new goals for the user to discharge these side conditions. In total, this converts `simp_mem` into a tactic that's usable for making incremental, interactive progress in simplifying memory non-interference. ### Testing: No semantics changed. Conformance succeeds. --- Stacked on top of #238 What tests have been run? Did `make all` succeed for your changes? Was conformance testing successful on an Aarch64 machine? ### License: By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
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.
Description:
We increase the ITPness of
simp_mem
by making it less of a proof hammer, and more of a user-controllable rewrite engine. Description of the new design follows:The simp_mem tactic allows simplifying expressions of the form
Memory.read_bytes rbase rn (mem')
.simp_mem
attempts to discover the result of the expression by various heuristics,which can be controlled by the end user:
mem' = Memory.write_bytes wbase wn mem
and we know that(rbase, rn) ⟂ (wbase, wn)
, then we simplify tomem.read (rbase, rn)
.mem' = Memory.write_bytes wbase wn wval mem
and we kow that(rbase, rn) ⊆ (wbase, wn)
, then we simplify towval.extract (rbase, rn) (wbase, wn)
.hr' : mem'.read_bytes rbase' rn' = rval
, and we know that(rbase, rn) ⊆ (rbase', rn')
, then we simplify torval.extract (rbase, rn) (rbase', rn')
.These simplifications are performed by reducing the problem to a problem that can be solved by a decision procedure (
omega
) to establishwhich hypotheses are at play.
simp_mem
can be controlled along multiple axes:simp_mem
will pass along to the decision procedure to discover overlapping reads (likehr'
),and hypotheses to establish memory (non-)interference, such as
(rbase, rn) ⟂ (wbase, wn)
.The kind of rewrite that simp_mem should apply. By default, it explores all possible choices, which might be expensive due to repeated calls to the decision
procedure. The user can describe which of (a), (b), (c) above happen:
simp_mem ⟂
: Only simplify when read is disjoint from write.simp_mem ⊂w
: Only simplify when read overlaps the write.simp_mem ⊂r hr
: Simplify when read overlaps with a known readhr : mem.read_bytes baseaddr' n' = val
.This is useful for static information such as lookup tables that are at a fixed location and never modified.
simp_mem ⊂r
: Simplify when read overlaps with known read from hypothesis list.The targets where the rewrite must be applied. (This needs some thought: does this even make sense?)
simp_mem at ⊢
simp_mem at h₁, h₂, ⊢
simp_mem using []
simp_mem ⟂/⊂w/⊂r hr/⊂r
Stacked on top of #237
@shilgoel the branch shows appreciable speedups, by controlling the lemmas we pass to mem_omega: In total, it goes from 34s to 13s
Batch mode use, measured by
lake build
:Individual breakdown during Interactive use, measured by #time
MemCpyVCG:
I feel that this, plus if we get the instantiateMVars fix, will help quite a bit with scaling 🙂
Testing:
What tests have been run? Did
make all
succeed for your changes? Wasconformance testing successful on an Aarch64 machine?
No semantics were changed, conformance succeeds.
License:
By submitting this pull request, I confirm that my contribution is
made under the terms of the Apache 2.0 license.