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

Safe HaskellNone
LanguageHaskell2010

Futhark.CodeGen.ImpGen.Kernels.Base

Synopsis

Documentation

makeAllMemoryGlobal :: CallKernelGen a -> CallKernelGen a Source #

Change every memory block to be in the global address space, except those who are in the local memory space. This only affects generated code - we still need to make sure that the memory is actually present on the device (and dared as variables in the kernel).

sReplicate :: VName -> Shape -> SubExp -> CallKernelGen () Source #

Perform a Replicate with a kernel.

sIota :: VName -> Exp -> Exp -> Exp -> IntType -> CallKernelGen () Source #

Perform an Iota with a kernel.

virtualiseGroups :: KernelConstants -> Exp -> (VName -> InKernelGen ()) -> InKernelGen () Source #

For many kernels, we may not have enough physical groups to cover the logical iteration space. Some groups thus have to perform double duty; we put an outer loop to accomplish this. The advantage over just launching a bazillion threads is that the cost of memory expansion should be proportional to the number of *physical* threads (hardware parallelism), not the amount of application parallelism.

atomicUpdate :: ExplicitMemorish lore => Space -> [VName] -> [Exp] -> Lambda lore -> Locking -> ImpM lore KernelOp () Source #

atomicUpdateLocking :: ExplicitMemorish lore => Lambda lore -> Either (AtomicUpdate lore) (Locking -> AtomicUpdate lore) Source #

atomicUpdate, but where it is explicitly visible whether a locking strategy is necessary.

data Locking Source #

Locking strategy used for an atomic update.

Constructors

Locking 

Fields

type AtomicUpdate lore = Space -> [VName] -> [Exp] -> ImpM lore KernelOp () Source #

A function for generating code for an atomic update. Assumes that the bucket is in-bounds.