futhark-0.21.7: An optimising compiler for a functional, array-oriented language.
Safe HaskellNone
LanguageHaskell2010

Futhark.Tools

Description

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

Synopsis

Documentation

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 Idents for the result of the map.

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