Clover Git
OpenCL 1.1 software implementation
Public Member Functions | Private Attributes

Coal::CPUKernelEvent Class Reference

CPU-specific information about a kernel event. More...

#include <kernel.h>

Collaboration diagram for Coal::CPUKernelEvent:

List of all members.

Public Member Functions

 CPUKernelEvent (CPUDevice *device, KernelEvent *event)
 Constructor.
 ~CPUKernelEvent ()
bool reserve ()
 The next Work Group that will execute will be the last. Locks the event.
bool finished ()
 All the work groups have finished.
CPUKernelWorkGrouptakeInstance ()
 Must be called exactly one time after reserve(). Unlocks the event.
void * kernelArgs () const
 Return the cached kernel arguments.
void cacheKernelArgs (void *args)
 Cache pre-built kernel arguments.
void workGroupFinished ()
 A work-group has just finished.

Private Attributes

CPUDevicep_device
KernelEventp_event
size_t p_current_work_group [MAX_WORK_DIMS]
size_t p_max_work_groups [MAX_WORK_DIMS]
size_t p_current_wg
size_t p_finished_wg
size_t p_num_wg
pthread_mutex_t p_mutex
void * p_kernel_args

Detailed Description

CPU-specific information about a kernel event.

This class put in a Coal::KernelEvent device-data field (see Coal::Event::setDeviceData()) is responsible for dispatching the Coal::CPUKernelWorkGroup objects between the CPU worker threads.

Definition at line 292 of file cpu/kernel.h.


Constructor & Destructor Documentation

CPUKernelEvent::CPUKernelEvent ( CPUDevice device,
KernelEvent event 
)

Constructor.

Parameters:
devicedevice running the kernel
eventCoal::KernelEvent holding device-agnostic data about the event

Definition at line 297 of file cpu/kernel.cpp.

References p_current_work_group, p_max_work_groups, p_mutex, p_num_wg, and Coal::KernelEvent::work_dim().

CPUKernelEvent::~CPUKernelEvent ( )

Definition at line 319 of file cpu/kernel.cpp.

References p_kernel_args, and p_mutex.


Member Function Documentation

void CPUKernelEvent::cacheKernelArgs ( void *  args)

Cache pre-built kernel arguments.

Definition at line 380 of file cpu/kernel.cpp.

References p_kernel_args.

Referenced by Coal::CPUKernelWorkGroup::callArgs().

bool CPUKernelEvent::finished ( )

All the work groups have finished.

Definition at line 336 of file cpu/kernel.cpp.

References p_finished_wg, p_mutex, and p_num_wg.

Referenced by worker().

void * CPUKernelEvent::kernelArgs ( ) const

Return the cached kernel arguments.

Definition at line 375 of file cpu/kernel.cpp.

References p_kernel_args.

Referenced by Coal::CPUKernelWorkGroup::callArgs().

bool CPUKernelEvent::reserve ( )

The next Work Group that will execute will be the last. Locks the event.

Definition at line 327 of file cpu/kernel.cpp.

References p_current_wg, p_mutex, and p_num_wg.

Referenced by Coal::CPUDevice::getEvent().

CPUKernelWorkGroup * CPUKernelEvent::takeInstance ( )

Must be called exactly one time after reserve(). Unlocks the event.

Definition at line 358 of file cpu/kernel.cpp.

References Coal::KernelEvent::deviceKernel(), incVec(), p_current_wg, p_current_work_group, p_event, p_max_work_groups, p_mutex, and Coal::KernelEvent::work_dim().

Referenced by worker().

void CPUKernelEvent::workGroupFinished ( )

A work-group has just finished.

Definition at line 349 of file cpu/kernel.cpp.

References p_finished_wg, and p_mutex.

Referenced by Coal::CPUKernelWorkGroup::~CPUKernelWorkGroup().


Member Data Documentation

Definition at line 318 of file cpu/kernel.h.

Referenced by reserve(), and takeInstance().

size_t Coal::CPUKernelEvent::p_current_work_group[MAX_WORK_DIMS] [private]

Definition at line 316 of file cpu/kernel.h.

Referenced by CPUKernelEvent(), and takeInstance().

Definition at line 314 of file cpu/kernel.h.

Definition at line 315 of file cpu/kernel.h.

Referenced by takeInstance().

Definition at line 318 of file cpu/kernel.h.

Referenced by finished(), and workGroupFinished().

Definition at line 320 of file cpu/kernel.h.

Referenced by cacheKernelArgs(), kernelArgs(), and ~CPUKernelEvent().

size_t Coal::CPUKernelEvent::p_max_work_groups[MAX_WORK_DIMS] [private]

Definition at line 316 of file cpu/kernel.h.

Referenced by CPUKernelEvent(), and takeInstance().

pthread_mutex_t Coal::CPUKernelEvent::p_mutex [private]

Definition at line 318 of file cpu/kernel.h.

Referenced by CPUKernelEvent(), finished(), and reserve().


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Defines