-
Notifications
You must be signed in to change notification settings - Fork 413
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
[coq] Add .vos support #4050
[coq] Add .vos support #4050
Conversation
I'd add |
Thanks @rgrinberg , so cool, I'll have a look.
You should be able to disable those using command line flags. |
Tho it could indeed make sense to have different object directories à la OCaml, for |
This may be safer in the long run, as one of the very tricky features on the upstream implementation of So indeed, having a clear control over the Coq's loadpath could help avoid this kind of situations and provide better incrementality. |
It's only possible to disable .glob files. I don't see a way to disable .aux files.
Sounds good. What about the installation layout? Do we flatten |
Another downside of having a separate object directory for .vos files: users aren't going to be able to do
|
Will have a closer look soon, but we have the same problem here with native, this feature was introduced in Coq 8.11 so we need to guard the feature under a new coq lang flag [or if we could get the major coq version reliably then with the Coq version] |
[rebased] |
|
||
let coqdep_rule (cctx : _ Context.t) ~source_rule ~file_flags coq_module = | ||
(* coqdep needs the full source + plugin's mlpack to be present :( *) | ||
let source = Coq_module.source coq_module in | ||
let file_flags = | ||
[ Command.Args.S file_flags | ||
; As [ "-dyndep"; "opt" ] | ||
; As [ "-dyndep"; "opt"; "-vos" ] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This needs to be conditional as to support Coq older than 8.11
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But we don't have a way to check the version of Coq. Perhaps it should be enabled explicitly in the project file? E.g. (coq.vos enable)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can also say that (coq lang 0.4)
is required and only 8.11 upwards is supported
Ok, I had a look and I'm not sure I understand how this is supposed to work from the point of view of the user. Coq documentation on vos is here https://coq.inria.fr/refman/practical-tools/coq-commands.html#compiled-interfaces A few comments:
|
There are some other small issues such as duplicate rules when native or extraction are used. |
I'm then confused by this passage from the docs:
How would this work when
If |
We now build and install .vos files. This requires us to parse coqdep with -vos and setup a .vos rule for every file. Signed-off-by: Rudi Grinberg <me@rgrinberg.com>
Indeed that's a bit confusing, the real code does: if !Flags.load_vos_libraries then begin
match find ".vos" with
| Some (_, vos as resvos) when (Unix.stat vos).Unix.st_size > 0 -> Ok resvos
| _ -> load_most_recent_of_vo_and_vio()
end else load_most_recent_of_vo_and_vio() so if there is no vos file, Coq will fallback to .vo. Actually, Coq will overwrite the .vos to zero when compiling a .vo file, so it is actually pretty hard to install both
It will just use
Yup, that seems the way to go! I'd keep So indeed as to be correct we cannot setup both rules unfortunately, as this would lead to non-determinism, as we have
So this is very similar to I'm ccing @charguer as he knows all the details. |
Thanks @ejgallego for your precise answers. The Regarding the basic assumption:
I hope this clarifies the intended usage. |
Signed-off-by: Rudi Grinberg <me@rgrinberg.com>
I see. This means that we need to setup sandboxes for the rules as they produce the same target. Thinking about a setup that makes sense from dune's perspective:
|
This was the original intention of .vio files, which correspond pretty much exactly to the contents of .vos files plus "suspended proofs" needed to complete to ".vo" files. With two caveats: (1) universes can't be checked on a per-file basis, and (2) the suspended proofs, as implemented, were taking quadratic amount space in a large project (dozens of Gb, for a project whose vo files sum up to no more than a few hundred megabytes). Due to reason (1), having .vo pipeline reuse the .vos pipeline is doomed to failure. It's tempting to try to make the .vos and the .vo pipeline live completely separately, but then the cost is that (1) the user will often need to recompile .vos file even when the .vo files are already at hand, and (2) we need to distinguish between library files and local files---not an easy thing to do. |
@rgrinberg another issue we ought to be careful with is what is outlined in coq/coq#13921 , in particular:
|
@rgrinberg Any progress with this? |
As you mentioned on zulip, dune should separate vos and vo targets (through different... profiles?); it doesn't need to truncate the I wonder if dune should ask coq to disable the vos truncation (via a new option), since it conceptually belongs in the coq_makefile build system, but actually migrating it there is probably not worth it? |
It's not that simple. The problem is that the behavior of coq is to load whichever is available between .vos and .vo. One could argue that the issue comes from that behavior: the user should specify whether .vos or .vo files should be loaded. However, there is a quite high cost to this approach, because for every library, one needs a way to indicate whether to load .vos or .vo files. Indeed, for installed libraries it does not make much sense to load .vos files, but for local libraries it can make sense. At the time of developing .vos files, it seemed too impractical to go that way. Hence, the need to clear .vos files when dumping .vo file, to make sure that coq is not loading stale versions. If you are interested in a different way to do things, my suggestion would be to introduce an option that, in the presence of flags -vos or -vok, allows the user to indicate which libraries should be loaded in .vo format; all the other For example, you could call this flag
I wouldn't say this. I'd say it is associated with the "make" build system, combined with the behavior of coq for loading libraries. |
Sure, but that doesn’t mean that After reading coq/coq#13921, I’d propose that That might mean building and loading (I’m also imagining a tool extracting |
I also think it's fine to rebuild If you configure dune to use separate folders for producing If I read you well, this would implement your suggestion "I’d propose that dune default to stop Coq from ever loading vo files in vos mode, by never making them available." PS: If you want to extract a |
Agree with 99%.
That wouldn't guarantee byte-for-byte reproducible outputs, but we can leave that aside. |
@Alizter can take over this if he's interested. |
That'd be great! Some of us have been dying to get |
@Alizter has been working on it I think, but actually a quick form of support for it should be just a few lines of code, so let's coordinate in Zulip if you want. The idea is as follows:
thanks to target cleaning, everything should work fine, voilà ! |
We now build and install .vos files. This requires us to parse coqdep
with -vos and setup a .vos rule for every file.