omp.h 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521
  1. /*
  2. * include/omp.h.var
  3. */
  4. //===----------------------------------------------------------------------===//
  5. //
  6. // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
  7. // See https://llvm.org/LICENSE.txt for license information.
  8. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  9. //
  10. //===----------------------------------------------------------------------===//
  11. #ifndef __OMP_H
  12. # define __OMP_H
  13. #if 0 // !defined(NORUNTIME) && !defined(USE_STL_SYSTEM)
  14. // We need to put all possible dependencies to prevent blinking:
  15. // on all stdlib.h that can be mentioned here within a platform.
  16. # include <contrib/libs/cxxsupp/libcxx/include/stdlib.h>
  17. #else
  18. # include <stdlib.h>
  19. #endif
  20. # include <stdint.h>
  21. # define KMP_VERSION_MAJOR 5
  22. # define KMP_VERSION_MINOR 0
  23. # define KMP_VERSION_BUILD 20140926
  24. # define KMP_BUILD_DATE "No_Timestamp"
  25. # ifdef __cplusplus
  26. extern "C" {
  27. # endif
  28. # define omp_set_affinity_format ompc_set_affinity_format
  29. # define omp_get_affinity_format ompc_get_affinity_format
  30. # define omp_display_affinity ompc_display_affinity
  31. # define omp_capture_affinity ompc_capture_affinity
  32. # if defined(_WIN32)
  33. # define __KAI_KMPC_CONVENTION __cdecl
  34. # ifndef __KMP_IMP
  35. # define __KMP_IMP __declspec(dllimport)
  36. # endif
  37. # else
  38. # define __KAI_KMPC_CONVENTION
  39. # ifndef __KMP_IMP
  40. # define __KMP_IMP
  41. # endif
  42. # endif
  43. /* schedule kind constants */
  44. typedef enum omp_sched_t {
  45. omp_sched_static = 1,
  46. omp_sched_dynamic = 2,
  47. omp_sched_guided = 3,
  48. omp_sched_auto = 4,
  49. omp_sched_monotonic = 0x80000000
  50. } omp_sched_t;
  51. /* set API functions */
  52. extern void __KAI_KMPC_CONVENTION omp_set_num_threads (int);
  53. extern void __KAI_KMPC_CONVENTION omp_set_dynamic (int);
  54. extern void __KAI_KMPC_CONVENTION omp_set_nested (int);
  55. extern void __KAI_KMPC_CONVENTION omp_set_max_active_levels (int);
  56. extern void __KAI_KMPC_CONVENTION omp_set_schedule (omp_sched_t, int);
  57. /* query API functions */
  58. extern int __KAI_KMPC_CONVENTION omp_get_num_threads (void);
  59. extern int __KAI_KMPC_CONVENTION omp_get_dynamic (void);
  60. extern int __KAI_KMPC_CONVENTION omp_get_nested (void);
  61. extern int __KAI_KMPC_CONVENTION omp_get_max_threads (void);
  62. extern int __KAI_KMPC_CONVENTION omp_get_thread_num (void);
  63. extern int __KAI_KMPC_CONVENTION omp_get_num_procs (void);
  64. extern int __KAI_KMPC_CONVENTION omp_in_parallel (void);
  65. extern int __KAI_KMPC_CONVENTION omp_in_final (void);
  66. extern int __KAI_KMPC_CONVENTION omp_get_active_level (void);
  67. extern int __KAI_KMPC_CONVENTION omp_get_level (void);
  68. extern int __KAI_KMPC_CONVENTION omp_get_ancestor_thread_num (int);
  69. extern int __KAI_KMPC_CONVENTION omp_get_team_size (int);
  70. extern int __KAI_KMPC_CONVENTION omp_get_thread_limit (void);
  71. extern int __KAI_KMPC_CONVENTION omp_get_max_active_levels (void);
  72. extern void __KAI_KMPC_CONVENTION omp_get_schedule (omp_sched_t *, int *);
  73. extern int __KAI_KMPC_CONVENTION omp_get_max_task_priority (void);
  74. /* lock API functions */
  75. typedef struct omp_lock_t {
  76. void * _lk;
  77. } omp_lock_t;
  78. extern void __KAI_KMPC_CONVENTION omp_init_lock (omp_lock_t *);
  79. extern void __KAI_KMPC_CONVENTION omp_set_lock (omp_lock_t *);
  80. extern void __KAI_KMPC_CONVENTION omp_unset_lock (omp_lock_t *);
  81. extern void __KAI_KMPC_CONVENTION omp_destroy_lock (omp_lock_t *);
  82. extern int __KAI_KMPC_CONVENTION omp_test_lock (omp_lock_t *);
  83. /* nested lock API functions */
  84. typedef struct omp_nest_lock_t {
  85. void * _lk;
  86. } omp_nest_lock_t;
  87. extern void __KAI_KMPC_CONVENTION omp_init_nest_lock (omp_nest_lock_t *);
  88. extern void __KAI_KMPC_CONVENTION omp_set_nest_lock (omp_nest_lock_t *);
  89. extern void __KAI_KMPC_CONVENTION omp_unset_nest_lock (omp_nest_lock_t *);
  90. extern void __KAI_KMPC_CONVENTION omp_destroy_nest_lock (omp_nest_lock_t *);
  91. extern int __KAI_KMPC_CONVENTION omp_test_nest_lock (omp_nest_lock_t *);
  92. /* OpenMP 5.0 Synchronization hints*/
  93. typedef enum omp_sync_hint_t {
  94. omp_sync_hint_none = 0,
  95. omp_lock_hint_none = omp_sync_hint_none,
  96. omp_sync_hint_uncontended = 1,
  97. omp_lock_hint_uncontended = omp_sync_hint_uncontended,
  98. omp_sync_hint_contended = (1<<1),
  99. omp_lock_hint_contended = omp_sync_hint_contended,
  100. omp_sync_hint_nonspeculative = (1<<2),
  101. omp_lock_hint_nonspeculative = omp_sync_hint_nonspeculative,
  102. omp_sync_hint_speculative = (1<<3),
  103. omp_lock_hint_speculative = omp_sync_hint_speculative,
  104. kmp_lock_hint_hle = (1<<16),
  105. kmp_lock_hint_rtm = (1<<17),
  106. kmp_lock_hint_adaptive = (1<<18)
  107. } omp_sync_hint_t;
  108. /* lock hint type for dynamic user lock */
  109. typedef omp_sync_hint_t omp_lock_hint_t;
  110. /* hinted lock initializers */
  111. extern void __KAI_KMPC_CONVENTION omp_init_lock_with_hint(omp_lock_t *, omp_lock_hint_t);
  112. extern void __KAI_KMPC_CONVENTION omp_init_nest_lock_with_hint(omp_nest_lock_t *, omp_lock_hint_t);
  113. /* time API functions */
  114. extern double __KAI_KMPC_CONVENTION omp_get_wtime (void);
  115. extern double __KAI_KMPC_CONVENTION omp_get_wtick (void);
  116. /* OpenMP 4.0 */
  117. extern int __KAI_KMPC_CONVENTION omp_get_default_device (void);
  118. extern void __KAI_KMPC_CONVENTION omp_set_default_device (int);
  119. extern int __KAI_KMPC_CONVENTION omp_is_initial_device (void);
  120. extern int __KAI_KMPC_CONVENTION omp_get_num_devices (void);
  121. extern int __KAI_KMPC_CONVENTION omp_get_num_teams (void);
  122. extern int __KAI_KMPC_CONVENTION omp_get_team_num (void);
  123. extern int __KAI_KMPC_CONVENTION omp_get_cancellation (void);
  124. /* OpenMP 4.5 */
  125. extern int __KAI_KMPC_CONVENTION omp_get_initial_device (void);
  126. extern void* __KAI_KMPC_CONVENTION omp_target_alloc(size_t, int);
  127. extern void __KAI_KMPC_CONVENTION omp_target_free(void *, int);
  128. extern int __KAI_KMPC_CONVENTION omp_target_is_present(const void *, int);
  129. extern int __KAI_KMPC_CONVENTION omp_target_memcpy(void *, const void *, size_t, size_t, size_t, int, int);
  130. extern int __KAI_KMPC_CONVENTION omp_target_memcpy_rect(void *, const void *, size_t, int, const size_t *,
  131. const size_t *, const size_t *, const size_t *, const size_t *, int, int);
  132. extern int __KAI_KMPC_CONVENTION omp_target_associate_ptr(const void *, const void *, size_t, size_t, int);
  133. extern int __KAI_KMPC_CONVENTION omp_target_disassociate_ptr(const void *, int);
  134. /* OpenMP 5.0 */
  135. extern int __KAI_KMPC_CONVENTION omp_get_device_num (void);
  136. typedef void * omp_depend_t;
  137. /* OpenMP 5.1 interop */
  138. typedef intptr_t omp_intptr_t;
  139. /* 0..omp_get_num_interop_properties()-1 are reserved for implementation-defined properties */
  140. typedef enum omp_interop_property {
  141. omp_ipr_fr_id = -1,
  142. omp_ipr_fr_name = -2,
  143. omp_ipr_vendor = -3,
  144. omp_ipr_vendor_name = -4,
  145. omp_ipr_device_num = -5,
  146. omp_ipr_platform = -6,
  147. omp_ipr_device = -7,
  148. omp_ipr_device_context = -8,
  149. omp_ipr_targetsync = -9,
  150. omp_ipr_first = -9
  151. } omp_interop_property_t;
  152. #define omp_interop_none 0
  153. typedef enum omp_interop_rc {
  154. omp_irc_no_value = 1,
  155. omp_irc_success = 0,
  156. omp_irc_empty = -1,
  157. omp_irc_out_of_range = -2,
  158. omp_irc_type_int = -3,
  159. omp_irc_type_ptr = -4,
  160. omp_irc_type_str = -5,
  161. omp_irc_other = -6
  162. } omp_interop_rc_t;
  163. typedef enum omp_interop_fr {
  164. omp_ifr_cuda = 1,
  165. omp_ifr_cuda_driver = 2,
  166. omp_ifr_opencl = 3,
  167. omp_ifr_sycl = 4,
  168. omp_ifr_hip = 5,
  169. omp_ifr_level_zero = 6,
  170. omp_ifr_last = 7
  171. } omp_interop_fr_t;
  172. typedef void * omp_interop_t;
  173. /*!
  174. * The `omp_get_num_interop_properties` routine retrieves the number of implementation-defined properties available for an `omp_interop_t` object.
  175. */
  176. extern int __KAI_KMPC_CONVENTION omp_get_num_interop_properties(const omp_interop_t);
  177. /*!
  178. * The `omp_get_interop_int` routine retrieves an integer property from an `omp_interop_t` object.
  179. */
  180. extern omp_intptr_t __KAI_KMPC_CONVENTION omp_get_interop_int(const omp_interop_t, omp_interop_property_t, int *);
  181. /*!
  182. * The `omp_get_interop_ptr` routine retrieves a pointer property from an `omp_interop_t` object.
  183. */
  184. extern void * __KAI_KMPC_CONVENTION omp_get_interop_ptr(const omp_interop_t, omp_interop_property_t, int *);
  185. /*!
  186. * The `omp_get_interop_str` routine retrieves a string property from an `omp_interop_t` object.
  187. */
  188. extern const char * __KAI_KMPC_CONVENTION omp_get_interop_str(const omp_interop_t, omp_interop_property_t, int *);
  189. /*!
  190. * The `omp_get_interop_name` routine retrieves a property name from an `omp_interop_t` object.
  191. */
  192. extern const char * __KAI_KMPC_CONVENTION omp_get_interop_name(const omp_interop_t, omp_interop_property_t);
  193. /*!
  194. * The `omp_get_interop_type_desc` routine retrieves a description of the type of a property associated with an `omp_interop_t` object.
  195. */
  196. extern const char * __KAI_KMPC_CONVENTION omp_get_interop_type_desc(const omp_interop_t, omp_interop_property_t);
  197. /*!
  198. * The `omp_get_interop_rc_desc` routine retrieves a description of the return code associated with an `omp_interop_t` object.
  199. */
  200. extern const char * __KAI_KMPC_CONVENTION omp_get_interop_rc_desc(const omp_interop_t, omp_interop_rc_t);
  201. /* OpenMP 5.1 device memory routines */
  202. /*!
  203. * The `omp_target_memcpy_async` routine asynchronously performs a copy between any combination of host and device pointers.
  204. */
  205. extern int __KAI_KMPC_CONVENTION omp_target_memcpy_async(void *, const void *, size_t, size_t, size_t, int,
  206. int, int, omp_depend_t *);
  207. /*!
  208. * The `omp_target_memcpy_rect_async` routine asynchronously performs a copy between any combination of host and device pointers.
  209. */
  210. extern int __KAI_KMPC_CONVENTION omp_target_memcpy_rect_async(void *, const void *, size_t, int, const size_t *,
  211. const size_t *, const size_t *, const size_t *, const size_t *, int, int,
  212. int, omp_depend_t *);
  213. /*!
  214. * The `omp_get_mapped_ptr` routine returns the device pointer that is associated with a host pointer for a given device.
  215. */
  216. extern void * __KAI_KMPC_CONVENTION omp_get_mapped_ptr(const void *, int);
  217. extern int __KAI_KMPC_CONVENTION omp_target_is_accessible(const void *, size_t, int);
  218. /* kmp API functions */
  219. extern int __KAI_KMPC_CONVENTION kmp_get_stacksize (void);
  220. extern void __KAI_KMPC_CONVENTION kmp_set_stacksize (int);
  221. extern size_t __KAI_KMPC_CONVENTION kmp_get_stacksize_s (void);
  222. extern void __KAI_KMPC_CONVENTION kmp_set_stacksize_s (size_t);
  223. extern int __KAI_KMPC_CONVENTION kmp_get_blocktime (void);
  224. extern int __KAI_KMPC_CONVENTION kmp_get_library (void);
  225. extern void __KAI_KMPC_CONVENTION kmp_set_blocktime (int);
  226. extern void __KAI_KMPC_CONVENTION kmp_set_library (int);
  227. extern void __KAI_KMPC_CONVENTION kmp_set_library_serial (void);
  228. extern void __KAI_KMPC_CONVENTION kmp_set_library_turnaround (void);
  229. extern void __KAI_KMPC_CONVENTION kmp_set_library_throughput (void);
  230. extern void __KAI_KMPC_CONVENTION kmp_set_defaults (char const *);
  231. extern void __KAI_KMPC_CONVENTION kmp_set_disp_num_buffers (int);
  232. /* Intel affinity API */
  233. typedef void * kmp_affinity_mask_t;
  234. extern int __KAI_KMPC_CONVENTION kmp_set_affinity (kmp_affinity_mask_t *);
  235. extern int __KAI_KMPC_CONVENTION kmp_get_affinity (kmp_affinity_mask_t *);
  236. extern int __KAI_KMPC_CONVENTION kmp_get_affinity_max_proc (void);
  237. extern void __KAI_KMPC_CONVENTION kmp_create_affinity_mask (kmp_affinity_mask_t *);
  238. extern void __KAI_KMPC_CONVENTION kmp_destroy_affinity_mask (kmp_affinity_mask_t *);
  239. extern int __KAI_KMPC_CONVENTION kmp_set_affinity_mask_proc (int, kmp_affinity_mask_t *);
  240. extern int __KAI_KMPC_CONVENTION kmp_unset_affinity_mask_proc (int, kmp_affinity_mask_t *);
  241. extern int __KAI_KMPC_CONVENTION kmp_get_affinity_mask_proc (int, kmp_affinity_mask_t *);
  242. /* OpenMP 4.0 affinity API */
  243. typedef enum omp_proc_bind_t {
  244. omp_proc_bind_false = 0,
  245. omp_proc_bind_true = 1,
  246. omp_proc_bind_master = 2,
  247. omp_proc_bind_close = 3,
  248. omp_proc_bind_spread = 4
  249. } omp_proc_bind_t;
  250. extern omp_proc_bind_t __KAI_KMPC_CONVENTION omp_get_proc_bind (void);
  251. /* OpenMP 4.5 affinity API */
  252. extern int __KAI_KMPC_CONVENTION omp_get_num_places (void);
  253. extern int __KAI_KMPC_CONVENTION omp_get_place_num_procs (int);
  254. extern void __KAI_KMPC_CONVENTION omp_get_place_proc_ids (int, int *);
  255. extern int __KAI_KMPC_CONVENTION omp_get_place_num (void);
  256. extern int __KAI_KMPC_CONVENTION omp_get_partition_num_places (void);
  257. extern void __KAI_KMPC_CONVENTION omp_get_partition_place_nums (int *);
  258. extern void * __KAI_KMPC_CONVENTION kmp_malloc (size_t);
  259. extern void * __KAI_KMPC_CONVENTION kmp_aligned_malloc (size_t, size_t);
  260. extern void * __KAI_KMPC_CONVENTION kmp_calloc (size_t, size_t);
  261. extern void * __KAI_KMPC_CONVENTION kmp_realloc (void *, size_t);
  262. extern void __KAI_KMPC_CONVENTION kmp_free (void *);
  263. extern void __KAI_KMPC_CONVENTION kmp_set_warnings_on(void);
  264. extern void __KAI_KMPC_CONVENTION kmp_set_warnings_off(void);
  265. /* OpenMP 5.0 Tool Control */
  266. typedef enum omp_control_tool_result_t {
  267. omp_control_tool_notool = -2,
  268. omp_control_tool_nocallback = -1,
  269. omp_control_tool_success = 0,
  270. omp_control_tool_ignored = 1
  271. } omp_control_tool_result_t;
  272. typedef enum omp_control_tool_t {
  273. omp_control_tool_start = 1,
  274. omp_control_tool_pause = 2,
  275. omp_control_tool_flush = 3,
  276. omp_control_tool_end = 4
  277. } omp_control_tool_t;
  278. extern int __KAI_KMPC_CONVENTION omp_control_tool(int, int, void*);
  279. /* OpenMP 5.0 Memory Management */
  280. typedef uintptr_t omp_uintptr_t;
  281. typedef enum {
  282. omp_atk_sync_hint = 1,
  283. omp_atk_alignment = 2,
  284. omp_atk_access = 3,
  285. omp_atk_pool_size = 4,
  286. omp_atk_fallback = 5,
  287. omp_atk_fb_data = 6,
  288. omp_atk_pinned = 7,
  289. omp_atk_partition = 8
  290. } omp_alloctrait_key_t;
  291. typedef enum {
  292. omp_atv_false = 0,
  293. omp_atv_true = 1,
  294. omp_atv_contended = 3,
  295. omp_atv_uncontended = 4,
  296. omp_atv_serialized = 5,
  297. omp_atv_sequential = omp_atv_serialized, // (deprecated)
  298. omp_atv_private = 6,
  299. omp_atv_all = 7,
  300. omp_atv_thread = 8,
  301. omp_atv_pteam = 9,
  302. omp_atv_cgroup = 10,
  303. omp_atv_default_mem_fb = 11,
  304. omp_atv_null_fb = 12,
  305. omp_atv_abort_fb = 13,
  306. omp_atv_allocator_fb = 14,
  307. omp_atv_environment = 15,
  308. omp_atv_nearest = 16,
  309. omp_atv_blocked = 17,
  310. omp_atv_interleaved = 18
  311. } omp_alloctrait_value_t;
  312. #define omp_atv_default ((omp_uintptr_t)-1)
  313. typedef struct {
  314. omp_alloctrait_key_t key;
  315. omp_uintptr_t value;
  316. } omp_alloctrait_t;
  317. # if defined(_WIN32)
  318. // On Windows cl and icl do not support 64-bit enum, let's use integer then.
  319. typedef omp_uintptr_t omp_allocator_handle_t;
  320. extern __KMP_IMP omp_allocator_handle_t const omp_null_allocator;
  321. extern __KMP_IMP omp_allocator_handle_t const omp_default_mem_alloc;
  322. extern __KMP_IMP omp_allocator_handle_t const omp_large_cap_mem_alloc;
  323. extern __KMP_IMP omp_allocator_handle_t const omp_const_mem_alloc;
  324. extern __KMP_IMP omp_allocator_handle_t const omp_high_bw_mem_alloc;
  325. extern __KMP_IMP omp_allocator_handle_t const omp_low_lat_mem_alloc;
  326. extern __KMP_IMP omp_allocator_handle_t const omp_cgroup_mem_alloc;
  327. extern __KMP_IMP omp_allocator_handle_t const omp_pteam_mem_alloc;
  328. extern __KMP_IMP omp_allocator_handle_t const omp_thread_mem_alloc;
  329. extern __KMP_IMP omp_allocator_handle_t const llvm_omp_target_host_mem_alloc;
  330. extern __KMP_IMP omp_allocator_handle_t const llvm_omp_target_shared_mem_alloc;
  331. extern __KMP_IMP omp_allocator_handle_t const llvm_omp_target_device_mem_alloc;
  332. typedef omp_uintptr_t omp_memspace_handle_t;
  333. extern __KMP_IMP omp_memspace_handle_t const omp_default_mem_space;
  334. extern __KMP_IMP omp_memspace_handle_t const omp_large_cap_mem_space;
  335. extern __KMP_IMP omp_memspace_handle_t const omp_const_mem_space;
  336. extern __KMP_IMP omp_memspace_handle_t const omp_high_bw_mem_space;
  337. extern __KMP_IMP omp_memspace_handle_t const omp_low_lat_mem_space;
  338. extern __KMP_IMP omp_memspace_handle_t const llvm_omp_target_host_mem_space;
  339. extern __KMP_IMP omp_memspace_handle_t const llvm_omp_target_shared_mem_space;
  340. extern __KMP_IMP omp_memspace_handle_t const llvm_omp_target_device_mem_space;
  341. # else
  342. # if __cplusplus >= 201103
  343. typedef enum omp_allocator_handle_t : omp_uintptr_t
  344. # else
  345. typedef enum omp_allocator_handle_t
  346. # endif
  347. {
  348. omp_null_allocator = 0,
  349. omp_default_mem_alloc = 1,
  350. omp_large_cap_mem_alloc = 2,
  351. omp_const_mem_alloc = 3,
  352. omp_high_bw_mem_alloc = 4,
  353. omp_low_lat_mem_alloc = 5,
  354. omp_cgroup_mem_alloc = 6,
  355. omp_pteam_mem_alloc = 7,
  356. omp_thread_mem_alloc = 8,
  357. llvm_omp_target_host_mem_alloc = 100,
  358. llvm_omp_target_shared_mem_alloc = 101,
  359. llvm_omp_target_device_mem_alloc = 102,
  360. KMP_ALLOCATOR_MAX_HANDLE = UINTPTR_MAX
  361. } omp_allocator_handle_t;
  362. # if __cplusplus >= 201103
  363. typedef enum omp_memspace_handle_t : omp_uintptr_t
  364. # else
  365. typedef enum omp_memspace_handle_t
  366. # endif
  367. {
  368. omp_default_mem_space = 0,
  369. omp_large_cap_mem_space = 1,
  370. omp_const_mem_space = 2,
  371. omp_high_bw_mem_space = 3,
  372. omp_low_lat_mem_space = 4,
  373. llvm_omp_target_host_mem_space = 100,
  374. llvm_omp_target_shared_mem_space = 101,
  375. llvm_omp_target_device_mem_space = 102,
  376. KMP_MEMSPACE_MAX_HANDLE = UINTPTR_MAX
  377. } omp_memspace_handle_t;
  378. # endif
  379. extern omp_allocator_handle_t __KAI_KMPC_CONVENTION omp_init_allocator(omp_memspace_handle_t m,
  380. int ntraits, omp_alloctrait_t traits[]);
  381. extern void __KAI_KMPC_CONVENTION omp_destroy_allocator(omp_allocator_handle_t allocator);
  382. extern void __KAI_KMPC_CONVENTION omp_set_default_allocator(omp_allocator_handle_t a);
  383. extern omp_allocator_handle_t __KAI_KMPC_CONVENTION omp_get_default_allocator(void);
  384. # ifdef __cplusplus
  385. extern void *__KAI_KMPC_CONVENTION omp_alloc(size_t size, omp_allocator_handle_t a = omp_null_allocator);
  386. extern void *__KAI_KMPC_CONVENTION omp_aligned_alloc(size_t align, size_t size,
  387. omp_allocator_handle_t a = omp_null_allocator);
  388. extern void *__KAI_KMPC_CONVENTION omp_calloc(size_t nmemb, size_t size,
  389. omp_allocator_handle_t a = omp_null_allocator);
  390. extern void *__KAI_KMPC_CONVENTION omp_aligned_calloc(size_t align, size_t nmemb, size_t size,
  391. omp_allocator_handle_t a = omp_null_allocator);
  392. extern void *__KAI_KMPC_CONVENTION omp_realloc(void *ptr, size_t size,
  393. omp_allocator_handle_t allocator = omp_null_allocator,
  394. omp_allocator_handle_t free_allocator = omp_null_allocator);
  395. extern void __KAI_KMPC_CONVENTION omp_free(void * ptr, omp_allocator_handle_t a = omp_null_allocator);
  396. # else
  397. extern void *__KAI_KMPC_CONVENTION omp_alloc(size_t size, omp_allocator_handle_t a);
  398. extern void *__KAI_KMPC_CONVENTION omp_aligned_alloc(size_t align, size_t size,
  399. omp_allocator_handle_t a);
  400. extern void *__KAI_KMPC_CONVENTION omp_calloc(size_t nmemb, size_t size, omp_allocator_handle_t a);
  401. extern void *__KAI_KMPC_CONVENTION omp_aligned_calloc(size_t align, size_t nmemb, size_t size,
  402. omp_allocator_handle_t a);
  403. extern void *__KAI_KMPC_CONVENTION omp_realloc(void *ptr, size_t size, omp_allocator_handle_t allocator,
  404. omp_allocator_handle_t free_allocator);
  405. extern void __KAI_KMPC_CONVENTION omp_free(void *ptr, omp_allocator_handle_t a);
  406. # endif
  407. /* OpenMP 5.0 Affinity Format */
  408. extern void __KAI_KMPC_CONVENTION omp_set_affinity_format(char const *);
  409. extern size_t __KAI_KMPC_CONVENTION omp_get_affinity_format(char *, size_t);
  410. extern void __KAI_KMPC_CONVENTION omp_display_affinity(char const *);
  411. extern size_t __KAI_KMPC_CONVENTION omp_capture_affinity(char *, size_t, char const *);
  412. /* OpenMP 5.0 events */
  413. # if defined(_WIN32)
  414. // On Windows cl and icl do not support 64-bit enum, let's use integer then.
  415. typedef omp_uintptr_t omp_event_handle_t;
  416. # else
  417. typedef enum omp_event_handle_t { KMP_EVENT_MAX_HANDLE = UINTPTR_MAX } omp_event_handle_t;
  418. # endif
  419. extern void __KAI_KMPC_CONVENTION omp_fulfill_event ( omp_event_handle_t event );
  420. /* OpenMP 5.0 Pause Resources */
  421. typedef enum omp_pause_resource_t {
  422. omp_pause_resume = 0,
  423. omp_pause_soft = 1,
  424. omp_pause_hard = 2
  425. } omp_pause_resource_t;
  426. extern int __KAI_KMPC_CONVENTION omp_pause_resource(omp_pause_resource_t, int);
  427. extern int __KAI_KMPC_CONVENTION omp_pause_resource_all(omp_pause_resource_t);
  428. extern int __KAI_KMPC_CONVENTION omp_get_supported_active_levels(void);
  429. /* OpenMP 5.1 */
  430. extern void __KAI_KMPC_CONVENTION omp_set_num_teams(int num_teams);
  431. extern int __KAI_KMPC_CONVENTION omp_get_max_teams(void);
  432. extern void __KAI_KMPC_CONVENTION omp_set_teams_thread_limit(int limit);
  433. extern int __KAI_KMPC_CONVENTION omp_get_teams_thread_limit(void);
  434. /* OpenMP 5.1 Display Environment */
  435. extern void omp_display_env(int verbose);
  436. # if defined(_OPENMP) && _OPENMP >= 201811
  437. #pragma omp begin declare variant match(device={kind(host)})
  438. static inline int omp_is_initial_device(void) { return 1; }
  439. #pragma omp end declare variant
  440. #pragma omp begin declare variant match(device={kind(nohost)})
  441. static inline int omp_is_initial_device(void) { return 0; }
  442. #pragma omp end declare variant
  443. # endif
  444. /* OpenMP 5.2 */
  445. extern int __KAI_KMPC_CONVENTION omp_in_explicit_task(void);
  446. /* LLVM Extensions */
  447. extern void *llvm_omp_target_dynamic_shared_alloc();
  448. # undef __KAI_KMPC_CONVENTION
  449. # undef __KMP_IMP
  450. /* Warning:
  451. The following typedefs are not standard, deprecated and will be removed in a future release.
  452. */
  453. typedef int omp_int_t;
  454. typedef double omp_wtime_t;
  455. # ifdef __cplusplus
  456. }
  457. # endif
  458. #endif /* __OMP_H */