futhark-0.22.4: 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 :: forall {k} (t :: k) m. 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 rep op Source #

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

Constructors

SegOp (SegOp SegLevel rep)

A segmented operation.

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

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

Instances

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

Defined in Futhark.IR.GPU.Op

Methods

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

show :: HostOp rep op -> String #

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

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

Defined in Futhark.IR.GPU.Op

Methods

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

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

Defined in Futhark.IR.GPU.Op

Methods

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

OpReturns (HostOp GPUMem ()) Source # 
Instance details

Defined in Futhark.IR.GPUMem

Methods

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

OpReturns (HostOp (Wise GPUMem) ()) Source # 
Instance details

Defined in Futhark.IR.GPUMem

Methods

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

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

Defined in Futhark.IR.GPU.Op

Methods

safeOp :: HostOp rep op -> Bool Source #

cheapOp :: HostOp rep op -> Bool Source #

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

Defined in Futhark.IR.GPU.Op

Methods

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

consumedInOp :: HostOp rep op -> Names Source #

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

Defined in Futhark.IR.GPU.Op

Associated Types

type OpWithAliases (HostOp rep op) Source #

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

Defined in Futhark.IR.GPU.Op

Methods

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

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

Defined in Futhark.IR.GPU.Op

Methods

opType :: forall {k} (t :: k) m. HasScope t m => HostOp rep op -> m [ExtType] Source #

CreatesNewArrOp inner => CreatesNewArrOp (HostOp (Aliases GPUMem) inner) Source # 
Instance details

Defined in Futhark.Optimise.ArrayShortCircuiting.DataStructs

TopDownHelper (HostOp (Aliases GPUMem) ()) Source # 
Instance details

Defined in Futhark.Optimise.ArrayShortCircuiting.TopdownAnalysis

Methods

innerNonNegatives :: [VName] -> HostOp (Aliases GPUMem) () -> Names

innerKnownLessThan :: HostOp (Aliases GPUMem) () -> [(VName, PrimExp VName)]

scopeHelper :: forall {k} (rep :: k). HostOp (Aliases GPUMem) () -> Scope rep

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

Defined in Futhark.Optimise.CSE

Methods

cseInOp :: forall {k} (rep0 :: k). HostOp rep op -> CSEM rep0 (HostOp rep op)

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

Defined in Futhark.IR.GPU.Op

Associated Types

type OpWithWisdom (HostOp rep op) Source #

Methods

removeOpWisdom :: OpWithWisdom (HostOp rep op) -> HostOp rep op Source #

addOpWisdom :: HostOp rep op -> OpWithWisdom (HostOp rep op) Source #

SizeSubst (HostOp rep op) Source # 
Instance details

Defined in Futhark.Pass.ExplicitAllocations.GPU

Methods

opIsConst :: HostOp rep op -> Bool Source #

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

Defined in Futhark.IR.GPU.Op

Methods

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

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

Defined in Futhark.IR.GPU.Op

Methods

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

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

Defined in Futhark.IR.GPU.Op

Methods

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

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

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

Defined in Futhark.IR.GPU.Op

Methods

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

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

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

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

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

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

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

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

Defined in Futhark.IR.GPU.Op

Methods

pretty :: HostOp rep op -> Doc ann #

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

type OpWithAliases (HostOp rep op) Source # 
Instance details

Defined in Futhark.IR.GPU.Op

type OpWithAliases (HostOp rep op) = HostOp (Aliases rep) (OpWithAliases op)
type OpWithWisdom (HostOp rep op) Source # 
Instance details

Defined in Futhark.IR.GPU.Op

type OpWithWisdom (HostOp rep op) = HostOp (Wise rep) (OpWithWisdom op)

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

A helper for defining TraverseOpStms.

typeCheckHostOp :: Checkable rep => (SegLevel -> OpWithAliases (Op rep) -> TypeM rep ()) -> Maybe SegLevel -> (op -> TypeM rep ()) -> HostOp (Aliases rep) op -> 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

Methods

simplify :: forall {k} (rep :: k). SimplifiableRep rep => SegLevel -> SimpleM rep SegLevel Source #

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.

Instances

Instances details
Show KernelGrid Source # 
Instance details

Defined in Futhark.IR.GPU.Op

FreeIn KernelGrid Source # 
Instance details

Defined in Futhark.IR.GPU.Op

Simplifiable KernelGrid Source # 
Instance details

Defined in Futhark.IR.GPU.Op

Methods

simplify :: forall {k} (rep :: k). SimplifiableRep rep => KernelGrid -> SimpleM rep KernelGrid Source #

Substitute KernelGrid Source # 
Instance details

Defined in Futhark.IR.GPU.Op

Eq KernelGrid Source # 
Instance details

Defined in Futhark.IR.GPU.Op

Ord KernelGrid Source # 
Instance details

Defined in Futhark.IR.GPU.Op

Pretty KernelGrid Source # 
Instance details

Defined in Futhark.IR.GPU.Op

Methods

pretty :: KernelGrid -> Doc ann #

prettyList :: [KernelGrid] -> Doc ann #

Reexports