Safe Haskell | None |
---|---|
Language | Haskell2010 |
It is well known that fully parallel loops can always be interchanged inwards with a sequential loop. This module implements that transformation.
This is also where we implement loop-switching (for branches), which is semantically similar to interchange.
Synopsis
- data SeqLoop = SeqLoop [Int] Pattern [(FParam, SubExp)] (LoopForm SOACS) Body
- interchangeLoops :: (MonadFreshNames m, HasScope SOACS m) => KernelNest -> SeqLoop -> m (Stms SOACS)
- data Branch = Branch [Int] Pattern SubExp Body Body (IfAttr (BranchType SOACS))
- interchangeBranch :: (MonadFreshNames m, HasScope SOACS m) => KernelNest -> Branch -> m (Stms SOACS)
Documentation
An encoding of a sequential do-loop with no existential context, alongside its result pattern.
interchangeLoops :: (MonadFreshNames m, HasScope SOACS m) => KernelNest -> SeqLoop -> m (Stms SOACS) Source #
Given a (parallel) map nesting and an inner sequential loop, move
the maps inside the sequential loop. The result is several
statements - one of these will be the loop, which will then contain
statements with Map
expressions.
interchangeBranch :: (MonadFreshNames m, HasScope SOACS m) => KernelNest -> Branch -> m (Stms SOACS) Source #