socl.h 28 KB

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