socl.h 29 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752
  1. /* StarPU --- Runtime system for heterogeneous multicore architectures.
  2. *
  3. * Copyright (C) 2010,2011 University of Bordeaux
  4. *
  5. * StarPU is free software; you can redistribute it and/or modify
  6. * it under the terms of the GNU Lesser General Public License as published by
  7. * the Free Software Foundation; either version 2.1 of the License, or (at
  8. * your option) any later version.
  9. *
  10. * StarPU is distributed in the hope that it will be useful, but
  11. * WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  13. *
  14. * See the GNU Lesser General Public License in COPYING.LGPL for more details.
  15. */
  16. #ifndef SOCL_H
  17. #define SOCL_H
  18. #ifndef CL_HEADERS
  19. #include "CL/cl.h"
  20. #else
  21. #include CL_HEADERS "CL/cl.h"
  22. #endif
  23. /* Additional command type */
  24. #define CL_COMMAND_BARRIER 0x99987
  25. #include <string.h>
  26. #include <stdlib.h>
  27. #include <stdint.h>
  28. #include <unistd.h>
  29. #include <pthread.h>
  30. #include <starpu.h>
  31. #include <starpu_opencl.h>
  32. #include <starpu_data_interfaces.h>
  33. #include <starpu_profiling.h>
  34. #include <starpu_task.h>
  35. typedef struct starpu_task * starpu_task;
  36. #ifdef UNUSED
  37. #elif defined(__GNUC__)
  38. #define UNUSED(x) UNUSED_ ## x __attribute__((unused))
  39. #else
  40. #define UNUSED(x) x
  41. #endif
  42. /**
  43. * Entity that can be managed by the garbage collector
  44. */
  45. typedef struct entity * entity;
  46. #include "command.h"
  47. #include "command_list.h"
  48. #include "command_queue.h"
  49. #include "debug.h"
  50. #include "devices.h"
  51. #include "event.h"
  52. #include "gc.h"
  53. #include "mem_objects.h"
  54. #include "task.h"
  55. #include "util.h"
  56. struct entity {
  57. /* Reference count */
  58. size_t refs;
  59. /* Callback called on release */
  60. void (*release_callback)(void*entity);
  61. /* Next entity in garbage collector queue */
  62. entity prev;
  63. entity next;
  64. };
  65. /* OpenCL entities (context, command queues, buffers...) must use
  66. * this macro as their first field */
  67. #define CL_ENTITY struct entity _entity;
  68. struct _cl_platform_id {};
  69. #define RETURN_EVENT(cmd, event) \
  70. if (event != NULL) { \
  71. cl_event ev = command_event_get(cmd);\
  72. gc_entity_retain(ev);\
  73. *event = ev; \
  74. }
  75. #define RETURN_CUSTOM_EVENT(src, tgt) \
  76. if (tgt != NULL) { \
  77. gc_entity_retain(src); \
  78. *tgt = src; \
  79. }
  80. #define MAY_BLOCK(blocking) \
  81. if ((blocking) == CL_TRUE) {\
  82. cl_event ev = command_event_get(cmd);\
  83. soclWaitForEvents(1, &ev);\
  84. gc_entity_release(ev);\
  85. }
  86. #define MAY_BLOCK_CUSTOM(blocking,event) \
  87. if ((blocking) == CL_TRUE) {\
  88. cl_event ev = (event);\
  89. soclWaitForEvents(1, &ev);\
  90. gc_entity_release(ev);\
  91. }
  92. /* Constants */
  93. struct _cl_platform_id socl_platform;
  94. const char * SOCL_PROFILE;
  95. const char * SOCL_VERSION;
  96. const char * SOCL_PLATFORM_NAME;
  97. const char * SOCL_VENDOR;
  98. const char * SOCL_PLATFORM_EXTENSIONS;
  99. struct _cl_context {
  100. CL_ENTITY;
  101. void (*pfn_notify)(const char *, const void *, size_t, void *);
  102. void *user_data;
  103. /* Associated devices */
  104. cl_device_id * devices;
  105. cl_uint num_devices;
  106. /* Properties */
  107. cl_context_properties * properties;
  108. cl_uint num_properties;
  109. /* ID */
  110. #ifdef DEBUG
  111. int id;
  112. #endif
  113. };
  114. struct _cl_command_queue {
  115. CL_ENTITY;
  116. cl_command_queue_properties properties;
  117. cl_device_id device;
  118. cl_context context;
  119. /* Stored commands */
  120. command_list commands;
  121. /* Last enqueued barrier-like event */
  122. cl_command barrier;
  123. /* Mutex */
  124. pthread_mutex_t mutex;
  125. /* ID */
  126. #ifdef DEBUG
  127. int id;
  128. #endif
  129. };
  130. struct _cl_event {
  131. CL_ENTITY;
  132. /* Command queue */
  133. cl_command_queue cq;
  134. /* Command */
  135. cl_command command;
  136. /* Event status */
  137. cl_int status;
  138. /* ID
  139. * This ID is used as a tag for StarPU dependencies
  140. */
  141. int id;
  142. /* Profiling info are copied here */
  143. struct starpu_task_profiling_info *profiling_info;
  144. };
  145. struct _cl_mem {
  146. CL_ENTITY;
  147. /* StarPU handle */
  148. starpu_data_handle_t handle;
  149. /* Pointer to data in host memory */
  150. void *ptr;
  151. /* Buffer size */
  152. size_t size;
  153. /* Indicates how many references (mapping, MEM_USE_HOST_PTR...) require
  154. * coherence in host memory. If set to zero, no coherency is maintained
  155. * (this is the most efficient) */
  156. int map_count;
  157. /* Creation flags */
  158. cl_mem_flags flags;
  159. /* Creation context */
  160. cl_context context;
  161. /* Access mode */
  162. int mode;
  163. /* Host ptr */
  164. void * host_ptr;
  165. /* Fields used to store cl_mems in mem_objects list */
  166. cl_mem prev;
  167. cl_mem next;
  168. /* Indicates if a buffer may contain meaningful data. Otherwise
  169. we don't have to transfer it */
  170. int scratch;
  171. /* ID */
  172. #ifdef DEBUG
  173. int id;
  174. #endif
  175. };
  176. struct _cl_program {
  177. CL_ENTITY;
  178. /* Real OpenCL Programs
  179. * There is one entry for each device (even non OpenCL ones)
  180. * in order to index this array with dev_id
  181. */
  182. cl_program *cl_programs;
  183. /* Context used to create this program */
  184. cl_context context;
  185. /* Options */
  186. char * options;
  187. unsigned int options_size;
  188. /* ID */
  189. #ifdef DEBUG
  190. int id;
  191. #endif
  192. };
  193. enum kernel_arg_type { Null, Buffer, Immediate };
  194. struct _cl_kernel {
  195. CL_ENTITY;
  196. /* Associated program */
  197. cl_program program;
  198. /* Kernel name */
  199. char * kernel_name;
  200. /* Real OpenCL kernels */
  201. cl_kernel *cl_kernels;
  202. /* clCreateKernel return codes */
  203. cl_int *errcodes;
  204. /* Arguments */
  205. unsigned int num_args;
  206. size_t *arg_size;
  207. enum kernel_arg_type *arg_type;
  208. void **arg_value;
  209. /* ID */
  210. #ifdef DEBUG
  211. int id;
  212. #endif
  213. };
  214. /* Global vars */
  215. /* Command queues with profiling enabled
  216. * This allows us to disable StarPU profiling it
  217. * is equal to 0
  218. */
  219. int profiling_queue_count;
  220. /***************************************************************************/
  221. /* Platform API */
  222. extern CL_API_ENTRY cl_int CL_API_CALL
  223. soclGetPlatformIDs(cl_uint /* num_entries */,
  224. cl_platform_id * /* platforms */,
  225. cl_uint * /* num_platforms */) CL_API_SUFFIX__VERSION_1_0;
  226. extern CL_API_ENTRY cl_int CL_API_CALL
  227. soclGetPlatformInfo(cl_platform_id /* platform */,
  228. cl_platform_info /* param_name */,
  229. size_t /* param_value_size */,
  230. void * /* param_value */,
  231. size_t * /* param_value_size_ret */) CL_API_SUFFIX__VERSION_1_0;
  232. /* Device APIs */
  233. extern CL_API_ENTRY cl_int CL_API_CALL
  234. soclGetDeviceIDs(cl_platform_id /* platform */,
  235. cl_device_type /* device_type */,
  236. cl_uint /* num_entries */,
  237. cl_device_id * /* devices */,
  238. cl_uint * /* num_devices */) CL_API_SUFFIX__VERSION_1_0;
  239. extern CL_API_ENTRY cl_int CL_API_CALL
  240. soclGetDeviceInfo(cl_device_id /* device */,
  241. cl_device_info /* param_name */,
  242. size_t /* param_value_size */,
  243. void * /* param_value */,
  244. size_t * /* param_value_size_ret */) CL_API_SUFFIX__VERSION_1_0;
  245. /* Context APIs */
  246. extern CL_API_ENTRY cl_context CL_API_CALL
  247. soclCreateContext(const cl_context_properties * /* properties */,
  248. cl_uint /* num_devices */,
  249. const cl_device_id * /* devices */,
  250. void (*pfn_notify)(const char *, const void *, size_t, void *) /* pfn_notify */,
  251. void * /* user_data */,
  252. cl_int * /* errcode_ret */) CL_API_SUFFIX__VERSION_1_0;
  253. extern CL_API_ENTRY cl_context CL_API_CALL
  254. soclCreateContextFromType(const cl_context_properties * /* properties */,
  255. cl_device_type /* device_type */,
  256. void (*pfn_notify)(const char *, const void *, size_t, void *) /* pfn_notify */,
  257. void * /* user_data */,
  258. cl_int * /* errcode_ret */) CL_API_SUFFIX__VERSION_1_0;
  259. extern CL_API_ENTRY cl_int CL_API_CALL
  260. soclRetainContext(cl_context /* context */) CL_API_SUFFIX__VERSION_1_0;
  261. extern CL_API_ENTRY cl_int CL_API_CALL
  262. soclReleaseContext(cl_context /* context */) CL_API_SUFFIX__VERSION_1_0;
  263. extern CL_API_ENTRY cl_int CL_API_CALL
  264. soclGetContextInfo(cl_context /* context */,
  265. cl_context_info /* param_name */,
  266. size_t /* param_value_size */,
  267. void * /* param_value */,
  268. size_t * /* param_value_size_ret */) CL_API_SUFFIX__VERSION_1_0;
  269. /* Command Queue APIs */
  270. extern CL_API_ENTRY cl_command_queue CL_API_CALL
  271. soclCreateCommandQueue(cl_context /* context */,
  272. cl_device_id /* device */,
  273. cl_command_queue_properties /* properties */,
  274. cl_int * /* errcode_ret */) CL_API_SUFFIX__VERSION_1_0;
  275. extern CL_API_ENTRY cl_int CL_API_CALL
  276. soclRetainCommandQueue(cl_command_queue /* command_queue */) CL_API_SUFFIX__VERSION_1_0;
  277. extern CL_API_ENTRY cl_int CL_API_CALL
  278. soclReleaseCommandQueue(cl_command_queue /* command_queue */) CL_API_SUFFIX__VERSION_1_0;
  279. extern CL_API_ENTRY cl_int CL_API_CALL
  280. soclGetCommandQueueInfo(cl_command_queue /* command_queue */,
  281. cl_command_queue_info /* param_name */,
  282. size_t /* param_value_size */,
  283. void * /* param_value */,
  284. size_t * /* param_value_size_ret */) CL_API_SUFFIX__VERSION_1_0;
  285. extern CL_API_ENTRY cl_int CL_API_CALL
  286. soclSetCommandQueueProperty(cl_command_queue /* command_queue */,
  287. cl_command_queue_properties /* properties */,
  288. cl_bool /* enable */,
  289. cl_command_queue_properties * /* old_properties */) CL_API_SUFFIX__VERSION_1_0;
  290. /* Memory Object APIs */
  291. extern CL_API_ENTRY cl_mem CL_API_CALL
  292. soclCreateBuffer(cl_context /* context */,
  293. cl_mem_flags /* flags */,
  294. size_t /* size */,
  295. void * /* host_ptr */,
  296. cl_int * /* errcode_ret */) CL_API_SUFFIX__VERSION_1_0;
  297. extern CL_API_ENTRY cl_mem CL_API_CALL
  298. soclCreateImage2D(cl_context /* context */,
  299. cl_mem_flags /* flags */,
  300. const cl_image_format * /* image_format */,
  301. size_t /* image_width */,
  302. size_t /* image_height */,
  303. size_t /* image_row_pitch */,
  304. void * /* host_ptr */,
  305. cl_int * /* errcode_ret */) CL_API_SUFFIX__VERSION_1_0;
  306. extern CL_API_ENTRY cl_mem CL_API_CALL
  307. soclCreateImage3D(cl_context /* context */,
  308. cl_mem_flags /* flags */,
  309. const cl_image_format * /* image_format */,
  310. size_t /* image_width */,
  311. size_t /* image_height */,
  312. size_t /* image_depth */,
  313. size_t /* image_row_pitch */,
  314. size_t /* image_slice_pitch */,
  315. void * /* host_ptr */,
  316. cl_int * /* errcode_ret */) CL_API_SUFFIX__VERSION_1_0;
  317. extern CL_API_ENTRY cl_int CL_API_CALL
  318. soclRetainMemObject(cl_mem /* memobj */) CL_API_SUFFIX__VERSION_1_0;
  319. extern CL_API_ENTRY cl_int CL_API_CALL
  320. soclReleaseMemObject(cl_mem /* memobj */) CL_API_SUFFIX__VERSION_1_0;
  321. extern CL_API_ENTRY cl_int CL_API_CALL
  322. soclGetSupportedImageFormats(cl_context /* context */,
  323. cl_mem_flags /* flags */,
  324. cl_mem_object_type /* image_type */,
  325. cl_uint /* num_entries */,
  326. cl_image_format * /* image_formats */,
  327. cl_uint * /* num_image_formats */) CL_API_SUFFIX__VERSION_1_0;
  328. extern CL_API_ENTRY cl_int CL_API_CALL
  329. soclGetMemObjectInfo(cl_mem /* memobj */,
  330. cl_mem_info /* param_name */,
  331. size_t /* param_value_size */,
  332. void * /* param_value */,
  333. size_t * /* param_value_size_ret */) CL_API_SUFFIX__VERSION_1_0;
  334. extern CL_API_ENTRY cl_int CL_API_CALL
  335. soclGetImageInfo(cl_mem /* image */,
  336. cl_image_info /* param_name */,
  337. size_t /* param_value_size */,
  338. void * /* param_value */,
  339. size_t * /* param_value_size_ret */) CL_API_SUFFIX__VERSION_1_0;
  340. /* Sampler APIs */
  341. extern CL_API_ENTRY cl_sampler CL_API_CALL
  342. soclCreateSampler(cl_context /* context */,
  343. cl_bool /* normalized_coords */,
  344. cl_addressing_mode /* addressing_mode */,
  345. cl_filter_mode /* filter_mode */,
  346. cl_int * /* errcode_ret */) CL_API_SUFFIX__VERSION_1_0;
  347. extern CL_API_ENTRY cl_int CL_API_CALL
  348. soclRetainSampler(cl_sampler /* sampler */) CL_API_SUFFIX__VERSION_1_0;
  349. extern CL_API_ENTRY cl_int CL_API_CALL
  350. soclReleaseSampler(cl_sampler /* sampler */) CL_API_SUFFIX__VERSION_1_0;
  351. extern CL_API_ENTRY cl_int CL_API_CALL
  352. soclGetSamplerInfo(cl_sampler /* sampler */,
  353. cl_sampler_info /* param_name */,
  354. size_t /* param_value_size */,
  355. void * /* param_value */,
  356. size_t * /* param_value_size_ret */) CL_API_SUFFIX__VERSION_1_0;
  357. /* Program Object APIs */
  358. extern CL_API_ENTRY cl_program CL_API_CALL
  359. soclCreateProgramWithSource(cl_context /* context */,
  360. cl_uint /* count */,
  361. const char ** /* strings */,
  362. const size_t * /* lengths */,
  363. cl_int * /* errcode_ret */) CL_API_SUFFIX__VERSION_1_0;
  364. extern CL_API_ENTRY cl_program CL_API_CALL
  365. soclCreateProgramWithBinary(cl_context /* context */,
  366. cl_uint /* num_devices */,
  367. const cl_device_id * /* device_list */,
  368. const size_t * /* lengths */,
  369. const unsigned char ** /* binaries */,
  370. cl_int * /* binary_status */,
  371. cl_int * /* errcode_ret */) CL_API_SUFFIX__VERSION_1_0;
  372. extern CL_API_ENTRY cl_int CL_API_CALL
  373. soclRetainProgram(cl_program /* program */) CL_API_SUFFIX__VERSION_1_0;
  374. extern CL_API_ENTRY cl_int CL_API_CALL
  375. soclReleaseProgram(cl_program /* program */) CL_API_SUFFIX__VERSION_1_0;
  376. extern CL_API_ENTRY cl_int CL_API_CALL
  377. soclBuildProgram(cl_program /* program */,
  378. cl_uint /* num_devices */,
  379. const cl_device_id * /* device_list */,
  380. const char * /* options */,
  381. void (*pfn_notify)(cl_program /* program */, void * /* user_data */),
  382. void * /* user_data */) CL_API_SUFFIX__VERSION_1_0;
  383. extern CL_API_ENTRY cl_int CL_API_CALL
  384. soclUnloadCompiler(void) CL_API_SUFFIX__VERSION_1_0;
  385. extern CL_API_ENTRY cl_int CL_API_CALL
  386. soclGetProgramInfo(cl_program /* program */,
  387. cl_program_info /* param_name */,
  388. size_t /* param_value_size */,
  389. void * /* param_value */,
  390. size_t * /* param_value_size_ret */) CL_API_SUFFIX__VERSION_1_0;
  391. extern CL_API_ENTRY cl_int CL_API_CALL
  392. soclGetProgramBuildInfo(cl_program /* program */,
  393. cl_device_id /* device */,
  394. cl_program_build_info /* param_name */,
  395. size_t /* param_value_size */,
  396. void * /* param_value */,
  397. size_t * /* param_value_size_ret */) CL_API_SUFFIX__VERSION_1_0;
  398. /* Kernel Object APIs */
  399. extern CL_API_ENTRY cl_kernel CL_API_CALL
  400. soclCreateKernel(cl_program /* program */,
  401. const char * /* kernel_name */,
  402. cl_int * /* errcode_ret */) CL_API_SUFFIX__VERSION_1_0;
  403. extern CL_API_ENTRY cl_int CL_API_CALL
  404. soclCreateKernelsInProgram(cl_program /* program */,
  405. cl_uint /* num_kernels */,
  406. cl_kernel * /* kernels */,
  407. cl_uint * /* num_kernels_ret */) CL_API_SUFFIX__VERSION_1_0;
  408. extern CL_API_ENTRY cl_int CL_API_CALL
  409. soclRetainKernel(cl_kernel /* kernel */) CL_API_SUFFIX__VERSION_1_0;
  410. extern CL_API_ENTRY cl_int CL_API_CALL
  411. soclReleaseKernel(cl_kernel /* kernel */) CL_API_SUFFIX__VERSION_1_0;
  412. extern CL_API_ENTRY cl_int CL_API_CALL
  413. soclSetKernelArg(cl_kernel /* kernel */,
  414. cl_uint /* arg_index */,
  415. size_t /* arg_size */,
  416. const void * /* arg_value */) CL_API_SUFFIX__VERSION_1_0;
  417. extern CL_API_ENTRY cl_int CL_API_CALL
  418. soclGetKernelInfo(cl_kernel /* kernel */,
  419. cl_kernel_info /* param_name */,
  420. size_t /* param_value_size */,
  421. void * /* param_value */,
  422. size_t * /* param_value_size_ret */) CL_API_SUFFIX__VERSION_1_0;
  423. extern CL_API_ENTRY cl_int CL_API_CALL
  424. soclGetKernelWorkGroupInfo(cl_kernel /* kernel */,
  425. cl_device_id /* device */,
  426. cl_kernel_work_group_info /* param_name */,
  427. size_t /* param_value_size */,
  428. void * /* param_value */,
  429. size_t * /* param_value_size_ret */) CL_API_SUFFIX__VERSION_1_0;
  430. /* Event Object APIs */
  431. extern CL_API_ENTRY cl_int CL_API_CALL
  432. soclWaitForEvents(cl_uint /* num_events */,
  433. const cl_event * /* event_list */) CL_API_SUFFIX__VERSION_1_0;
  434. extern CL_API_ENTRY cl_int CL_API_CALL
  435. soclGetEventInfo(cl_event /* event */,
  436. cl_event_info /* param_name */,
  437. size_t /* param_value_size */,
  438. void * /* param_value */,
  439. size_t * /* param_value_size_ret */) CL_API_SUFFIX__VERSION_1_0;
  440. extern CL_API_ENTRY cl_int CL_API_CALL
  441. soclRetainEvent(cl_event /* event */) CL_API_SUFFIX__VERSION_1_0;
  442. extern CL_API_ENTRY cl_int CL_API_CALL
  443. soclReleaseEvent(cl_event /* event */) CL_API_SUFFIX__VERSION_1_0;
  444. /* Profiling APIs */
  445. extern CL_API_ENTRY cl_int CL_API_CALL
  446. soclGetEventProfilingInfo(cl_event /* event */,
  447. cl_profiling_info /* param_name */,
  448. size_t /* param_value_size */,
  449. void * /* param_value */,
  450. size_t * /* param_value_size_ret */) CL_API_SUFFIX__VERSION_1_0;
  451. /* Flush and Finish APIs */
  452. extern CL_API_ENTRY cl_int CL_API_CALL
  453. soclFlush(cl_command_queue /* command_queue */) CL_API_SUFFIX__VERSION_1_0;
  454. extern CL_API_ENTRY cl_int CL_API_CALL
  455. soclFinish(cl_command_queue /* command_queue */) CL_API_SUFFIX__VERSION_1_0;
  456. /* Enqueued Commands APIs */
  457. extern CL_API_ENTRY cl_int CL_API_CALL
  458. soclEnqueueReadBuffer(cl_command_queue /* command_queue */,
  459. cl_mem /* buffer */,
  460. cl_bool /* blocking_read */,
  461. size_t /* offset */,
  462. size_t /* cb */,
  463. void * /* ptr */,
  464. cl_uint /* num_events_in_wait_list */,
  465. const cl_event * /* event_wait_list */,
  466. cl_event * /* event */) CL_API_SUFFIX__VERSION_1_0;
  467. extern CL_API_ENTRY cl_int CL_API_CALL
  468. soclEnqueueWriteBuffer(cl_command_queue /* command_queue */,
  469. cl_mem /* buffer */,
  470. cl_bool /* blocking_write */,
  471. size_t /* offset */,
  472. size_t /* cb */,
  473. const void * /* ptr */,
  474. cl_uint /* num_events_in_wait_list */,
  475. const cl_event * /* event_wait_list */,
  476. cl_event * /* event */) CL_API_SUFFIX__VERSION_1_0;
  477. extern CL_API_ENTRY cl_int CL_API_CALL
  478. soclEnqueueCopyBuffer(cl_command_queue /* command_queue */,
  479. cl_mem /* src_buffer */,
  480. cl_mem /* dst_buffer */,
  481. size_t /* src_offset */,
  482. size_t /* dst_offset */,
  483. size_t /* cb */,
  484. cl_uint /* num_events_in_wait_list */,
  485. const cl_event * /* event_wait_list */,
  486. cl_event * /* event */) CL_API_SUFFIX__VERSION_1_0;
  487. extern CL_API_ENTRY cl_int CL_API_CALL
  488. soclEnqueueReadImage(cl_command_queue /* command_queue */,
  489. cl_mem /* image */,
  490. cl_bool /* blocking_read */,
  491. const size_t * /* origin[3] */,
  492. const size_t * /* region[3] */,
  493. size_t /* row_pitch */,
  494. size_t /* slice_pitch */,
  495. void * /* ptr */,
  496. cl_uint /* num_events_in_wait_list */,
  497. const cl_event * /* event_wait_list */,
  498. cl_event * /* event */) CL_API_SUFFIX__VERSION_1_0;
  499. extern CL_API_ENTRY cl_int CL_API_CALL
  500. soclEnqueueWriteImage(cl_command_queue /* command_queue */,
  501. cl_mem /* image */,
  502. cl_bool /* blocking_write */,
  503. const size_t * /* origin[3] */,
  504. const size_t * /* region[3] */,
  505. size_t /* input_row_pitch */,
  506. size_t /* input_slice_pitch */,
  507. const void * /* ptr */,
  508. cl_uint /* num_events_in_wait_list */,
  509. const cl_event * /* event_wait_list */,
  510. cl_event * /* event */) CL_API_SUFFIX__VERSION_1_0;
  511. extern CL_API_ENTRY cl_int CL_API_CALL
  512. soclEnqueueCopyImage(cl_command_queue /* command_queue */,
  513. cl_mem /* src_image */,
  514. cl_mem /* dst_image */,
  515. const size_t * /* src_origin[3] */,
  516. const size_t * /* dst_origin[3] */,
  517. const size_t * /* region[3] */,
  518. cl_uint /* num_events_in_wait_list */,
  519. const cl_event * /* event_wait_list */,
  520. cl_event * /* event */) CL_API_SUFFIX__VERSION_1_0;
  521. extern CL_API_ENTRY cl_int CL_API_CALL
  522. soclEnqueueCopyImageToBuffer(cl_command_queue /* command_queue */,
  523. cl_mem /* src_image */,
  524. cl_mem /* dst_buffer */,
  525. const size_t * /* src_origin[3] */,
  526. const size_t * /* region[3] */,
  527. size_t /* dst_offset */,
  528. cl_uint /* num_events_in_wait_list */,
  529. const cl_event * /* event_wait_list */,
  530. cl_event * /* event */) CL_API_SUFFIX__VERSION_1_0;
  531. extern CL_API_ENTRY cl_int CL_API_CALL
  532. soclEnqueueCopyBufferToImage(cl_command_queue /* command_queue */,
  533. cl_mem /* src_buffer */,
  534. cl_mem /* dst_image */,
  535. size_t /* src_offset */,
  536. const size_t * /* dst_origin[3] */,
  537. const size_t * /* region[3] */,
  538. cl_uint /* num_events_in_wait_list */,
  539. const cl_event * /* event_wait_list */,
  540. cl_event * /* event */) CL_API_SUFFIX__VERSION_1_0;
  541. extern CL_API_ENTRY void * CL_API_CALL
  542. soclEnqueueMapBuffer(cl_command_queue /* command_queue */,
  543. cl_mem /* buffer */,
  544. cl_bool /* blocking_map */,
  545. cl_map_flags /* map_flags */,
  546. size_t /* offset */,
  547. size_t /* cb */,
  548. cl_uint /* num_events_in_wait_list */,
  549. const cl_event * /* event_wait_list */,
  550. cl_event * /* event */,
  551. cl_int * /* errcode_ret */) CL_API_SUFFIX__VERSION_1_0;
  552. extern CL_API_ENTRY void * CL_API_CALL
  553. soclEnqueueMapImage(cl_command_queue /* command_queue */,
  554. cl_mem /* image */,
  555. cl_bool /* blocking_map */,
  556. cl_map_flags /* map_flags */,
  557. const size_t * /* origin[3] */,
  558. const size_t * /* region[3] */,
  559. size_t * /* image_row_pitch */,
  560. size_t * /* image_slice_pitch */,
  561. cl_uint /* num_events_in_wait_list */,
  562. const cl_event * /* event_wait_list */,
  563. cl_event * /* event */,
  564. cl_int * /* errcode_ret */) CL_API_SUFFIX__VERSION_1_0;
  565. extern CL_API_ENTRY cl_int CL_API_CALL
  566. soclEnqueueUnmapMemObject(cl_command_queue /* command_queue */,
  567. cl_mem /* memobj */,
  568. void * /* mapped_ptr */,
  569. cl_uint /* num_events_in_wait_list */,
  570. const cl_event * /* event_wait_list */,
  571. cl_event * /* event */) CL_API_SUFFIX__VERSION_1_0;
  572. extern CL_API_ENTRY cl_int CL_API_CALL
  573. soclEnqueueNDRangeKernel(cl_command_queue /* command_queue */,
  574. cl_kernel /* kernel */,
  575. cl_uint /* work_dim */,
  576. const size_t * /* global_work_offset */,
  577. const size_t * /* global_work_size */,
  578. const size_t * /* local_work_size */,
  579. cl_uint /* num_events_in_wait_list */,
  580. const cl_event * /* event_wait_list */,
  581. cl_event * /* event */) CL_API_SUFFIX__VERSION_1_0;
  582. extern CL_API_ENTRY cl_int CL_API_CALL
  583. soclEnqueueTask(cl_command_queue /* command_queue */,
  584. cl_kernel /* kernel */,
  585. cl_uint /* num_events_in_wait_list */,
  586. const cl_event * /* event_wait_list */,
  587. cl_event * /* event */) CL_API_SUFFIX__VERSION_1_0;
  588. extern CL_API_ENTRY cl_int CL_API_CALL
  589. soclEnqueueNativeKernel(cl_command_queue /* command_queue */,
  590. void (*user_func)(void *),
  591. void * /* args */,
  592. size_t /* cb_args */,
  593. cl_uint /* num_mem_objects */,
  594. const cl_mem * /* mem_list */,
  595. const void ** /* args_mem_loc */,
  596. cl_uint /* num_events_in_wait_list */,
  597. const cl_event * /* event_wait_list */,
  598. cl_event * /* event */) CL_API_SUFFIX__VERSION_1_0;
  599. extern CL_API_ENTRY cl_int CL_API_CALL
  600. soclEnqueueMarker(cl_command_queue /* command_queue */,
  601. cl_event * /* event */) CL_API_SUFFIX__VERSION_1_0;
  602. extern CL_API_ENTRY cl_int CL_API_CALL
  603. soclEnqueueWaitForEvents(cl_command_queue /* command_queue */,
  604. cl_uint /* num_events */,
  605. const cl_event * /* event_list */) CL_API_SUFFIX__VERSION_1_0;
  606. extern CL_API_ENTRY cl_int CL_API_CALL
  607. soclEnqueueBarrier(cl_command_queue /* command_queue */) CL_API_SUFFIX__VERSION_1_0;
  608. /* Extension function access
  609. *
  610. * Returns the extension function address for the given function name,
  611. * or NULL if a valid function can not be found. The client must
  612. * check to make sure the address is not NULL, before using or
  613. * calling the returned function address.
  614. */
  615. extern CL_API_ENTRY void * CL_API_CALL
  616. soclGetExtensionFunctionAddress(const char * /* func_name */) CL_API_SUFFIX__VERSION_1_0;
  617. #endif /* SOCL_H */