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

Futhark.CodeGen.ImpGen.Kernels.Base

Synopsis

Documentation

Constructors

 KernelConstants FieldskernelOuterVTable :: VTable ExplicitMemory kernelGlobalThreadId :: Exp kernelLocalThreadId :: Exp kernelGroupId :: Exp kernelGlobalThreadIdVar :: VName kernelLocalThreadIdVar :: VName kernelGroupIdVar :: VName kernelGroupSize :: Exp kernelNumGroups :: Exp kernelNumThreads :: Exp kernelWaveSize :: Exp kernelDimensions :: [(VName, Exp)] kernelThreadActive :: Exp kernelStreamed :: [(VName, DimSize)]Chunk sizes and their maximum size. Hint for unrolling.

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).

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 FieldslockingArray :: VNameArray containing the lock.lockingIsUnlocked :: ExpValue for us to consider the lock free.lockingToLock :: ExpWhat to write when we lock it.lockingToUnlock :: ExpWhat to write when we unlock it.lockingMapping :: [Exp] -> ExpA transformation from the logical lock index to the physical position in the array. This can also be used to make the lock array smaller.

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.