summaryrefslogtreecommitdiff
path: root/include/cl_command_queue.h
blob: 1cc2990436fcbf87c79c935e858b9e599de567f9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
/* 
 * Copyright © 2012 Intel Corporation
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library. If not, see <http://www.gnu.org/licenses/>.
 *
 */

#ifndef __CL_COMMAND_QUEUE_H__
#define __CL_COMMAND_QUEUE_H__

#include <stdint.h>
#include "CL/cl.h"

typedef struct _cl_command_queue {
  uint64_t magic;                      /* To identify it as a command queue */
  volatile int ref_n;                  /* We reference count this object */
  cl_device_id device;                 /* Its device. */
  cl_context ctx;                      /* The context it belongs to. */
  cl_event* barrier_events;            /* Point to array of non-complete user events that block this command queue */
  cl_int barrier_events_num;           /* Number of Non-complete user events */
  cl_int barrier_events_size;          /* The size of array that wait_events point to */
  cl_event* wait_events;               /* Point to array of non-complete user events that block this command queue */
  cl_int wait_events_num;              /* Number of Non-complete user events */
  cl_int wait_events_size;             /* The size of array that wait_events point to */
  cl_command_queue_properties props;   /* Queue properties */
  cl_command_queue prev, next;         /* We chain the command queues together */
  void* pdata;                         /* The private data for driver. */
  void* worker;                        /* The worker thread related info. */
} _cl_command_queue;

/* Represent one enqueued work item, eg, EnqueueNDRange. */
typedef struct _cl_command_queue_work_item {
  struct _cl_command_queue_work_item *prev, *next;
  cl_event event; // The event represent this work.
  cl_event* depend_events;
  cl_uint depend_event_num;
  void* content;
} _cl_command_queue_work_item;
typedef _cl_command_queue_work_item* cl_command_queue_work_item;

#endif /* __CL_COMMAND_QUEUE_H__ */