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

RFC: Caching on CI machine #1140

Closed
cpitclaudel opened this issue Jul 19, 2017 · 8 comments
Closed

RFC: Caching on CI machine #1140

cpitclaudel opened this issue Jul 19, 2017 · 8 comments

Comments

@cpitclaudel
Copy link
Contributor

Our CI takes roughly 12 minutes to run, with approx 2 minutes spent bootstrapping and 10 spent verifying examples. Here's a proposal to make it better:

  • Every time we send a query to Z3 and get unsat, we record a hash of that query in a cache file.
  • Every time we get a new VC, we check whether we already know that it's unsat from the cache file.

The cache file should also include a Z3 version, and it should survive across CI invocations.

The idea is that in the relatively common case in which a change to F* changes few VCs, we can skip most of the 10 minutes currently spent reverifying everything.

Thoughts?

@BarryBo
Copy link
Contributor

BarryBo commented Jul 19, 2017

I think we will have much of the infrastructure needed to do this, when we convert the F* build to use Scons instead of make. Scons uses hashes of files instead of timestamps, and records the timestamps of build tools. It also supports use of a disk directory tree as a cache, allowing it to memoize build steps. If the hashes of the inputs and tools match a prior set of hashes, then Scons will copy the result files out of the cache rather than recomputing.

For F* invoking Z3, today, that would be opaque to SCons, since F* invokes Z3 directly, not via a makefile rule.

In Vale, we do have these performance gains, as the Vale compiler generates Dafny source, hands it to Dafny to prove. Scons memoizes the Dafny input and output, skipping the expensive verification in the event that the inputs are unchanged from a prior build.

@cpitclaudel
Copy link
Contributor Author

I think we will have much of the infrastructure needed to do this, when we convert the F* build to use Scons instead of make. […] For F* invoking Z3, today, that would be opaque to SCons, since F* invokes Z3 directly, not via a makefile rule.

Do we expect to change the way we invoke F*, too? I knew of the plan to move to SCons, but I couldn't/can't see how it will help us here.

@BarryBo
Copy link
Contributor

BarryBo commented Jul 19, 2017

I think we would have to, in order to make the Z3 programs visible to Scons for memoization. It isn't clear to me whether that's a better approach, than building that caching into F* itself.

@cpitclaudel
Copy link
Contributor Author

I don't think that would work easily, though: we'd need some form of computed dependencies (the number of queries to Z3 isn't fixed), and we'd be reading from and writing to disk a lot

@BarryBo
Copy link
Contributor

BarryBo commented Jul 19, 2017

OK, that makes sense then, to do the work in F* itself.

@cpitclaudel
Copy link
Contributor Author

@nikswamy , @wintersteiger , the recent changes were an implementation of this, right? Can it be closed now?

@nikswamy
Copy link
Collaborator

Yes, although the scons work is still applicable and will provide another level of caching, i.e., cache entire fstar invocations.

Maybe we can use this issue to continue to track that part of the work.

@cpitclaudel
Copy link
Contributor Author

Maybe we can use this issue to continue to track that part of the work.

I'm not sure (it's my bad for mis-titling the issue); this one was very much about caching z3 responses :)

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

No branches or pull requests

3 participants