futhark-0.20.0: An optimising compiler for a functional, array-oriented language.
Safe HaskellSafe-Inferred
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, Bindable lore, ExpDec lore ~ (), Op lore ~ SOAC lore) => Pattern lore -> (SubExp, Commutativity, LambdaT lore, LambdaT lore, [SubExp], [VName]) -> m (Stm lore, Stm lore) 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.

Only handles a pattern with an empty patternContextElements.

dissectScrema :: (MonadBinder m, Op (Lore m) ~ SOAC (Lore m), Bindable (Lore m)) => Pattern (Lore m) -> SubExp -> ScremaForm (Lore 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 :: (MonadBinder m, Bindable (Lore m)) => Pattern (Lore m) -> SubExp -> [SubExp] -> LambdaT (Lore 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