
Hi all -
Some (beginner) hoopl questions:
1) There doesn't seem to be a "run" function or a way to create FuelMonads.
I found runWithFuel, getFuel and setFuel, but they are in the hidden
Compiler.Hoopl.Fuel module. This is ghc version 7.6.3 and hoopl version
3.9.0
2) Are there any examples that show "inlining" empty graphs/blocks?
Suppose I have a C C graph that looks like this:
label 12:
goto 13;
I'd like to rewrite all the occurrences of label 12 to label 13 and
eliminate the label 12 graph (from what I've seen this will happen
automatically once all the label 12 references are gone).
3) How about inlining single use graphs?
Suppose I have two C C graphs that look like this:
label 15:
<nodes O O>
goto 16;
label 16:
<nodes O O>
<node O C>
If the only reference to label 16 is from the label 15 graph, then I'd like
to rewrite it as:
label 15:

Hi Brett,
1) There doesn't seem to be a "run" function or a way to create FuelMonads. I found runWithFuel, getFuel and setFuel, but they are in the hidden Compiler.Hoopl.Fuel module. This is ghc version 7.6.3 and hoopl version 3.9.0 I was confused the same way you are now: http://www.haskell.org/pipermail/ghc-devs/2013-July/001777.html There is no way to use fuel at the moment. You could try to re-enable it on your own.
Regarding the examples you're asking - I'm not aware of any. The best you can do is look at existing Hoopl code and try to learn from it. As for the transformations you're trying to implement. You are aware that they are already implemented in GHC but without Hoopl? Janek Dnia poniedziałek, 21 października 2013, Brett Letner napisał:
Hi all -
Some (beginner) hoopl questions:
1) There doesn't seem to be a "run" function or a way to create FuelMonads. I found runWithFuel, getFuel and setFuel, but they are in the hidden Compiler.Hoopl.Fuel module. This is ghc version 7.6.3 and hoopl version 3.9.0
2) Are there any examples that show "inlining" empty graphs/blocks?
Suppose I have a C C graph that looks like this:
label 12: goto 13;
I'd like to rewrite all the occurrences of label 12 to label 13 and eliminate the label 12 graph (from what I've seen this will happen automatically once all the label 12 references are gone).
3) How about inlining single use graphs?
Suppose I have two C C graphs that look like this:
label 15: <nodes O O> goto 16;
label 16: <nodes O O> <node O C>
If the only reference to label 16 is from the label 15 graph, then I'd like to rewrite it as: label 15:
Thanks, Brett

As for the transformations you're trying to implement. You are aware that they are already implemented in GHC but without Hoopl?
Is that because the ghc code just hasn't been updated yet (no need to if it is already working) or because those sorts of transformations are outside the scope of what hoopl does (or was intended to do)? Thank you, Brett

*Sigh*. Resending to list from the correct email...
-------------------
Part of it, probably, is that Hoopl actually costs quite a bit in
terms of efficiency, both in use (e.g. compiler paasses) and
integration (i.e. using the library at all.) Simon Marlow spent quite
a lot of time bringing the new code generator up-to-par with the old
one in terms of compilation time, but it was a tough battle. In
particular, you'll notice all the Monad types from Hoopl are actually
specialized to hell in the compiler, and this is precisely the reasons
for doing so.
On the whole, Hoopl will probably always cost a little more - the new
backend requires more passes due to its design, so there will always
be some cost associated with that. But we only want that cost, and not
the Hoopl overhead itself. :) If you can find a way to introduce new
passes or more flexible optimizations, I'm sure we'd still like to
look at them, though.
On Wed, Oct 23, 2013 at 8:53 AM, Brett Letner
As for the transformations you're trying to implement. You are aware that they are already implemented in GHC but without Hoopl?
Is that because the ghc code just hasn't been updated yet (no need to if it is already working) or because those sorts of transformations are outside the scope of what hoopl does (or was intended to do)?
Thank you, Brett
_______________________________________________ ghc-devs mailing list ghc-devs@haskell.org http://www.haskell.org/mailman/listinfo/ghc-devs
-- Regards, Austin Seipp, Haskell Consultant Well-Typed LLP, http://www.well-typed.com/

Brett, if you'd like to do some work on Hoopl and contribute to GHC at the same time please take a look here: http://ghc.haskell.org/trac/ghc/wiki/Hoopl/Cleanup This page sumarizes some conclusions Simon and I reached during my summer internship. In the end I didn't have enough time to implement them and most likely I won't. Maybe you'd be interested in picking up that project? Janek Dnia środa, 23 października 2013, Austin Seipp napisał:
*Sigh*. Resending to list from the correct email...
-------------------
Part of it, probably, is that Hoopl actually costs quite a bit in terms of efficiency, both in use (e.g. compiler paasses) and integration (i.e. using the library at all.) Simon Marlow spent quite a lot of time bringing the new code generator up-to-par with the old one in terms of compilation time, but it was a tough battle. In particular, you'll notice all the Monad types from Hoopl are actually specialized to hell in the compiler, and this is precisely the reasons for doing so.
On the whole, Hoopl will probably always cost a little more - the new backend requires more passes due to its design, so there will always be some cost associated with that. But we only want that cost, and not the Hoopl overhead itself. :) If you can find a way to introduce new passes or more flexible optimizations, I'm sure we'd still like to look at them, though.
On Wed, Oct 23, 2013 at 8:53 AM, Brett Letner
wrote: As for the transformations you're trying to implement. You are aware that they are already implemented in GHC but without Hoopl?
Is that because the ghc code just hasn't been updated yet (no need to if it is already working) or because those sorts of transformations are outside the scope of what hoopl does (or was intended to do)?
Thank you, Brett
_______________________________________________ ghc-devs mailing list ghc-devs@haskell.org http://www.haskell.org/mailman/listinfo/ghc-devs

On 23/10/13 18:06, Austin Seipp wrote:
*Sigh*. Resending to list from the correct email...
-------------------
Part of it, probably, is that Hoopl actually costs quite a bit in terms of efficiency, both in use (e.g. compiler paasses) and integration (i.e. using the library at all.) Simon Marlow spent quite a lot of time bringing the new code generator up-to-par with the old one in terms of compilation time, but it was a tough battle. In particular, you'll notice all the Monad types from Hoopl are actually specialized to hell in the compiler, and this is precisely the reasons for doing so.
Correct. Right now, we use Hoopl for analysis only, particularly live-variable analysis. We don't use its transformation capabilities, since even the simplest removeDeadAssignments transformation costs about 5% extra compile time, and I wasn't willing to pay that. The sinking pass that I wrote by hand does a lot more and only costs 3%. Edward Yang's Hoopl version of the sinking pass cost 30%, and that was after I'd wrung everything I could out of hoopl. It ought to be possible to make hoopl faster. One idea I had was to abstract it over the transformation for a whole basic block, rather than for a single instruction. That way you could hand-code the block transformer to take advantage of local knowledge - in particular in most cases we're not splicing entire graphs in place of a single instruction, which is where a lot of the complexity in hoopl comes from. Cheers, Simon
On the whole, Hoopl will probably always cost a little more - the new backend requires more passes due to its design, so there will always be some cost associated with that. But we only want that cost, and not the Hoopl overhead itself. :) If you can find a way to introduce new passes or more flexible optimizations, I'm sure we'd still like to look at them, though.
On Wed, Oct 23, 2013 at 8:53 AM, Brett Letner
wrote: As for the transformations you're trying to implement. You are aware that they are already implemented in GHC but without Hoopl?
Is that because the ghc code just hasn't been updated yet (no need to if it is already working) or because those sorts of transformations are outside the scope of what hoopl does (or was intended to do)?
Thank you, Brett
_______________________________________________ ghc-devs mailing list ghc-devs@haskell.org http://www.haskell.org/mailman/listinfo/ghc-devs
participants (4)
-
Austin Seipp
-
Brett Letner
-
Jan Stolarek
-
Simon Marlow