-
Notifications
You must be signed in to change notification settings - Fork 500
SCP-2693: New PIR.LetFloat #3823
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
Conversation
596578f to
fd416eb
Compare
|
(Requesting a review from Jakub, fo when Nikos thinks this is ready to look at!) |
0fa32ac to
7bef1a1
Compare
fc86b27 to
1f6e84a
Compare
14d3a07 to
cd108d4
Compare
cd108d4 to
52c8fb8
Compare
52c8fb8 to
8aab0d4
Compare
jakzale
left a comment
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.
I have added some minor comments and possible improvements to how Pos is handled.
Looks good. My only concern is that after reading the file multiple times I still do not completely grok how the floating works...
michaelpj
left a comment
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.
Still reviewing the floating back. Along the way, I did the writer transformation because I wanted to check that it would actually work 😅 which it does. I pushed the commits to this branch but. Feel free to take it or do something else.
| makeNewLet :: NE.NonEmpty (LetNaked tyname name uni fun a) -> Term tyname name uni fun a -> Term tyname name uni fun a | ||
| makeNewLet floatableNaked = | ||
| -- arbitrary: use the annotation of the first let of the floated lets as the annotation of the new let | ||
| -- TODO: use some semigroup annotation-joining instead |
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.
do it!
|
Okay, basically LGTM! |
a29a313 to
9970a8d
Compare
7b3533e to
cf324ee
Compare
2667c03 to
d8bcb64
Compare
Forgot to recurse the removeLets inside the rhs bindings WIP: separated depth and scope reader WIP: fixed remaining bugs NewLetFloat: fixed accumulating letholes, fixed depth-calc of mark Fixed floatBack to recurse inside the floated-lets rhs'es Don't store the Recursivity for LetHoles NewLetFloat: when calculating freevars look into bindings' types Clean up, refactor More refactoring Changed from unmovable to floatable Formatting Rewrite removeLets to use Writer Rewrite mark to use Writer Make MarkCtx a datatype Make Pos a datatype PR adressing semigroup annotation joining update nix+fixstylishhaskell
d8bcb64 to
66c4552
Compare
|
Succeeded on all the linux jobs, let's just merge this. |
Forgot to recurse the removeLets inside the rhs bindings WIP: separated depth and scope reader WIP: fixed remaining bugs NewLetFloat: fixed accumulating letholes, fixed depth-calc of mark Fixed floatBack to recurse inside the floated-lets rhs'es Don't store the Recursivity for LetHoles NewLetFloat: when calculating freevars look into bindings' types Clean up, refactor More refactoring Changed from unmovable to floatable Formatting Rewrite removeLets to use Writer Rewrite mark to use Writer Make MarkCtx a datatype Make Pos a datatype PR adressing semigroup annotation joining update nix+fixstylishhaskell Co-authored-by: Nikolaos Bezirgiannis <[email protected]>
Forgot to recurse the removeLets inside the rhs bindings WIP: separated depth and scope reader WIP: fixed remaining bugs NewLetFloat: fixed accumulating letholes, fixed depth-calc of mark Fixed floatBack to recurse inside the floated-lets rhs'es Don't store the Recursivity for LetHoles NewLetFloat: when calculating freevars look into bindings' types Clean up, refactor More refactoring Changed from unmovable to floatable Formatting Rewrite removeLets to use Writer Rewrite mark to use Writer Make MarkCtx a datatype Make Pos a datatype PR adressing semigroup annotation joining update nix+fixstylishhaskell Co-authored-by: Nikolaos Bezirgiannis <[email protected]>
A new PIR.letfloat pass that floats maximally outwards (a.k.a. full laziness).
The algorithm is influenced by "Let-floating: moving bindings to give faster programs",
where the authors also make use of the free term&type variables of to-float lets to calculate their maximum floating position.
Unlike their approach, we apply this floating transformation in a global fashion ; unlike their source language (ghc-core), we have to make sure not to float any effectful lets.
Pre-submit checklist: