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

Safe Haskell | Safe-Inferred
Language | GHC2021

Futhark.IR.SegOp

Contents

- Details
  - Generic traversal
- Simplification
- Memory

Description

Segmented operations. These correspond to perfect `map` nests on top of something, except that the `map`s are conceptually only over `iota`s (so there will be explicit indexing inside them).

Synopsis

- data SegOp lvl rep
  - = SegMap lvl SegSpace [Type] (KernelBody rep)
  - | SegRed lvl SegSpace [SegBinOp rep] [Type] (KernelBody rep)
  - | SegScan lvl SegSpace [SegBinOp rep] [Type] (KernelBody rep)
  - | SegHist lvl SegSpace [HistOp rep] [Type] (KernelBody rep)
- segLevel :: SegOp lvl rep -> lvl
- segBody :: SegOp lvl rep -> KernelBody rep
- segSpace :: SegOp lvl rep -> SegSpace
- typeCheckSegOp :: Checkable rep => (lvl -> TypeM rep ()) -> SegOp lvl (Aliases rep) -> TypeM rep ()
- data SegSpace = SegSpace {
  - segFlat :: VName
  - unSegSpace :: [(VName, SubExp)]
  }
- scopeOfSegSpace :: SegSpace -> Scope rep
- segSpaceDims :: SegSpace -> [SubExp]
- data HistOp rep = HistOp {
  - histShape :: Shape
  - histRaceFactor :: SubExp
  - histDest :: [VName]
  - histNeutral :: [SubExp]
  - histOpShape :: Shape
  - histOp :: Lambda rep
  }
- histType :: HistOp rep -> [Type]
- splitHistResults :: [HistOp rep] -> [SubExp] -> [([SubExp], [SubExp])]
- data SegBinOp rep = SegBinOp {
  - segBinOpComm :: Commutativity
  - segBinOpLambda :: Lambda rep
  - segBinOpNeutral :: [SubExp]
  - segBinOpShape :: Shape
  }
- segBinOpResults :: [SegBinOp rep] -> Int
- segBinOpChunks :: [SegBinOp rep] -> [a] -> [[a]]
- data KernelBody rep = KernelBody {
  - kernelBodyDec :: BodyDec rep
  - kernelBodyStms :: Stms rep
  - kernelBodyResult :: [KernelResult]
  }
- aliasAnalyseKernelBody :: AliasableRep rep => AliasTable -> KernelBody rep -> KernelBody (Aliases rep)
- consumedInKernelBody :: Aliased rep => KernelBody rep -> Names
- data ResultManifest
  - = ResultNoSimplify
  - | ResultMaySimplify
  - | ResultPrivate
- data KernelResult
  - = Returns ResultManifest Certs SubExp
  - | WriteReturns Certs VName [(Slice SubExp, SubExp)]
  - | TileReturns Certs [(SubExp, SubExp)] VName
  - | RegTileReturns Certs [(SubExp, SubExp, SubExp)] VName
- kernelResultCerts :: KernelResult -> Certs
- kernelResultSubExp :: KernelResult -> SubExp
- data SegOpMapper lvl frep trep m = SegOpMapper {
  - mapOnSegOpSubExp :: SubExp -> m SubExp
  - mapOnSegOpLambda :: Lambda frep -> m (Lambda trep)
  - mapOnSegOpBody :: KernelBody frep -> m (KernelBody trep)
  - mapOnSegOpVName :: VName -> m VName
  - mapOnSegOpLevel :: lvl -> m lvl
  }
- identitySegOpMapper :: Monad m => SegOpMapper lvl rep rep m
- mapSegOpM :: Monad m => SegOpMapper lvl frep trep m -> SegOp lvl frep -> m (SegOp lvl trep)
- traverseSegOpStms :: Monad m => OpStmsTraverser m (SegOp lvl rep) rep
- simplifySegOp :: (SimplifiableRep rep, BodyDec rep ~ (), Simplifiable lvl) => SegOp lvl (Wise rep) -> SimpleM rep (SegOp lvl (Wise rep), Stms (Wise rep))
- class HasSegOp rep where
  - type SegOpLevel rep
  - asSegOp :: Op rep -> Maybe (SegOp (SegOpLevel rep) rep)
  - segOp :: SegOp (SegOpLevel rep) rep -> Op rep
- segOpRules :: (HasSegOp rep, BuilderOps rep, Buildable rep, Aliased rep) => RuleBook rep
- segOpReturns :: (Mem rep inner, Monad m, HasScope rep m) => SegOp lvl rep -> m [ExpReturns]

# Documentation

data SegOp lvl rep Source #

A `SegOp` is semantically a perfectly nested stack of maps, on top of some bottommost computation (scalar computation, reduction, scan, or histogram). The `SegSpace` encodes the original map structure.

All `SegOp`s are parameterised by the representation of their body, as well as a *level*. The *level* is a representation-specific bit of information. For example, in GPU backends, it is used to indicate whether the `SegOp` is expected to run at the thread-level or the block-level.

The type list is usually the type of the element returned by a single thread. The result of the SegOp is then an array of that type, with the shape of the `SegSpace` prepended. One exception is for `WriteReturns`, where the type annotation is the full type of the result.

Constructors

SegMap lvl SegSpace [Type] (KernelBody rep) |
SegRed lvl SegSpace [SegBinOp rep] [Type] (KernelBody rep) | The KernelSpace must always have at least two dimensions, implying that the result of a SegRed is always an array.
SegScan lvl SegSpace [SegBinOp rep] [Type] (KernelBody rep) |
SegHist lvl SegSpace [HistOp rep] [Type] (KernelBody rep) |

#### Instances

Instances details

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

Instance details

Defined in Futhark.IR.SegOp

Methods

compare :: SegOp lvl rep -> SegOp lvl rep -> Ordering Source #

(<) :: SegOp lvl rep -> SegOp lvl rep -> Bool Source #

(<=) :: SegOp lvl rep -> SegOp lvl rep -> Bool Source #

(>) :: SegOp lvl rep -> SegOp lvl rep -> Bool Source #

(>=) :: SegOp lvl rep -> SegOp lvl rep -> Bool Source #

max :: SegOp lvl rep -> SegOp lvl rep -> SegOp lvl rep Source #

min :: SegOp lvl rep -> SegOp lvl rep -> SegOp lvl rep Source #

(PrettyRep rep, Pretty lvl) => Pretty (SegOp lvl rep) Source # |
Instance details Defined in Futhark.IR.SegOp Methods pretty :: SegOp lvl rep -> Doc ann Source # prettyList :: [SegOp lvl rep] -> Doc ann Source #

segLevel :: SegOp lvl rep -> lvl Source #

The level of a `SegOp`.

segBody :: SegOp lvl rep -> KernelBody rep Source #

The body of a `SegOp`.

segSpace :: SegOp lvl rep -> SegSpace Source #

The space of a `SegOp`.

typeCheckSegOp :: Checkable rep => (lvl -> TypeM rep ()) -> SegOp lvl (Aliases rep) -> TypeM rep () Source #

Type check a `SegOp`, given a checker for its level.

data SegSpace Source #

Index space of a `SegOp`.

Constructors

SegSpace |

Fields

- segFlat :: VName

  Flat physical index corresponding to the dimensions (at code generation used for a thread ID or similar).

- unSegSpace :: [(VName, SubExp)]

#### Instances

Instances details

Show SegSpace Source # |
Instance details Defined in Futhark.IR.SegOp Methods showsPrec :: Int -> SegSpace -> ShowS Source # show :: SegSpace -> String Source # showList :: [SegSpace] -> ShowS Source #
Simplifiable SegSpace Source # |
Instance details Defined in Futhark.IR.SegOp Methods simplify :: SimplifiableRep rep => SegSpace -> SimpleM rep SegSpace Source #
Eq SegSpace Source # |
Instance details Defined in Futhark.IR.SegOp Methods (==) :: SegSpace -> SegSpace -> Bool Source # (/=) :: SegSpace -> SegSpace -> Bool Source #
Ord SegSpace Source # |
Instance details Defined in Futhark.IR.SegOp Methods compare :: SegSpace -> SegSpace -> Ordering Source # (<) :: SegSpace -> SegSpace -> Bool Source # (<=) :: SegSpace -> SegSpace -> Bool Source # (>) :: SegSpace -> SegSpace -> Bool Source # (>=) :: SegSpace -> SegSpace -> Bool Source # max :: SegSpace -> SegSpace -> SegSpace Source # min :: SegSpace -> SegSpace -> SegSpace Source #
Pretty SegSpace Source # |
Instance details Defined in Futhark.IR.SegOp Methods pretty :: SegSpace -> Doc ann Source # prettyList :: [SegSpace] -> Doc ann Source #

scopeOfSegSpace :: SegSpace -> Scope rep Source #

A `Scope` containing all the identifiers brought into scope by this `SegSpace`.

segSpaceDims :: SegSpace -> [SubExp] Source #

The sizes spanned by the indexes of the `SegSpace`.

# Details

data HistOp rep Source #

An operator for `SegHist`.

Constructors

HistOp |

Fields

- histShape :: Shape
- histRaceFactor :: SubExp
- histDest :: [VName]
- histNeutral :: [SubExp]
- histOpShape :: Shape

  In case this operator is semantically a vectorised operator (corresponding to a perfect map nest in the SOACS representation), these are the logical "dimensions". This is used to generate more efficient code.

- histOp :: Lambda rep

#### Instances

Instances details

RepTypes rep => Show (HistOp rep) Source # |
Instance details Defined in Futhark.IR.SegOp Methods showsPrec :: Int -> HistOp rep -> ShowS Source # show :: HistOp rep -> String Source # showList :: [HistOp rep] -> ShowS Source #
RepTypes rep => Eq (HistOp rep) Source # |
Instance details Defined in Futhark.IR.SegOp Methods (==) :: HistOp rep -> HistOp rep -> Bool Source # (/=) :: HistOp rep -> HistOp rep -> Bool Source #
RepTypes rep => Ord (HistOp rep) Source # |

Instance details

Defined in Futhark.IR.SegOp

Methods

compare :: HistOp rep -> HistOp rep -> Ordering Source #

(<) :: HistOp rep -> HistOp rep -> Bool Source #

(<=) :: HistOp rep -> HistOp rep -> Bool Source #

(>) :: HistOp rep -> HistOp rep -> Bool Source #

(>=) :: HistOp rep -> HistOp rep -> Bool Source #

max :: HistOp rep -> HistOp rep -> HistOp rep Source #

min :: HistOp rep -> HistOp rep -> HistOp rep Source #

histType :: HistOp rep -> [Type] Source #

The type of a histogram produced by a `HistOp`. This can be different from the type of the `histDest`s in case we are dealing with a segmented histogram.

splitHistResults :: [HistOp rep] -> [SubExp] -> [([SubExp], [SubExp])] Source #

Split reduction results returned by a `KernelBody` into those that correspond to indexes for the `HistOp`s, and those that correspond to value.

data SegBinOp rep Source #

An operator for `SegScan` and `SegRed`.

Constructors

SegBinOp |

Fields

- segBinOpComm :: Commutativity
- segBinOpLambda :: Lambda rep
- segBinOpNeutral :: [SubExp]
- segBinOpShape :: Shape

  In case this operator is semantically a vectorised operator (corresponding to a perfect map nest in the SOACS representation), these are the logical "dimensions". This is used to generate more efficient code.

#### Instances

Instances details

RepTypes rep => Show (SegBinOp rep) Source # |
Instance details Defined in Futhark.IR.SegOp Methods showsPrec :: Int -> SegBinOp rep -> ShowS Source # show :: SegBinOp rep -> String Source # showList :: [SegBinOp rep] -> ShowS Source #
RepTypes rep => Eq (SegBinOp rep) Source # |
Instance details Defined in Futhark.IR.SegOp Methods (==) :: SegBinOp rep -> SegBinOp rep -> Bool Source # (/=) :: SegBinOp rep -> SegBinOp rep -> Bool Source #
RepTypes rep => Ord (SegBinOp rep) Source # |

Instance details

Defined in Futhark.IR.SegOp

Methods

compare :: SegBinOp rep -> SegBinOp rep -> Ordering Source #

(<) :: SegBinOp rep -> SegBinOp rep -> Bool Source #

(<=) :: SegBinOp rep -> SegBinOp rep -> Bool Source #

(>) :: SegBinOp rep -> SegBinOp rep -> Bool Source #

(>=) :: SegBinOp rep -> SegBinOp rep -> Bool Source #

max :: SegBinOp rep -> SegBinOp rep -> SegBinOp rep Source #

min :: SegBinOp rep -> SegBinOp rep -> SegBinOp rep Source #

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

segBinOpResults :: [SegBinOp rep] -> Int Source #

How many reduction results are produced by these `SegBinOp`s?

segBinOpChunks :: [SegBinOp rep] -> [a] -> [[a]] Source #

Split some list into chunks equal to the number of values returned by each `SegBinOp`

data KernelBody rep Source #

The body of a `SegOp`.

Constructors

KernelBody |

Fields

- kernelBodyDec :: BodyDec rep
- kernelBodyStms :: Stms rep
- kernelBodyResult :: [KernelResult]

#### Instances

Instances details

RepTypes rep => Show (KernelBody rep) Source # |
Instance details Defined in Futhark.IR.SegOp Methods showsPrec :: Int -> KernelBody rep -> ShowS Source # show :: KernelBody rep -> String Source # showList :: [KernelBody rep] -> ShowS Source #
ASTRep rep => FreeIn (KernelBody rep) Source # |
Instance details Defined in Futhark.IR.SegOp Methods freeIn' :: KernelBody rep -> FV Source #
ASTRep rep => Rename (KernelBody rep) Source # |
Instance details Defined in Futhark.IR.SegOp Methods rename :: KernelBody rep -> RenameM (KernelBody rep) Source #
ASTRep rep => Substitute (KernelBody rep) Source # |
Instance details Defined in Futhark.IR.SegOp Methods substituteNames :: Map VName VName -> KernelBody rep -> KernelBody rep Source #
RepTypes rep => Eq (KernelBody rep) Source # |
Instance details Defined in Futhark.IR.SegOp Methods (==) :: KernelBody rep -> KernelBody rep -> Bool Source # (/=) :: KernelBody rep -> KernelBody rep -> Bool Source #
RepTypes rep => Ord (KernelBody rep) Source # |

Instance details

Defined in Futhark.IR.SegOp

Methods

compare :: KernelBody rep -> KernelBody rep -> Ordering Source #

(<) :: KernelBody rep -> KernelBody rep -> Bool Source #

(<=) :: KernelBody rep -> KernelBody rep -> Bool Source #

(>) :: KernelBody rep -> KernelBody rep -> Bool Source #

(>=) :: KernelBody rep -> KernelBody rep -> Bool Source #

max :: KernelBody rep -> KernelBody rep -> KernelBody rep Source #

min :: KernelBody rep -> KernelBody rep -> KernelBody rep Source #

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

aliasAnalyseKernelBody :: AliasableRep rep => AliasTable -> KernelBody rep -> KernelBody (Aliases rep) Source #

Perform alias analysis on a `KernelBody`.

consumedInKernelBody :: Aliased rep => KernelBody rep -> Names Source #

The variables consumed in the kernel body.

data ResultManifest Source #

Metadata about whether there is a subtle point to this `KernelResult`. This is used to protect things like tiling, which might otherwise be removed by the simplifier because they're semantically redundant. This has no semantic effect and can be ignored at code generation.

Constructors

ResultNoSimplify | Don't simplify this one!
ResultMaySimplify | Go nuts.
ResultPrivate | The results produced are only used within the same physical thread later on, and can thus be kept in registers.

#### Instances

Instances details

Show ResultManifest Source # |
Instance details Defined in Futhark.IR.SegOp Methods showsPrec :: Int -> ResultManifest -> ShowS Source # show :: ResultManifest -> String Source # showList :: [ResultManifest] -> ShowS Source #
Eq ResultManifest Source # |
Instance details Defined in Futhark.IR.SegOp Methods (==) :: ResultManifest -> ResultManifest -> Bool Source # (/=) :: ResultManifest -> ResultManifest -> Bool Source #
Ord ResultManifest Source # |

Instance details

Defined in Futhark.IR.SegOp

Methods

compare :: ResultManifest -> ResultManifest -> Ordering Source #

(<) :: ResultManifest -> ResultManifest -> Bool Source #

(<=) :: ResultManifest -> ResultManifest -> Bool Source #

(>) :: ResultManifest -> ResultManifest -> Bool Source #

(>=) :: ResultManifest -> ResultManifest -> Bool Source #

max :: ResultManifest -> ResultManifest -> ResultManifest Source #

min :: ResultManifest -> ResultManifest -> ResultManifest Source #

data KernelResult Source #

A `KernelBody` does not return an ordinary `Result`. Instead, it returns a list of these.

Constructors

Returns ResultManifest Certs SubExp | Each "worker" in the kernel returns this. Whether this is a result-per-thread or a result-per-block depends on where the `SegOp` occurs.
WriteReturns Certs VName [(Slice SubExp, SubExp)] |
TileReturns Certs [(SubExp, SubExp)] VName |
RegTileReturns Certs [(SubExp, SubExp, SubExp)] VName |

#### Instances

Instances details

Show KernelResult Source # |
Instance details Defined in Futhark.IR.SegOp Methods showsPrec :: Int -> KernelResult -> ShowS Source # show :: KernelResult -> String Source # showList :: [KernelResult] -> ShowS Source #
FreeIn KernelResult Source # |
Instance details Defined in Futhark.IR.SegOp Methods freeIn' :: KernelResult -> FV Source #
Simplifiable KernelResult Source # |
Instance details Defined in Futhark.IR.SegOp Methods simplify :: SimplifiableRep rep => KernelResult -> SimpleM rep KernelResult Source #
Rename KernelResult Source # |
Instance details Defined in Futhark.IR.SegOp Methods rename :: KernelResult -> RenameM KernelResult Source #
Substitute KernelResult Source # |
Instance details Defined in Futhark.IR.SegOp Methods substituteNames :: Map VName VName -> KernelResult -> KernelResult Source #
Eq KernelResult Source # |
Instance details Defined in Futhark.IR.SegOp Methods (==) :: KernelResult -> KernelResult -> Bool Source # (/=) :: KernelResult -> KernelResult -> Bool Source #
Ord KernelResult Source # |

Instance details

Defined in Futhark.IR.SegOp

Methods

compare :: KernelResult -> KernelResult -> Ordering Source #

(<) :: KernelResult -> KernelResult -> Bool Source #

(<=) :: KernelResult -> KernelResult -> Bool Source #

(>) :: KernelResult -> KernelResult -> Bool Source #

(>=) :: KernelResult -> KernelResult -> Bool Source #

max :: KernelResult -> KernelResult -> KernelResult Source #

min :: KernelResult -> KernelResult -> KernelResult Source #

Pretty KernelResult Source # |
Instance details Defined in Futhark.IR.SegOp Methods pretty :: KernelResult -> Doc ann Source # prettyList :: [KernelResult] -> Doc ann Source #

kernelResultCerts :: KernelResult -> Certs Source #

Get the certs for this `KernelResult`.

kernelResultSubExp :: KernelResult -> SubExp Source #

Get the root `SubExp` corresponding values for a `KernelResult`.

## Generic traversal

data SegOpMapper lvl frep trep m Source #

Like `Mapper`, but just for `SegOp`s.

Constructors

SegOpMapper |

Fields

- mapOnSegOpSubExp :: SubExp -> m SubExp
- mapOnSegOpLambda :: Lambda frep -> m (Lambda trep)
- mapOnSegOpBody :: KernelBody frep -> m (KernelBody trep)
- mapOnSegOpVName :: VName -> m VName
- mapOnSegOpLevel :: lvl -> m lvl

identitySegOpMapper :: Monad m => SegOpMapper lvl rep rep m Source #

A mapper that simply returns the `SegOp` verbatim.

mapSegOpM :: Monad m => SegOpMapper lvl frep trep m -> SegOp lvl frep -> m (SegOp lvl trep) Source #

Apply a `SegOpMapper` to the given `SegOp`.

traverseSegOpStms :: Monad m => OpStmsTraverser m (SegOp lvl rep) rep Source #

A helper for defining `TraverseOpStms`.

# Simplification

simplifySegOp :: (SimplifiableRep rep, BodyDec rep ~ (), Simplifiable lvl) => SegOp lvl (Wise rep) -> SimpleM rep (SegOp lvl (Wise rep), Stms (Wise rep)) Source #

Simplify the given `SegOp`.

class HasSegOp rep where Source #

Does this rep contain `SegOp`s in its `Op`s? A rep must be an instance of this class for the simplification rules to work.

Associated Types

type SegOpLevel rep Source #

Methods

asSegOp :: Op rep -> Maybe (SegOp (SegOpLevel rep) rep) Source #

segOp :: SegOp (SegOpLevel rep) rep -> Op rep Source #

#### Instances

Instances details

HasSegOp GPU Source # |
Instance details Defined in Futhark.IR.GPU Associated Types type SegOpLevel GPU Source # Methods asSegOp :: Op GPU -> Maybe (SegOp (SegOpLevel GPU) GPU) Source # segOp :: SegOp (SegOpLevel GPU) GPU -> Op GPU Source #
HasSegOp MC Source # |
Instance details Defined in Futhark.IR.MC Associated Types type SegOpLevel MC Source # Methods asSegOp :: Op MC -> Maybe (SegOp (SegOpLevel MC) MC) Source # segOp :: SegOp (SegOpLevel MC) MC -> Op MC Source #
HasSegOp (Wise GPU) Source # |
Instance details Defined in Futhark.IR.GPU.Simplify Associated Types type SegOpLevel (Wise GPU) Source # Methods asSegOp :: Op (Wise GPU) -> Maybe (SegOp (SegOpLevel (Wise GPU)) (Wise GPU)) Source # segOp :: SegOp (SegOpLevel (Wise GPU)) (Wise GPU) -> Op (Wise GPU) Source #
HasSegOp (Wise MC) Source # |
Instance details Defined in Futhark.IR.MC Associated Types type SegOpLevel (Wise MC) Source # Methods asSegOp :: Op (Wise MC) -> Maybe (SegOp (SegOpLevel (Wise MC)) (Wise MC)) Source # segOp :: SegOp (SegOpLevel (Wise MC)) (Wise MC) -> Op (Wise MC) Source #

segOpRules :: (HasSegOp rep, BuilderOps rep, Buildable rep, Aliased rep) => RuleBook rep Source #

Simplification rules for simplifying `SegOp`s.

# Memory

segOpReturns :: (Mem rep inner, Monad m, HasScope rep m) => SegOp lvl rep -> m [ExpReturns] Source #

Like `segOpType`, but for memory representations.