| Safe Haskell | None |
|---|---|
| Language | GHC2021 |
Futhark.IR.GPU
Contents
Description
A representation with flat parallelism via GPU-oriented kernels.
Synopsis
- data GPU
- module Futhark.IR.Prop
- module Futhark.IR.Traversals
- module Futhark.IR.Pretty
- module Futhark.IR.Syntax
- module Futhark.IR.GPU.Op
- module Futhark.IR.GPU.Sizes
- composeBinds :: (Buildable rep, Ord a) => Lambda rep -> [a] -> [a] -> Lambda rep -> Stms rep
- flatMapNonuniform :: ExtType -> Bool
- flatMapRowTypes :: ExtLambda rep -> [Type]
- flatMapSplitMeta :: [a] -> ((a, a, a, a), [a])
- flatMapSplitValues :: ExtLambda rep -> [a] -> ([a], [a])
- flatMapUniformTypes :: ExtLambda rep -> [Type]
- identitySOACMapper :: forall rep (m :: Type -> Type). Monad m => SOACMapper rep rep m
- isMapSOAC :: ScremaForm rep -> Maybe (Lambda rep)
- isMaposcanomapSOAC :: ScremaForm rep -> Maybe (Lambda rep, [Scan rep], Lambda rep)
- isRedomapSOAC :: ScremaForm rep -> Maybe ([Reduce rep], Lambda rep)
- isReduceSOAC :: ScremaForm rep -> Maybe [Reduce rep]
- isScanSOAC :: ScremaForm rep -> Maybe [Scan rep]
- isScanomapSOAC :: ScremaForm rep -> Maybe ([Scan rep], Lambda rep)
- mapSOAC :: (Buildable rep, MonadFreshNames m) => Lambda rep -> m (ScremaForm rep)
- mapSOACM :: Monad m => SOACMapper frep trep m -> SOAC frep -> m (SOAC trep)
- maposcanomapSOAC :: (Buildable rep, MonadFreshNames m) => Lambda rep -> [Scan rep] -> Lambda rep -> m (ScremaForm rep)
- mkIdentityLambda :: (Buildable rep, MonadFreshNames m) => [Type] -> m (Lambda rep)
- nilFn :: Buildable rep => Lambda rep
- ppHist :: (PrettyRep rep, Pretty inp) => SubExp -> [inp] -> [HistOp rep] -> Lambda rep -> Doc ann
- ppScrema :: (PrettyRep rep, Pretty inp) => SubExp -> [inp] -> ScremaForm rep -> Doc ann
- ppStream :: (PrettyRep rep, Pretty inp) => SubExp -> [inp] -> [SubExp] -> Lambda rep -> Doc ann
- redResults :: [Reduce rep] -> Int
- redomapSOAC :: (Buildable rep, MonadFreshNames m) => [Reduce rep] -> Lambda rep -> m (ScremaForm rep)
- reduceSOAC :: (Buildable rep, MonadFreshNames m) => [Reduce rep] -> m (ScremaForm rep)
- scanResults :: [Scan rep] -> Int
- scanSOAC :: (Buildable rep, MonadFreshNames m) => [Scan rep] -> m (ScremaForm rep)
- scanomapSOAC :: (Buildable rep, MonadFreshNames m) => [Scan rep] -> Lambda rep -> m (ScremaForm rep)
- scremaType :: SubExp -> ScremaForm rep -> [Type]
- singleReduce :: Buildable rep => [Reduce rep] -> Reduce rep
- singleScan :: Buildable rep => [Scan rep] -> Scan rep
- soacType :: Typed (LParamInfo rep) => SOAC rep -> [ExtType]
- traverseSOACStms :: Monad m => OpStmsTraverser m (SOAC rep) rep
- typeCheckSOAC :: Checkable rep => SOAC (Aliases rep) -> TypeM rep ()
- data Reduce rep = Reduce {
- redComm :: Commutativity
- redLambda :: Lambda rep
- redNeutral :: [SubExp]
- data SOAC rep
- = Stream SubExp [VName] [SubExp] (Lambda rep)
- | Hist SubExp [VName] [HistOp rep] (Lambda rep)
- | JVP Shape [SubExp] [SubExp] (Lambda rep)
- | VJP Shape [SubExp] [SubExp] (Lambda rep)
- | WithVJP [SubExp] (Lambda rep) (Lambda rep)
- | Screma SubExp [VName] (ScremaForm rep)
- | FlatMap SubExp [VName] (ExtLambda rep)
- data SOACMapper frep trep (m :: Type -> Type) = SOACMapper {
- mapOnSOACSubExp :: SubExp -> m SubExp
- mapOnSOACLambda :: Lambda frep -> m (Lambda trep)
- mapOnSOACExtLambda :: ExtLambda frep -> m (ExtLambda trep)
- mapOnSOACVName :: VName -> m VName
- data Scan rep = Scan {
- scanLambda :: Lambda rep
- scanNeutral :: [SubExp]
- data ScremaForm rep = ScremaForm {
- scremaLambda :: Lambda rep
- scremaScans :: [Scan rep]
- scremaReduces :: [Reduce rep]
- scremaPostLambda :: Lambda rep
Documentation
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.GPU.Op
module Futhark.IR.GPU.Sizes
Arguments
| :: (Buildable rep, Ord a) | |
| => Lambda rep | Producer lambda |
| -> [a] | Producer outputs to match |
| -> [a] | Consumer inputs to match |
| -> Lambda rep | Consumer lambda |
| -> Stms rep | Let-bindings connecting them |
Creates let-bindings to compose two lambda functions (producer → consumer).
When composing two operations where the outputs of one lambda (producer) flow into the inputs of another lambda (consumer), this function generates the necessary let-bindings that connect matching outputs to inputs.
The function looks for outputs from the producer that correspond to inputs expected by the consumer, and creates bindings like: let consumer_param = producer_result
This allows the two lambdas to be composed into a operation.
Returns: Statements containing let-bindings for each matched producer output → consumer input pair. Preserves certificates from the producer results.
Example: If out_p[i] == inp_c[j], then producer's result[i] is bound to consumer's parameter[j]. Unmatched outputs (producer results not consumed) are omitted.
flatMapNonuniform :: ExtType -> Bool Source #
Is this the type of an irregular result of a FlatMap lambda - one that is
concatenated with the results of the other iterations, rather than merely
collected? These are exactly the results whose outermost size is the
existential size returned by the lambda.
flatMapRowTypes :: ExtLambda rep -> [Type] Source #
The element types of the irregular (concatenated) arrays produced by a
FlatMap lambda, with the existential outer dimension stripped. The
remaining dimensions are never existential.
flatMapSplitMeta :: [a] -> ((a, a, a, a), [a]) Source #
Split a list with one element per result of a FlatMap into its metadata
results - the size, the shape array, the flag array, and the offset array -
and its value results.
flatMapSplitValues :: ExtLambda rep -> [a] -> ([a], [a]) Source #
Split a list with one element per value result of a FlatMap lambda into
the irregular and the regular parts.
flatMapUniformTypes :: ExtLambda rep -> [Type] Source #
The types of the regular results of a FlatMap lambda - the ones that are
collected rather than concatenated. These never have existential sizes.
identitySOACMapper :: forall rep (m :: Type -> Type). Monad m => SOACMapper rep rep m Source #
A mapper that simply returns the SOAC verbatim.
isMapSOAC :: ScremaForm rep -> Maybe (Lambda rep) Source #
Does this Screma correspond to a simple map, without any reduction or scan results?
isMaposcanomapSOAC :: ScremaForm rep -> Maybe (Lambda rep, [Scan rep], Lambda rep) Source #
isRedomapSOAC :: ScremaForm rep -> Maybe ([Reduce rep], Lambda rep) Source #
Does this Screma correspond to a reduce-map composition?
isReduceSOAC :: ScremaForm rep -> Maybe [Reduce rep] Source #
Does this Screma correspond to a pure reduce?
isScanSOAC :: ScremaForm rep -> Maybe [Scan rep] Source #
Does this Screma correspond to pure scan?
isScanomapSOAC :: ScremaForm rep -> Maybe ([Scan rep], Lambda rep) Source #
Does this Screma correspond to a scan-map composition?
mapSOAC :: (Buildable rep, MonadFreshNames m) => Lambda rep -> m (ScremaForm rep) Source #
Construct a Screma corresponding to a map.
mapSOACM :: Monad m => SOACMapper frep trep m -> SOAC frep -> m (SOAC trep) 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.
maposcanomapSOAC :: (Buildable rep, MonadFreshNames m) => Lambda rep -> [Scan rep] -> Lambda rep -> m (ScremaForm rep) Source #
Construct a Screma with possibly multiple scans, the given map function, and a given post lambda.
mkIdentityLambda :: (Buildable rep, MonadFreshNames m) => [Type] -> m (Lambda rep) Source #
Construct a lambda that takes parameters of the given types and simply returns them unchanged.
ppHist :: (PrettyRep rep, Pretty inp) => SubExp -> [inp] -> [HistOp rep] -> Lambda rep -> Doc ann Source #
Prettyprint the given histogram operation.
ppScrema :: (PrettyRep rep, Pretty inp) => SubExp -> [inp] -> ScremaForm rep -> Doc ann Source #
Prettyprint the given Screma.
ppStream :: (PrettyRep rep, Pretty inp) => SubExp -> [inp] -> [SubExp] -> Lambda rep -> Doc ann Source #
Prettyprint the given Stream.
redomapSOAC :: (Buildable rep, MonadFreshNames m) => [Reduce rep] -> Lambda rep -> m (ScremaForm rep) Source #
Construct a Screma with possibly multiple reductions, and the given map function.
reduceSOAC :: (Buildable rep, MonadFreshNames m) => [Reduce rep] -> m (ScremaForm rep) Source #
Construct a Screma with possibly multiple reductions, and identity map function.
scanSOAC :: (Buildable rep, MonadFreshNames m) => [Scan rep] -> m (ScremaForm rep) Source #
Construct a Screma with possibly multiple scans, and identity map function.
scanomapSOAC :: (Buildable rep, MonadFreshNames m) => [Scan rep] -> Lambda rep -> m (ScremaForm rep) Source #
Construct a Screma with possibly multiple scans, and the given map function.
scremaType :: SubExp -> ScremaForm rep -> [Type] Source #
The types produced by a single Screma, given the size of the
input array.
singleReduce :: Buildable rep => [Reduce rep] -> Reduce rep Source #
Combine multiple reduction operators to a single operator.
singleScan :: Buildable rep => [Scan rep] -> Scan rep Source #
Combine multiple scan operators to a single operator.
traverseSOACStms :: Monad m => OpStmsTraverser m (SOAC rep) rep Source #
A helper for defining TraverseOpStms.
How to compute a single reduction result.
Constructors
| Reduce | |
Fields
| |
Instances
| ASTRep rep => FreeIn (Reduce rep) Source # | |
| RepTypes rep => Show (Reduce rep) Source # | |
| RepTypes rep => Eq (Reduce rep) Source # | |
| RepTypes rep => Ord (Reduce rep) Source # | |
Defined in Futhark.IR.SOACS.SOAC | |
| PrettyRep rep => Pretty (Reduce rep) Source # | |
Defined in Futhark.IR.SOACS.SOAC | |
A second-order array combinator (SOAC).
Constructors
| Stream SubExp [VName] [SubExp] (Lambda rep) | |
| Hist SubExp [VName] [HistOp rep] (Lambda rep) | Hist length arrays dest-arrays-and-ops fun The final lambda produces indexes and values for the |
| JVP Shape [SubExp] [SubExp] (Lambda rep) | |
| VJP Shape [SubExp] [SubExp] (Lambda rep) | |
| WithVJP [SubExp] (Lambda rep) (Lambda rep) | |
| Screma SubExp [VName] (ScremaForm rep) | A combination of scan, reduction, and map. The first
|
| FlatMap SubExp [VName] (ExtLambda rep) | Nonuniform map where the nonuniform results are implicitly concatenated.
The For input of length
|
Instances
| CanBeAliased SOAC Source # | |
Defined in Futhark.IR.SOACS.SOAC Methods addOpAliases :: AliasableRep rep => AliasTable -> SOAC rep -> SOAC (Aliases rep) Source # | |
| IsOp SOAC Source # | |
| AliasedOp SOAC Source # | |
| TypedOp SOAC Source # | |
| RephraseOp SOAC Source # | |
Defined in Futhark.IR.SOACS.SOAC | |
| CanBeWise SOAC Source # | |
Defined in Futhark.IR.SOACS.SOAC | |
| OpMetrics (Op rep) => OpMetrics (SOAC rep) Source # | |
| RepTypes rep => IndexOp (SOAC rep) Source # | |
| ASTRep rep => FreeIn (SOAC rep) Source # | |
| (AliasableRep rep, CSEInOp (Op (Aliases rep))) => CSEInOp (SOAC (Aliases rep)) Source # | |
| ASTRep rep => Rename (SOAC rep) Source # | |
| ASTRep rep => Substitute (SOAC rep) Source # | |
Defined in Futhark.IR.SOACS.SOAC | |
| RepTypes rep => Show (SOAC rep) Source # | |
| RepTypes rep => Eq (SOAC rep) Source # | |
| RepTypes rep => Ord (SOAC rep) Source # | |
Defined in Futhark.IR.SOACS.SOAC | |
| PrettyRep rep => Pretty (SOAC rep) Source # | |
Defined in Futhark.IR.SOACS.SOAC | |
data SOACMapper frep trep (m :: Type -> Type) Source #
Constructors
| SOACMapper | |
Fields
| |
How to compute a single scan result.
Constructors
| Scan | |
Fields
| |
data ScremaForm rep Source #
The essential parts of a Screma factored out (everything
except the input arrays).
Constructors
| ScremaForm | |
Fields
| |
Instances
| ASTRep rep => FreeIn (ScremaForm rep) Source # | |
Defined in Futhark.IR.SOACS.SOAC Methods freeIn' :: ScremaForm rep -> FV Source # | |
| RepTypes rep => Show (ScremaForm rep) Source # | |
Defined in Futhark.IR.SOACS.SOAC Methods showsPrec :: Int -> ScremaForm rep -> ShowS # show :: ScremaForm rep -> String # showList :: [ScremaForm rep] -> ShowS # | |
| RepTypes rep => Eq (ScremaForm rep) Source # | |
Defined in Futhark.IR.SOACS.SOAC Methods (==) :: ScremaForm rep -> ScremaForm rep -> Bool # (/=) :: ScremaForm rep -> ScremaForm rep -> Bool # | |
| RepTypes rep => Ord (ScremaForm rep) Source # | |
Defined in Futhark.IR.SOACS.SOAC Methods compare :: ScremaForm rep -> ScremaForm rep -> Ordering # (<) :: ScremaForm rep -> ScremaForm rep -> Bool # (<=) :: ScremaForm rep -> ScremaForm rep -> Bool # (>) :: ScremaForm rep -> ScremaForm rep -> Bool # (>=) :: ScremaForm rep -> ScremaForm rep -> Bool # max :: ScremaForm rep -> ScremaForm rep -> ScremaForm rep # min :: ScremaForm rep -> ScremaForm rep -> ScremaForm rep # | |
| PrettyRep rep => Pretty (ScremaForm rep) Source # | |
Defined in Futhark.IR.SOACS.SOAC | |