Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- data KernelConstants = KernelConstants {}
- keyWithEntryPoint :: Maybe Name -> Name -> Name
- type CallKernelGen = ImpM ExplicitMemory HostEnv HostOp
- type InKernelGen = ImpM ExplicitMemory KernelEnv KernelOp
- newtype HostEnv = HostEnv {}
- data KernelEnv = KernelEnv {}
- computeThreadChunkSize :: SplitOrdering -> Exp -> Count Elements Exp -> Count Elements Exp -> VName -> ImpM lore r op ()
- groupReduce :: Exp -> Lambda ExplicitMemory -> [VName] -> InKernelGen ()
- groupScan :: Maybe (Exp -> Exp -> Exp) -> Exp -> Exp -> Lambda ExplicitMemory -> [VName] -> InKernelGen ()
- isActive :: [(VName, SubExp)] -> Exp
- sKernelThread :: String -> Count NumGroups Exp -> Count GroupSize Exp -> VName -> InKernelGen () -> CallKernelGen ()
- sKernelGroup :: String -> Count NumGroups Exp -> Count GroupSize Exp -> VName -> InKernelGen () -> CallKernelGen ()
- sReplicate :: VName -> SubExp -> CallKernelGen ()
- sIota :: VName -> Exp -> Exp -> Exp -> IntType -> CallKernelGen ()
- sCopy :: PrimType -> MemLocation -> MemLocation -> CallKernelGen ()
- compileThreadResult :: SegSpace -> PatElem ExplicitMemory -> KernelResult -> InKernelGen ()
- compileGroupResult :: SegSpace -> PatElem ExplicitMemory -> KernelResult -> InKernelGen ()
- virtualiseGroups :: SegVirt -> Exp -> (VName -> InKernelGen ()) -> InKernelGen ()
- groupLoop :: Exp -> (Exp -> InKernelGen ()) -> InKernelGen ()
- kernelLoop :: Exp -> Exp -> Exp -> (Exp -> InKernelGen ()) -> InKernelGen ()
- groupCoverSpace :: [Exp] -> ([Exp] -> InKernelGen ()) -> InKernelGen ()
- atomicUpdateLocking :: AtomicBinOp -> Lambda ExplicitMemory -> AtomicUpdate ExplicitMemory KernelEnv
- type AtomicBinOp = BinOp -> Maybe (VName -> VName -> Count Elements Exp -> Exp -> AtomicOp)
- data Locking = Locking {
- lockingArray :: VName
- lockingIsUnlocked :: Exp
- lockingToLock :: Exp
- lockingToUnlock :: Exp
- lockingMapping :: [Exp] -> [Exp]
- data AtomicUpdate lore r
- = AtomicPrim (DoAtomicUpdate lore r)
- | AtomicCAS (DoAtomicUpdate lore r)
- | AtomicLocking (Locking -> DoAtomicUpdate lore r)
- type DoAtomicUpdate lore r = Space -> [VName] -> [Exp] -> ImpM lore r KernelOp ()
Documentation
type CallKernelGen = ImpM ExplicitMemory HostEnv HostOp Source #
computeThreadChunkSize :: SplitOrdering -> Exp -> Count Elements Exp -> Count Elements Exp -> VName -> ImpM lore r op () Source #
groupReduce :: Exp -> Lambda ExplicitMemory -> [VName] -> InKernelGen () Source #
groupScan :: Maybe (Exp -> Exp -> Exp) -> Exp -> Exp -> Lambda ExplicitMemory -> [VName] -> InKernelGen () Source #
sKernelThread :: String -> Count NumGroups Exp -> Count GroupSize Exp -> VName -> InKernelGen () -> CallKernelGen () Source #
sKernelGroup :: String -> Count NumGroups Exp -> Count GroupSize Exp -> VName -> InKernelGen () -> CallKernelGen () Source #
sReplicate :: VName -> SubExp -> CallKernelGen () Source #
Perform a Replicate with a kernel.
sIota :: VName -> Exp -> Exp -> Exp -> IntType -> CallKernelGen () Source #
Perform an Iota with a kernel.
sCopy :: PrimType -> MemLocation -> MemLocation -> CallKernelGen () Source #
compileThreadResult :: SegSpace -> PatElem ExplicitMemory -> KernelResult -> InKernelGen () Source #
compileGroupResult :: SegSpace -> PatElem ExplicitMemory -> KernelResult -> InKernelGen () Source #
virtualiseGroups :: SegVirt -> 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.
groupLoop :: Exp -> (Exp -> InKernelGen ()) -> InKernelGen () Source #
Assign iterations of a for-loop to threads in the workgroup. The
passed-in function is invoked with the (symbolic) iteration. For
multidimensional loops, use groupCoverSpace
.
kernelLoop :: Exp -> Exp -> Exp -> (Exp -> InKernelGen ()) -> InKernelGen () Source #
Assign iterations of a for-loop to all threads in the kernel. The
passed-in function is invoked with the (symbolic) iteration. For
multidimensional loops, use groupCoverSpace
.
groupCoverSpace :: [Exp] -> ([Exp] -> InKernelGen ()) -> InKernelGen () Source #
Iterate collectively though a multidimensional space, such that all threads in the group participate. The passed-in function is invoked with a (symbolic) point in the index space.
atomicUpdateLocking :: AtomicBinOp -> Lambda ExplicitMemory -> AtomicUpdate ExplicitMemory KernelEnv Source #
atomicUpdate
, but where it is explicitly visible whether a
locking strategy is necessary.
type AtomicBinOp = BinOp -> Maybe (VName -> VName -> Count Elements Exp -> Exp -> AtomicOp) Source #
Locking strategy used for an atomic update.
Locking | |
|
data AtomicUpdate lore r Source #
The mechanism that will be used for performing the atomic update. Approximates how efficient it will be. Ordered from most to least efficient.
AtomicPrim (DoAtomicUpdate lore r) | Supported directly by primitive. |
AtomicCAS (DoAtomicUpdate lore r) | Can be done by efficient swaps. |
AtomicLocking (Locking -> DoAtomicUpdate lore r) | Requires explicit locking. |