futhark-0.24.3: An optimising compiler for a functional, array-oriented language.
Safe HaskellSafe-Inferred
LanguageHaskell2010

Futhark.IR.GPU.Op

Synopsis

Size operations

data SizeOp Source #

A simple size-level query or computation.

Constructors

GetSize Name SizeClass

Produce some runtime-configurable size.

GetSizeMax SizeClass

The maximum size of some class.

CmpSizeLe Name SizeClass SubExp

Compare size (likely a threshold) with some integer value.

CalcNumGroups SubExp Name SubExp

CalcNumGroups w max_num_groups group_size calculates the number of GPU workgroups to use for an input of the given size. The Name is a size name. Note that w is an i64 to avoid overflow issues.

Instances

Instances details
Show SizeOp Source # 
Instance details

Defined in Futhark.IR.GPU.Op

OpMetrics SizeOp Source # 
Instance details

Defined in Futhark.IR.GPU.Op

Methods

opMetrics :: SizeOp -> MetricsM () Source #

IsOp SizeOp Source # 
Instance details

Defined in Futhark.IR.GPU.Op

AliasedOp SizeOp Source # 
Instance details

Defined in Futhark.IR.GPU.Op

FreeIn SizeOp Source # 
Instance details

Defined in Futhark.IR.GPU.Op

Methods

freeIn' :: SizeOp -> FV Source #

TypedOp SizeOp Source # 
Instance details

Defined in Futhark.IR.GPU.Op

Methods

opType :: HasScope t m => SizeOp -> m [ExtType] Source #

Rename SizeOp Source # 
Instance details

Defined in Futhark.IR.GPU.Op

Substitute SizeOp Source # 
Instance details

Defined in Futhark.IR.GPU.Op

Eq SizeOp Source # 
Instance details

Defined in Futhark.IR.GPU.Op

Methods

(==) :: SizeOp -> SizeOp -> Bool #

(/=) :: SizeOp -> SizeOp -> Bool #

Ord SizeOp Source # 
Instance details

Defined in Futhark.IR.GPU.Op

Pretty SizeOp Source # 
Instance details

Defined in Futhark.IR.GPU.Op

Methods

pretty :: SizeOp -> Doc ann #

prettyList :: [SizeOp] -> Doc ann #

Host operations

data HostOp op rep Source #

A host-level operation; parameterised by what else it can do.

Constructors

SegOp (SegOp SegLevel rep)

A segmented operation.

SizeOp SizeOp 
OtherOp (op rep) 
GPUBody [Type] (Body rep)

Code to run sequentially on the GPU, in a single thread.

Instances

Instances details
CanBeAliased op => CanBeAliased (HostOp op) Source # 
Instance details

Defined in Futhark.IR.GPU.Op

Methods

addOpAliases :: AliasableRep rep => AliasTable -> HostOp op rep -> HostOp op (Aliases rep) Source #

RephraseOp op => RephraseOp (HostOp op) Source # 
Instance details

Defined in Futhark.IR.GPU.Op

Methods

rephraseInOp :: Monad m => Rephraser m from to -> HostOp op from -> m (HostOp op to) Source #

CanBeWise op => CanBeWise (HostOp op) Source # 
Instance details

Defined in Futhark.IR.GPU.Op

Methods

addOpWisdom :: Informing rep => HostOp op rep -> HostOp op (Wise rep) Source #

(RepTypes rep, Show (op rep)) => Show (HostOp op rep) Source # 
Instance details

Defined in Futhark.IR.GPU.Op

Methods

showsPrec :: Int -> HostOp op rep -> ShowS #

show :: HostOp op rep -> String #

showList :: [HostOp op rep] -> ShowS #

(OpMetrics (Op rep), OpMetrics (op rep)) => OpMetrics (HostOp op rep) Source # 
Instance details

Defined in Futhark.IR.GPU.Op

Methods

opMetrics :: HostOp op rep -> MetricsM () Source #

(ASTRep rep, IndexOp (op rep)) => IndexOp (HostOp op rep) Source # 
Instance details

Defined in Futhark.IR.GPU.Op

Methods

indexOp :: (ASTRep rep0, IndexOp (Op rep0)) => SymbolTable rep0 -> Int -> HostOp op rep -> [TPrimExp Int64 VName] -> Maybe Indexed Source #

OpReturns (HostOp (NoOp :: Type -> Type) GPUMem) Source # 
Instance details

Defined in Futhark.IR.GPUMem

Methods

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

OpReturns (HostOp (NoOp :: Type -> Type) (Wise GPUMem)) Source # 
Instance details

Defined in Futhark.IR.GPUMem

Methods

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

(ASTRep rep, IsOp (op rep)) => IsOp (HostOp op rep) Source # 
Instance details

Defined in Futhark.IR.GPU.Op

Methods

safeOp :: HostOp op rep -> Bool Source #

cheapOp :: HostOp op rep -> Bool Source #

(Aliased rep, AliasedOp (op rep)) => AliasedOp (HostOp op rep) Source # 
Instance details

Defined in Futhark.IR.GPU.Op

Methods

opAliases :: HostOp op rep -> [Names] Source #

consumedInOp :: HostOp op rep -> Names Source #

(ASTRep rep, FreeIn (op rep)) => FreeIn (HostOp op rep) Source # 
Instance details

Defined in Futhark.IR.GPU.Op

Methods

freeIn' :: HostOp op rep -> FV Source #

TypedOp (op rep) => TypedOp (HostOp op rep) Source # 
Instance details

Defined in Futhark.IR.GPU.Op

Methods

opType :: HasScope t m => HostOp op rep -> m [ExtType] Source #

TopDownHelper (HostOp (NoOp :: Type -> Type) (Aliases GPUMem)) Source # 
Instance details

Defined in Futhark.Optimise.ArrayShortCircuiting.TopdownAnalysis

(Aliased rep, CSEInOp (Op rep), CSEInOp (op rep)) => CSEInOp (HostOp op rep) Source # 
Instance details

Defined in Futhark.Optimise.CSE

Methods

cseInOp :: HostOp op rep -> CSEM rep0 (HostOp op rep)

SizeSubst (HostOp rep op) Source # 
Instance details

Defined in Futhark.Pass.ExplicitAllocations.GPU

Methods

opIsConst :: HostOp rep op -> Bool Source #

(ASTRep rep, Rename (op rep)) => Rename (HostOp op rep) Source # 
Instance details

Defined in Futhark.IR.GPU.Op

Methods

rename :: HostOp op rep -> RenameM (HostOp op rep) Source #

(ASTRep rep, Substitute (op rep)) => Substitute (HostOp op rep) Source # 
Instance details

Defined in Futhark.IR.GPU.Op

Methods

substituteNames :: Map VName VName -> HostOp op rep -> HostOp op rep Source #

(RepTypes rep, Eq (op rep)) => Eq (HostOp op rep) Source # 
Instance details

Defined in Futhark.IR.GPU.Op

Methods

(==) :: HostOp op rep -> HostOp op rep -> Bool #

(/=) :: HostOp op rep -> HostOp op rep -> Bool #

(RepTypes rep, Ord (op rep)) => Ord (HostOp op rep) Source # 
Instance details

Defined in Futhark.IR.GPU.Op

Methods

compare :: HostOp op rep -> HostOp op rep -> Ordering #

(<) :: HostOp op rep -> HostOp op rep -> Bool #

(<=) :: HostOp op rep -> HostOp op rep -> Bool #

(>) :: HostOp op rep -> HostOp op rep -> Bool #

(>=) :: HostOp op rep -> HostOp op rep -> Bool #

max :: HostOp op rep -> HostOp op rep -> HostOp op rep #

min :: HostOp op rep -> HostOp op rep -> HostOp op rep #

(PrettyRep rep, Pretty (op rep)) => Pretty (HostOp op rep) Source # 
Instance details

Defined in Futhark.IR.GPU.Op

Methods

pretty :: HostOp op rep -> Doc ann #

prettyList :: [HostOp op rep] -> Doc ann #

traverseHostOpStms :: Monad m => OpStmsTraverser m (op rep) rep -> OpStmsTraverser m (HostOp op rep) rep Source #

A helper for defining TraverseOpStms.

typeCheckHostOp :: Checkable rep => (SegLevel -> Op (Aliases rep) -> TypeM rep ()) -> Maybe SegLevel -> (op (Aliases rep) -> TypeM rep ()) -> HostOp op (Aliases rep) -> TypeM rep () Source #

SegOp refinements

data SegLevel Source #

At which level the *body* of a SegOp executes.

Instances

Instances details
Show SegLevel Source # 
Instance details

Defined in Futhark.IR.GPU.Op

FreeIn SegLevel Source # 
Instance details

Defined in Futhark.IR.GPU.Op

Methods

freeIn' :: SegLevel -> FV Source #

Simplifiable SegLevel Source # 
Instance details

Defined in Futhark.IR.GPU.Op

Rename SegLevel Source # 
Instance details

Defined in Futhark.IR.GPU.Op

Substitute SegLevel Source # 
Instance details

Defined in Futhark.IR.GPU.Op

Eq SegLevel Source # 
Instance details

Defined in Futhark.IR.GPU.Op

Ord SegLevel Source # 
Instance details

Defined in Futhark.IR.GPU.Op

Pretty SegLevel Source # 
Instance details

Defined in Futhark.IR.GPU.Op

Methods

pretty :: SegLevel -> Doc ann #

prettyList :: [SegLevel] -> Doc ann #

data SegVirt Source #

Do we need group-virtualisation when generating code for the segmented operation? In most cases, we do, but for some simple kernels, we compute the full number of groups in advance, and then virtualisation is an unnecessary (but generally very small) overhead. This only really matters for fairly trivial but very wide map kernels where each thread performs constant-time work on scalars.

Constructors

SegVirt 
SegNoVirt 
SegNoVirtFull SegSeqDims

Not only do we not need virtualisation, but we _guarantee_ that all physical threads participate in the work. This can save some checks in code generation.

Instances

Instances details
Show SegVirt Source # 
Instance details

Defined in Futhark.IR.GPU.Op

Eq SegVirt Source # 
Instance details

Defined in Futhark.IR.GPU.Op

Methods

(==) :: SegVirt -> SegVirt -> Bool #

(/=) :: SegVirt -> SegVirt -> Bool #

Ord SegVirt Source # 
Instance details

Defined in Futhark.IR.GPU.Op

Pretty SegVirt Source # 
Instance details

Defined in Futhark.IR.GPU.Op

Methods

pretty :: SegVirt -> Doc ann #

prettyList :: [SegVirt] -> Doc ann #

newtype SegSeqDims Source #

These dimensions (indexed from 0, outermost) of the corresponding SegSpace should not be parallelised, but instead iterated sequentially. For example, with a SegSeqDims of [0] and a SegSpace with dimensions [n][m], there will be an outer loop with n iterations, while the m dimension will be parallelised.

Semantically, this has no effect, but it may allow reductions in memory usage or other low-level optimisations. Operationally, the guarantee is that for a SegSeqDims of e.g. [i,j,k], threads running at any given moment will always have the same indexes along the dimensions specified by [i,j,k].

At the moment, this is only supported for SegNoVirtFull intra-group parallelism in GPU code, as we have not yet found it useful anywhere else.

Constructors

SegSeqDims 

Fields

data KernelGrid Source #

The actual, physical grid dimensions used for the GPU kernel running this HostOp.

Reexports