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

Safe Haskell | None
Language | GHC2021

Futhark.IR.Mem

Contents

- Type checking parts
- Module re-exports

Description

Building blocks for defining representations where every array is given information about which memory block is it based in, and how array elements map to memory block offsets.

There are two primary concepts you will need to understand:

1. Memory blocks, which are Futhark values of type `Mem` (parametrized with their size). These correspond to arbitrary blocks of memory, and are created using the `Alloc` operation.
2. Index functions, which describe a mapping from the index space of an array (eg. a two-dimensional space for an array of type `[[int]]`) to a one-dimensional offset into a memory block. Thus, index functions describe how arbitrary-dimensional arrays are mapped to the single-dimensional world of memory.

At a conceptual level, imagine that we have a two-dimensional array `a` of 32-bit integers, consisting of `n` rows of `m` elements each. This array could be represented in classic row-major format with an index function like the following:

      f(i,j) = i * m + j

When we want to know the location of element `a[2,3]`, we simply call the index function as `f(2,3)` and obtain `2*m+3`. We could also have chosen another index function, one that represents the array in column-major (or "transposed") format:

      f(i,j) = j * n + i

Index functions are not Futhark-level functions, but a special construct that the final code generator will eventually use to generate concrete access code. By modifying the index functions we can change how an array is represented in memory, which can permit memory access pattern optimisations.

Every time we bind an array, whether in a `let`-binding, `loop` merge parameter, or `lambda` parameter, we have an annotation specifying a memory block and an index function. In some cases, such as `let`-bindings for many expressions, we are free to specify an arbitrary index function and memory block - for example, we get to decide where `Copy` stores its result - but in other cases the type rules of the expression chooses for us. For example, `Index` always produces an array in the same memory block as its input, and with the same index function, except with some indices fixed.

Synopsis

- type LetDecMem = MemInfo SubExp NoUniqueness MemBind
- type FParamMem = MemInfo SubExp Uniqueness MemBind
- type LParamMem = MemInfo SubExp NoUniqueness MemBind
- type RetTypeMem = FunReturns
- type BranchTypeMem = BodyReturns
- data MemOp (inner :: Type -> Type) rep
  - = Alloc SubExp Space
  - | Inner (inner rep)
- traverseMemOpStms :: Monad m => OpStmsTraverser m (inner rep) rep -> OpStmsTraverser m (MemOp inner rep) rep
- data MemInfo d u ret
  - = MemPrim PrimType
  - | MemMem Space
  - | MemArray PrimType (ShapeBase d) u ret
  - | MemAcc VName Shape [Type] u
- type MemBound u = MemInfo SubExp u MemBind
- data MemBind = ArrayIn VName LMAD
- data MemReturn
  - = ReturnsInBlock VName ExtLMAD
  - | ReturnsNewBlock Space Int ExtLMAD
- type LMAD = LMAD (TPrimExp Int64 VName)
- type ExtLMAD = LMAD (TPrimExp Int64 (Ext VName))
- isStaticLMAD :: ExtLMAD -> Maybe LMAD
- type ExpReturns = MemInfo ExtSize NoUniqueness (Maybe MemReturn)
- type BodyReturns = MemInfo ExtSize NoUniqueness MemReturn
- type FunReturns = MemInfo ExtSize Uniqueness MemReturn
- noUniquenessReturns :: MemInfo d u r -> MemInfo d NoUniqueness r
- bodyReturnsToExpReturns :: BodyReturns -> ExpReturns
- type Mem rep (inner :: Type -> Type) = (FParamInfo rep ~ FParamMem, LParamInfo rep ~ LParamMem, HasLetDecMem (LetDec rep), RetType rep ~ RetTypeMem, BranchType rep ~ BranchTypeMem, ASTRep rep, OpReturns inner, RephraseOp inner, ASTConstraints (inner rep), FreeIn (inner rep), OpC rep ~ MemOp inner)
- class HasLetDecMem t where
  - letDecMem :: t -> LetDecMem
- class IsOp op => OpReturns (op :: Type -> Type) where
  - opReturns :: forall rep (inner :: Type -> Type) m. (Mem rep inner, Monad m, HasScope rep m) => op rep -> m [ExpReturns]
- varReturns :: forall rep m (inner :: Type -> Type). (HasScope rep m, Monad m, Mem rep inner) => VName -> m ExpReturns
- expReturns :: forall rep m (inner :: Type -> Type). (LocalScope rep m, Mem rep inner) => Exp rep -> m (Maybe [ExpReturns])
- extReturns :: [ExtType] -> [ExpReturns]
- nameInfoToMemInfo :: forall rep (inner :: Type -> Type). Mem rep inner => NameInfo rep -> MemBound NoUniqueness
- lookupMemInfo :: forall rep m (inner :: Type -> Type). (HasScope rep m, Mem rep inner) => VName -> m (MemInfo SubExp NoUniqueness MemBind)
- subExpMemInfo :: forall rep m (inner :: Type -> Type). (HasScope rep m, Mem rep inner) => SubExp -> m (MemInfo SubExp NoUniqueness MemBind)
- lookupArraySummary :: forall rep (inner :: Type -> Type) m. (Mem rep inner, HasScope rep m, Monad m) => VName -> m (VName, LMAD (TPrimExp Int64 VName))
- lookupMemSpace :: forall rep (inner :: Type -> Type) m. (Mem rep inner, HasScope rep m, Monad m) => VName -> m Space
- existentialiseLMAD :: [VName] -> LMAD -> ExtLMAD
- matchBranchReturnType :: forall rep (inner :: Type -> Type). (Mem rep inner, Checkable rep) => [BodyReturns] -> Body (Aliases rep) -> TypeM rep ()
- matchPatToExp :: forall rep (inner :: Type -> Type). (Mem rep inner, LetDec rep ~ LetDecMem, Checkable rep) => Pat (LetDec (Aliases rep)) -> Exp (Aliases rep) -> TypeM rep ()
- matchFunctionReturnType :: forall rep (inner :: Type -> Type). (Mem rep inner, Checkable rep) => [FunReturns] -> Result -> TypeM rep ()
- matchLoopResultMem :: forall rep (inner :: Type -> Type). (Mem rep inner, Checkable rep) => [FParam (Aliases rep)] -> Result -> TypeM rep ()
- bodyReturnsFromPat :: Pat (MemBound NoUniqueness) -> [(VName, BodyReturns)]
- checkMemInfo :: Checkable rep => VName -> MemInfo SubExp u MemBind -> TypeM rep ()
- module Futhark.IR.Prop
- module Futhark.IR.Traversals
- module Futhark.IR.Pretty
- module Futhark.IR.Syntax
- module Futhark.Analysis.PrimExp.Convert

# Documentation

type LetDecMem = MemInfo SubExp NoUniqueness MemBind Source #

type FParamMem = MemInfo SubExp Uniqueness MemBind Source #

type LParamMem = MemInfo SubExp NoUniqueness MemBind Source #

type RetTypeMem = FunReturns Source #

type BranchTypeMem = BodyReturns Source #

data MemOp (inner :: Type -> Type) rep Source #

Constructors

Alloc SubExp Space | Allocate a memory block.
Inner (inner rep) |

#### Instances

Instances details

CanBeAliased inner => CanBeAliased (MemOp inner) Source # |
Instance details Defined in Futhark.IR.Mem Methods addOpAliases :: AliasableRep rep => AliasTable -> MemOp inner rep -> MemOp inner (Aliases rep) Source #
OpReturns inner => OpReturns (MemOp inner) Source # |
Instance details Defined in Futhark.IR.Mem Methods opReturns :: forall rep (inner0 :: Type -> Type) m. (Mem rep inner0, Monad m, HasScope rep m) => MemOp inner rep -> m [ExpReturns] Source #
IsOp inner => IsOp (MemOp inner) Source # |
Instance details Defined in Futhark.IR.Mem Methods safeOp :: ASTRep rep => MemOp inner rep -> Bool Source # cheapOp :: ASTRep rep => MemOp inner rep -> Bool Source # opDependencies :: ASTRep rep => MemOp inner rep -> [Names] Source #
AliasedOp inner => AliasedOp (MemOp inner) Source # |
Instance details Defined in Futhark.IR.Mem Methods opAliases :: Aliased rep => MemOp inner rep -> [Names] Source # consumedInOp :: Aliased rep => MemOp inner rep -> Names Source #
TypedOp inner => TypedOp (MemOp inner) Source # |
Instance details Defined in Futhark.IR.Mem Methods opType :: HasScope rep m => MemOp inner rep -> m [ExtType] Source #
RephraseOp inner => RephraseOp (MemOp inner) Source # |
Instance details Defined in Futhark.IR.Mem Methods rephraseInOp :: Monad m => Rephraser m from to -> MemOp inner from -> m (MemOp inner to) Source #
CanBeWise inner => CanBeWise (MemOp inner) Source # |
Instance details Defined in Futhark.IR.Mem Methods addOpWisdom :: Informing rep => MemOp inner rep -> MemOp inner (Wise rep) Source #
OpMetrics (inner rep) => OpMetrics (MemOp inner rep) Source # |
Instance details Defined in Futhark.IR.Mem Methods opMetrics :: MemOp inner rep -> MetricsM () Source #
IndexOp (inner rep) => IndexOp (MemOp inner rep) Source # |
Instance details Defined in Futhark.IR.Mem Methods indexOp :: (ASTRep rep0, IndexOp (Op rep0)) => SymbolTable rep0 -> Int -> MemOp inner rep -> [TPrimExp Int64 VName] -> Maybe Indexed Source #
FreeIn (inner rep) => FreeIn (MemOp inner rep) Source # |
Instance details Defined in Futhark.IR.Mem Methods freeIn' :: MemOp inner rep -> FV Source #
CSEInOp (op rep) => CSEInOp (MemOp op rep) Source # |
Instance details Defined in Futhark.Optimise.CSE Methods cseInOp :: MemOp op rep -> CSEM rep0 (MemOp op rep)
SizeSubst (op rep) => SizeSubst (MemOp op rep) Source # |
Instance details Defined in Futhark.Pass.ExplicitAllocations Methods opIsConst :: MemOp op rep -> Bool Source #
Rename (inner rep) => Rename (MemOp inner rep) Source # |
Instance details Defined in Futhark.IR.Mem Methods rename :: MemOp inner rep -> RenameM (MemOp inner rep) Source #
Substitute (inner rep) => Substitute (MemOp inner rep) Source # |
Instance details Defined in Futhark.IR.Mem Methods substituteNames :: Map VName VName -> MemOp inner rep -> MemOp inner rep Source #
Show (inner rep) => Show (MemOp inner rep) Source # |
Instance details Defined in Futhark.IR.Mem Methods showsPrec :: Int -> MemOp inner rep -> ShowS Source # show :: MemOp inner rep -> String Source # showList :: [MemOp inner rep] -> ShowS Source #
Eq (inner rep) => Eq (MemOp inner rep) Source # |
Instance details Defined in Futhark.IR.Mem Methods (==) :: MemOp inner rep -> MemOp inner rep -> Bool Source # (/=) :: MemOp inner rep -> MemOp inner rep -> Bool Source #
Ord (inner rep) => Ord (MemOp inner rep) Source # |

Instance details

Defined in Futhark.IR.Mem

Methods

compare :: MemOp inner rep -> MemOp inner rep -> Ordering Source #

(<) :: MemOp inner rep -> MemOp inner rep -> Bool Source #

(<=) :: MemOp inner rep -> MemOp inner rep -> Bool Source #

(>) :: MemOp inner rep -> MemOp inner rep -> Bool Source #

(>=) :: MemOp inner rep -> MemOp inner rep -> Bool Source #

max :: MemOp inner rep -> MemOp inner rep -> MemOp inner rep Source #

min :: MemOp inner rep -> MemOp inner rep -> MemOp inner rep Source #

Pretty (inner rep) => Pretty (MemOp inner rep) Source # |
Instance details Defined in Futhark.IR.Mem Methods pretty :: MemOp inner rep -> Doc ann Source # prettyList :: [MemOp inner rep] -> Doc ann Source #

traverseMemOpStms :: Monad m => OpStmsTraverser m (inner rep) rep -> OpStmsTraverser m (MemOp inner rep) rep Source #

A helper for defining `TraverseOpStms`.

data MemInfo d u ret Source #

A summary of the memory information for every let-bound identifier, function parameter, and return value. Parameterisered over uniqueness, dimension, and auxiliary array information.

Constructors

MemPrim PrimType | A primitive value.
MemMem Space | A memory block.
MemArray PrimType (ShapeBase d) u ret | The array is stored in the named memory block, and with the given index function. The index function maps indices in the array to element offset, not byte offsets! To translate to byte offsets, multiply the offset with the size of the array element type.
MemAcc VName Shape [Type] u | An accumulator, which is not stored anywhere.

#### Instances

Instances details

HasLetDecMem LetDecMem Source # |
Instance details Defined in Futhark.IR.Mem Methods letDecMem :: LetDecMem -> LetDecMem Source #
IsBodyType BodyReturns Source # |
Instance details Defined in Futhark.IR.Mem Methods primBodyType :: PrimType -> BodyReturns Source #
IsRetType FunReturns Source # |
Instance details Defined in Futhark.IR.Mem Methods primRetType :: PrimType -> FunReturns Source # applyRetType :: Typed dec => [FunReturns] -> [Param dec] -> [(SubExp, Type)] -> Maybe [FunReturns] Source #
Simplifiable [FunReturns] Source # |
Instance details Defined in Futhark.IR.Mem Methods simplify :: SimplifiableRep rep => [FunReturns] -> SimpleM rep [FunReturns] Source #
(FreeIn d, FreeIn ret) => FreeIn (MemInfo d u ret) Source # |
Instance details Defined in Futhark.IR.Mem Methods freeIn' :: MemInfo d u ret -> FV Source #
FixExt ret => DeclExtTyped (MemInfo ExtSize Uniqueness ret) Source # |
Instance details Defined in Futhark.IR.Mem Methods declExtTypeOf :: MemInfo ExtSize Uniqueness ret -> DeclExtType Source #
DeclTyped (MemInfo SubExp Uniqueness ret) Source # |
Instance details Defined in Futhark.IR.Mem Methods declTypeOf :: MemInfo SubExp Uniqueness ret -> DeclType Source #
FixExt ret => ExtTyped (MemInfo ExtSize NoUniqueness ret) Source # |
Instance details Defined in Futhark.IR.Mem Methods extTypeOf :: MemInfo ExtSize NoUniqueness ret -> ExtType Source #
FixExt ret => ExtTyped (MemInfo ExtSize Uniqueness ret) Source # |
Instance details Defined in Futhark.IR.Mem Methods extTypeOf :: MemInfo ExtSize Uniqueness ret -> ExtType Source #
FixExt ret => FixExt (MemInfo ExtSize u ret) Source # |
Instance details Defined in Futhark.IR.Mem Methods fixExt :: Int -> SubExp -> MemInfo ExtSize u ret -> MemInfo ExtSize u ret Source # mapExt :: (Int -> Int) -> MemInfo ExtSize u ret -> MemInfo ExtSize u ret Source #
Typed (MemInfo SubExp NoUniqueness ret) Source # |
Instance details Defined in Futhark.IR.Mem Methods typeOf :: MemInfo SubExp NoUniqueness ret -> Type Source #
Typed (MemInfo SubExp Uniqueness ret) Source # |
Instance details Defined in Futhark.IR.Mem Methods typeOf :: MemInfo SubExp Uniqueness ret -> Type Source #
(Simplifiable d, Simplifiable ret) => Simplifiable (MemInfo d u ret) Source # |
Instance details Defined in Futhark.IR.Mem Methods simplify :: SimplifiableRep rep => MemInfo d u ret -> SimpleM rep (MemInfo d u ret) Source #
(Substitute d, Substitute ret) => Rename (MemInfo d u ret) Source # |
Instance details Defined in Futhark.IR.Mem Methods rename :: MemInfo d u ret -> RenameM (MemInfo d u ret) Source #
(Substitute d, Substitute ret) => Substitute (MemInfo d u ret) Source # |
Instance details Defined in Futhark.IR.Mem Methods substituteNames :: Map VName VName -> MemInfo d u ret -> MemInfo d u ret Source #
(Show d, Show ret, Show u) => Show (MemInfo d u ret) Source # |
Instance details Defined in Futhark.IR.Mem Methods showsPrec :: Int -> MemInfo d u ret -> ShowS Source # show :: MemInfo d u ret -> String Source # showList :: [MemInfo d u ret] -> ShowS Source #
(Eq d, Eq ret, Eq u) => Eq (MemInfo d u ret) Source # |
Instance details Defined in Futhark.IR.Mem Methods (==) :: MemInfo d u ret -> MemInfo d u ret -> Bool Source # (/=) :: MemInfo d u ret -> MemInfo d u ret -> Bool Source #
(Ord d, Ord ret, Ord u) => Ord (MemInfo d u ret) Source # |

Instance details

Defined in Futhark.IR.Mem

Methods

compare :: MemInfo d u ret -> MemInfo d u ret -> Ordering Source #

(<) :: MemInfo d u ret -> MemInfo d u ret -> Bool Source #

(<=) :: MemInfo d u ret -> MemInfo d u ret -> Bool Source #

(>) :: MemInfo d u ret -> MemInfo d u ret -> Bool Source #

(>=) :: MemInfo d u ret -> MemInfo d u ret -> Bool Source #

max :: MemInfo d u ret -> MemInfo d u ret -> MemInfo d u ret Source #

min :: MemInfo d u ret -> MemInfo d u ret -> MemInfo d u ret Source #

(Pretty (ShapeBase d), Pretty (TypeBase (ShapeBase d) u), Pretty d, Pretty u, Pretty ret) => Pretty (MemInfo d u ret) Source # |
Instance details Defined in Futhark.IR.Mem Methods pretty :: MemInfo d u ret -> Doc ann Source # prettyList :: [MemInfo d u ret] -> Doc ann Source #

type MemBound u = MemInfo SubExp u MemBind Source #

data MemBind Source #

Memory information for an array bound somewhere in the program.

Constructors

ArrayIn VName LMAD | Located in this memory block with this index function.

#### Instances

Instances details

HasLetDecMem LetDecMem Source # |
Instance details Defined in Futhark.IR.Mem Methods letDecMem :: LetDecMem -> LetDecMem Source #
FreeIn MemBind Source # |
Instance details Defined in Futhark.IR.Mem Methods freeIn' :: MemBind -> FV Source #
Simplifiable MemBind Source # |
Instance details Defined in Futhark.IR.Mem Methods simplify :: SimplifiableRep rep => MemBind -> SimpleM rep MemBind Source #
Rename MemBind Source # |
Instance details Defined in Futhark.IR.Mem Methods rename :: MemBind -> RenameM MemBind Source #
Substitute MemBind Source # |
Instance details Defined in Futhark.IR.Mem Methods substituteNames :: Map VName VName -> MemBind -> MemBind Source #
Show MemBind Source # |
Instance details Defined in Futhark.IR.Mem Methods showsPrec :: Int -> MemBind -> ShowS Source # show :: MemBind -> String Source # showList :: [MemBind] -> ShowS Source #
Eq MemBind Source # |
Instance details Defined in Futhark.IR.Mem Methods (==) :: MemBind -> MemBind -> Bool Source # (/=) :: MemBind -> MemBind -> Bool Source #
Ord MemBind Source # |
Instance details Defined in Futhark.IR.Mem Methods compare :: MemBind -> MemBind -> Ordering Source # (<) :: MemBind -> MemBind -> Bool Source # (<=) :: MemBind -> MemBind -> Bool Source # (>) :: MemBind -> MemBind -> Bool Source # (>=) :: MemBind -> MemBind -> Bool Source # max :: MemBind -> MemBind -> MemBind Source # min :: MemBind -> MemBind -> MemBind Source #
Pretty MemBind Source # |
Instance details Defined in Futhark.IR.Mem Methods pretty :: MemBind -> Doc ann Source # prettyList :: [MemBind] -> Doc ann Source #

data MemReturn Source #

A description of the memory properties of an array being returned by an operation.

Constructors

ReturnsInBlock VName ExtLMAD | The array is located in a memory block that is already in scope.
ReturnsNewBlock Space Int ExtLMAD | The operation returns a new (existential) memory block.

#### Instances

Instances details

FreeIn MemReturn Source # |
Instance details Defined in Futhark.IR.Mem Methods freeIn' :: MemReturn -> FV Source #
FixExt MemReturn Source # |
Instance details Defined in Futhark.IR.Mem Methods fixExt :: Int -> SubExp -> MemReturn -> MemReturn Source # mapExt :: (Int -> Int) -> MemReturn -> MemReturn Source #
IsBodyType BodyReturns Source # |
Instance details Defined in Futhark.IR.Mem Methods primBodyType :: PrimType -> BodyReturns Source #
IsRetType FunReturns Source # |
Instance details Defined in Futhark.IR.Mem Methods primRetType :: PrimType -> FunReturns Source # applyRetType :: Typed dec => [FunReturns] -> [Param dec] -> [(SubExp, Type)] -> Maybe [FunReturns] Source #
Simplifiable MemReturn Source # |
Instance details Defined in Futhark.IR.Mem Methods simplify :: SimplifiableRep rep => MemReturn -> SimpleM rep MemReturn Source #
Rename MemReturn Source # |
Instance details Defined in Futhark.IR.Mem Methods rename :: MemReturn -> RenameM MemReturn Source #
Substitute MemReturn Source # |
Instance details Defined in Futhark.IR.Mem Methods substituteNames :: Map VName VName -> MemReturn -> MemReturn Source #
Show MemReturn Source # |
Instance details Defined in Futhark.IR.Mem Methods showsPrec :: Int -> MemReturn -> ShowS Source # show :: MemReturn -> String Source # showList :: [MemReturn] -> ShowS Source #
Eq MemReturn Source # |
Instance details Defined in Futhark.IR.Mem Methods (==) :: MemReturn -> MemReturn -> Bool Source # (/=) :: MemReturn -> MemReturn -> Bool Source #
Ord MemReturn Source # |
Instance details Defined in Futhark.IR.Mem Methods compare :: MemReturn -> MemReturn -> Ordering Source # (<) :: MemReturn -> MemReturn -> Bool Source # (<=) :: MemReturn -> MemReturn -> Bool Source # (>) :: MemReturn -> MemReturn -> Bool Source # (>=) :: MemReturn -> MemReturn -> Bool Source # max :: MemReturn -> MemReturn -> MemReturn Source # min :: MemReturn -> MemReturn -> MemReturn Source #
Pretty MemReturn Source # |
Instance details Defined in Futhark.IR.Mem Methods pretty :: MemReturn -> Doc ann Source # prettyList :: [MemReturn] -> Doc ann Source #
Simplifiable [FunReturns] Source # |
Instance details Defined in Futhark.IR.Mem Methods simplify :: SimplifiableRep rep => [FunReturns] -> SimpleM rep [FunReturns] Source #

type LMAD = LMAD (TPrimExp Int64 VName) Source #

The LMAD representation used for memory annotations.

type ExtLMAD = LMAD (TPrimExp Int64 (Ext VName)) Source #

An index function that may contain existential variables.

isStaticLMAD :: ExtLMAD -> Maybe LMAD Source #

type ExpReturns = MemInfo ExtSize NoUniqueness (Maybe MemReturn) Source #

The memory return of an expression. An array is annotated with `Maybe MemReturn`, which can be interpreted as the expression either dictating exactly where the array is located when it is returned (if `Just`), or able to put it whereever the binding prefers (if `Nothing`).

This is necessary to capture the difference between an expression that is just an array-typed variable, in which the array being "returned" is located where it already is, and a `copy` expression, whose entire purpose is to store an existing array in some arbitrary location. This is a consequence of the design decision never to have implicit memory copies.

type BodyReturns = MemInfo ExtSize NoUniqueness MemReturn Source #

The return of a body, which must always indicate where returned arrays are located.

type FunReturns = MemInfo ExtSize Uniqueness MemReturn Source #

The memory return of a function, which must always indicate where returned arrays are located.

noUniquenessReturns :: MemInfo d u r -> MemInfo d NoUniqueness r Source #

bodyReturnsToExpReturns :: BodyReturns -> ExpReturns Source #

type Mem rep (inner :: Type -> Type) = (FParamInfo rep ~ FParamMem, LParamInfo rep ~ LParamMem, HasLetDecMem (LetDec rep), RetType rep ~ RetTypeMem, BranchType rep ~ BranchTypeMem, ASTRep rep, OpReturns inner, RephraseOp inner, ASTConstraints (inner rep), FreeIn (inner rep), OpC rep ~ MemOp inner) Source #

class HasLetDecMem t where Source #

The class of pattern element decorators that contain memory information.

Methods

letDecMem :: t -> LetDecMem Source #

#### Instances

Instances details

HasLetDecMem LetDecMem Source # |
Instance details Defined in Futhark.IR.Mem Methods letDecMem :: LetDecMem -> LetDecMem Source #
HasLetDecMem b => HasLetDecMem (a, b) Source # |
Instance details Defined in Futhark.IR.Mem Methods letDecMem :: (a, b) -> LetDecMem Source #

class IsOp op => OpReturns (op :: Type -> Type) where Source #

Minimal complete definition

Nothing

Methods

opReturns :: forall rep (inner :: Type -> Type) m. (Mem rep inner, Monad m, HasScope rep m) => op rep -> m [ExpReturns] Source #

#### Instances

Instances details

OpReturns (HostOp (NoOp :: Type -> Type)) Source # |
Instance details Defined in Futhark.IR.GPU.Op Methods opReturns :: forall rep (inner :: Type -> Type) m. (Mem rep inner, Monad m, HasScope rep m) => HostOp (NoOp :: Type -> Type) rep -> m [ExpReturns] Source #
OpReturns (MCOp (NoOp :: Type -> Type)) Source # |
Instance details Defined in Futhark.IR.MC.Op Methods opReturns :: forall rep (inner :: Type -> Type) m. (Mem rep inner, Monad m, HasScope rep m) => MCOp (NoOp :: Type -> Type) rep -> m [ExpReturns] Source #
OpReturns inner => OpReturns (MemOp inner) Source # |
Instance details Defined in Futhark.IR.Mem Methods opReturns :: forall rep (inner0 :: Type -> Type) m. (Mem rep inner0, Monad m, HasScope rep m) => MemOp inner rep -> m [ExpReturns] Source #
OpReturns (NoOp :: Type -> Type) Source # |
Instance details Defined in Futhark.IR.Mem Methods opReturns :: forall rep (inner :: Type -> Type) m. (Mem rep inner, Monad m, HasScope rep m) => NoOp rep -> m [ExpReturns] Source #

varReturns :: forall rep m (inner :: Type -> Type). (HasScope rep m, Monad m, Mem rep inner) => VName -> m ExpReturns Source #

expReturns :: forall rep m (inner :: Type -> Type). (LocalScope rep m, Mem rep inner) => Exp rep -> m (Maybe [ExpReturns]) Source #

The return information of an expression. This can be seen as the "return type with memory annotations" of the expression.

This can produce Nothing, which signifies that the result is an array layout that is not expressible as an index function.

extReturns :: [ExtType] -> [ExpReturns] Source #

nameInfoToMemInfo :: forall rep (inner :: Type -> Type). Mem rep inner => NameInfo rep -> MemBound NoUniqueness Source #

Turn info into memory information.

lookupMemInfo :: forall rep m (inner :: Type -> Type). (HasScope rep m, Mem rep inner) => VName -> m (MemInfo SubExp NoUniqueness MemBind) Source #

Look up information about the memory block with this name.

subExpMemInfo :: forall rep m (inner :: Type -> Type). (HasScope rep m, Mem rep inner) => SubExp -> m (MemInfo SubExp NoUniqueness MemBind) Source #

lookupArraySummary :: forall rep (inner :: Type -> Type) m. (Mem rep inner, HasScope rep m, Monad m) => VName -> m (VName, LMAD (TPrimExp Int64 VName)) Source #

lookupMemSpace :: forall rep (inner :: Type -> Type) m. (Mem rep inner, HasScope rep m, Monad m) => VName -> m Space Source #

existentialiseLMAD :: [VName] -> LMAD -> ExtLMAD Source #

# Type checking parts

matchBranchReturnType :: forall rep (inner :: Type -> Type). (Mem rep inner, Checkable rep) => [BodyReturns] -> Body (Aliases rep) -> TypeM rep () Source #

matchPatToExp :: forall rep (inner :: Type -> Type). (Mem rep inner, LetDec rep ~ LetDecMem, Checkable rep) => Pat (LetDec (Aliases rep)) -> Exp (Aliases rep) -> TypeM rep () Source #

matchFunctionReturnType :: forall rep (inner :: Type -> Type). (Mem rep inner, Checkable rep) => [FunReturns] -> Result -> TypeM rep () Source #

matchLoopResultMem :: forall rep (inner :: Type -> Type). (Mem rep inner, Checkable rep) => [FParam (Aliases rep)] -> Result -> TypeM rep () Source #

bodyReturnsFromPat :: Pat (MemBound NoUniqueness) -> [(VName, BodyReturns)] Source #

checkMemInfo :: Checkable rep => VName -> MemInfo SubExp u MemBind -> TypeM rep () Source #

# Module re-exports

module Futhark.IR.Prop

module Futhark.IR.Traversals

module Futhark.IR.Pretty

module Futhark.IR.Syntax

module Futhark.Analysis.PrimExp.Convert