-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Remove float array optimisation #163
Conversation
Thanks, this is great! I'm not sure that this could be integrated directly, however, since it would directly degrade performance of any numerical code that rely on float arrays. What do you think of the migration path I describe in my blog post? First make available the new FloatArray module and add some helpers to find out when they should be used (static analysis of .cmt files to find occurences of "float array" and/or runtime warnings to detect and report the creation of such float arrays [e.g. with some stacktrace]); and only remove the support for the unboxed representation in a later version. |
Any consequences for records of float ? |
I would love to see it gone as soon as possible, but you're right that it might be worth doing the removal in stages. This would mean applying the first two commits of the patch now, and the rest later. I'm not sure that static analysis of .cmt files would be significantly more useful than grep. A warning might be more useful, since it would inform people that didn't know that the change was coming.
No, they are unchanged. |
Yes, indeed.
Me too! For the records, I think I remember Xavier saying he was still fond of automatically unboxed float arrays. It's probably best to wait for his opinion before spending too much time on that. (Maybe the argument about Coq will facilitate the discussion :-) ) |
It would have been better to discuss this proposal on caml-devel before starting coding. For the record, I am opposed to removing the float array optimization. |
Why doesn't |
One potential slow way to move forward would be to introduce an new 'array' type that always box float value. If it gets used, some day the array type could be deprecated. But that would need quite a lot of time to get rid of special cases for float (if it can ever happen). |
@xavierleroy, could you outline your rationale for keeping the float array optimization? So far, I have only seen good arguments for removing it. |
Parallel build was broken
Update depend
What about |
This proposal has been subsumed by another (which doesn't have a PR yet) that will allow users to created unboxed array types for types other than float. |
I guess I'll close this in favour of #1294. |
* Discard dead code after Itailcalls and Iextcalls that don't return Revert a line from flambda-backend#72 * Don't propagate Ladjust_trap_depth past Llabel * Add terminator "Throw" for invoking a continuation Blocks that end with Iextcall that does not return can be generated by Flambda2 (e.g., bounds check) and result in a block without terminator. * Rename Cfg.terminator.Throw to Call_no_return * Don't propagate Ladjust_trap_depth past Lbranch * Revert to pre-Cmm-traps version of discard_dead_code after Itailcall
The
float array
optimisation has a number of negative consequences. Alain's blog post contains a good description of the most important ones.So here is a patch to remove the
float array
optimisation. It does three things:FloatArray
(and correspondingFloatArrayLabels
) module to the standard library. The typeFloatArray.t
is abstract and is represented using the optimised float array representation. It provides the same operations asArray
, as well as acreate
function similar to the one inString
. The primitives used byFloatArray
are defined indouble_array.c
.float array
.float lazy
values to be short-circuited by the garbage collector -- since the risk from float arrays is gone.