socl.h 29 KB

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