socl.h 30 KB

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