futhark-0.25.32: An optimising compiler for a functional, array-oriented language.

Safe Haskell | Safe-Inferred
Language | GHC2021

Futhark.Pass.ExtractKernels.Distribution

Synopsis

- type Target = (Pat Type, Result)
- data Targets
- ppTargets :: Targets -> String
- singleTarget :: Target -> Targets
- outerTarget :: Targets -> Target
- innerTarget :: Targets -> Target
- pushInnerTarget :: Target -> Targets -> Targets
- popInnerTarget :: Targets -> Maybe (Target, Targets)
- targetsScope :: DistRep rep => Targets -> Scope rep
- data LoopNesting = MapNesting {
  - loopNestingPat :: Pat Type
  - loopNestingAux :: StmAux ()
  - loopNestingWidth :: SubExp
  - loopNestingParamsAndArrs :: [(Param Type, VName)]
  }
- ppLoopNesting :: LoopNesting -> String
- scopeOfLoopNesting :: LParamInfo rep ~ Type => LoopNesting -> Scope rep
- data Nesting = Nesting {
  - nestingLetBound :: Names
  - nestingLoop :: LoopNesting
  }
- type Nestings = (Nesting, [Nesting])
- ppNestings :: Nestings -> String
- letBindInInnerNesting :: Names -> Nestings -> Nestings
- singleNesting :: Nesting -> Nestings
- pushInnerNesting :: Nesting -> Nestings -> Nestings
- type KernelNest = (LoopNesting, [LoopNesting])
- ppKernelNest :: KernelNest -> String
- newKernel :: LoopNesting -> KernelNest
- innermostKernelNesting :: KernelNest -> LoopNesting
- pushKernelNesting :: Target -> LoopNesting -> KernelNest -> KernelNest
- pushInnerKernelNesting :: Target -> LoopNesting -> KernelNest -> KernelNest
- scopeOfKernelNest :: LParamInfo rep ~ Type => KernelNest -> Scope rep
- kernelNestLoops :: KernelNest -> [LoopNesting]
- kernelNestWidths :: KernelNest -> [SubExp]
- boundInKernelNest :: KernelNest -> Names
- boundInKernelNests :: KernelNest -> [Names]
- flatKernel :: MonadFreshNames m => KernelNest -> m ([(VName, SubExp)], [KernelInput])
- constructKernel :: (DistRep rep, MonadFreshNames m, LocalScope rep m) => MkSegLevel rep m -> KernelNest -> Body rep -> m (Stm rep, Stms rep)
- tryDistribute :: (DistRep rep, MonadFreshNames m, LocalScope rep m, MonadLogger m) => MkSegLevel rep m -> Nestings -> Targets -> Stms rep -> m (Maybe (Targets, Stms rep))
- tryDistributeStm :: (MonadFreshNames m, HasScope t m, ASTRep rep) => Nestings -> Targets -> Stm rep -> m (Maybe (Result, Targets, KernelNest))

# Documentation

type Target = (Pat Type, Result) Source #

data Targets Source #

First pair element is the very innermost ("current") target. In the list, the outermost target comes first. Invariant: Every element of a pattern must be present as the result of the immediately enclosing target. This is ensured by `pushInnerTarget` by removing unused pattern elements.

ppTargets :: Targets -> String Source #

singleTarget :: Target -> Targets Source #

outerTarget :: Targets -> Target Source #

innerTarget :: Targets -> Target Source #

pushInnerTarget :: Target -> Targets -> Targets Source #

popInnerTarget :: Targets -> Maybe (Target, Targets) Source #

targetsScope :: DistRep rep => Targets -> Scope rep Source #

data LoopNesting Source #

Constructors

MapNesting |

Fields

- loopNestingPat :: Pat Type
- loopNestingAux :: StmAux ()
- loopNestingWidth :: SubExp
- loopNestingParamsAndArrs :: [(Param Type, VName)]

#### Instances

Instances details

Show LoopNesting Source # |
Instance details Defined in Futhark.Pass.ExtractKernels.Distribution Methods showsPrec :: Int -> LoopNesting -> ShowS Source # show :: LoopNesting -> String Source # showList :: [LoopNesting] -> ShowS Source #
FreeIn LoopNesting Source # |
Instance details Defined in Futhark.Pass.ExtractKernels.Distribution Methods freeIn' :: LoopNesting -> FV Source #

ppLoopNesting :: LoopNesting -> String Source #

scopeOfLoopNesting :: LParamInfo rep ~ Type => LoopNesting -> Scope rep Source #

data Nesting Source #

Constructors

Nesting |

Fields

- nestingLetBound :: Names
- nestingLoop :: LoopNesting

#### Instances

Instances details

Show Nesting Source # |
Instance details Defined in Futhark.Pass.ExtractKernels.Distribution Methods showsPrec :: Int -> Nesting -> ShowS Source # show :: Nesting -> String Source # showList :: [Nesting] -> ShowS Source #

type Nestings = (Nesting, [Nesting]) Source #

ppNestings :: Nestings -> String Source #

letBindInInnerNesting :: Names -> Nestings -> Nestings Source #

singleNesting :: Nesting -> Nestings Source #

pushInnerNesting :: Nesting -> Nestings -> Nestings Source #

type KernelNest = (LoopNesting, [LoopNesting]) Source #

Note: first element is *outermost* nesting. This is different from the similar types elsewhere!

ppKernelNest :: KernelNest -> String Source #

newKernel :: LoopNesting -> KernelNest Source #

innermostKernelNesting :: KernelNest -> LoopNesting Source #

Retrieve the innermost kernel nesting.

pushKernelNesting :: Target -> LoopNesting -> KernelNest -> KernelNest Source #

Add new outermost nesting, pushing the current outermost to the list, also taking care to swap patterns if necessary.

pushInnerKernelNesting :: Target -> LoopNesting -> KernelNest -> KernelNest Source #

Add new innermost nesting, pushing the current outermost to the list. It is important that the `Target` has the right order (non-permuted compared to what is expected by the outer nests).

scopeOfKernelNest :: LParamInfo rep ~ Type => KernelNest -> Scope rep Source #

kernelNestLoops :: KernelNest -> [LoopNesting] Source #

kernelNestWidths :: KernelNest -> [SubExp] Source #

boundInKernelNest :: KernelNest -> Names Source #

boundInKernelNests :: KernelNest -> [Names] Source #

flatKernel :: MonadFreshNames m => KernelNest -> m ([(VName, SubExp)], [KernelInput]) Source #

Flatten a kernel nesting to:

1. The index space.
2. The kernel inputs - note that some of these may be unused.

constructKernel :: (DistRep rep, MonadFreshNames m, LocalScope rep m) => MkSegLevel rep m -> KernelNest -> Body rep -> m (Stm rep, Stms rep) Source #

tryDistribute :: (DistRep rep, MonadFreshNames m, LocalScope rep m, MonadLogger m) => MkSegLevel rep m -> Nestings -> Targets -> Stms rep -> m (Maybe (Targets, Stms rep)) Source #

tryDistributeStm :: (MonadFreshNames m, HasScope t m, ASTRep rep) => Nestings -> Targets -> Stm rep -> m (Maybe (Result, Targets, KernelNest)) Source #