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

WIP: feat: integrate simp_mem with sym_n #179

Draft
wants to merge 53 commits into
base: main
Choose a base branch
from

Conversation

alexkeizer
Copy link
Collaborator

@alexkeizer alexkeizer commented Sep 23, 2024

Description:

This PR is stacked on #222.

This PR starts the integration, by adding a call to simp_mem to the effect aggregation post-processing step of sym_n.

Testing:

What tests have been run? Did make all succeed for your changes? Was
conformance testing successful on an Aarch64 machine?

Yes, make all succeeds.

License:

By submitting this pull request, I confirm that my contribution is
made under the terms of the Apache 2.0 license.

NOTE: this PR is owned by @bollu, I (alex) merely opened it because we started pairing on my machine

@alexkeizer
Copy link
Collaborator Author

@bollu

@bollu bollu force-pushed the memory-effects-struct branch from ca521ce to e00ea82 Compare September 25, 2024 22:23
@bollu bollu marked this pull request as ready for review September 25, 2024 22:48
@bollu bollu requested a review from shigoel as a code owner September 25, 2024 22:48
@bollu
Copy link
Collaborator

bollu commented Sep 26, 2024

@alexkeizer comment addressed!

@bollu
Copy link
Collaborator

bollu commented Sep 26, 2024

@alexkeizer is this an LGTM from you?

…rue.

In particular, run only once, and set other profiler-related options
Traces cause less clutter in the infoview, and still give a decent enough output in batch mode as well
This way, we don't get old data because of lake's caching.
We still incorporate all benchmark files in the `Benchmarks` data, but only to ensure we build all dependencies; we disable running the actual benchmark when run with `lake build Benchmarks`
This target runs all the same benchmarks, but with the profiler option enabled
Copy link
Collaborator Author

@alexkeizer alexkeizer left a comment

Choose a reason for hiding this comment

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

LGTM as a starting point!

Comment on lines 17 to 29
/-- Create a trace node in trace class (i.e. `set_option traceClass true`),
with header `header`, whose default collapsed state is `collapsed`. -/
def withTraceNode' (header : MessageData) (k : MetaM α)
(collapsed : Bool := true)
(traceClass : Name := `Tactic.sym) : MetaM α :=
Lean.withTraceNode traceClass (fun _ => return header) k (collapsed := collapsed)

/-- Create a trace note that folds `header` with `(NOTE: can be large)`,
and prints `msg` under such a trace node.
-/
def traceLargeMsg (header : MessageData) (msg : MessageData) : MetaM Unit :=
withTraceNode' m!"{header} (NOTE: can be large)" do
trace[Tactic.sym] msg
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Should these go to some more common file? I'm also not a huge fan of priming names, how about SymM.withTraceNode or some other similar namespace?

These tags show up in the profile (unlike the message itself)
This help when profiling `sym_n`, because the threshold is applied to each step individually
This help when profiling `sym_n`, because the threshold is applied to each step individually
…step in `sym_n`.

This unfortunately does not buy us much, as aggregation for 500 already seems to hit both the recursion limit and heartbeat budget, by itself.
Useful to profile extreme slowdowns, which cause even the 75 step benchmark to timeout
@alexkeizer alexkeizer force-pushed the memory-effects-struct branch from 1cb884f to 40cb6f2 Compare October 7, 2024 21:01
@alexkeizer alexkeizer changed the base branch from main to extract-memory-effects October 7, 2024 21:01
@alexkeizer alexkeizer changed the title feat: integrate simp_mem with sym_n WIP: feat: integrate simp_mem with sym_n Oct 7, 2024
@alexkeizer
Copy link
Collaborator Author

@bollu I separated out the MemoryEffects structure refactor into its own PR, without the simp_mem call at the end of sym_n (which is still in the current PR), because I don't think the latter is quite ready to be merged yet.

@alexkeizer alexkeizer force-pushed the extract-memory-effects branch from 077b5da to 6295e15 Compare October 8, 2024 20:01
shigoel added a commit that referenced this pull request Oct 10, 2024
### Description:

Extracted from #179, stacked on #220.

We extract out memory-effects related code from AxEffects into a new
MemoryEffects structure. This PR is purely a non-functional change, but
will serve as the starting point of integrating simp_mem with sym_n.

The current simplification is effectively a no-op, since the proof state
is not massaged to the way `simp_mem` wants it to be. Subsequent PRs
will focus on massaging the goal state to be as `simp_mem` likes, and
then trying to symbolically simplify the memory expression we see.

### Testing:

What tests have been run? Did `make all` succeed for your changes? Was
conformance testing successful on an Aarch64 machine? yes

### License:

By submitting this pull request, I confirm that my contribution is
made under the terms of the Apache 2.0 license.

Co-authored-by @bollu<[email protected]>

---------

Co-authored-by: Shilpi Goel <[email protected]>
Base automatically changed from extract-memory-effects to main October 10, 2024 15:14
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