socl.h 29 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763
  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. struct entity {
  43. struct _cl_icd_dispatch * dispatch;
  44. /* Reference count */
  45. size_t refs;
  46. /* Callback called on release */
  47. void (*release_callback)(void*entity);
  48. /* Next entity in garbage collector queue */
  49. entity prev;
  50. entity next;
  51. };
  52. /* OpenCL entities (context, command queues, buffers...) must use
  53. * this macro as their first field */
  54. #define CL_ENTITY struct entity _entity;
  55. #include "command.h"
  56. #include "command_list.h"
  57. #include "command_queue.h"
  58. #include "debug.h"
  59. #include "event.h"
  60. #include "gc.h"
  61. #include "mem_objects.h"
  62. #include "task.h"
  63. #include "util.h"
  64. struct _cl_platform_id {struct _cl_icd_dispatch *dispatch;};
  65. struct _cl_device_id {struct _cl_icd_dispatch *dispatch; int device_id; int worker_id;};
  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. /* StarPU codelet */
  193. struct starpu_perfmodel * perfmodel;
  194. /* Kernel name */
  195. char * kernel_name;
  196. /* Real OpenCL kernels */
  197. cl_kernel *cl_kernels;
  198. /* clCreateKernel return codes */
  199. cl_int *errcodes;
  200. /* Arguments */
  201. unsigned int num_args;
  202. size_t *arg_size;
  203. enum kernel_arg_type *arg_type;
  204. void **arg_value;
  205. /* ID */
  206. #ifdef DEBUG
  207. int id;
  208. #endif
  209. };
  210. /* Global vars */
  211. /* Command queues with profiling enabled
  212. * This allows us to disable StarPU profiling it
  213. * is equal to 0
  214. */
  215. int profiling_queue_count;
  216. /***************************************************************************/
  217. /* Platform API */
  218. extern CL_API_ENTRY cl_int CL_API_CALL
  219. soclGetPlatformIDs(cl_uint /* num_entries */,
  220. cl_platform_id * /* platforms */,
  221. cl_uint * /* num_platforms */) CL_API_SUFFIX__VERSION_1_0;
  222. extern CL_API_ENTRY cl_int CL_API_CALL
  223. soclGetPlatformInfo(cl_platform_id /* platform */,
  224. cl_platform_info /* param_name */,
  225. size_t /* param_value_size */,
  226. void * /* param_value */,
  227. size_t * /* param_value_size_ret */) CL_API_SUFFIX__VERSION_1_0;
  228. /* Device APIs */
  229. extern CL_API_ENTRY cl_int CL_API_CALL
  230. soclGetDeviceIDs(cl_platform_id /* platform */,
  231. cl_device_type /* device_type */,
  232. cl_uint /* num_entries */,
  233. cl_device_id * /* devices */,
  234. cl_uint * /* num_devices */) CL_API_SUFFIX__VERSION_1_0;
  235. extern CL_API_ENTRY cl_int CL_API_CALL
  236. soclGetDeviceInfo(cl_device_id /* device */,
  237. cl_device_info /* param_name */,
  238. size_t /* param_value_size */,
  239. void * /* param_value */,
  240. size_t * /* param_value_size_ret */) CL_API_SUFFIX__VERSION_1_0;
  241. /* Context APIs */
  242. extern CL_API_ENTRY cl_context CL_API_CALL
  243. soclCreateContext(const cl_context_properties * /* properties */,
  244. cl_uint /* num_devices */,
  245. const cl_device_id * /* devices */,
  246. void (*pfn_notify)(const char *, const void *, size_t, void *) /* pfn_notify */,
  247. void * /* user_data */,
  248. cl_int * /* errcode_ret */) CL_API_SUFFIX__VERSION_1_0;
  249. extern CL_API_ENTRY cl_context CL_API_CALL
  250. soclCreateContextFromType(const cl_context_properties * /* properties */,
  251. cl_device_type /* device_type */,
  252. void (*pfn_notify)(const char *, const void *, size_t, void *) /* pfn_notify */,
  253. void * /* user_data */,
  254. cl_int * /* errcode_ret */) CL_API_SUFFIX__VERSION_1_0;
  255. extern CL_API_ENTRY cl_int CL_API_CALL
  256. soclRetainContext(cl_context /* context */) CL_API_SUFFIX__VERSION_1_0;
  257. extern CL_API_ENTRY cl_int CL_API_CALL
  258. soclReleaseContext(cl_context /* context */) CL_API_SUFFIX__VERSION_1_0;
  259. extern CL_API_ENTRY cl_int CL_API_CALL
  260. soclGetContextInfo(cl_context /* context */,
  261. cl_context_info /* param_name */,
  262. size_t /* param_value_size */,
  263. void * /* param_value */,
  264. size_t * /* param_value_size_ret */) CL_API_SUFFIX__VERSION_1_0;
  265. /* Command Queue APIs */
  266. extern CL_API_ENTRY cl_command_queue CL_API_CALL
  267. soclCreateCommandQueue(cl_context /* context */,
  268. cl_device_id /* device */,
  269. cl_command_queue_properties /* properties */,
  270. cl_int * /* errcode_ret */) CL_API_SUFFIX__VERSION_1_0;
  271. extern CL_API_ENTRY cl_int CL_API_CALL
  272. soclRetainCommandQueue(cl_command_queue /* command_queue */) CL_API_SUFFIX__VERSION_1_0;
  273. extern CL_API_ENTRY cl_int CL_API_CALL
  274. soclReleaseCommandQueue(cl_command_queue /* command_queue */) CL_API_SUFFIX__VERSION_1_0;
  275. extern CL_API_ENTRY cl_int CL_API_CALL
  276. soclGetCommandQueueInfo(cl_command_queue /* command_queue */,
  277. cl_command_queue_info /* param_name */,
  278. size_t /* param_value_size */,
  279. void * /* param_value */,
  280. size_t * /* param_value_size_ret */) CL_API_SUFFIX__VERSION_1_0;
  281. extern CL_API_ENTRY cl_int CL_API_CALL
  282. soclSetCommandQueueProperty(cl_command_queue /* command_queue */,
  283. cl_command_queue_properties /* properties */,
  284. cl_bool /* enable */,
  285. cl_command_queue_properties * /* old_properties */) CL_API_SUFFIX__VERSION_1_0;
  286. /* Memory Object APIs */
  287. extern CL_API_ENTRY cl_mem CL_API_CALL
  288. soclCreateBuffer(cl_context /* context */,
  289. cl_mem_flags /* flags */,
  290. size_t /* size */,
  291. void * /* host_ptr */,
  292. cl_int * /* errcode_ret */) CL_API_SUFFIX__VERSION_1_0;
  293. extern CL_API_ENTRY cl_mem CL_API_CALL
  294. soclCreateImage2D(cl_context /* context */,
  295. cl_mem_flags /* flags */,
  296. const cl_image_format * /* image_format */,
  297. size_t /* image_width */,
  298. size_t /* image_height */,
  299. size_t /* image_row_pitch */,
  300. void * /* host_ptr */,
  301. cl_int * /* errcode_ret */) CL_API_SUFFIX__VERSION_1_0;
  302. extern CL_API_ENTRY cl_mem CL_API_CALL
  303. soclCreateImage3D(cl_context /* context */,
  304. cl_mem_flags /* flags */,
  305. const cl_image_format * /* image_format */,
  306. size_t /* image_width */,
  307. size_t /* image_height */,
  308. size_t /* image_depth */,
  309. size_t /* image_row_pitch */,
  310. size_t /* image_slice_pitch */,
  311. void * /* host_ptr */,
  312. cl_int * /* errcode_ret */) CL_API_SUFFIX__VERSION_1_0;
  313. extern CL_API_ENTRY cl_int CL_API_CALL
  314. soclRetainMemObject(cl_mem /* memobj */) CL_API_SUFFIX__VERSION_1_0;
  315. extern CL_API_ENTRY cl_int CL_API_CALL
  316. soclReleaseMemObject(cl_mem /* memobj */) CL_API_SUFFIX__VERSION_1_0;
  317. extern CL_API_ENTRY cl_int CL_API_CALL
  318. soclGetSupportedImageFormats(cl_context /* context */,
  319. cl_mem_flags /* flags */,
  320. cl_mem_object_type /* image_type */,
  321. cl_uint /* num_entries */,
  322. cl_image_format * /* image_formats */,
  323. cl_uint * /* num_image_formats */) CL_API_SUFFIX__VERSION_1_0;
  324. extern CL_API_ENTRY cl_int CL_API_CALL
  325. soclGetMemObjectInfo(cl_mem /* memobj */,
  326. cl_mem_info /* param_name */,
  327. size_t /* param_value_size */,
  328. void * /* param_value */,
  329. size_t * /* param_value_size_ret */) CL_API_SUFFIX__VERSION_1_0;
  330. extern CL_API_ENTRY cl_int CL_API_CALL
  331. soclGetImageInfo(cl_mem /* image */,
  332. cl_image_info /* param_name */,
  333. size_t /* param_value_size */,
  334. void * /* param_value */,
  335. size_t * /* param_value_size_ret */) CL_API_SUFFIX__VERSION_1_0;
  336. /* Sampler APIs */
  337. extern CL_API_ENTRY cl_sampler CL_API_CALL
  338. soclCreateSampler(cl_context /* context */,
  339. cl_bool /* normalized_coords */,
  340. cl_addressing_mode /* addressing_mode */,
  341. cl_filter_mode /* filter_mode */,
  342. cl_int * /* errcode_ret */) CL_API_SUFFIX__VERSION_1_0;
  343. extern CL_API_ENTRY cl_int CL_API_CALL
  344. soclRetainSampler(cl_sampler /* sampler */) CL_API_SUFFIX__VERSION_1_0;
  345. extern CL_API_ENTRY cl_int CL_API_CALL
  346. soclReleaseSampler(cl_sampler /* sampler */) CL_API_SUFFIX__VERSION_1_0;
  347. extern CL_API_ENTRY cl_int CL_API_CALL
  348. soclGetSamplerInfo(cl_sampler /* sampler */,
  349. cl_sampler_info /* param_name */,
  350. size_t /* param_value_size */,
  351. void * /* param_value */,
  352. size_t * /* param_value_size_ret */) CL_API_SUFFIX__VERSION_1_0;
  353. /* Program Object APIs */
  354. extern CL_API_ENTRY cl_program CL_API_CALL
  355. soclCreateProgramWithSource(cl_context /* context */,
  356. cl_uint /* count */,
  357. const char ** /* strings */,
  358. const size_t * /* lengths */,
  359. cl_int * /* errcode_ret */) CL_API_SUFFIX__VERSION_1_0;
  360. extern CL_API_ENTRY cl_program CL_API_CALL
  361. soclCreateProgramWithBinary(cl_context /* context */,
  362. cl_uint /* num_devices */,
  363. const cl_device_id * /* device_list */,
  364. const size_t * /* lengths */,
  365. const unsigned char ** /* binaries */,
  366. cl_int * /* binary_status */,
  367. cl_int * /* errcode_ret */) CL_API_SUFFIX__VERSION_1_0;
  368. extern CL_API_ENTRY cl_int CL_API_CALL
  369. soclRetainProgram(cl_program /* program */) CL_API_SUFFIX__VERSION_1_0;
  370. extern CL_API_ENTRY cl_int CL_API_CALL
  371. soclReleaseProgram(cl_program /* program */) CL_API_SUFFIX__VERSION_1_0;
  372. extern CL_API_ENTRY cl_int CL_API_CALL
  373. soclBuildProgram(cl_program /* program */,
  374. cl_uint /* num_devices */,
  375. const cl_device_id * /* device_list */,
  376. const char * /* options */,
  377. void (*pfn_notify)(cl_program /* program */, void * /* user_data */),
  378. void * /* user_data */) CL_API_SUFFIX__VERSION_1_0;
  379. extern CL_API_ENTRY cl_int CL_API_CALL
  380. soclUnloadCompiler(void) CL_API_SUFFIX__VERSION_1_0;
  381. extern CL_API_ENTRY cl_int CL_API_CALL
  382. soclGetProgramInfo(cl_program /* program */,
  383. cl_program_info /* param_name */,
  384. size_t /* param_value_size */,
  385. void * /* param_value */,
  386. size_t * /* param_value_size_ret */) CL_API_SUFFIX__VERSION_1_0;
  387. extern CL_API_ENTRY cl_int CL_API_CALL
  388. soclGetProgramBuildInfo(cl_program /* program */,
  389. cl_device_id /* device */,
  390. cl_program_build_info /* param_name */,
  391. size_t /* param_value_size */,
  392. void * /* param_value */,
  393. size_t * /* param_value_size_ret */) CL_API_SUFFIX__VERSION_1_0;
  394. /* Kernel Object APIs */
  395. extern CL_API_ENTRY cl_kernel CL_API_CALL
  396. soclCreateKernel(cl_program /* program */,
  397. const char * /* kernel_name */,
  398. cl_int * /* errcode_ret */) CL_API_SUFFIX__VERSION_1_0;
  399. extern CL_API_ENTRY cl_int CL_API_CALL
  400. soclCreateKernelsInProgram(cl_program /* program */,
  401. cl_uint /* num_kernels */,
  402. cl_kernel * /* kernels */,
  403. cl_uint * /* num_kernels_ret */) CL_API_SUFFIX__VERSION_1_0;
  404. extern CL_API_ENTRY cl_int CL_API_CALL
  405. soclRetainKernel(cl_kernel /* kernel */) CL_API_SUFFIX__VERSION_1_0;
  406. extern CL_API_ENTRY cl_int CL_API_CALL
  407. soclReleaseKernel(cl_kernel /* kernel */) CL_API_SUFFIX__VERSION_1_0;
  408. extern CL_API_ENTRY cl_int CL_API_CALL
  409. soclSetKernelArg(cl_kernel /* kernel */,
  410. cl_uint /* arg_index */,
  411. size_t /* arg_size */,
  412. const void * /* arg_value */) CL_API_SUFFIX__VERSION_1_0;
  413. extern CL_API_ENTRY cl_int CL_API_CALL
  414. soclGetKernelInfo(cl_kernel /* kernel */,
  415. cl_kernel_info /* param_name */,
  416. size_t /* param_value_size */,
  417. void * /* param_value */,
  418. size_t * /* param_value_size_ret */) CL_API_SUFFIX__VERSION_1_0;
  419. extern CL_API_ENTRY cl_int CL_API_CALL
  420. soclGetKernelWorkGroupInfo(cl_kernel /* kernel */,
  421. cl_device_id /* device */,
  422. cl_kernel_work_group_info /* param_name */,
  423. size_t /* param_value_size */,
  424. void * /* param_value */,
  425. size_t * /* param_value_size_ret */) CL_API_SUFFIX__VERSION_1_0;
  426. /* Event Object APIs */
  427. extern CL_API_ENTRY cl_int CL_API_CALL
  428. soclWaitForEvents(cl_uint /* num_events */,
  429. const cl_event * /* event_list */) CL_API_SUFFIX__VERSION_1_0;
  430. extern CL_API_ENTRY cl_int CL_API_CALL
  431. soclGetEventInfo(cl_event /* event */,
  432. cl_event_info /* param_name */,
  433. size_t /* param_value_size */,
  434. void * /* param_value */,
  435. size_t * /* param_value_size_ret */) CL_API_SUFFIX__VERSION_1_0;
  436. extern CL_API_ENTRY cl_int CL_API_CALL
  437. soclRetainEvent(cl_event /* event */) CL_API_SUFFIX__VERSION_1_0;
  438. extern CL_API_ENTRY cl_int CL_API_CALL
  439. soclReleaseEvent(cl_event /* event */) CL_API_SUFFIX__VERSION_1_0;
  440. /* Profiling APIs */
  441. extern CL_API_ENTRY cl_int CL_API_CALL
  442. soclGetEventProfilingInfo(cl_event /* event */,
  443. cl_profiling_info /* param_name */,
  444. size_t /* param_value_size */,
  445. void * /* param_value */,
  446. size_t * /* param_value_size_ret */) CL_API_SUFFIX__VERSION_1_0;
  447. /* Flush and Finish APIs */
  448. extern CL_API_ENTRY cl_int CL_API_CALL
  449. soclFlush(cl_command_queue /* command_queue */) CL_API_SUFFIX__VERSION_1_0;
  450. extern CL_API_ENTRY cl_int CL_API_CALL
  451. soclFinish(cl_command_queue /* command_queue */) CL_API_SUFFIX__VERSION_1_0;
  452. /* Enqueued Commands APIs */
  453. extern CL_API_ENTRY cl_int CL_API_CALL
  454. soclEnqueueReadBuffer(cl_command_queue /* command_queue */,
  455. cl_mem /* buffer */,
  456. cl_bool /* blocking_read */,
  457. size_t /* offset */,
  458. size_t /* cb */,
  459. void * /* ptr */,
  460. cl_uint /* num_events_in_wait_list */,
  461. const cl_event * /* event_wait_list */,
  462. cl_event * /* event */) CL_API_SUFFIX__VERSION_1_0;
  463. extern CL_API_ENTRY cl_int CL_API_CALL
  464. soclEnqueueWriteBuffer(cl_command_queue /* command_queue */,
  465. cl_mem /* buffer */,
  466. cl_bool /* blocking_write */,
  467. size_t /* offset */,
  468. size_t /* cb */,
  469. const void * /* ptr */,
  470. cl_uint /* num_events_in_wait_list */,
  471. const cl_event * /* event_wait_list */,
  472. cl_event * /* event */) CL_API_SUFFIX__VERSION_1_0;
  473. extern CL_API_ENTRY cl_int CL_API_CALL
  474. soclEnqueueCopyBuffer(cl_command_queue /* command_queue */,
  475. cl_mem /* src_buffer */,
  476. cl_mem /* dst_buffer */,
  477. size_t /* src_offset */,
  478. size_t /* dst_offset */,
  479. size_t /* cb */,
  480. cl_uint /* num_events_in_wait_list */,
  481. const cl_event * /* event_wait_list */,
  482. cl_event * /* event */) CL_API_SUFFIX__VERSION_1_0;
  483. extern CL_API_ENTRY cl_int CL_API_CALL
  484. soclEnqueueReadImage(cl_command_queue /* command_queue */,
  485. cl_mem /* image */,
  486. cl_bool /* blocking_read */,
  487. const size_t * /* origin[3] */,
  488. const size_t * /* region[3] */,
  489. size_t /* row_pitch */,
  490. size_t /* slice_pitch */,
  491. void * /* ptr */,
  492. cl_uint /* num_events_in_wait_list */,
  493. const cl_event * /* event_wait_list */,
  494. cl_event * /* event */) CL_API_SUFFIX__VERSION_1_0;
  495. extern CL_API_ENTRY cl_int CL_API_CALL
  496. soclEnqueueWriteImage(cl_command_queue /* command_queue */,
  497. cl_mem /* image */,
  498. cl_bool /* blocking_write */,
  499. const size_t * /* origin[3] */,
  500. const size_t * /* region[3] */,
  501. size_t /* input_row_pitch */,
  502. size_t /* input_slice_pitch */,
  503. const void * /* ptr */,
  504. cl_uint /* num_events_in_wait_list */,
  505. const cl_event * /* event_wait_list */,
  506. cl_event * /* event */) CL_API_SUFFIX__VERSION_1_0;
  507. extern CL_API_ENTRY cl_int CL_API_CALL
  508. soclEnqueueCopyImage(cl_command_queue /* command_queue */,
  509. cl_mem /* src_image */,
  510. cl_mem /* dst_image */,
  511. const size_t * /* src_origin[3] */,
  512. const size_t * /* dst_origin[3] */,
  513. const size_t * /* region[3] */,
  514. cl_uint /* num_events_in_wait_list */,
  515. const cl_event * /* event_wait_list */,
  516. cl_event * /* event */) CL_API_SUFFIX__VERSION_1_0;
  517. extern CL_API_ENTRY cl_int CL_API_CALL
  518. soclEnqueueCopyImageToBuffer(cl_command_queue /* command_queue */,
  519. cl_mem /* src_image */,
  520. cl_mem /* dst_buffer */,
  521. const size_t * /* src_origin[3] */,
  522. const size_t * /* region[3] */,
  523. size_t /* dst_offset */,
  524. cl_uint /* num_events_in_wait_list */,
  525. const cl_event * /* event_wait_list */,
  526. cl_event * /* event */) CL_API_SUFFIX__VERSION_1_0;
  527. extern CL_API_ENTRY cl_int CL_API_CALL
  528. soclEnqueueCopyBufferToImage(cl_command_queue /* command_queue */,
  529. cl_mem /* src_buffer */,
  530. cl_mem /* dst_image */,
  531. size_t /* src_offset */,
  532. const size_t * /* dst_origin[3] */,
  533. const size_t * /* region[3] */,
  534. cl_uint /* num_events_in_wait_list */,
  535. const cl_event * /* event_wait_list */,
  536. cl_event * /* event */) CL_API_SUFFIX__VERSION_1_0;
  537. extern CL_API_ENTRY void * CL_API_CALL
  538. soclEnqueueMapBuffer(cl_command_queue /* command_queue */,
  539. cl_mem /* buffer */,
  540. cl_bool /* blocking_map */,
  541. cl_map_flags /* map_flags */,
  542. size_t /* offset */,
  543. size_t /* cb */,
  544. cl_uint /* num_events_in_wait_list */,
  545. const cl_event * /* event_wait_list */,
  546. cl_event * /* event */,
  547. cl_int * /* errcode_ret */) CL_API_SUFFIX__VERSION_1_0;
  548. extern CL_API_ENTRY void * CL_API_CALL
  549. soclEnqueueMapImage(cl_command_queue /* command_queue */,
  550. cl_mem /* image */,
  551. cl_bool /* blocking_map */,
  552. cl_map_flags /* map_flags */,
  553. const size_t * /* origin[3] */,
  554. const size_t * /* region[3] */,
  555. size_t * /* image_row_pitch */,
  556. size_t * /* image_slice_pitch */,
  557. cl_uint /* num_events_in_wait_list */,
  558. const cl_event * /* event_wait_list */,
  559. cl_event * /* event */,
  560. cl_int * /* errcode_ret */) CL_API_SUFFIX__VERSION_1_0;
  561. extern CL_API_ENTRY cl_int CL_API_CALL
  562. soclEnqueueUnmapMemObject(cl_command_queue /* command_queue */,
  563. cl_mem /* memobj */,
  564. void * /* mapped_ptr */,
  565. cl_uint /* num_events_in_wait_list */,
  566. const cl_event * /* event_wait_list */,
  567. cl_event * /* event */) CL_API_SUFFIX__VERSION_1_0;
  568. extern CL_API_ENTRY cl_int CL_API_CALL
  569. soclEnqueueNDRangeKernel(cl_command_queue /* command_queue */,
  570. cl_kernel /* kernel */,
  571. cl_uint /* work_dim */,
  572. const size_t * /* global_work_offset */,
  573. const size_t * /* global_work_size */,
  574. const size_t * /* local_work_size */,
  575. cl_uint /* num_events_in_wait_list */,
  576. const cl_event * /* event_wait_list */,
  577. cl_event * /* event */) CL_API_SUFFIX__VERSION_1_0;
  578. extern CL_API_ENTRY cl_int CL_API_CALL
  579. soclEnqueueTask(cl_command_queue /* command_queue */,
  580. cl_kernel /* kernel */,
  581. cl_uint /* num_events_in_wait_list */,
  582. const cl_event * /* event_wait_list */,
  583. cl_event * /* event */) CL_API_SUFFIX__VERSION_1_0;
  584. extern CL_API_ENTRY cl_int CL_API_CALL
  585. soclEnqueueNativeKernel(cl_command_queue /* command_queue */,
  586. void (*user_func)(void *),
  587. void * /* args */,
  588. size_t /* cb_args */,
  589. cl_uint /* num_mem_objects */,
  590. const cl_mem * /* mem_list */,
  591. const void ** /* args_mem_loc */,
  592. cl_uint /* num_events_in_wait_list */,
  593. const cl_event * /* event_wait_list */,
  594. cl_event * /* event */) CL_API_SUFFIX__VERSION_1_0;
  595. extern CL_API_ENTRY cl_int CL_API_CALL
  596. soclEnqueueMarker(cl_command_queue /* command_queue */,
  597. cl_event * /* event */) CL_API_SUFFIX__VERSION_1_0;
  598. extern CL_API_ENTRY cl_int CL_API_CALL
  599. soclEnqueueWaitForEvents(cl_command_queue /* command_queue */,
  600. cl_uint /* num_events */,
  601. const cl_event * /* event_list */) CL_API_SUFFIX__VERSION_1_0;
  602. extern CL_API_ENTRY cl_int CL_API_CALL
  603. soclEnqueueBarrier(cl_command_queue /* command_queue */) CL_API_SUFFIX__VERSION_1_0;
  604. /* Extension function access
  605. *
  606. * Returns the extension function address for the given function name,
  607. * or NULL if a valid function can not be found. The client must
  608. * check to make sure the address is not NULL, before using or
  609. * calling the returned function address.
  610. */
  611. extern CL_API_ENTRY void * CL_API_CALL
  612. soclGetExtensionFunctionAddress(const char * /* func_name */) CL_API_SUFFIX__VERSION_1_0;
  613. extern void * CL_API_CALL
  614. soclGetExtensionFunctionAddressForPlatform(cl_platform_id p, const char * func_name) CL_API_SUFFIX__VERSION_1_2;
  615. extern CL_API_ENTRY cl_int CL_API_CALL
  616. soclIcdGetPlatformIDsKHR(cl_uint /* num_entries */,
  617. cl_platform_id * /* platforms */,
  618. cl_uint * /* num_platforms */) CL_EXT_SUFFIX__VERSION_1_0;
  619. struct _cl_icd_dispatch socl_master_dispatch;
  620. struct _cl_platform_id socl_platform;
  621. struct _cl_device_id * socl_devices;
  622. extern unsigned int socl_device_count;
  623. #endif /* SOCL_H */