futhark-0.18.3: An optimising compiler for a functional, array-oriented language.
Safe HaskellNone
LanguageHaskell2010

Futhark.IR.Kernels.Kernel

Synopsis

Size operations

data SizeOp Source #

A simple size-level query or computation.

Constructors

SplitSpace SplitOrdering SubExp SubExp SubExp

SplitSpace o w i elems_per_thread.

Computes how to divide array elements to threads in a kernel. Returns the number of elements in the chunk that the current thread should take.

w is the length of the outer dimension in the array. i is the current thread index. Each thread takes at most elems_per_thread elements.

If the order o is SplitContiguous, thread with index i should receive elements i*elems_per_tread, i*elems_per_thread + 1, ..., i*elems_per_thread + (elems_per_thread-1).

If the order o is SplitStrided stride, the thread will receive elements i, i+stride, i+2*stride, ..., i+(elems_per_thread-1)*stride.

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
Eq SizeOp Source # 
Instance details

Defined in Futhark.IR.Kernels.Kernel

Methods

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

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

Ord SizeOp Source # 
Instance details

Defined in Futhark.IR.Kernels.Kernel

Show SizeOp Source # 
Instance details

Defined in Futhark.IR.Kernels.Kernel

Generic SizeOp Source # 
Instance details

Defined in Futhark.IR.Kernels.Kernel

Associated Types

type Rep SizeOp :: Type -> Type #

Methods

from :: SizeOp -> Rep SizeOp x #

to :: Rep SizeOp x -> SizeOp #

Pretty SizeOp Source # 
Instance details

Defined in Futhark.IR.Kernels.Kernel

Methods

ppr :: SizeOp -> Doc #

pprPrec :: Int -> SizeOp -> Doc #

pprList :: [SizeOp] -> Doc #

SexpIso SizeOp Source # 
Instance details

Defined in Futhark.IR.Kernels.Kernel

TypedOp SizeOp Source # 
Instance details

Defined in Futhark.IR.Kernels.Kernel

Methods

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

FreeIn SizeOp Source # 
Instance details

Defined in Futhark.IR.Kernels.Kernel

Methods

freeIn' :: SizeOp -> FV Source #

Substitute SizeOp Source # 
Instance details

Defined in Futhark.IR.Kernels.Kernel

Rename SizeOp Source # 
Instance details

Defined in Futhark.IR.Kernels.Kernel

IsOp SizeOp Source # 
Instance details

Defined in Futhark.IR.Kernels.Kernel

AliasedOp SizeOp Source # 
Instance details

Defined in Futhark.IR.Kernels.Kernel

OpMetrics SizeOp Source # 
Instance details

Defined in Futhark.IR.Kernels.Kernel

Methods

opMetrics :: SizeOp -> MetricsM () Source #

type Rep SizeOp Source # 
Instance details

Defined in Futhark.IR.Kernels.Kernel

type Rep SizeOp = D1 ('MetaData "SizeOp" "Futhark.IR.Kernels.Kernel" "futhark-0.18.3-inplace" 'False) ((C1 ('MetaCons "SplitSpace" 'PrefixI 'False) ((S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 SplitOrdering) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 SubExp)) :*: (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 SubExp) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 SubExp))) :+: C1 ('MetaCons "GetSize" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Name) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 SizeClass))) :+: (C1 ('MetaCons "GetSizeMax" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 SizeClass)) :+: (C1 ('MetaCons "CmpSizeLe" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Name) :*: (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 SizeClass) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 SubExp))) :+: C1 ('MetaCons "CalcNumGroups" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 SubExp) :*: (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Name) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 SubExp))))))

Host operations

data HostOp lore op Source #

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

Constructors

SegOp (SegOp SegLevel lore)

A segmented operation.

SizeOp SizeOp 
OtherOp op 

Instances

Instances details
(Decorations lore, Eq op) => Eq (HostOp lore op) Source # 
Instance details

Defined in Futhark.IR.Kernels.Kernel

Methods

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

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

(Decorations lore, Ord op) => Ord (HostOp lore op) Source # 
Instance details

Defined in Futhark.IR.Kernels.Kernel

Methods

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

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

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

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

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

max :: HostOp lore op -> HostOp lore op -> HostOp lore op #

min :: HostOp lore op -> HostOp lore op -> HostOp lore op #

(Decorations lore, Show op) => Show (HostOp lore op) Source # 
Instance details

Defined in Futhark.IR.Kernels.Kernel

Methods

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

show :: HostOp lore op -> String #

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

Generic (HostOp lore op) Source # 
Instance details

Defined in Futhark.IR.Kernels.Kernel

Associated Types

type Rep (HostOp lore op) :: Type -> Type #

Methods

from :: HostOp lore op -> Rep (HostOp lore op) x #

to :: Rep (HostOp lore op) x -> HostOp lore op #

(PrettyLore lore, Pretty op) => Pretty (HostOp lore op) Source # 
Instance details

Defined in Futhark.IR.Kernels.Kernel

Methods

ppr :: HostOp lore op -> Doc #

pprPrec :: Int -> HostOp lore op -> Doc #

pprList :: [HostOp lore op] -> Doc #

(SexpIso op, Decorations lore) => SexpIso (HostOp lore op) Source # 
Instance details

Defined in Futhark.IR.Kernels.Kernel

Methods

sexpIso :: SexpGrammar (HostOp lore op) #

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

Defined in Futhark.IR.Kernels.Kernel

Methods

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

(ASTLore lore, FreeIn op) => FreeIn (HostOp lore op) Source # 
Instance details

Defined in Futhark.IR.Kernels.Kernel

Methods

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

(ASTLore lore, Substitute op) => Substitute (HostOp lore op) Source # 
Instance details

Defined in Futhark.IR.Kernels.Kernel

Methods

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

(ASTLore lore, Rename op) => Rename (HostOp lore op) Source # 
Instance details

Defined in Futhark.IR.Kernels.Kernel

Methods

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

(ASTLore lore, IsOp op) => IsOp (HostOp lore op) Source # 
Instance details

Defined in Futhark.IR.Kernels.Kernel

Methods

safeOp :: HostOp lore op -> Bool Source #

cheapOp :: HostOp lore op -> Bool Source #

(CanBeAliased (Op lore), CanBeAliased op, ASTLore lore) => CanBeAliased (HostOp lore op) Source # 
Instance details

Defined in Futhark.IR.Kernels.Kernel

Associated Types

type OpWithAliases (HostOp lore op) Source #

Methods

removeOpAliases :: OpWithAliases (HostOp lore op) -> HostOp lore op Source #

addOpAliases :: HostOp lore op -> OpWithAliases (HostOp lore op) Source #

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

Defined in Futhark.IR.Kernels.Kernel

Methods

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

consumedInOp :: HostOp lore op -> Names Source #

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

Defined in Futhark.IR.Kernels.Kernel

Methods

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

(CanBeWise (Op lore), CanBeWise op, ASTLore lore) => CanBeWise (HostOp lore op) Source # 
Instance details

Defined in Futhark.IR.Kernels.Kernel

Associated Types

type OpWithWisdom (HostOp lore op) Source #

Methods

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

(ASTLore lore, IndexOp op) => IndexOp (HostOp lore op) Source # 
Instance details

Defined in Futhark.IR.Kernels.Kernel

Methods

indexOp :: (ASTLore lore0, IndexOp (Op lore0)) => SymbolTable lore0 -> Int -> HostOp lore op -> [TPrimExp Int64 VName] -> Maybe Indexed Source #

SizeSubst (HostOp lore op) Source # 
Instance details

Defined in Futhark.Pass.ExplicitAllocations.Kernels

Methods

opSizeSubst :: PatternT dec -> HostOp lore op -> ChunkMap Source #

opIsConst :: HostOp lore op -> Bool Source #

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

Defined in Futhark.Optimise.CSE

Methods

cseInOp :: HostOp lore op -> CSEM lore0 (HostOp lore op)

type Rep (HostOp lore op) Source # 
Instance details

Defined in Futhark.IR.Kernels.Kernel

type OpWithAliases (HostOp lore op) Source # 
Instance details

Defined in Futhark.IR.Kernels.Kernel

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

Defined in Futhark.IR.Kernels.Kernel

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

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

SegOp refinements

data SegLevel Source #

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

Instances

Instances details
Eq SegLevel Source # 
Instance details

Defined in Futhark.IR.Kernels.Kernel

Ord SegLevel Source # 
Instance details

Defined in Futhark.IR.Kernels.Kernel

Show SegLevel Source # 
Instance details

Defined in Futhark.IR.Kernels.Kernel

Generic SegLevel Source # 
Instance details

Defined in Futhark.IR.Kernels.Kernel

Associated Types

type Rep SegLevel :: Type -> Type #

Methods

from :: SegLevel -> Rep SegLevel x #

to :: Rep SegLevel x -> SegLevel #

Pretty SegLevel Source # 
Instance details

Defined in Futhark.IR.Kernels.Kernel

Methods

ppr :: SegLevel -> Doc #

pprPrec :: Int -> SegLevel -> Doc #

pprList :: [SegLevel] -> Doc #

SexpIso SegLevel Source # 
Instance details

Defined in Futhark.IR.Kernels.Kernel

FreeIn SegLevel Source # 
Instance details

Defined in Futhark.IR.Kernels.Kernel

Methods

freeIn' :: SegLevel -> FV Source #

Substitute SegLevel Source # 
Instance details

Defined in Futhark.IR.Kernels.Kernel

Rename SegLevel Source # 
Instance details

Defined in Futhark.IR.Kernels.Kernel

Simplifiable SegLevel Source # 
Instance details

Defined in Futhark.IR.Kernels.Kernel

type Rep SegLevel Source # 
Instance details

Defined in Futhark.IR.Kernels.Kernel

Reexports