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

Safe Haskell | Safe-Inferred
Language | GHC2021

Futhark.Optimise.Simplify.Rules.ClosedForm

Description

This module implements facilities for determining whether a reduction or fold can be expressed in a closed form (i.e. not as a SOAC).

Right now, the module can detect only trivial cases. In the future, we would like to make it more powerful, as well as possibly also being able to analyse sequential loops.

Synopsis

- foldClosedForm :: BuilderOps rep => VarLookup rep -> Pat (LetDec rep) -> Lambda rep -> [SubExp] -> [VName] -> RuleM rep ()
- loopClosedForm :: BuilderOps rep => Pat (LetDec rep) -> [(FParam rep, SubExp)] -> Names -> IntType -> SubExp -> Body rep -> RuleM rep ()

# Documentation

foldClosedForm :: BuilderOps rep => VarLookup rep -> Pat (LetDec rep) -> Lambda rep -> [SubExp] -> [VName] -> RuleM rep () Source #

`foldClosedForm look foldfun accargs arrargs` determines whether each of the results of `foldfun` can be expressed in a closed form.

loopClosedForm :: BuilderOps rep => Pat (LetDec rep) -> [(FParam rep, SubExp)] -> Names -> IntType -> SubExp -> Body rep -> RuleM rep () Source #

`loopClosedForm pat respat merge bound bodys` determines whether the do-loop can be expressed in a closed form.