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

why does compiling Coq snapshot need 96GB #4

Open
aa755 opened this issue Jun 11, 2020 · 3 comments
Open

why does compiling Coq snapshot need 96GB #4

aa755 opened this issue Jun 11, 2020 · 3 comments

Comments

@aa755
Copy link

aa755 commented Jun 11, 2020

I would like to get it to be less memory consuming. Do you already know where the bottlenecks are?

@aa755
Copy link
Author

aa755 commented Jun 11, 2020

both for the compilation time and understandability, would it help to break down aarch64.v into smaller files? e.g. decoder, emulator, etc.
It seems the contents of aarch64_mem.sail, aarch64_vector.sail, aarch64_decode.sail all go into aarch64.v. Can these be put into respective .v files?

@Alasdair
Copy link
Contributor

I personally don't know where the bottlenecks are. I think what we do is build the model on a powerful compute server then transfer the results to an ordinary desktop/laptop. @bacam will likely know more

@bacam
Copy link
Contributor

bacam commented Jun 14, 2020

The biggest contributor is that our Coq translations attempt to capture the rich type information from the Sail model. However, the SMT proofs from the Sail type checking can't be reasonably reused, so the Sail Coq library has a tactic which attempts to construct similar proofs. Unfortunately this can be quite fragile and sometimes expensive, particularly when Coq's linear arithmetic solver is used in a context that it doesn't like. That said, more recent versions of the model tend to use much less memory, somewhere below 32GB. (I notice from your pull request that you're using Coq 8.11 - I think that changes the linear solver and I don't know what effect that will have on memory usage.)

Note that the memory consumption is just for building the model. After building it you can use it on another machine with much less memory as long as you use exactly the same build of OCaml and Coq. I've done some work with the Arm model on an old 8GB laptop in this way.

Another factor in the memory use is the size and structure of the decode functions. Currently it has a backtracking mechanism built in because there's something similar in Arm's specification and does make the decoder much larger and deeper than is strictly necessary. We'd like to make it simpler but haven't had the resources to do it yet.

One possible variation that may make a large difference is to drop the extra type information. This requires making versions of the library functions that are defined in badly-formed situations (e.g., bitvectors which appear to have negative lengths). The downside of doing this is that we would lose some of this detailed automatic information. However, from our experience with other proof assistants and our limited experience of working with the Coq model we suspect this may not be a major problem.

If you have some particular use for the model it would be helpful to know what kind of requirements you have so that we can bear them in mind during future Sail development.

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

No branches or pull requests

3 participants