socl.h 29 KB

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