socl.h 30 KB

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