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

Futhark.Representation.Kernels.Kernel

Synopsis

Documentation

data HistOp lore Source #

Constructors

HistOp 

Fields

Instances

Instances details
Annotations lore => Eq (HistOp lore) Source # 
Instance details

Defined in Futhark.Representation.Kernels.Kernel

Methods

(==) :: HistOp lore -> HistOp lore -> Bool #

(/=) :: HistOp lore -> HistOp lore -> Bool #

Annotations lore => Ord (HistOp lore) Source # 
Instance details

Defined in Futhark.Representation.Kernels.Kernel

Methods

compare :: HistOp lore -> HistOp lore -> Ordering #

(<) :: HistOp lore -> HistOp lore -> Bool #

(<=) :: HistOp lore -> HistOp lore -> Bool #

(>) :: HistOp lore -> HistOp lore -> Bool #

(>=) :: HistOp lore -> HistOp lore -> Bool #

max :: HistOp lore -> HistOp lore -> HistOp lore #

min :: HistOp lore -> HistOp lore -> HistOp lore #

Annotations lore => Show (HistOp lore) Source # 
Instance details

Defined in Futhark.Representation.Kernels.Kernel

Methods

showsPrec :: Int -> HistOp lore -> ShowS #

show :: HistOp lore -> String #

showList :: [HistOp lore] -> ShowS #

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

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

data SegRedOp lore Source #

Constructors

SegRedOp 

Fields

Instances

Instances details
Annotations lore => Eq (SegRedOp lore) Source # 
Instance details

Defined in Futhark.Representation.Kernels.Kernel

Methods

(==) :: SegRedOp lore -> SegRedOp lore -> Bool #

(/=) :: SegRedOp lore -> SegRedOp lore -> Bool #

Annotations lore => Ord (SegRedOp lore) Source # 
Instance details

Defined in Futhark.Representation.Kernels.Kernel

Methods

compare :: SegRedOp lore -> SegRedOp lore -> Ordering #

(<) :: SegRedOp lore -> SegRedOp lore -> Bool #

(<=) :: SegRedOp lore -> SegRedOp lore -> Bool #

(>) :: SegRedOp lore -> SegRedOp lore -> Bool #

(>=) :: SegRedOp lore -> SegRedOp lore -> Bool #

max :: SegRedOp lore -> SegRedOp lore -> SegRedOp lore #

min :: SegRedOp lore -> SegRedOp lore -> SegRedOp lore #

Annotations lore => Show (SegRedOp lore) Source # 
Instance details

Defined in Futhark.Representation.Kernels.Kernel

Methods

showsPrec :: Int -> SegRedOp lore -> ShowS #

show :: SegRedOp lore -> String #

showList :: [SegRedOp lore] -> ShowS #

segRedResults :: [SegRedOp lore] -> Int Source #

How many reduction results are produced by these SegRedOps?

data KernelBody lore Source #

The body of a Kernel.

Instances

Instances details
Annotations lore => Eq (KernelBody lore) Source # 
Instance details

Defined in Futhark.Representation.Kernels.Kernel

Methods

(==) :: KernelBody lore -> KernelBody lore -> Bool #

(/=) :: KernelBody lore -> KernelBody lore -> Bool #

Annotations lore => Ord (KernelBody lore) Source # 
Instance details

Defined in Futhark.Representation.Kernels.Kernel

Methods

compare :: KernelBody lore -> KernelBody lore -> Ordering #

(<) :: KernelBody lore -> KernelBody lore -> Bool #

(<=) :: KernelBody lore -> KernelBody lore -> Bool #

(>) :: KernelBody lore -> KernelBody lore -> Bool #

(>=) :: KernelBody lore -> KernelBody lore -> Bool #

max :: KernelBody lore -> KernelBody lore -> KernelBody lore #

min :: KernelBody lore -> KernelBody lore -> KernelBody lore #

Annotations lore => Show (KernelBody lore) Source # 
Instance details

Defined in Futhark.Representation.Kernels.Kernel

Methods

showsPrec :: Int -> KernelBody lore -> ShowS #

show :: KernelBody lore -> String #

showList :: [KernelBody lore] -> ShowS #

PrettyLore lore => Pretty (KernelBody lore) Source # 
Instance details

Defined in Futhark.Representation.Kernels.Kernel

Methods

ppr :: KernelBody lore -> Doc

pprPrec :: Int -> KernelBody lore -> Doc

pprList :: [KernelBody lore] -> Doc

Attributes lore => FreeIn (KernelBody lore) Source # 
Instance details

Defined in Futhark.Representation.Kernels.Kernel

Methods

freeIn' :: KernelBody lore -> FV Source #

Attributes lore => Substitute (KernelBody lore) Source # 
Instance details

Defined in Futhark.Representation.Kernels.Kernel

Attributes lore => Rename (KernelBody lore) Source # 
Instance details

Defined in Futhark.Representation.Kernels.Kernel

Methods

rename :: KernelBody lore -> RenameM (KernelBody lore) Source #

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.

data KernelResult Source #

Constructors

Returns ResultManifest SubExp

Each "worker" in the kernel returns this. Whether this is a result-per-thread or a result-per-group depends on the SegLevel.

WriteReturns [SubExp] VName [([SubExp], SubExp)] 
ConcatReturns SplitOrdering SubExp SubExp VName 
TileReturns [(SubExp, SubExp)] VName 

Instances

Instances details
Eq KernelResult Source # 
Instance details

Defined in Futhark.Representation.Kernels.Kernel

Ord KernelResult Source # 
Instance details

Defined in Futhark.Representation.Kernels.Kernel

Show KernelResult Source # 
Instance details

Defined in Futhark.Representation.Kernels.Kernel

Pretty KernelResult Source # 
Instance details

Defined in Futhark.Representation.Kernels.Kernel

FreeIn KernelResult Source # 
Instance details

Defined in Futhark.Representation.Kernels.Kernel

Substitute KernelResult Source # 
Instance details

Defined in Futhark.Representation.Kernels.Kernel

Rename KernelResult Source # 
Instance details

Defined in Futhark.Representation.Kernels.Kernel

Simplifiable KernelResult Source # 
Instance details

Defined in Futhark.Representation.Kernels.Simplify

data SplitOrdering Source #

How an array is split into chunks.

Instances

Instances details
Eq SplitOrdering Source # 
Instance details

Defined in Futhark.Representation.Kernels.Kernel

Ord SplitOrdering Source # 
Instance details

Defined in Futhark.Representation.Kernels.Kernel

Show SplitOrdering Source # 
Instance details

Defined in Futhark.Representation.Kernels.Kernel

FreeIn SplitOrdering Source # 
Instance details

Defined in Futhark.Representation.Kernels.Kernel

Substitute SplitOrdering Source # 
Instance details

Defined in Futhark.Representation.Kernels.Kernel

Rename SplitOrdering Source # 
Instance details

Defined in Futhark.Representation.Kernels.Kernel

Simplifiable SplitOrdering Source # 
Instance details

Defined in Futhark.Representation.Kernels.Simplify

Segmented operations

data SegOp lore Source #

Constructors

SegMap SegLevel SegSpace [Type] (KernelBody lore) 
SegRed SegLevel SegSpace [SegRedOp lore] [Type] (KernelBody lore)

The KernelSpace must always have at least two dimensions, implying that the result of a SegRed is always an array.

SegScan SegLevel SegSpace (Lambda lore) [SubExp] [Type] (KernelBody lore) 
SegHist SegLevel SegSpace [HistOp lore] [Type] (KernelBody lore) 

Instances

Instances details
Annotations lore => Eq (SegOp lore) Source # 
Instance details

Defined in Futhark.Representation.Kernels.Kernel

Methods

(==) :: SegOp lore -> SegOp lore -> Bool #

(/=) :: SegOp lore -> SegOp lore -> Bool #

Annotations lore => Ord (SegOp lore) Source # 
Instance details

Defined in Futhark.Representation.Kernels.Kernel

Methods

compare :: SegOp lore -> SegOp lore -> Ordering #

(<) :: SegOp lore -> SegOp lore -> Bool #

(<=) :: SegOp lore -> SegOp lore -> Bool #

(>) :: SegOp lore -> SegOp lore -> Bool #

(>=) :: SegOp lore -> SegOp lore -> Bool #

max :: SegOp lore -> SegOp lore -> SegOp lore #

min :: SegOp lore -> SegOp lore -> SegOp lore #

Annotations lore => Show (SegOp lore) Source # 
Instance details

Defined in Futhark.Representation.Kernels.Kernel

Methods

showsPrec :: Int -> SegOp lore -> ShowS #

show :: SegOp lore -> String #

showList :: [SegOp lore] -> ShowS #

PrettyLore lore => Pretty (SegOp lore) Source # 
Instance details

Defined in Futhark.Representation.Kernels.Kernel

Methods

ppr :: SegOp lore -> Doc

pprPrec :: Int -> SegOp lore -> Doc

pprList :: [SegOp lore] -> Doc

TypedOp (SegOp lore) Source # 
Instance details

Defined in Futhark.Representation.Kernels.Kernel

Methods

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

(Attributes lore, FreeIn (LParamAttr lore)) => FreeIn (SegOp lore) Source # 
Instance details

Defined in Futhark.Representation.Kernels.Kernel

Methods

freeIn' :: SegOp lore -> FV Source #

Attributes lore => Substitute (SegOp lore) Source # 
Instance details

Defined in Futhark.Representation.Kernels.Kernel

Methods

substituteNames :: Map VName VName -> SegOp lore -> SegOp lore Source #

Attributes lore => Rename (SegOp lore) Source # 
Instance details

Defined in Futhark.Representation.Kernels.Kernel

Methods

rename :: SegOp lore -> RenameM (SegOp lore) Source #

Attributes lore => IsOp (SegOp lore) Source # 
Instance details

Defined in Futhark.Representation.Kernels.Kernel

Methods

safeOp :: SegOp lore -> Bool Source #

cheapOp :: SegOp lore -> Bool Source #

(Attributes lore, Attributes (Aliases lore), CanBeAliased (Op lore)) => CanBeAliased (SegOp lore) Source # 
Instance details

Defined in Futhark.Representation.Kernels.Kernel

Associated Types

type OpWithAliases (SegOp lore) Source #

(Attributes lore, Aliased lore) => AliasedOp (SegOp lore) Source # 
Instance details

Defined in Futhark.Representation.Kernels.Kernel

Methods

opAliases :: SegOp lore -> [Names] Source #

consumedInOp :: SegOp lore -> Names Source #

OpMetrics (Op lore) => OpMetrics (SegOp lore) Source # 
Instance details

Defined in Futhark.Representation.Kernels.Kernel

Methods

opMetrics :: SegOp lore -> MetricsM () Source #

(Attributes lore, CanBeRanged (Op lore)) => CanBeRanged (SegOp lore) Source # 
Instance details

Defined in Futhark.Representation.Kernels.Kernel

Associated Types

type OpWithRanges (SegOp lore) Source #

Attributes inner => RangedOp (SegOp inner) Source # 
Instance details

Defined in Futhark.Representation.Kernels.Kernel

Methods

opRanges :: SegOp inner -> [Range] Source #

(CanBeWise (Op lore), Attributes lore) => CanBeWise (SegOp lore) Source # 
Instance details

Defined in Futhark.Representation.Kernels.Kernel

Associated Types

type OpWithWisdom (SegOp lore) Source #

Methods

removeOpWisdom :: OpWithWisdom (SegOp lore) -> SegOp lore Source #

Attributes lore => IndexOp (SegOp lore) Source # 
Instance details

Defined in Futhark.Representation.Kernels.Kernel

Methods

indexOp :: (Attributes lore0, IndexOp (Op lore0)) => SymbolTable lore0 -> Int -> SegOp lore -> [PrimExp VName] -> Maybe Indexed Source #

(Attributes lore, Aliased lore, CSEInOp (Op lore)) => CSEInOp (SegOp lore) Source # 
Instance details

Defined in Futhark.Optimise.CSE

Methods

cseInOp :: SegOp lore -> CSEM lore0 (SegOp lore)

type OpWithAliases (SegOp lore) Source # 
Instance details

Defined in Futhark.Representation.Kernels.Kernel

type OpWithAliases (SegOp lore) = SegOp (Aliases lore)
type OpWithRanges (SegOp lore) Source # 
Instance details

Defined in Futhark.Representation.Kernels.Kernel

type OpWithRanges (SegOp lore) = SegOp (Ranges lore)
type OpWithWisdom (SegOp lore) Source # 
Instance details

Defined in Futhark.Representation.Kernels.Kernel

type OpWithWisdom (SegOp lore) = SegOp (Wise lore)

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 

Instances

Instances details
Eq SegVirt Source # 
Instance details

Defined in Futhark.Representation.Kernels.Kernel

Methods

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

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

Ord SegVirt Source # 
Instance details

Defined in Futhark.Representation.Kernels.Kernel

Show SegVirt Source # 
Instance details

Defined in Futhark.Representation.Kernels.Kernel

typeCheckSegOp :: Checkable lore => Maybe SegLevel -> SegOp (Aliases lore) -> TypeM lore () Source #

data SegSpace Source #

Index space of a SegOp.

Constructors

SegSpace 

Fields

Generic traversal

data SegOpMapper flore tlore m Source #

Like Mapper, but just for SegOps.

Constructors

SegOpMapper 

Fields

identitySegOpMapper :: Monad m => SegOpMapper lore lore m Source #

A mapper that simply returns the SegOp verbatim.

mapSegOpM :: (Applicative m, Monad m) => SegOpMapper flore tlore m -> SegOp flore -> m (SegOp tlore) Source #

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.Representation.Kernels.Kernel

Methods

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

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

Ord SizeOp Source # 
Instance details

Defined in Futhark.Representation.Kernels.Kernel

Show SizeOp Source # 
Instance details

Defined in Futhark.Representation.Kernels.Kernel

Pretty SizeOp Source # 
Instance details

Defined in Futhark.Representation.Kernels.Kernel

Methods

ppr :: SizeOp -> Doc

pprPrec :: Int -> SizeOp -> Doc

pprList :: [SizeOp] -> Doc

TypedOp SizeOp Source # 
Instance details

Defined in Futhark.Representation.Kernels.Kernel

Methods

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

FreeIn SizeOp Source # 
Instance details

Defined in Futhark.Representation.Kernels.Kernel

Methods

freeIn' :: SizeOp -> FV Source #

Substitute SizeOp Source # 
Instance details

Defined in Futhark.Representation.Kernels.Kernel

Rename SizeOp Source # 
Instance details

Defined in Futhark.Representation.Kernels.Kernel

IsOp SizeOp Source # 
Instance details

Defined in Futhark.Representation.Kernels.Kernel

AliasedOp SizeOp Source # 
Instance details

Defined in Futhark.Representation.Kernels.Kernel

OpMetrics SizeOp Source # 
Instance details

Defined in Futhark.Representation.Kernels.Kernel

Methods

opMetrics :: SizeOp -> MetricsM () Source #

RangedOp SizeOp Source # 
Instance details

Defined in Futhark.Representation.Kernels.Kernel

Methods

opRanges :: SizeOp -> [Range] Source #

Host operations

data HostOp lore op Source #

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

Constructors

SegOp (SegOp lore)

A segmented operation.

SizeOp SizeOp 
OtherOp op 

Instances

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

Defined in Futhark.Representation.Kernels.Kernel

Methods

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

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

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

Defined in Futhark.Representation.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 #

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

Defined in Futhark.Representation.Kernels.Kernel

Methods

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

show :: HostOp lore op -> String #

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

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

Defined in Futhark.Representation.Kernels.Kernel

Methods

ppr :: HostOp lore op -> Doc

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

pprList :: [HostOp lore op] -> Doc

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

Defined in Futhark.Representation.Kernels.Kernel

Methods

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

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

Defined in Futhark.Representation.Kernels.Kernel

Methods

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

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

Defined in Futhark.Representation.Kernels.Kernel

Methods

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

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

Defined in Futhark.Representation.Kernels.Kernel

Methods

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

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

Defined in Futhark.Representation.Kernels.Kernel

Methods

safeOp :: HostOp lore op -> Bool Source #

cheapOp :: HostOp lore op -> Bool Source #

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

Defined in Futhark.Representation.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, Attributes lore) => AliasedOp (HostOp lore op) Source # 
Instance details

Defined in Futhark.Representation.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.Representation.Kernels.Kernel

Methods

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

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

Defined in Futhark.Representation.Kernels.Kernel

Associated Types

type OpWithRanges (HostOp lore op) Source #

Methods

removeOpRanges :: OpWithRanges (HostOp lore op) -> HostOp lore op Source #

addOpRanges :: HostOp lore op -> OpWithRanges (HostOp lore op) Source #

(Attributes lore, RangedOp op) => RangedOp (HostOp lore op) Source # 
Instance details

Defined in Futhark.Representation.Kernels.Kernel

Methods

opRanges :: HostOp lore op -> [Range] Source #

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

Defined in Futhark.Representation.Kernels.Kernel

Associated Types

type OpWithWisdom (HostOp lore op) Source #

Methods

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

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

Defined in Futhark.Representation.Kernels.Kernel

Methods

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

(Attributes 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 OpWithAliases (HostOp lore op) Source # 
Instance details

Defined in Futhark.Representation.Kernels.Kernel

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

Defined in Futhark.Representation.Kernels.Kernel

type OpWithRanges (HostOp lore op) = HostOp (Ranges lore) (OpWithRanges op)
type OpWithWisdom (HostOp lore op) Source # 
Instance details

Defined in Futhark.Representation.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 #

Reexports