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

Safe HaskellNone
LanguageHaskell2010

Futhark.Representation.Kernels.Kernel

Contents

Synopsis

Documentation

data Kernel lore Source #

Constructors

Kernel KernelDebugHints KernelSpace [Type] (KernelBody lore) 
SegMap KernelSpace [Type] (KernelBody lore) 
SegRed KernelSpace [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 KernelSpace (Lambda lore) [SubExp] [Type] (KernelBody lore) 
SegGenRed KernelSpace [GenReduceOp lore] [Type] (KernelBody lore) 
Instances
Annotations lore => Eq (Kernel lore) Source # 
Instance details

Defined in Futhark.Representation.Kernels.Kernel

Methods

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

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

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

Defined in Futhark.Representation.Kernels.Kernel

Methods

compare :: Kernel lore -> Kernel lore -> Ordering #

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

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

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

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

max :: Kernel lore -> Kernel lore -> Kernel lore #

min :: Kernel lore -> Kernel lore -> Kernel lore #

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

Defined in Futhark.Representation.Kernels.Kernel

Methods

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

show :: Kernel lore -> String #

showList :: [Kernel lore] -> ShowS #

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

Defined in Futhark.Representation.Kernels.Kernel

Methods

ppr :: Kernel lore -> Doc #

pprPrec :: Int -> Kernel lore -> Doc #

pprList :: [Kernel lore] -> Doc #

TypedOp (Kernel lore) Source # 
Instance details

Defined in Futhark.Representation.Kernels.Kernel

Methods

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

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

Defined in Futhark.Representation.Kernels.Kernel

Methods

freeIn :: Kernel lore -> Names Source #

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

Defined in Futhark.Representation.Kernels.Kernel

Methods

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

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

Defined in Futhark.Representation.Kernels.Kernel

Methods

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

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

Defined in Futhark.Representation.Kernels.Kernel

Methods

safeOp :: Kernel lore -> Bool Source #

cheapOp :: Kernel lore -> Bool Source #

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

Defined in Futhark.Representation.Kernels.Kernel

Associated Types

type OpWithAliases (Kernel lore) :: Type Source #

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

Defined in Futhark.Representation.Kernels.Kernel

Methods

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

consumedInOp :: Kernel lore -> Names Source #

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

Defined in Futhark.Representation.Kernels.Kernel

Methods

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

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

Defined in Futhark.Representation.Kernels.Kernel

Associated Types

type OpWithRanges (Kernel lore) :: Type Source #

Ranged inner => RangedOp (Kernel inner) Source # 
Instance details

Defined in Futhark.Representation.Kernels.Kernel

Methods

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

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

Defined in Futhark.Representation.Kernels.Kernel

Associated Types

type OpWithWisdom (Kernel lore) :: Type Source #

Methods

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

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

Defined in Futhark.Representation.Kernels.Kernel

Methods

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

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

Defined in Futhark.Optimise.CSE

Methods

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

type OpWithAliases (Kernel lore) Source # 
Instance details

Defined in Futhark.Representation.Kernels.Kernel

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

Defined in Futhark.Representation.Kernels.Kernel

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

Defined in Futhark.Representation.Kernels.Kernel

type OpWithWisdom (Kernel lore) = Kernel (Wise lore)

data KernelDebugHints Source #

Some information about what goes into a kernel, and where it came from. Has no semantic meaning; only used for debugging generated code.

Constructors

KernelDebugHints 

Fields

data GenReduceOp lore Source #

Constructors

GenReduceOp 

Fields

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

Defined in Futhark.Representation.Kernels.Kernel

Methods

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

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

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

Defined in Futhark.Representation.Kernels.Kernel

Methods

compare :: GenReduceOp lore -> GenReduceOp lore -> Ordering #

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

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

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

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

max :: GenReduceOp lore -> GenReduceOp lore -> GenReduceOp lore #

min :: GenReduceOp lore -> GenReduceOp lore -> GenReduceOp lore #

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

Defined in Futhark.Representation.Kernels.Kernel

Methods

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

show :: GenReduceOp lore -> String #

showList :: [GenReduceOp lore] -> ShowS #

data SegRedOp lore Source #

Constructors

SegRedOp 

Fields

Instances
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
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 -> Names 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 KernelSpace Source #

first three bound in the kernel, the rest are params to kernel

spaceDimensions :: KernelSpace -> [(VName, SubExp)] Source #

Global thread IDs and their upper bound.

data SpaceStructure Source #

Indices computed for each thread (or group) inside the kernel. This is an arbitrary-dimensional space that is generated from the flat GPU thread space.

data KernelResult Source #

Constructors

ThreadsReturn SubExp

Each thread in the kernel space (which must be non-empty) returns this.

GroupsReturn SubExp

Each group returns this.

WriteReturn [SubExp] VName [([SubExp], SubExp)] 
ConcatReturns SplitOrdering SubExp SubExp (Maybe SubExp) VName 
Instances
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

type KernelPath = [(Name, Bool)] Source #

An indication of which comparisons have been performed to get to this point, as well as the result of each comparison.

typeCheckKernel :: Checkable lore => Kernel (Aliases lore) -> TypeM lore () Source #

Generic traversal

data KernelMapper flore tlore m Source #

Like Mapper, but just for Kernels.

Constructors

KernelMapper 

Fields

identityKernelMapper :: Monad m => KernelMapper lore lore m Source #

A mapper that simply returns the Kernel verbatim.

mapKernelM :: (Applicative m, Monad m) => KernelMapper flore tlore m -> Kernel flore -> m (Kernel tlore) Source #

Map a monadic action across the immediate children of a Kernel. The mapping does not descend recursively into subexpressions and is done left-to-right.

data KernelWalker lore m Source #

Like Walker, but just for Kernels.

Constructors

KernelWalker 

Fields

identityKernelWalker :: Monad m => KernelWalker lore m Source #

A no-op traversal.

walkKernelM :: Monad m => KernelWalker lore m -> Kernel lore -> m () Source #

As mapKernelM, but ignoring the results.

Host operations

data HostOp lore inner Source #

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

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 Int32 value.

HostOp inner

The arbitrary operation.

Instances
Eq inner => Eq (HostOp lore inner) Source # 
Instance details

Defined in Futhark.Representation.Kernels.Kernel

Methods

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

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

Ord inner => Ord (HostOp lore inner) Source # 
Instance details

Defined in Futhark.Representation.Kernels.Kernel

Methods

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

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

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

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

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

max :: HostOp lore inner -> HostOp lore inner -> HostOp lore inner #

min :: HostOp lore inner -> HostOp lore inner -> HostOp lore inner #

Show inner => Show (HostOp lore inner) Source # 
Instance details

Defined in Futhark.Representation.Kernels.Kernel

Methods

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

show :: HostOp lore inner -> String #

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

Pretty inner => Pretty (HostOp lore inner) Source # 
Instance details

Defined in Futhark.Representation.Kernels.Kernel

Methods

ppr :: HostOp lore inner -> Doc #

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

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

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

Defined in Futhark.Representation.Kernels.Kernel

Methods

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

FreeIn inner => FreeIn (HostOp lore inner) Source # 
Instance details

Defined in Futhark.Representation.Kernels.Kernel

Methods

freeIn :: HostOp lore inner -> Names Source #

Substitute inner => Substitute (HostOp lore inner) Source # 
Instance details

Defined in Futhark.Representation.Kernels.Kernel

Methods

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

Rename inner => Rename (HostOp lore inner) Source # 
Instance details

Defined in Futhark.Representation.Kernels.Kernel

Methods

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

IsOp inner => IsOp (HostOp lore inner) Source # 
Instance details

Defined in Futhark.Representation.Kernels.Kernel

Methods

safeOp :: HostOp lore inner -> Bool Source #

cheapOp :: HostOp lore inner -> Bool Source #

CanBeAliased inner => CanBeAliased (HostOp lore inner) Source # 
Instance details

Defined in Futhark.Representation.Kernels.Kernel

Associated Types

type OpWithAliases (HostOp lore inner) :: Type Source #

Methods

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

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

AliasedOp inner => AliasedOp (HostOp lore inner) Source # 
Instance details

Defined in Futhark.Representation.Kernels.Kernel

Methods

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

consumedInOp :: HostOp lore inner -> Names Source #

OpMetrics inner => OpMetrics (HostOp lore inner) Source # 
Instance details

Defined in Futhark.Representation.Kernels.Kernel

Methods

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

CanBeRanged inner => CanBeRanged (HostOp lore inner) Source # 
Instance details

Defined in Futhark.Representation.Kernels.Kernel

Associated Types

type OpWithRanges (HostOp lore inner) :: Type Source #

Methods

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

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

RangedOp inner => RangedOp (HostOp lore inner) Source # 
Instance details

Defined in Futhark.Representation.Kernels.Kernel

Methods

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

CanBeWise inner => CanBeWise (HostOp lore inner) Source # 
Instance details

Defined in Futhark.Representation.Kernels.Kernel

Associated Types

type OpWithWisdom (HostOp lore inner) :: Type Source #

Methods

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

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 (PrimExp VName, Certificates) Source #

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 inner) Source # 
Instance details

Defined in Futhark.Representation.Kernels.Kernel

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

Defined in Futhark.Representation.Kernels.Kernel

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

Defined in Futhark.Representation.Kernels.Kernel

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

typeCheckHostOp :: Checkable lore => (inner -> TypeM lore ()) -> HostOp (Aliases lore) inner -> TypeM lore () Source #