socl.h 26 KB

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