-
Notifications
You must be signed in to change notification settings - Fork 19
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
Version 0.0.7 does not compile on ARM Mac with maximum system allowed stack size (0.0.6 is OK) #97
Comments
Where in the rewriter is it failing? (Can you also get a stack trace?) Some of the reification has been rewritten for performance for 0.0.7 (#77) (see also the release notes of the tag), but if the rewriter is stack overflowing this makes me very pessimistic about Fiat Crypto, since AFAIK there's nothing particularly stack intensive in the rewriter. |
I see what I can do about the stack trace, but it might be largish (with a stack limit of 64 MB). fiat-crypto currently hangs on coq-coqprime. There is already a new version, but the opam package isn't through as yet. |
Hmm - interesting. It dies on a
which results in:
I added the two I try to get it further down. It is difficult to get a stack trace (lldb How it comes that I can compile almost all of Coq Platform and then it dies here I really can't tell. |
I got it down to this snipet:
Replacing the require with all requires and imports in this file (including |
Ah, and yes: when I comment out the "Search" command the file compiles fine. |
What about putting
Can you be more specific? |
Is the pattern searched important? (So as to have a hint about whether it is about the pattern-matching algorithm or about the browsing of the environment.) |
With "Set Debug "backtrace" I get for the first 100 levels:
regarding the directory stuff: I see the sequence:
nested about 500 function levels deep - unlikely to be the cause for a 64M stack overflow, but still a bit strange. |
@herbelin : I tried:
Both also result in a stack overflow. This does work, though:
|
OK, this is consistent with the trace that says that it is a "loop" in the pattern-matching algorithm (file One would need to see on which exact pattern-matching problem it explodes but a "very long computation" is not to be excluded. |
I assumed that the |
I'll have a look. |
You're right, "long computation" does not make sense here. If I put a Could it be an OCaml bug in implementing tail recursion on M1/M2? |
Possibly it is an OCaml issue. Still a 64M stack overflow for a simple search is strange - isn't it? What is it doing? |
|
I see. Who follows up on the OCaml question? In case it is really an issue with TRO on ARM, I would suggest to patch away the search and document in the release notes that there is such an issue on ARM. |
I have no idea. I don't know if the problem has been reported. A search for "tail" and "Apple" on the OCaml bug tracker gives nothing recent.
You mean in |
I mean we patch away the Search in rewriter and document in the release notes of Coq / Coq Platform that there might be an issue with Search (and possibly other things). Who in the Coq team has the best connections to the OCaml maintainers? |
@gadmm might know something about this |
Incidentally, it is probably unrelated because Added: this information seems actually obsolete since 4.14.0 (OCaml PR 19595) and the limit was 6 + 10 IIUC. |
Actually, I'm using ocaml 4.14.1 (installed with opam) and the detected architecture is arm64, so the same as you, I guess. As said, the Are you compiling ocaml with special flags? |
I am using a plain OCaml 4.13.1. Possibly I should switch to 4.14.1. |
ocaml/ocaml#10595 is relevant in lifting arbitrary restrictions on TCO. I suggest adding |
Some good news: I switched to OCaml 4.14.1 and rewriter 0.0.7 compiles fine with it without any hacks. So shall we conclude that this was an early OCaml for ARM artefact and we can close this? |
I would say so. Maybe indeed related to ocaml/ocaml#10595 which landed in 4.14.0. |
In this case is it not still a bug in Coq (unless minimal OCaml version requirement is increased to 4.14)? |
Well OCaml for ARM is still slightly experimental and I think it is known that for ARM a later OCaml version works better. My plan was to document it in the Coq Platform release notes. Also Coq Platform is tied to 4.14.1 now. I am not sure if it is easy to make an ARM specific version restriction on OCaml in opam. |
I can probably copy CompCert and do something like
Does this look right? |
Yes, this looks right, but for platform it is not required since it is anyway tied to OCaml 4.14.1. Still it makes sense to do this. |
I just tried to compile version 0.0.7 on an ARM / Apple silicon Mac. the maximum stack size one can specify on macOS is 64MB. This is sufficient to compile version 0.0.6, but it is not sufficient for 0.0.7.
The text was updated successfully, but these errors were encountered: