amosr / streamtiling

'Controlled' stream fusion

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

streamtiling

'Controlled' stream fusion or loop tiling.

Attempt to limit loop fusion when there are "too many" registers. Too many is very vague since we don't actually know how many registers an arbitrary function will require, but we at least know that things like zip will require a few of its own.

This will probably only be useful for strict, unboxed vectors; lazy vectors will probably just end up storing thunks so we'd lose any cache locality benefits.

On second thoughts, perhaps only zip will really benefit from this. Map doesn't really require its own state, nor filter.

One example is if we have zipped the map of several things together:

    map f xs `zip` map g ys `zip` map h zs

At some stage we'll need to compute 'map h zs', but when we do we will already have an "x" and a "y" contending for registers. Suppose "x" and "y" are complicated tuples, then maybe we already have six registers used, and ten left. Except for GHC's pinned registers. So maybe we actually have eight available registers.

Would moving the (map f xs) and (map g ys) into their own buffers be helpful in this case? It might give better cache locality. I don't know.

About

'Controlled' stream fusion


Languages

Language:Haskell 100.0%