Fusing loops by specializing on functions with SpecConstr?

Harendra Kumar harendra.kumar at gmail.com
Wed Apr 1 08:20:12 UTC 2020


On Wed, 1 Apr 2020 at 02:49, Alexis King <lexi.lambda at gmail.com> wrote:

>
> I’ve been trying to figure out if it would be possible to help the
> optimizer out by annotating the program with special combinators like the
> existing ones provided by GHC.Magic. However, I haven’t been able to come
> up with anything yet that seems like it would actually work.
>

You may want to take a look at https://github.com/composewell/fusion-plugin
which uses annotations to help GHC fuse, not specifically what you want but
might possibly be relevant to your work.
https://github.com/composewell/streamly relies heavily on case-of-case and
SpecConstr for stream fusion. There are several cases that GHC is unable to
fuse currently. We use a "Fuse" annotation to tell GHC that any function
involving this type must be inlined so that fusion can occur reliably. With
the help of fusion-plugin we have been able to fuse almost every known case
in streamly till now.

-harendra
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-devs/attachments/20200401/39a569d1/attachment.html>


More information about the ghc-devs mailing list