Loop unrolling + fusion ?

Roman Leshchinskiy rl at cse.unsw.edu.au
Mon Mar 9 00:16:25 EDT 2009

On 07/03/2009, at 09:26, Claus Reinke wrote:

> My preferred spec would be roughly
> {-# NOINLINE f #-}
>   as now
> {-# INLINE f #-}    works as now, which is for non-recursive f only  
> (might in future
>   be taken as go-ahead for analysis-based recursion unfolding)
> {-# INLINE f PEEL n #-}
>   inline calls *into* recursive f (called loop peeling for loops)
> {-# INLINE f UNROLL m #-}
>   inline recursive calls to f *inside* f (called loop unrolling for  
> loops)
> {-# INLINE f PEEL n UNROLL m #-}
>   combine the previous two

The problem here is that this only works for directly recursive  
functions which I, for instance, don't normally use in high- 
performance code. Most of my loops are pipelines of collective  
combinators like map, filter, fold etc. because these are the ones  
that can be fused automatically. Unless I'm misunderstanding  
something, this approach doesn't handle such cases.


More information about the Glasgow-haskell-users mailing list