| 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
- opIsConst :: op -> Bool
- 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))
- class (forall (m :: Type -> Type). Monad m => Monad (t m)) => MonadTrans (t :: (Type -> Type) -> Type -> Type) where
- lift :: Monad m => m a -> t m a
- class Monad m => MonadReader r (m :: Type -> Type) | m -> r where
- type Reader r = ReaderT r Identity
- class Monad m => MonadIO (m :: Type -> Type) where
- liftIO :: IO a -> m a
- asks :: MonadReader r m => (r -> a) -> m a
- newtype ReaderT r (m :: Type -> Type) a = ReaderT {
- runReaderT :: r -> m a
- mapReader :: (a -> b) -> Reader r a -> Reader r b
- mapReaderT :: (m a -> n b) -> ReaderT r m a -> ReaderT r n b
- runReader :: Reader r a -> r -> a
- withReader :: (r' -> r) -> Reader r a -> Reader r' a
- withReaderT :: forall r' r (m :: Type -> Type) a. (r' -> r) -> ReaderT r m a -> ReaderT r' m a
- 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 | |||||
| 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 # | |||||
| 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 # | |||||
| 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
Instances
| SizeSubst (HostOp rep op) Source # | |
Defined in Futhark.Pass.ExplicitAllocations.GPU | |
| SizeSubst (MCOp rep op) Source # | |
Defined in Futhark.Pass.ExplicitAllocations.MC | |
| SizeSubst (op rep) => SizeSubst (MemOp op rep) Source # | |
Defined in Futhark.Pass.ExplicitAllocations | |
| SizeSubst (NoOp rep) Source # | |
Defined in Futhark.Pass.ExplicitAllocations | |
| SizeSubst (SegOp lvl rep) Source # | |
Defined in Futhark.Pass.ExplicitAllocations.SegOp | |
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
class (forall (m :: Type -> Type). Monad m => Monad (t m)) => MonadTrans (t :: (Type -> Type) -> Type -> Type) where #
Instances
class Monad m => MonadReader r (m :: Type -> Type) | m -> r where #
Instances
class Monad m => MonadIO (m :: Type -> Type) where #
Instances
asks :: MonadReader r m => (r -> a) -> m a #
newtype ReaderT r (m :: Type -> Type) a #
Constructors
| ReaderT | |
Fields
| |
Instances
| Monoid Fmt | |||||
| Semigroup Fmt | |||||
| IsString Fmt | |||||
Defined in Futhark.Fmt.Monad Methods fromString :: String -> Fmt | |||||
| MonadParsec e s m => MonadParsec e s (ReaderT r m) | |||||
Defined in Text.Megaparsec.Class Methods parseError :: ParseError s e -> ReaderT r m a Source # label :: String -> ReaderT r m a -> ReaderT r m a Source # hidden :: ReaderT r m a -> ReaderT r m a Source # try :: ReaderT r m a -> ReaderT r m a Source # lookAhead :: ReaderT r m a -> ReaderT r m a Source # notFollowedBy :: ReaderT r m a -> ReaderT r m () Source # withRecovery :: (ParseError s e -> ReaderT r m a) -> ReaderT r m a -> ReaderT r m a Source # observing :: ReaderT r m a -> ReaderT r m (Either (ParseError s e) a) Source # eof :: ReaderT r m () Source # token :: (Token s -> Maybe a) -> Set (ErrorItem (Token s)) -> ReaderT r m a Source # tokens :: (Tokens s -> Tokens s -> Bool) -> Tokens s -> ReaderT r m (Tokens s) Source # takeWhileP :: Maybe String -> (Token s -> Bool) -> ReaderT r m (Tokens s) Source # takeWhile1P :: Maybe String -> (Token s -> Bool) -> ReaderT r m (Tokens s) Source # takeP :: Maybe String -> Int -> ReaderT r m (Tokens s) Source # getParserState :: ReaderT r m (State s e) Source # updateParserState :: (State s e -> State s e) -> ReaderT r m () Source # mkParsec :: (State s e -> Reply e s a) -> ReaderT r m a Source # | |||||
| MonadParsecDbg e s m => MonadParsecDbg e s (ReaderT r m) | |||||
| (Functor f, MonadFree f m) => MonadFree f (ReaderT e m) | |||||
| (Monad m, RepTypes rep) => HasScope rep (ReaderT (Scope rep) m) Source # | |||||
| (Monad m, RepTypes rep) => LocalScope rep (ReaderT (Scope rep) m) Source # | |||||
Defined in Futhark.IR.Prop.Scope | |||||
| Generic1 (ReaderT r m :: Type -> Type) | |||||
Defined in Control.Monad.Trans.Reader Associated Types
| |||||
| MonadAccum w m => MonadAccum w (ReaderT r m) | |||||
| MonadError e m => MonadError e (ReaderT r m) | |||||
Defined in Control.Monad.Error.Class Methods throwError :: e -> ReaderT r m a # catchError :: ReaderT r m a -> (e -> ReaderT r m a) -> ReaderT r m a | |||||
| Monad m => MonadReader r (ReaderT r m) | |||||
| MonadSelect r' m => MonadSelect r' (ReaderT r m) | |||||
Defined in Control.Monad.Select | |||||
| MonadState s m => MonadState s (ReaderT r m) | |||||
| MonadWriter w m => MonadWriter w (ReaderT r m) | |||||
| (MonadIO m, MonadMask m) => CommandMonad (InputCmdT m) | |||||
Defined in System.Console.Haskeline.InputT Methods runCompletion :: (String, String) -> InputCmdT m (String, [Completion]) | |||||
| MonadTrans (ReaderT r) | |||||
Defined in Control.Monad.Trans.Reader | |||||
| Representable m => Representable (ReaderT e m) | |||||
Defined in Data.Functor.Rep Associated Types
| |||||
| MonadIO m => MonadIO (ReaderT r m) | |||||
Defined in Control.Monad.Trans.Reader | |||||
| MonadZip m => MonadZip (ReaderT r m) | |||||
| Contravariant m => Contravariant (ReaderT r m) | |||||
| MonadCatch m => MonadCatch (ReaderT r m) | |||||
Defined in Control.Monad.Catch | |||||
| MonadMask m => MonadMask (ReaderT r m) | |||||
Defined in Control.Monad.Catch Methods mask :: HasCallStack => ((forall a. ReaderT r m a -> ReaderT r m a) -> ReaderT r m b) -> ReaderT r m b uninterruptibleMask :: HasCallStack => ((forall a. ReaderT r m a -> ReaderT r m a) -> ReaderT r m b) -> ReaderT r m b generalBracket :: HasCallStack => ReaderT r m a -> (a -> ExitCase b -> ReaderT r m c) -> (a -> ReaderT r m b) -> ReaderT r m (b, c) | |||||
| MonadThrow m => MonadThrow (ReaderT r m) | |||||
Defined in Control.Monad.Catch | |||||
| MonadFreshNames m => MonadFreshNames (ReaderT s m) Source # | |||||
Defined in Futhark.MonadFreshNames Methods getNameSource :: ReaderT s m VNameSource Source # putNameSource :: VNameSource -> ReaderT s m () Source # | |||||
| Alternative m => Alternative (ReaderT r m) | |||||
| Applicative m => Applicative (ReaderT r m) | |||||
Defined in Control.Monad.Trans.Reader | |||||
| Functor m => Functor (ReaderT r m) | |||||
| Monad m => Monad (ReaderT r m) | |||||
| MonadPlus m => MonadPlus (ReaderT r m) | |||||
| MonadFail m => MonadFail (ReaderT r m) | |||||
Defined in Control.Monad.Trans.Reader | |||||
| MonadFix m => MonadFix (ReaderT r m) | |||||
Defined in Control.Monad.Trans.Reader | |||||
| MonadCont m => MonadCont (ReaderT r m) | |||||
Defined in Control.Monad.Cont.Class | |||||
| PrimMonad m => PrimMonad (ReaderT r m) | |||||
Defined in Control.Monad.Primitive Associated Types
| |||||
| Quasi m => Quasi (ReaderT r m) | |||||
Defined in Language.Haskell.TH.Instances Methods qNewName :: String -> ReaderT r m Name qReport :: Bool -> String -> ReaderT r m () qRecover :: ReaderT r m a -> ReaderT r m a -> ReaderT r m a qLookupName :: Bool -> String -> ReaderT r m (Maybe Name) qReify :: Name -> ReaderT r m Info qReifyFixity :: Name -> ReaderT r m (Maybe Fixity) qReifyType :: Name -> ReaderT r m Type qReifyInstances :: Name -> [Type] -> ReaderT r m [Dec] qReifyRoles :: Name -> ReaderT r m [Role] qReifyAnnotations :: Data a => AnnLookup -> ReaderT r m [a] qReifyModule :: Module -> ReaderT r m ModuleInfo qReifyConStrictness :: Name -> ReaderT r m [DecidedStrictness] qRunIO :: IO a -> ReaderT r m a qGetPackageRoot :: ReaderT r m FilePath qAddDependentFile :: FilePath -> ReaderT r m () qAddTempFile :: String -> ReaderT r m FilePath qAddTopDecls :: [Dec] -> ReaderT r m () qAddForeignFilePath :: ForeignSrcLang -> String -> ReaderT r m () qAddModFinalizer :: Q () -> ReaderT r m () qAddCorePlugin :: String -> ReaderT r m () qGetQ :: Typeable a => ReaderT r m (Maybe a) qPutQ :: Typeable a => a -> ReaderT r m () qIsExtEnabled :: Extension -> ReaderT r m Bool qExtsEnabled :: ReaderT r m [Extension] | |||||
| Quote m => Quote (ReaderT r m) | |||||
Defined in Language.Haskell.TH.Instances | |||||
| Monad m => Magnify (ReaderT b m) (ReaderT a m) b a | |||||
| Zoom m n s t => Zoom (ReaderT e m) (ReaderT e n) s t | |||||
| Generic (ReaderT r m a) | |||||
Defined in Control.Monad.Trans.Reader Associated Types
| |||||
| Wrapped (ReaderT r m a) | |||||
| t ~ ReaderT s n b => Rewrapped (ReaderT r m a) t | |||||
Defined in Control.Lens.Wrapped | |||||
| type Rep1 (ReaderT r m :: Type -> Type) | |||||
Defined in Control.Monad.Trans.Reader type Rep1 (ReaderT r m :: Type -> Type) = D1 ('MetaData "ReaderT" "Control.Monad.Trans.Reader" "transformers-0.6.1.1-inplace" 'True) (C1 ('MetaCons "ReaderT" 'PrefixI 'True) (S1 ('MetaSel ('Just "runReaderT") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) ((FUN 'Many r :: Type -> Type) :.: Rec1 m))) | |||||
| type Rep (ReaderT e m) | |||||
Defined in Data.Functor.Rep type Rep (ReaderT e m) = (e, Rep m) | |||||
| type Magnified (ReaderT b m) | |||||
Defined in Control.Lens.Zoom | |||||
| type Zoomed (ReaderT e m) | |||||
Defined in Control.Lens.Zoom | |||||
| type PrimState (ReaderT r m) | |||||
Defined in Control.Monad.Primitive type PrimState (ReaderT r m) = PrimState m | |||||
| type Rep (ReaderT r m a) | |||||
Defined in Control.Monad.Trans.Reader type Rep (ReaderT r m a) = D1 ('MetaData "ReaderT" "Control.Monad.Trans.Reader" "transformers-0.6.1.1-inplace" 'True) (C1 ('MetaCons "ReaderT" 'PrefixI 'True) (S1 ('MetaSel ('Just "runReaderT") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (r -> m a)))) | |||||
| type Unwrapped (ReaderT r m a) | |||||
Defined in Control.Lens.Wrapped | |||||
mapReaderT :: (m a -> n b) -> ReaderT r m a -> ReaderT r n b #
withReader :: (r' -> r) -> Reader r a -> Reader r' a #
withReaderT :: forall r' r (m :: Type -> Type) a. (r' -> r) -> ReaderT r m a -> ReaderT r' m a #
module Futhark.MonadFreshNames
module Futhark.Pass
module Futhark.Tools