Safe Haskell | None |
---|---|
Language | GHC2021 |
Futhark.Pass.ExplicitAllocations
Contents
Description
A generic transformation for adding memory allocations to a Futhark program. Specialised by specific representations in submodules.
Synopsis
- explicitAllocationsGeneric :: forall fromrep torep (inner :: Type -> Type). Allocable fromrep torep inner => Space -> (Op fromrep -> AllocM fromrep torep (Op torep)) -> (Exp torep -> AllocM fromrep torep [ExpHint]) -> Pass fromrep torep
- explicitAllocationsInStmsGeneric :: forall m torep fromrep (inner :: Type -> Type). (MonadFreshNames m, HasScope torep m, Allocable fromrep torep inner) => Space -> (Op fromrep -> AllocM fromrep torep (Op torep)) -> (Exp torep -> AllocM fromrep torep [ExpHint]) -> Stms fromrep -> m (Stms torep)
- data ExpHint
- defaultExpHints :: (ASTRep rep, HasScope rep m) => Exp rep -> m [ExpHint]
- askDefaultSpace :: AllocM fromrep torep Space
- type Allocable fromrep torep (inner :: Type -> Type) = (PrettyRep fromrep, PrettyRep torep, Mem torep inner, LetDec torep ~ LetDecMem, FParamInfo fromrep ~ DeclType, LParamInfo fromrep ~ Type, BranchType fromrep ~ ExtType, RetType fromrep ~ DeclExtType, BodyDec fromrep ~ (), BodyDec torep ~ (), ExpDec torep ~ (), SizeSubst (inner torep), BuilderOps torep)
- data AllocM fromrep torep a
- data AllocEnv fromrep torep = AllocEnv {}
- class SizeSubst op where
- allocInStms :: forall fromrep torep (inner :: Type -> Type) a. Allocable fromrep torep inner => Stms fromrep -> AllocM fromrep torep a -> AllocM fromrep torep a
- allocForArray :: forall fromrep torep (inner :: Type -> Type). Allocable fromrep torep inner => Type -> Space -> AllocM fromrep torep VName
- simplifiable :: (SimplifiableRep rep, LetDec rep ~ LetDecMem, ExpDec rep ~ (), BodyDec rep ~ (), Mem (Wise rep) inner, CanBeWise inner, RephraseOp inner, IsOp inner, OpReturns inner, AliasedOp inner, IndexOp (inner (Wise rep))) => (inner (Wise rep) -> UsageTable) -> (inner (Wise rep) -> SimpleM rep (inner (Wise rep), Stms (Wise rep))) -> SimpleOps rep
- mkLetNamesB' :: forall m (inner :: Type -> Type). (LetDec (Rep m) ~ LetDecMem, Mem (Rep m) inner, MonadBuilder m, ExpDec (Rep m) ~ ()) => Space -> ExpDec (Rep m) -> [VName] -> Exp (Rep m) -> m (Stm (Rep m))
- mkLetNamesB'' :: forall rep (inner :: Type -> Type) m. (Mem rep inner, LetDec rep ~ LetDecMem, OpReturns inner, ExpDec rep ~ (), Rep m ~ Wise rep, HasScope (Wise rep) m, MonadBuilder m, AliasedOp inner, RephraseOp (MemOp inner), CanBeWise inner, ASTConstraints (inner (Wise rep))) => Space -> [VName] -> Exp (Wise rep) -> m (Stm (Wise rep))
- module Control.Monad.Reader
- module Futhark.MonadFreshNames
- module Futhark.Pass
- module Futhark.Tools
Documentation
explicitAllocationsGeneric :: forall fromrep torep (inner :: Type -> Type). Allocable fromrep torep inner => Space -> (Op fromrep -> AllocM fromrep torep (Op torep)) -> (Exp torep -> AllocM fromrep torep [ExpHint]) -> Pass fromrep torep Source #
explicitAllocationsInStmsGeneric :: forall m torep fromrep (inner :: Type -> Type). (MonadFreshNames m, HasScope torep m, Allocable fromrep torep inner) => Space -> (Op fromrep -> AllocM fromrep torep (Op torep)) -> (Exp torep -> AllocM fromrep torep [ExpHint]) -> Stms fromrep -> m (Stms torep) Source #
askDefaultSpace :: AllocM fromrep torep Space Source #
The space in which we allocate memory if we have no other preferences or constraints.
type Allocable fromrep torep (inner :: Type -> Type) = (PrettyRep fromrep, PrettyRep torep, Mem torep inner, LetDec torep ~ LetDecMem, FParamInfo fromrep ~ DeclType, LParamInfo fromrep ~ Type, BranchType fromrep ~ ExtType, RetType fromrep ~ DeclExtType, BodyDec fromrep ~ (), BodyDec torep ~ (), ExpDec torep ~ (), SizeSubst (inner torep), BuilderOps torep) Source #
data AllocM fromrep torep a Source #
Monad for adding allocations to an entire program.
Instances
ASTRep torep => HasScope torep (AllocM fromrep torep) Source # | |||||
ASTRep torep => LocalScope torep (AllocM fromrep torep) Source # | |||||
Defined in Futhark.Pass.ExplicitAllocations | |||||
Applicative (AllocM fromrep torep) Source # | |||||
Defined in Futhark.Pass.ExplicitAllocations Methods pure :: a -> AllocM fromrep torep a # (<*>) :: AllocM fromrep torep (a -> b) -> AllocM fromrep torep a -> AllocM fromrep torep b # liftA2 :: (a -> b -> c) -> AllocM fromrep torep a -> AllocM fromrep torep b -> AllocM fromrep torep c # (*>) :: AllocM fromrep torep a -> AllocM fromrep torep b -> AllocM fromrep torep b # (<*) :: AllocM fromrep torep a -> AllocM fromrep torep b -> AllocM fromrep torep a # | |||||
Functor (AllocM fromrep torep) Source # | |||||
Monad (AllocM fromrep torep) Source # | |||||
Allocable fromrep torep inner => MonadBuilder (AllocM fromrep torep) Source # | |||||
Defined in Futhark.Pass.ExplicitAllocations Associated Types
Methods mkExpDecM :: Pat (LetDec (Rep (AllocM fromrep torep))) -> Exp (Rep (AllocM fromrep torep)) -> AllocM fromrep torep (ExpDec (Rep (AllocM fromrep torep))) Source # mkBodyM :: Stms (Rep (AllocM fromrep torep)) -> Result -> AllocM fromrep torep (Body (Rep (AllocM fromrep torep))) Source # mkLetNamesM :: [VName] -> Exp (Rep (AllocM fromrep torep)) -> AllocM fromrep torep (Stm (Rep (AllocM fromrep torep))) Source # addStm :: Stm (Rep (AllocM fromrep torep)) -> AllocM fromrep torep () Source # addStms :: Stms (Rep (AllocM fromrep torep)) -> AllocM fromrep torep () Source # collectStms :: AllocM fromrep torep a -> AllocM fromrep torep (a, Stms (Rep (AllocM fromrep torep))) Source # certifying :: Certs -> AllocM fromrep torep a -> AllocM fromrep torep a Source # | |||||
MonadFreshNames (AllocM fromrep torep) Source # | |||||
Defined in Futhark.Pass.ExplicitAllocations Methods getNameSource :: AllocM fromrep torep VNameSource Source # putNameSource :: VNameSource -> AllocM fromrep torep () Source # | |||||
MonadReader (AllocEnv fromrep torep) (AllocM fromrep torep) Source # | |||||
type Rep (AllocM fromrep torep) Source # | |||||
Defined in Futhark.Pass.ExplicitAllocations |
data AllocEnv fromrep torep Source #
Constructors
AllocEnv | |
Fields
|
Instances
MonadReader (AllocEnv fromrep torep) (AllocM fromrep torep) Source # | |
class SizeSubst op where Source #
Minimal complete definition
Nothing
allocInStms :: forall fromrep torep (inner :: Type -> Type) a. Allocable fromrep torep inner => Stms fromrep -> AllocM fromrep torep a -> AllocM fromrep torep a Source #
allocForArray :: forall fromrep torep (inner :: Type -> Type). Allocable fromrep torep inner => Type -> Space -> AllocM fromrep torep VName Source #
Allocate memory for a value of the given type.
simplifiable :: (SimplifiableRep rep, LetDec rep ~ LetDecMem, ExpDec rep ~ (), BodyDec rep ~ (), Mem (Wise rep) inner, CanBeWise inner, RephraseOp inner, IsOp inner, OpReturns inner, AliasedOp inner, IndexOp (inner (Wise rep))) => (inner (Wise rep) -> UsageTable) -> (inner (Wise rep) -> SimpleM rep (inner (Wise rep), Stms (Wise rep))) -> SimpleOps rep Source #
mkLetNamesB' :: forall m (inner :: Type -> Type). (LetDec (Rep m) ~ LetDecMem, Mem (Rep m) inner, MonadBuilder m, ExpDec (Rep m) ~ ()) => Space -> ExpDec (Rep m) -> [VName] -> Exp (Rep m) -> m (Stm (Rep m)) Source #
mkLetNamesB'' :: forall rep (inner :: Type -> Type) m. (Mem rep inner, LetDec rep ~ LetDecMem, OpReturns inner, ExpDec rep ~ (), Rep m ~ Wise rep, HasScope (Wise rep) m, MonadBuilder m, AliasedOp inner, RephraseOp (MemOp inner), CanBeWise inner, ASTConstraints (inner (Wise rep))) => Space -> [VName] -> Exp (Wise rep) -> m (Stm (Wise rep)) Source #
Module re-exports
module Control.Monad.Reader
module Futhark.MonadFreshNames
module Futhark.Pass
module Futhark.Tools