Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Definition of Second-Order Array Combinators (SOACs), which are the main form of parallelism in the early stages of the compiler.
Synopsis
- data SOAC lore
- data StreamOrd
- data StreamForm lore
- = Parallel StreamOrd Commutativity (Lambda lore) [SubExp]
- | Sequential [SubExp]
- data ScremaForm lore = ScremaForm [Scan lore] [Reduce lore] (Lambda lore)
- data HistOp lore = HistOp {
- histWidth :: SubExp
- histRaceFactor :: SubExp
- histDest :: [VName]
- histNeutral :: [SubExp]
- histOp :: Lambda lore
- data Scan lore = Scan {
- scanLambda :: Lambda lore
- scanNeutral :: [SubExp]
- scanResults :: [Scan lore] -> Int
- singleScan :: Bindable lore => [Scan lore] -> Scan lore
- data Reduce lore = Reduce {
- redComm :: Commutativity
- redLambda :: Lambda lore
- redNeutral :: [SubExp]
- redResults :: [Reduce lore] -> Int
- singleReduce :: Bindable lore => [Reduce lore] -> Reduce lore
- getStreamAccums :: StreamForm lore -> [SubExp]
- scremaType :: SubExp -> ScremaForm lore -> [Type]
- soacType :: SOAC lore -> [Type]
- typeCheckSOAC :: Checkable lore => SOAC (Aliases lore) -> TypeM lore ()
- 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)
- isRedomapSOAC :: ScremaForm lore -> Maybe ([Reduce lore], Lambda lore)
- isScanSOAC :: ScremaForm lore -> Maybe [Scan lore]
- isReduceSOAC :: ScremaForm lore -> Maybe [Reduce lore]
- isMapSOAC :: ScremaForm lore -> Maybe (Lambda lore)
- ppScrema :: (PrettyLore lore, Pretty inp) => SubExp -> ScremaForm lore -> [inp] -> Doc
- ppHist :: (PrettyLore lore, Pretty inp) => SubExp -> [HistOp lore] -> Lambda lore -> [inp] -> Doc
- data SOACMapper flore tlore m = SOACMapper {
- mapOnSOACSubExp :: SubExp -> m SubExp
- mapOnSOACLambda :: Lambda flore -> m (Lambda tlore)
- mapOnSOACVName :: VName -> m VName
- identitySOACMapper :: Monad m => SOACMapper lore lore m
- mapSOACM :: (Applicative m, Monad m) => SOACMapper flore tlore m -> SOAC flore -> m (SOAC tlore)
Documentation
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
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.
data StreamForm lore Source #
What kind of stream is this?
Parallel StreamOrd Commutativity (Lambda lore) [SubExp] | |
Sequential [SubExp] |
Instances
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
Information about computing a single histogram.
HistOp | |
|
Instances
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 # | |
Generic (Scan lore) Source # | |
PrettyLore lore => Pretty (Scan lore) Source # | |
Decorations lore => SexpIso (Scan lore) Source # | |
Defined in Futhark.IR.SOACS.SOAC sexpIso :: SexpGrammar (Scan lore) # | |
type Rep (Scan lore) Source # | |
Defined in Futhark.IR.SOACS.SOAC type Rep (Scan lore) = D1 ('MetaData "Scan" "Futhark.IR.SOACS.SOAC" "futhark-0.18.1-inplace" 'False) (C1 ('MetaCons "Scan" 'PrefixI 'True) (S1 ('MetaSel ('Just "scanLambda") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Lambda lore)) :*: S1 ('MetaSel ('Just "scanNeutral") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [SubExp]))) |
singleScan :: Bindable lore => [Scan lore] -> Scan lore Source #
Combine multiple scan operators to a single operator.
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 # | |
Generic (Reduce lore) Source # | |
PrettyLore lore => Pretty (Reduce lore) Source # | |
Decorations lore => SexpIso (Reduce lore) Source # | |
Defined in Futhark.IR.SOACS.SOAC sexpIso :: SexpGrammar (Reduce lore) # | |
type Rep (Reduce lore) Source # | |
Defined in Futhark.IR.SOACS.SOAC type Rep (Reduce lore) = D1 ('MetaData "Reduce" "Futhark.IR.SOACS.SOAC" "futhark-0.18.1-inplace" 'False) (C1 ('MetaCons "Reduce" 'PrefixI 'True) (S1 ('MetaSel ('Just "redComm") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Commutativity) :*: (S1 ('MetaSel ('Just "redLambda") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Lambda lore)) :*: S1 ('MetaSel ('Just "redNeutral") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [SubExp])))) |
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.
Utility
getStreamAccums :: StreamForm lore -> [SubExp] Source #
Get Stream's accumulators as a sub-expression list
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?
isRedomapSOAC :: ScremaForm lore -> Maybe ([Reduce lore], Lambda lore) Source #
Does this Screma correspond to a reduce-map composition?
isScanSOAC :: ScremaForm lore -> Maybe [Scan lore] Source #
Does this Screma correspond to pure scan?
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?
ppScrema :: (PrettyLore lore, Pretty inp) => SubExp -> ScremaForm lore -> [inp] -> Doc Source #
Prettyprint the given Screma.
ppHist :: (PrettyLore lore, Pretty inp) => SubExp -> [HistOp lore] -> Lambda lore -> [inp] -> Doc Source #
Prettyprint the given histogram operation.
Generic traversal
data SOACMapper flore tlore m Source #
SOACMapper | |
|
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.