futhark-0.10.2: An optimising compiler for a functional, array-oriented language.

Safe HaskellNone
LanguageHaskell2010

Futhark.Pass.ExtractKernels.Interchange

Description

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

Documentation

data SeqLoop Source #

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.