Copyright | [2009..2014] Trevor L. McDonell |
---|---|
License | BSD |
Safe Haskell | None |
Language | Haskell98 |
Kernel execution control for low-level driver interface
- newtype Fun = Fun (Ptr ())
- data FunParam where
- data FunAttribute
- requires :: Fun -> FunAttribute -> IO Int
- setBlockShape :: Fun -> (Int, Int, Int) -> IO ()
- setSharedSize :: Fun -> Integer -> IO ()
- setParams :: Fun -> [FunParam] -> IO ()
- setCacheConfigFun :: Fun -> Cache -> IO ()
- launch :: Fun -> (Int, Int) -> Maybe Stream -> IO ()
- launchKernel :: Fun -> (Int, Int, Int) -> (Int, Int, Int) -> Int -> Maybe Stream -> [FunParam] -> IO ()
- launchKernel' :: Fun -> (Int, Int, Int) -> (Int, Int, Int) -> Int -> Maybe Stream -> [FunParam] -> IO ()
Kernel Execution
data FunAttribute Source
Function attributes
MaxKernelThreadsPerBlock | |
SharedSizeBytes | |
ConstSizeBytes | |
LocalSizeBytes | |
NumRegs | |
PtxVersion | |
BinaryVersion | |
CacheModeCa | |
CU_FUNC_ATTRIBUTE_MAX |
Enum FunAttribute Source | Kernel function parameters |
Eq FunAttribute Source | |
Show FunAttribute Source |
requires :: Fun -> FunAttribute -> IO Int Source
Returns the value of the selected attribute requirement for the given kernel
setBlockShape :: Fun -> (Int, Int, Int) -> IO () Source
Deprecated: use launchKernel instead
Specify the (x,y,z)
dimensions of the thread blocks that are created when
the given kernel function is launched.
setSharedSize :: Fun -> Integer -> IO () Source
Deprecated: use launchKernel instead
Set the number of bytes of dynamic shared memory to be available to each thread block when the function is launched
setParams :: Fun -> [FunParam] -> IO () Source
Deprecated: use launchKernel instead
Set the parameters that will specified next time the kernel is invoked
setCacheConfigFun :: Fun -> Cache -> IO () Source
On devices where the L1 cache and shared memory use the same hardware resources, this sets the preferred cache configuration for the given device function. This is only a preference; the driver is free to choose a different configuration as required to execute the function.
Switching between configuration modes may insert a device-side synchronisation point for streamed kernel launches.
launch :: Fun -> (Int, Int) -> Maybe Stream -> IO () Source
Deprecated: use launchKernel instead
Invoke the kernel on a size (w,h)
grid of blocks. Each block contains the
number of threads specified by a previous call to setBlockShape
. The launch
may also be associated with a specific Stream
.
:: Fun | function to execute |
-> (Int, Int, Int) | block grid dimension |
-> (Int, Int, Int) | thread block shape |
-> Int | shared memory (bytes) |
-> Maybe Stream | (optional) stream to execute in |
-> [FunParam] | list of function parameters |
-> IO () |
Invoke a kernel on a (gx * gy * gz)
grid of blocks, where each block
contains (tx * ty * tz)
threads and has access to a given number of bytes
of shared memory. The launch may also be associated with a specific Stream
.
In launchKernel
, the number of kernel parameters and their offsets and
sizes do not need to be specified, as this information is retrieved directly
from the kernel's image. This requires the kernel to have been compiled with
toolchain version 3.2 or later.
The alternative launchKernel'
will pass the arguments in directly,
requiring the application to know the size and alignment/padding of each
kernel parameter.
:: Fun | function to execute |
-> (Int, Int, Int) | block grid dimension |
-> (Int, Int, Int) | thread block shape |
-> Int | shared memory (bytes) |
-> Maybe Stream | (optional) stream to execute in |
-> [FunParam] | list of function parameters |
-> IO () |
Invoke a kernel on a (gx * gy * gz)
grid of blocks, where each block
contains (tx * ty * tz)
threads and has access to a given number of bytes
of shared memory. The launch may also be associated with a specific Stream
.
In launchKernel
, the number of kernel parameters and their offsets and
sizes do not need to be specified, as this information is retrieved directly
from the kernel's image. This requires the kernel to have been compiled with
toolchain version 3.2 or later.
The alternative launchKernel'
will pass the arguments in directly,
requiring the application to know the size and alignment/padding of each
kernel parameter.