Configure default value of -native-compiler#13352
Configure default value of -native-compiler#13352coqbot-app[bot] merged 6 commits intorocq-prover:masterfrom
Conversation
|
It may be prettier to have a new value for the -native-compiler configure option. |
+1 I'm not sure if hardcoding this is a good idea; IMHO these kind of options should be better controlled by the build system [coq_makefile or dune]. Having this kind of hardcoded values makes it the life of the build system harder due to a combinatorial explosion on possible flags values. Now the build system has to do another query to see what coqc is going to do by default, and maybe override it in case the user wants a quick build. |
Indeed, here is an offer with |
To me, this always has been and definitely remains a configure option. But if you have a rationale supporting your opinion, I'd be happy to hear it.
Sorry, I din't follow you, why would you like to know the default value ?
If by quick you mean without native, you can just pass Anyway, this PR is certainly missing a dune part. I was unable to write it because I still don't understand how the configuration phase is done in the dune build process. |
The example I pointed out is a good one I think: when in dev mode, you may want to skip native compilation for performance purposes, of even proofs as done in vos , so indeed you want a coqc that is able to work both ways.
The build system needs to know what object files will coqc produce, in particular to prevent stale files when building incrementally. For example if you compile
Nothing to be done for dune in this tree, dune rules would have to be adapted themselves to query the configure option of coqc. This introduces a bit painful build dependency tho, as |
|
One alternative is just to patch |
That wouldn't work for build systems other than coq_makefile. |
dune could call coqc with the option always explicit, not relying on the default. |
That would completely ruin the whole point of the CEP though. |
|
The job library:ci-fiat_crypto_legacy has failed in allow failure mode |
Well it is not gonna work either now as unless you patch them, they won't realize that additional files are being built. By the way, we should converge to a single build system for Coq packages so that would be moot [and if people want to have their own DIY build system, IMHO they are on their own] |
No, coq_makefile is working fine, whenever
Well, we shouldn't make their life ridiculously harder though. |
I was answering to your question about systems other than coq_makefile.
Actually this PR would make their life harder as now they have to implement a method to query Coq config options in order to know what's being built |
That may be a stupid question but can't we just clean the cmxs whether there is actually one or not ? |
Sorry, they indeed would have to do the same (and the few cases I'm aware of do it). |
|
I wrongly believed that the related CEP was backwards compatible, but with this PR I realize now that it requires changes to the coqc binary. Since it was its main interest, I think I should make an alternative proposal based on split compilation that is essentially a configure-agnostic way of achieving on-demand compilation. |
Well that'd result in a pretty suboptimal incremental build. |
That discussion should happen in a separate issue — I thought we had already concluded that too many packages still rely on
That might be great when using
These changes seem easy enough to get in for 8.13, and they give you a better default. You said split packages would not get in before 8.14; even if your PR can be finished in time, it’s not clear the build-system changes can be done in time as well for 8.13, and ditto for the changes to all the packages.
Why? You could also move potential outputs out-of-the way, and restore them if needed. I’m also not sure why “asking coq for a bunch of flags” is intrinsically hard — add one coq option to dump the config in machine-readable format, and call that at the start. |
You can only coq_makefile as suggested an still you get the same effect; this PR, as-is, is breaking everything else.
If you clean the cmxs files, then you need to regenerate them again at each build, all of them. To restore the outputs you need to know them, that's beyond what make can do.
First, it adds complexity. Not having to parse anything is much much better than having to parse. Second, when you compose with |
|
Hi @ejgallego,
by "breaking everything else", do you just mean "this PR breaks the CI currently", or "this PR is incomplete because the dune counterpart is missing in this PR"? − because as I'm not very fluent with dune, it is hard for me to see how easy it is to finalize that part…
But I believe the |
This does sound interesting, and potentially better! It doesn't help users of DIY build systems — but they can make the same choice independently.
More accurately, I think it breaks dune and might help DIY build system; changing
No? If you recompile a %.v->%.vo file, remove only %.vo: %.v
mv "%.cmxs" "%.cmxs-old"
coqc ...
[ -f "%.cmxs" ] || mv "%.cmxs-old" "%.cmxs"Optionally, restore the old file even if the contents have not changed (à la KBuild), to restore the old timestamps, but adding features to I do agree that the above change might add some complexity to weigh in to this proposal, and 4 lines of untested bash don't prove it's easy. |
silene
left a comment
There was a problem hiding this comment.
You are supposed to modify the configure call in .gitlab-ci.yml so as to pass -native-compiler ondemand, I guess. Hopefully, our CI guys can point you to the correct place if this is not it.
Regarding the discoverability of the setting, you could add a line at the end of file lib/envars.ml.
Coul you be more precise? If that means configuring coq_makefile rather than coqc, this just breaks every build sytem (but coq_makefile). |
Let’s assume Emilio’s proposal won’t break dune. Let coq_makefile pass the desired default setting of native_compute to coq. Why are other build-systems broken, if they'd get the same behavior as today? |
Note that the default behavior of |
|
Since there seems to be some confusion, let me stress the following point. This pull request does not change the behavior of |
|
The only difference in default behavior is that the stdlib is no longer precompiled for native compute (which you were interested in @Blaisorblade IIRC ;-) )
Because they won't get the expected behavior for native_compute users (except maybe by hacking them to discover the setting hidden in coq_makefile). |
acbbc05 to
ed709be
Compare
|
After implementing @SkySkimmer 's idea just above, there is no more duplicate job. |
|
Hi @proux01! |
Thanks a lot for your patience @proux01 ; I'd say that the PR looks good to go. We had a failure on the test suite however: This is not the first time I see this, and it looks quite fishy. I'll re-run the job for now. |
|
re-running fixed the failure, I think we can merge , @gares , do you need your comments addressed before merge? |
We should probably have a look with a |
This an implementation of point 2 of CEP rocq-prover/rfcs#48 rocq-prover/rfcs#48 Option -native-compiler of the configure script now impacts the default value of the option -native-compiler of coqc. The -native-compiler option of the configure script is added an ondemand value, which becomes the default, thus preserving the previous default behavior. The stdlib is still precompiled when configuring with -native-compiler yes. It is not precompiled otherwise.
A few libraries in the CI don't compile with it (out of memory).
|
I just removed equations and metacoq specific code following upstream fixes. |
|
So I do need to update the pins... anyway, please merge. |
|
@coqbot: merge now |
|
I'm surprised this didn't break the fiat-parsers CI, as it breaks the CI on our end because the native compiler hangs for over ten minutes trying to compile libraries to native code. Is the correct solution to this to add |
|
Apparently, we got the CI to pass with |
This an implementation of point 2 of rocq-prover/rfcs#48
A new boolean option -native-compiler-default-yes is added to the configure script. When set to "yes", the default value for the -native-compiler option of the produced coqc becomes "yes" (and the stdlib is still precompiled for native compute), otherwise (default) it remains "ondemand" (but the stdlib is no longer precompiled for
native compute).