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

Safe Haskell | Safe-Inferred
Language | GHC2021

Futhark.Tools

Contents

- Primitive expressions

Description

An unstructured grab-bag of various tools and inspection functions that didn't really fit anywhere else.

Synopsis

- module Futhark.Construct
- redomapToMapAndReduce :: (MonadFreshNames m, Buildable rep, ExpDec rep ~ (), Op rep ~ SOAC rep) => Pat (LetDec rep) -> (SubExp, [Reduce rep], Lambda rep, [VName]) -> m (Stm rep, Stm rep)
- scanomapToMapAndScan :: (MonadFreshNames m, Buildable rep, ExpDec rep ~ (), Op rep ~ SOAC rep) => Pat (LetDec rep) -> (SubExp, [Scan rep], Lambda rep, [VName]) -> m (Stm rep, Stm rep)
- dissectScrema :: (MonadBuilder m, Op (Rep m) ~ SOAC (Rep m), Buildable (Rep m)) => Pat (LetDec (Rep m)) -> SubExp -> ScremaForm (Rep m) -> [VName] -> m ()
- sequentialStreamWholeArray :: (MonadBuilder m, Buildable (Rep m)) => Pat (LetDec (Rep m)) -> SubExp -> [SubExp] -> Lambda (Rep m) -> [VName] -> m ()
- partitionChunkedFoldParameters :: Int -> [Param dec] -> (Param dec, [Param dec], [Param dec])
- module Futhark.Analysis.PrimExp.Convert

# Documentation

module Futhark.Construct

redomapToMapAndReduce :: (MonadFreshNames m, Buildable rep, ExpDec rep ~ (), Op rep ~ SOAC rep) => Pat (LetDec rep) -> (SubExp, [Reduce rep], Lambda rep, [VName]) -> m (Stm rep, Stm rep) Source #

Turns a binding of a `redomap` into two seperate bindings, a `map` binding and a `reduce` binding (returned in that order).

Reuses the original pattern for the `reduce`, and creates a new pattern with new `Ident`s for the result of the `map`.

scanomapToMapAndScan :: (MonadFreshNames m, Buildable rep, ExpDec rep ~ (), Op rep ~ SOAC rep) => Pat (LetDec rep) -> (SubExp, [Scan rep], Lambda rep, [VName]) -> m (Stm rep, Stm rep) Source #

dissectScrema :: (MonadBuilder m, Op (Rep m) ~ SOAC (Rep m), Buildable (Rep m)) => Pat (LetDec (Rep m)) -> SubExp -> ScremaForm (Rep m) -> [VName] -> m () Source #

Turn a Screma into a Scanomap (possibly with mapout parts) and a Redomap. This is used to handle Scremas that are so complicated that we cannot directly generate efficient parallel code for them. In essense, what happens is the opposite of horisontal fusion.

sequentialStreamWholeArray :: (MonadBuilder m, Buildable (Rep m)) => Pat (LetDec (Rep m)) -> SubExp -> [SubExp] -> Lambda (Rep m) -> [VName] -> m () Source #

Turn a stream SOAC into statements that apply the stream lambda to the entire input.

partitionChunkedFoldParameters :: Int -> [Param dec] -> (Param dec, [Param dec], [Param dec]) Source #

Split the parameters of a stream reduction lambda into the chunk size parameter, the accumulator parameters, and the input chunk parameters. The integer argument is how many accumulators are used.

# Primitive expressions

module Futhark.Analysis.PrimExp.Convert