| Safe Haskell | None |
|---|---|
| Language | GHC2021 |
Futhark.CodeGen.ImpCode.GPU
Description
Variation of Futhark.CodeGen.ImpCode that contains the notion of a kernel invocation.
Synopsis
- type Program = Definitions HostOp
- type HostCode = Code HostOp
- type KernelCode = Code KernelOp
- data KernelConst
- type KernelConstExp = PrimExp KernelConst
- data HostOp
- data Bookkeeping
- bookkeepingSize :: Bookkeeping -> Integer
- data KernelOp
- data Fence
- data AtomicOp
- = AtomicAdd IntType VName VName (Count Elements (TExp Int64)) Exp
- | AtomicFAdd FloatType VName VName (Count Elements (TExp Int64)) Exp
- | AtomicSMax IntType VName VName (Count Elements (TExp Int64)) Exp
- | AtomicSMin IntType VName VName (Count Elements (TExp Int64)) Exp
- | AtomicUMax IntType VName VName (Count Elements (TExp Int64)) Exp
- | AtomicUMin IntType VName VName (Count Elements (TExp Int64)) Exp
- | AtomicAnd IntType VName VName (Count Elements (TExp Int64)) Exp
- | AtomicOr IntType VName VName (Count Elements (TExp Int64)) Exp
- | AtomicXor IntType VName VName (Count Elements (TExp Int64)) Exp
- | AtomicCmpXchg PrimType VName VName (Count Elements (TExp Int64)) Exp Exp
- | AtomicXchg PrimType VName VName (Count Elements (TExp Int64)) Exp
- | AtomicWrite PrimType VName (Count Elements (TExp Int64)) Exp
- type BlockDim = Either Exp KernelConstExp
- data Kernel = Kernel {}
- data KernelUse
- module Futhark.CodeGen.ImpCode
- module Futhark.IR.GPU.Sizes
Documentation
type Program = Definitions HostOp Source #
A program that calls kernels.
type KernelCode = Code KernelOp Source #
Code inside a kernel.
data KernelConst Source #
A run-time constant related to kernels.
Constructors
| SizeConst Name SizeClass | |
| SizeMaxConst SizeClass | |
| SizeUserParam Name KernelConstExp |
Instances
| FreeIn KernelConst Source # | |
Defined in Futhark.CodeGen.ImpCode.GPU Methods freeIn' :: KernelConst -> FV Source # | |
| Show KernelConst Source # | |
Defined in Futhark.CodeGen.ImpCode.GPU Methods showsPrec :: Int -> KernelConst -> ShowS # show :: KernelConst -> String # showList :: [KernelConst] -> ShowS # | |
| Eq KernelConst Source # | |
Defined in Futhark.CodeGen.ImpCode.GPU | |
| Ord KernelConst Source # | |
Defined in Futhark.CodeGen.ImpCode.GPU Methods compare :: KernelConst -> KernelConst -> Ordering # (<) :: KernelConst -> KernelConst -> Bool # (<=) :: KernelConst -> KernelConst -> Bool # (>) :: KernelConst -> KernelConst -> Bool # (>=) :: KernelConst -> KernelConst -> Bool # max :: KernelConst -> KernelConst -> KernelConst # min :: KernelConst -> KernelConst -> KernelConst # | |
| Pretty KernelConst Source # | |
Defined in Futhark.CodeGen.ImpCode.GPU | |
type KernelConstExp = PrimExp KernelConst Source #
An expression whose variables are kernel constants.
An operation that runs on the host (CPU).
Constructors
| CallKernel Kernel | |
| GetSize VName Name SizeClass | |
| CmpSizeLe VName Name SizeClass Exp | |
| GetSizeMax VName SizeClass | |
| GetBookkeeping VName Bookkeeping | Bind the given device memory to one of the bookkeeping buffers of the context. |
data Bookkeeping Source #
The bookkeeping buffers are device buffers of 32-bit integers that belong to the context and are shared by all kernels. They are zero whenever no kernel is running, and a kernel that uses them must leave them zeroed when it succeeds, and the context zeroes them again after a failure. As kernels run serially, they never compete for them. If we ever add support for multiple streams, we must have a set of buffers per stream.
Constructors
| BookkeepingCounters | Counters, e.g. for detecting the last block to finish. |
| BookkeepingLocks | Locks for operations that cannot be done atomically. |
Instances
| Show Bookkeeping Source # | |
Defined in Futhark.CodeGen.ImpCode.GPU Methods showsPrec :: Int -> Bookkeeping -> ShowS # show :: Bookkeeping -> String # showList :: [Bookkeeping] -> ShowS # | |
| Eq Bookkeeping Source # | |
Defined in Futhark.CodeGen.ImpCode.GPU | |
| Ord Bookkeeping Source # | |
Defined in Futhark.CodeGen.ImpCode.GPU Methods compare :: Bookkeeping -> Bookkeeping -> Ordering # (<) :: Bookkeeping -> Bookkeeping -> Bool # (<=) :: Bookkeeping -> Bookkeeping -> Bool # (>) :: Bookkeeping -> Bookkeeping -> Bool # (>=) :: Bookkeeping -> Bookkeeping -> Bool # max :: Bookkeeping -> Bookkeeping -> Bookkeeping # min :: Bookkeeping -> Bookkeeping -> Bookkeeping # | |
bookkeepingSize :: Bookkeeping -> Integer Source #
The number of 32-bit integers in a bookkeeping buffer.
An operation that occurs within a kernel body.
Constructors
| GetBlockId VName Int | |
| GetLocalId VName Int | |
| GetLocalSize VName Int | |
| GetLockstepWidth VName | |
| Atomic Space AtomicOp | |
| Barrier Fence | |
| MemFence Fence | |
| WarpSync | Basically a warp-level barrier. Must be executed by all threads of warp. Only supported for CUDA and HIP. |
| SharedAlloc VName (Count Bytes (TExp Int64)) | |
| ErrorSync Fence (Code KernelOp) | Perform a barrier and also check whether any threads have failed an
assertion. If so, all threads of the block execute the given code and
then stop. The code must not fail, and is usually empty. Make sure all
threads would reach all |
When we do a barrier or fence, is it at the local or global
level? By the Ord instance, global is greater than local.
Constructors
| FenceLocal | |
| FenceGlobal |
Atomic operations return the value stored before the update. This
old value is stored in the first VName (except for
AtomicWrite). The second VName is the memory block to update.
The Exp is the new value.
Constructors
| AtomicAdd IntType VName VName (Count Elements (TExp Int64)) Exp | |
| AtomicFAdd FloatType VName VName (Count Elements (TExp Int64)) Exp | |
| AtomicSMax IntType VName VName (Count Elements (TExp Int64)) Exp | |
| AtomicSMin IntType VName VName (Count Elements (TExp Int64)) Exp | |
| AtomicUMax IntType VName VName (Count Elements (TExp Int64)) Exp | |
| AtomicUMin IntType VName VName (Count Elements (TExp Int64)) Exp | |
| AtomicAnd IntType VName VName (Count Elements (TExp Int64)) Exp | |
| AtomicOr IntType VName VName (Count Elements (TExp Int64)) Exp | |
| AtomicXor IntType VName VName (Count Elements (TExp Int64)) Exp | |
| AtomicCmpXchg PrimType VName VName (Count Elements (TExp Int64)) Exp Exp | |
| AtomicXchg PrimType VName VName (Count Elements (TExp Int64)) Exp | |
| AtomicWrite PrimType VName (Count Elements (TExp Int64)) Exp | Corresponds to a write followed by a memory fence. The old value is not read. |
A generic kernel containing arbitrary kernel code.
Constructors
| Kernel | |
Fields
| |
Information about a host-level variable that is used inside this kernel. When generating the actual kernel code, this is used to deduce which parameters are needed.
Instances
| Show KernelUse Source # | |
| Eq KernelUse Source # | |
| Ord KernelUse Source # | |
| Pretty KernelUse Source # | |
Defined in Futhark.CodeGen.ImpCode.GPU | |
module Futhark.CodeGen.ImpCode
module Futhark.IR.GPU.Sizes