Conversation
46427c7 to
fa94371
Compare
fa94371 to
b011ea9
Compare
|
@lthls : would you like to review this one as well? |
dd36b56 to
6ab4a64
Compare
lthls
left a comment
There was a problem hiding this comment.
I approve this pull request, both its objective and its implementation. There are a few remarks that I can make, tough:
-
If I understand correctly, after this gets merged we'll have catch handlers with non-
valregister types for the first time on trunk. I think this is already handled correctly, but I'll ask a few people around me who have experienced with register types if there's anything to watch for. -
The
notify_catchfield of the environment is a bit unintuitive. Knowing what it tries to achieve, I understand how it works, but it could use a few lines of comments explaining what it's used for. I think that the natural solution would be to have thenotify_catchfield contain anunboxed_number_kind IntMap.t, but this would mean that the environment contains information that needs to be returned back to the caller, changing the signature of thetransl*functions and updating the code everywhere. I see the proposed version here as a way around that problem, but it could do with a bit more documentation. -
I'd be curious to know how often the
No_resultcase occurs intransl_catch, and on which kind of programs. There's a number of optimisations that could be done if it happens, but I'd expect that either the optimisations are already done elsewhere or that this case never occurs in practice.
|
Thanks @lthls. I've added some words about the notify_catch callback technique.
I think all the cmm and post-cmm backend is ready to deal with non-val types (also for functions arguments, which is what I used in an experimental PR about unboxed calling conventions), but indeed, this hasn't received wide coverage. Did you more feedback from other people?
I haven't been able to produce this situation (corresponding to a dead catch handler), and possibly this is excluded by other passes, but it would seem weird to reject the case at this point. |
Yes, they confirmed that they didn't find any bugs linked to this change in their experiments.
I wasn't thinking about rejecting the case, I would have simply removed the handler since it's unreachable. If you haven't encountered such a situation in practice, it's probably not worth worrying about. Thanks for addressing my concerns. In the light of the recently merged #8584, do you want to take the opportunity to show some of the improvements that one can expect ? Your original pull request (#2162) showed some of the cases where it would trigger, maybe you could build a micro-benchmark based on these. |
|
Sorry, I should indeed have put a link to #2165 (comment) which still applies (just checked). |
|
(That's a 40% speedup on the micro-benchmark.) |
|
Based on @lthls 's approval and the availability of the micro-benchmark above, I'll merge this soon if nobody complains. |
|
@alainfrisch Have you obtained any benchmark numbers from larger programs with this patch? It seems a significant enough change to be worth doing so. As an aside, I think the existing register typing for unboxed integers is dubious, as they are assigned type |
No visible change on some larger payloads I tried, but we wrote our critical numerical code knowing how unboxing works currently, and carefully rewrote parts to workaround current limitations. This ends up with some code like: let a = ref 0. and b = 0. in
if cond then (a := ...; b := ...) else (a:= ...; b := ...)which could be avoided by a simple unboxed float tuple binding with this PR.
If there is a problem, I think it already exists with normal unboxing of let-bound identifiers. Here we unbox catch arguments if they are boxed numbers for sure, considering all call sites; and for the "continuation" (i.e. the handler code), it is as if we inserted a local let-bound identifier to hold the unboxed value ( |
|
I think the typing problem isn't specific to this PR, agreed. |
|
@mshinwell : are you ok with merging? |
|
I think as long as you're satisfied with the potential performance changes, it's fine. |
|
Closed/reopened to relaunch Appveyor CI, which took significantly longer than usual (and one job was killed because of it); no problem on Travis, so I suspect a transient issue on Appveyor, but let's be sure before merging. |
|
Ok, AppVeyor finished each job in < 1 hour, but job time seems to be significantly higher than on master; I think it's worth investigating before merging. |
|
False alarm, the latest AppVeyor build is a fast as usual (also confirmed by checking AppVeyor logs that slow builds were also slow on the bytecode parts). |
This is a version of #2162, but built on top of the new (proposed) treatment of unboxing at the Cmm level (from #2165).
The first two commits are those from #2165. Only the third commit should be reviewer here, and this PR should not be merged before #2165.