Class Kernel¶
Defined in File kernel.hpp
Class Documentation¶
-
class
legion::core::compute
::
Kernel
¶ Wraps a cl_kernel, allows you to parametrize an OpenCL kernel without worrying about the CommandQueue.
Public Functions
-
inline
~Kernel
()¶
-
Kernel &
local
(size_type)¶ Determines the “Local Work Size”, aka how many Kernels should run in parallel This number should not exceed the amount of available cores, a good max is 1024.
-
Kernel &
global
(dimension)¶ Determines the “Global Work Size”, aka how many Kernels should run in total This number should match your input arrays (but not exceed it!)
-
Kernel &
buildBufferNames
()¶ Maps Parameter Names to indices, for example:
would be mapped to:__kernel void do_something(__global int* Parameter1, __global int* Parameter2) { ... }
Parameter1 -> 0
Parameter2 -> 1
-
Kernel &
readWriteMode
(buffer_type)¶ Sets the modus operandi for Read-Write Buffers:
-
Kernel &
enqueueBuffer
(Buffer buffer, block_mode blocking = block_mode::BLOCKING)¶ Enqueues a Buffer in the command queue, write buffers need to be enqueued before dispatching the kernel, read buffers afterwards.
- Parameters
buffer
: The buffer you want to enqueue.index
: The index of the Buffer you want to enqueue to (this must match the kernel index)blocking
: Whether or not you want a blocking write/read (default=BLOCKING)
-
Kernel &
setBuffer
(Buffer buffer)¶ Sets a Buffer as the Kernel Argument.
- Note
this is required for all Kernel Arguments regardless of buffer direction
- Note
this needs to be done for all buffers before the kernel is dispatched
- Note
This Overload requires that the buffer is named
- Parameters
buffer
: The buffer you want to inform the kernel about
-
template<class
T
>
inline Kernel &setKernelArg
(T *value, const std::string &name)¶ Sets a Kernel Parameter that is the same for all invocations of the kernel.
-
template<class
T
>
inline Kernel &setKernelArg
(T *value, cl_uint index)¶ Sets a Kernel Parameter that is the same for all invocations of the kernel.
- Template Parameters
T
: The type of the Kernel Argument.
- Parameters
value
: A pointer to the value of the kernel Argument.index
: The index of the parameter.
-
Kernel &
setKernelArg
(void *value, size_type size, cl_uint index)¶ See above.
- Parameters
value
: Value of the parameter.size
: Sizeof of the parameter.index
: The index of the parameter.
-
Kernel &
setAndEnqueueBuffer
(Buffer buffer, block_mode blocking = block_mode::BLOCKING)¶ same as informing the kernel about a buffer and then enqueueing it
-
Kernel &
setAndEnqueueBuffer
(Buffer buffer, const std::string&, block_mode blocking = block_mode::BLOCKING)¶ same as informing the kernel about a buffer and then enqueueing it
-
Kernel &
setAndEnqueueBuffer
(Buffer buffer, cl_uint index, block_mode blocking = block_mode::BLOCKING)¶ same as informing the kernel about a buffer and then enqueueing it
-
Kernel &
dispatch
()¶ Dispatches the Kernel to the command-queue.
- Note
All Kernel Parameters must be set before this can be called
- Note
global and local must be set before this can be called
- Pre
set_buffer
- Pre
set_and_enqueue_buffer
- Pre
local
- Pre
global
-
void
finish
() const¶ Ensures that the command-queue is committed and finished executing.
- Pre
dispatch
-
struct
d2
¶
-
struct
d3
¶
-
inline