Пример #1
0
cl_int WINAPI wine_clRetainEvent(cl_event event)
{
    cl_int ret;
    TRACE("\n");
    ret = clRetainEvent(event);
    return ret;
}
Пример #2
0
/*! \brief Copies the Event.
  *
  * Note that no deep copy is performed. Both Event Objects
  * refer to the same OpenCL event.
  *
  * \param other Event from which the OpenCL Event and Context is taken from.
  */
ocl::Event::Event( const Event & other ) : _id(other._id), _ctxt(other._ctxt)
{
	if(this->_ctxt == nullptr) throw std::runtime_error("context not valid");
	if(this->_id == nullptr) throw std::runtime_error("id not valid");

	OPENCL_SAFE_CALL( clRetainEvent( _id ) );
}
Пример #3
0
/*! \brief Copies the Event.
  *
  * Note that no deep copy is performed. Both Event Objects
  * refer to the same OpenCL event.
  *
  * \param other Event from which the OpenCL Event and Context is taken from.
  */
ocl::Event::Event( const Event & other ) : _id(other._id), _ctxt(other._ctxt)
{
    TRUE_ASSERT(_id != 0, "Event not valid (id == 0)");
    TRUE_ASSERT(_ctxt != 0, "Event not valid (ctxt == 0)");


	OPENCL_SAFE_CALL( clRetainEvent( _id ) );
}
Пример #4
0
 void EventList::append(const EventList& other)
 {
     for(size_t i = 0; i < other.size(); ++i)
     {
         cl_event e = other._events[i];
         clRetainEvent(e);
         _events.push_back(e);
     }
 }
Пример #5
0
 void EventList::append(const Event& event)
 {
     cl_event _id = event.eventId();
     if(_id)
     {
         clRetainEvent(_id);
         _events.push_back(_id);
     }
 }
Пример #6
0
 EventList& EventList::operator=(const EventList& other)
 {
     for(size_t i = 0; i < _events.size(); ++i)
         clReleaseEvent(_events[i]);
     _events = other._events;
     for(size_t i = 0; i < _events.size(); ++i)
         clRetainEvent(_events[i]);
     return *this;
 }
Пример #7
0
 Event& Event::operator=(const Event& other)
 {
     if(other._id)
         clRetainEvent(other._id);
     if(_id)
         clReleaseEvent(_id);
     _id = other._id;
     _callback = other._callback;
     return *this;
 }
Пример #8
0
 Event EventList::at(size_t index) const
 {
     if(index < _events.size())
     {
         cl_event e = _events[index];
         clRetainEvent(e);
         return Event(e);
     }
     return Event();
 }
Пример #9
0
cl_int clEnqueueNDRangeKernel (cl_command_queue command_queue,
                               cl_kernel kernel,
                               cl_uint work_dim,
                               const size_t *global_work_offset,
                               const size_t *global_work_size,
                               const size_t *local_work_size,
                               cl_uint num_events_in_wait_list,
                               const cl_event *event_wait_list,
                               cl_event *event)
{
  static struct work_size_s work_sizes;
  
  struct ld_kernel_s *ldKernel = find_kernel_entry(kernel);
  int i;
  cl_int errcode;

  if (num_events_in_wait_list) {
    clCheck(clWaitForEvents(num_events_in_wait_list, event_wait_list));
  }
  
  assert(ldKernel);
  for (i = 0; i < work_dim; i++) {
    work_sizes.local[i] = local_work_size[i];
    work_sizes.global[i] = global_work_size[i]/work_sizes.local[i];
  }

#if ENABLE_KERNEL_PROFILING == 1
  static cl_event kern_event;
  
  if (!event) {
    event = &kern_event; // scope of the event is limited to this function.
  }
#endif
  
  kernel_executed_event(ldKernel, &work_sizes, work_dim);
  
  errcode = real_clEnqueueNDRangeKernel(command_queue, kernel, work_dim,
                                        global_work_offset, global_work_size,
                                        local_work_size, num_events_in_wait_list,
                                        event_wait_list, event);
#if ENABLE_KERNEL_PROFILING == 1
  clCheck(errcode);
  
  clRetainEvent(*event);
  clSetEventCallback(*event, CL_COMPLETE, kernel_profiler_cb, ldKernel);
#endif

#if FORCE_FINISH_KERNEL
  real_clFinish(command_queue);
#endif
  
  kernel_finished_event(ldKernel, &work_sizes, work_dim);
  
  return errcode;
}
Пример #10
0
cl_mem cl_fft<T>::run(const cl_mem input, cl_event *out_finishEvent)
{
	cl_event start_evt, *kernel_evts = new cl_event[launches.size()];

	cl_mem v_out = runInternal(input, &start_evt, kernel_evts);

	if (out_finishEvent)
	{
		*out_finishEvent = kernel_evts[launches.size() - 1];
		CL_CHECK_ERR("clRetainEvent", clRetainEvent(*out_finishEvent));
	}

#if 0
	printStatsAndReleaseEvents(0, start_evt, kernel_evts, 0);
#else
	CL_CHECK_ERR("clReleaseEvent", clRetainEvent(start_evt));
	for (unsigned int i = 0; i < launches.size(); i++)
		CL_CHECK_ERR("clReleaseEvent", clReleaseEvent(kernel_evts[i]));
#endif

	delete[] kernel_evts;

	return v_out;
}
Пример #11
0
ocl::Event& ocl::Event::operator =( ocl::Event const& other )
{

	if ( this == &other ) return *this;

	TRUE_ASSERT(other._id != 0, "Event not valid (id == 0)");
	TRUE_ASSERT(other._ctxt != 0, "Event not valid (ctxt == 0)");

	release();

	_id   = other._id;
	_ctxt = other._ctxt;

	clRetainEvent( _id );
	return *this;
}
Пример #12
0
ocl::Event& ocl::Event::operator =( ocl::Event const& other )
{

	if ( this == &other ) return *this;

	if(this->_ctxt == nullptr) throw std::runtime_error("context not valid");
	if(this->_id == nullptr) throw std::runtime_error("id not valid");

	release();

	_id   = other._id;
	_ctxt = other._ctxt;

	clRetainEvent( _id );
	return *this;
}
Пример #13
0
 Event::Event(const Event& other)
     : _id(other._id), _callback(other._callback)
 {
     if(_id)
         clRetainEvent(_id);
 }
Пример #14
0
 EventList::EventList(const EventList& other)
     : _events(other._events)
 {
     for(size_t i = 0; i < _events.size(); ++i)
         clRetainEvent(_events[i]);
 }
Пример #15
0
 UserEvent::UserEvent(const UserEvent& other)
     : Event(other._id)
 {
     if(_id)
         clRetainEvent(_id);
 }
Пример #16
0
void FC_FUNC_(clretainevent_low, CLRETAINEVENT_LOW)(cl_event * event, int * status){

  *status = (int)clRetainEvent(*event);
}