Safe Haskell | None |
---|---|
Language | Haskell2010 |
A representation with flat parallelism via GPU-oriented kernels.
Synopsis
- data Kernels
- module Futhark.IR.Prop
- module Futhark.IR.Traversals
- module Futhark.IR.Pretty
- module Futhark.IR.Syntax
- module Futhark.IR.Kernels.Kernel
- module Futhark.IR.Kernels.Sizes
- data SOACMapper flore tlore m = SOACMapper {
- mapOnSOACSubExp :: SubExp -> m SubExp
- mapOnSOACLambda :: Lambda flore -> m (Lambda tlore)
- mapOnSOACVName :: VName -> m VName
- data Reduce lore = Reduce {
- redComm :: Commutativity
- redLambda :: Lambda lore
- redNeutral :: [SubExp]
- data Scan lore = Scan {
- scanLambda :: Lambda lore
- scanNeutral :: [SubExp]
- data ScremaForm lore = ScremaForm [Scan lore] [Reduce lore] (Lambda lore)
- data StreamForm lore
- = Parallel StreamOrd Commutativity (Lambda lore) [SubExp]
- | Sequential [SubExp]
- data StreamOrd
- data SOAC lore
- scanResults :: [Scan lore] -> Int
- singleScan :: Bindable lore => [Scan lore] -> Scan lore
- redResults :: [Reduce lore] -> Int
- singleReduce :: Bindable lore => [Reduce lore] -> Reduce lore
- scremaType :: SubExp -> ScremaForm lore -> [Type]
- mkIdentityLambda :: (Bindable lore, MonadFreshNames m) => [Type] -> m (Lambda lore)
- isIdentityLambda :: Lambda lore -> Bool
- nilFn :: Bindable lore => Lambda lore
- scanomapSOAC :: [Scan lore] -> Lambda lore -> ScremaForm lore
- redomapSOAC :: [Reduce lore] -> Lambda lore -> ScremaForm lore
- scanSOAC :: (Bindable lore, MonadFreshNames m) => [Scan lore] -> m (ScremaForm lore)
- reduceSOAC :: (Bindable lore, MonadFreshNames m) => [Reduce lore] -> m (ScremaForm lore)
- mapSOAC :: Lambda lore -> ScremaForm lore
- isScanomapSOAC :: ScremaForm lore -> Maybe ([Scan lore], Lambda lore)
- isScanSOAC :: ScremaForm lore -> Maybe [Scan lore]
- isRedomapSOAC :: ScremaForm lore -> Maybe ([Reduce lore], Lambda lore)
- isReduceSOAC :: ScremaForm lore -> Maybe [Reduce lore]
- isMapSOAC :: ScremaForm lore -> Maybe (Lambda lore)
- identitySOACMapper :: Monad m => SOACMapper lore lore m
- mapSOACM :: (Applicative m, Monad m) => SOACMapper flore tlore m -> SOAC flore -> m (SOAC tlore)
- soacType :: SOAC lore -> [Type]
- typeCheckSOAC :: Checkable lore => SOAC (Aliases lore) -> TypeM lore ()
- getStreamAccums :: StreamForm lore -> [SubExp]
- ppScrema :: (PrettyLore lore, Pretty inp) => SubExp -> ScremaForm lore -> [inp] -> Doc
- ppHist :: (PrettyLore lore, Pretty inp) => SubExp -> [HistOp lore] -> Lambda lore -> [inp] -> Doc
The Lore definition
The phantom data type for the kernels representation.
Instances
Module re-exports
module Futhark.IR.Prop
module Futhark.IR.Traversals
module Futhark.IR.Pretty
module Futhark.IR.Syntax
module Futhark.IR.Kernels.Kernel
module Futhark.IR.Kernels.Sizes
data SOACMapper flore tlore m Source #
SOACMapper | |
|
How to compute a single reduction result.
Reduce | |
|
Instances
Decorations lore => Eq (Reduce lore) Source # | |
Decorations lore => Ord (Reduce lore) Source # | |
Defined in Futhark.IR.SOACS.SOAC | |
Decorations lore => Show (Reduce lore) Source # | |
PrettyLore lore => Pretty (Reduce lore) Source # | |
How to compute a single scan result.
Scan | |
|
Instances
Decorations lore => Eq (Scan lore) Source # | |
Decorations lore => Ord (Scan lore) Source # | |
Defined in Futhark.IR.SOACS.SOAC | |
Decorations lore => Show (Scan lore) Source # | |
PrettyLore lore => Pretty (Scan lore) Source # | |
data ScremaForm lore Source #
The essential parts of a Screma
factored out (everything
except the input arrays).
ScremaForm [Scan lore] [Reduce lore] (Lambda lore) |
Instances
Decorations lore => Eq (ScremaForm lore) Source # | |
Defined in Futhark.IR.SOACS.SOAC (==) :: ScremaForm lore -> ScremaForm lore -> Bool # (/=) :: ScremaForm lore -> ScremaForm lore -> Bool # | |
Decorations lore => Ord (ScremaForm lore) Source # | |
Defined in Futhark.IR.SOACS.SOAC compare :: ScremaForm lore -> ScremaForm lore -> Ordering # (<) :: ScremaForm lore -> ScremaForm lore -> Bool # (<=) :: ScremaForm lore -> ScremaForm lore -> Bool # (>) :: ScremaForm lore -> ScremaForm lore -> Bool # (>=) :: ScremaForm lore -> ScremaForm lore -> Bool # max :: ScremaForm lore -> ScremaForm lore -> ScremaForm lore # min :: ScremaForm lore -> ScremaForm lore -> ScremaForm lore # | |
Decorations lore => Show (ScremaForm lore) Source # | |
Defined in Futhark.IR.SOACS.SOAC showsPrec :: Int -> ScremaForm lore -> ShowS # show :: ScremaForm lore -> String # showList :: [ScremaForm lore] -> ShowS # |
data StreamForm lore Source #
What kind of stream is this?
Parallel StreamOrd Commutativity (Lambda lore) [SubExp] | |
Sequential [SubExp] |
Instances
Decorations lore => Eq (StreamForm lore) Source # | |
Defined in Futhark.IR.SOACS.SOAC (==) :: StreamForm lore -> StreamForm lore -> Bool # (/=) :: StreamForm lore -> StreamForm lore -> Bool # | |
Decorations lore => Ord (StreamForm lore) Source # | |
Defined in Futhark.IR.SOACS.SOAC compare :: StreamForm lore -> StreamForm lore -> Ordering # (<) :: StreamForm lore -> StreamForm lore -> Bool # (<=) :: StreamForm lore -> StreamForm lore -> Bool # (>) :: StreamForm lore -> StreamForm lore -> Bool # (>=) :: StreamForm lore -> StreamForm lore -> Bool # max :: StreamForm lore -> StreamForm lore -> StreamForm lore # min :: StreamForm lore -> StreamForm lore -> StreamForm lore # | |
Decorations lore => Show (StreamForm lore) Source # | |
Defined in Futhark.IR.SOACS.SOAC showsPrec :: Int -> StreamForm lore -> ShowS # show :: StreamForm lore -> String # showList :: [StreamForm lore] -> ShowS # |
Is the stream chunk required to correspond to a contiguous
subsequence of the original input (InOrder
) or not? Disorder
streams can be more efficient, but not all algorithms work with
this.
A second-order array combinator (SOAC).
Stream SubExp (StreamForm lore) (Lambda lore) [VName] | |
Scatter SubExp (Lambda lore) [VName] [(SubExp, Int, VName)] | Scatter cs length lambda index and value arrays <input/output arrays along with their sizes and number of values to write for that array> length is the length of each index array and value array, since they all must be the same length for any fusion to make sense. If you have a list of index-value array pairs of different sizes, you need to use multiple writes instead. The lambda body returns the output in this manner:
This must be consistent along all Scatter-related optimisations. |
Hist SubExp [HistOp lore] (Lambda lore) [VName] | Hist length dest-arrays-and-ops fun arrays The first SubExp is the length of the input arrays. The first
list describes the operations to perform. The |
Screma SubExp (ScremaForm lore) [VName] | A combination of scan, reduction, and map. The first
|
Instances
singleScan :: Bindable lore => [Scan lore] -> Scan lore Source #
Combine multiple scan operators to a single operator.
redResults :: [Reduce lore] -> Int Source #
How many reduction results are produced by these Reduce
s?
singleReduce :: Bindable lore => [Reduce lore] -> Reduce lore Source #
Combine multiple reduction operators to a single operator.
scremaType :: SubExp -> ScremaForm lore -> [Type] Source #
The types produced by a single Screma
, given the size of the
input array.
mkIdentityLambda :: (Bindable lore, MonadFreshNames m) => [Type] -> m (Lambda lore) Source #
Construct a lambda that takes parameters of the given types and simply returns them unchanged.
isIdentityLambda :: Lambda lore -> Bool Source #
Is the given lambda an identity lambda?
scanomapSOAC :: [Scan lore] -> Lambda lore -> ScremaForm lore Source #
Construct a Screma with possibly multiple scans, and the given map function.
redomapSOAC :: [Reduce lore] -> Lambda lore -> ScremaForm lore Source #
Construct a Screma with possibly multiple reductions, and the given map function.
scanSOAC :: (Bindable lore, MonadFreshNames m) => [Scan lore] -> m (ScremaForm lore) Source #
Construct a Screma with possibly multiple scans, and identity map function.
reduceSOAC :: (Bindable lore, MonadFreshNames m) => [Reduce lore] -> m (ScremaForm lore) Source #
Construct a Screma with possibly multiple reductions, and identity map function.
mapSOAC :: Lambda lore -> ScremaForm lore Source #
Construct a Screma corresponding to a map.
isScanomapSOAC :: ScremaForm lore -> Maybe ([Scan lore], Lambda lore) Source #
Does this Screma correspond to a scan-map composition?
isScanSOAC :: ScremaForm lore -> Maybe [Scan lore] Source #
Does this Screma correspond to pure scan?
isRedomapSOAC :: ScremaForm lore -> Maybe ([Reduce lore], Lambda lore) Source #
Does this Screma correspond to a reduce-map composition?
isReduceSOAC :: ScremaForm lore -> Maybe [Reduce lore] Source #
Does this Screma correspond to a pure reduce?
isMapSOAC :: ScremaForm lore -> Maybe (Lambda lore) Source #
Does this Screma correspond to a simple map, without any reduction or scan results?
identitySOACMapper :: Monad m => SOACMapper lore lore m Source #
A mapper that simply returns the SOAC verbatim.
mapSOACM :: (Applicative m, Monad m) => SOACMapper flore tlore m -> SOAC flore -> m (SOAC tlore) Source #
Map a monadic action across the immediate children of a SOAC. The mapping does not descend recursively into subexpressions and is done left-to-right.
getStreamAccums :: StreamForm lore -> [SubExp] Source #
Get Stream's accumulators as a sub-expression list
ppScrema :: (PrettyLore lore, Pretty inp) => SubExp -> ScremaForm lore -> [inp] -> Doc Source #
Prettyprint the given Screma.