socl.h 26 KB

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