13c6bb671SDimitry Andric /* 2dac87cc0SDimitry Andric * include/omp.h.var 33c6bb671SDimitry Andric */ 43c6bb671SDimitry Andric 53c6bb671SDimitry Andric 63c6bb671SDimitry Andric //===----------------------------------------------------------------------===// 73c6bb671SDimitry Andric // 8dac87cc0SDimitry Andric // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 9dac87cc0SDimitry Andric // See https://llvm.org/LICENSE.txt for license information. 10dac87cc0SDimitry Andric // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 113c6bb671SDimitry Andric // 123c6bb671SDimitry Andric //===----------------------------------------------------------------------===// 133c6bb671SDimitry Andric 143c6bb671SDimitry Andric 153c6bb671SDimitry Andric #ifndef __OMP_H 163c6bb671SDimitry Andric # define __OMP_H 173c6bb671SDimitry Andric 18*5f757f3fSDimitry Andric # include <stddef.h> 19dac87cc0SDimitry Andric # include <stdlib.h> 20dac87cc0SDimitry Andric # include <stdint.h> 21dac87cc0SDimitry Andric 223c6bb671SDimitry Andric # define KMP_VERSION_MAJOR 5 233c6bb671SDimitry Andric # define KMP_VERSION_MINOR 0 243c6bb671SDimitry Andric # define KMP_VERSION_BUILD 20140926 253c6bb671SDimitry Andric # define KMP_BUILD_DATE "No_Timestamp" 263c6bb671SDimitry Andric 273c6bb671SDimitry Andric # ifdef __cplusplus 283c6bb671SDimitry Andric extern "C" { 293c6bb671SDimitry Andric # endif 303c6bb671SDimitry Andric 313c6bb671SDimitry Andric # define omp_set_affinity_format ompc_set_affinity_format 323c6bb671SDimitry Andric # define omp_get_affinity_format ompc_get_affinity_format 333c6bb671SDimitry Andric # define omp_display_affinity ompc_display_affinity 343c6bb671SDimitry Andric # define omp_capture_affinity ompc_capture_affinity 353c6bb671SDimitry Andric 363c6bb671SDimitry Andric # if defined(_WIN32) 373c6bb671SDimitry Andric # define __KAI_KMPC_CONVENTION __cdecl 383c6bb671SDimitry Andric # ifndef __KMP_IMP 393c6bb671SDimitry Andric # define __KMP_IMP __declspec(dllimport) 403c6bb671SDimitry Andric # endif 413c6bb671SDimitry Andric # else 423c6bb671SDimitry Andric # define __KAI_KMPC_CONVENTION 433c6bb671SDimitry Andric # ifndef __KMP_IMP 443c6bb671SDimitry Andric # define __KMP_IMP 453c6bb671SDimitry Andric # endif 463c6bb671SDimitry Andric # endif 473c6bb671SDimitry Andric 483c6bb671SDimitry Andric /* schedule kind constants */ 493c6bb671SDimitry Andric typedef enum omp_sched_t { 503c6bb671SDimitry Andric omp_sched_static = 1, 513c6bb671SDimitry Andric omp_sched_dynamic = 2, 523c6bb671SDimitry Andric omp_sched_guided = 3, 53dac87cc0SDimitry Andric omp_sched_auto = 4, 54dac87cc0SDimitry Andric omp_sched_monotonic = 0x80000000 553c6bb671SDimitry Andric } omp_sched_t; 563c6bb671SDimitry Andric 573c6bb671SDimitry Andric /* set API functions */ 583c6bb671SDimitry Andric extern void __KAI_KMPC_CONVENTION omp_set_num_threads (int); 593c6bb671SDimitry Andric extern void __KAI_KMPC_CONVENTION omp_set_dynamic (int); 603c6bb671SDimitry Andric extern void __KAI_KMPC_CONVENTION omp_set_nested (int); 613c6bb671SDimitry Andric extern void __KAI_KMPC_CONVENTION omp_set_max_active_levels (int); 623c6bb671SDimitry Andric extern void __KAI_KMPC_CONVENTION omp_set_schedule (omp_sched_t, int); 633c6bb671SDimitry Andric 643c6bb671SDimitry Andric /* query API functions */ 653c6bb671SDimitry Andric extern int __KAI_KMPC_CONVENTION omp_get_num_threads (void); 663c6bb671SDimitry Andric extern int __KAI_KMPC_CONVENTION omp_get_dynamic (void); 673c6bb671SDimitry Andric extern int __KAI_KMPC_CONVENTION omp_get_nested (void); 683c6bb671SDimitry Andric extern int __KAI_KMPC_CONVENTION omp_get_max_threads (void); 693c6bb671SDimitry Andric extern int __KAI_KMPC_CONVENTION omp_get_thread_num (void); 703c6bb671SDimitry Andric extern int __KAI_KMPC_CONVENTION omp_get_num_procs (void); 713c6bb671SDimitry Andric extern int __KAI_KMPC_CONVENTION omp_in_parallel (void); 723c6bb671SDimitry Andric extern int __KAI_KMPC_CONVENTION omp_in_final (void); 733c6bb671SDimitry Andric extern int __KAI_KMPC_CONVENTION omp_get_active_level (void); 743c6bb671SDimitry Andric extern int __KAI_KMPC_CONVENTION omp_get_level (void); 753c6bb671SDimitry Andric extern int __KAI_KMPC_CONVENTION omp_get_ancestor_thread_num (int); 763c6bb671SDimitry Andric extern int __KAI_KMPC_CONVENTION omp_get_team_size (int); 773c6bb671SDimitry Andric extern int __KAI_KMPC_CONVENTION omp_get_thread_limit (void); 783c6bb671SDimitry Andric extern int __KAI_KMPC_CONVENTION omp_get_max_active_levels (void); 793c6bb671SDimitry Andric extern void __KAI_KMPC_CONVENTION omp_get_schedule (omp_sched_t *, int *); 803c6bb671SDimitry Andric extern int __KAI_KMPC_CONVENTION omp_get_max_task_priority (void); 813c6bb671SDimitry Andric 823c6bb671SDimitry Andric /* lock API functions */ 833c6bb671SDimitry Andric typedef struct omp_lock_t { 843c6bb671SDimitry Andric void * _lk; 853c6bb671SDimitry Andric } omp_lock_t; 863c6bb671SDimitry Andric 873c6bb671SDimitry Andric extern void __KAI_KMPC_CONVENTION omp_init_lock (omp_lock_t *); 883c6bb671SDimitry Andric extern void __KAI_KMPC_CONVENTION omp_set_lock (omp_lock_t *); 893c6bb671SDimitry Andric extern void __KAI_KMPC_CONVENTION omp_unset_lock (omp_lock_t *); 903c6bb671SDimitry Andric extern void __KAI_KMPC_CONVENTION omp_destroy_lock (omp_lock_t *); 913c6bb671SDimitry Andric extern int __KAI_KMPC_CONVENTION omp_test_lock (omp_lock_t *); 923c6bb671SDimitry Andric 933c6bb671SDimitry Andric /* nested lock API functions */ 943c6bb671SDimitry Andric typedef struct omp_nest_lock_t { 953c6bb671SDimitry Andric void * _lk; 963c6bb671SDimitry Andric } omp_nest_lock_t; 973c6bb671SDimitry Andric 983c6bb671SDimitry Andric extern void __KAI_KMPC_CONVENTION omp_init_nest_lock (omp_nest_lock_t *); 993c6bb671SDimitry Andric extern void __KAI_KMPC_CONVENTION omp_set_nest_lock (omp_nest_lock_t *); 1003c6bb671SDimitry Andric extern void __KAI_KMPC_CONVENTION omp_unset_nest_lock (omp_nest_lock_t *); 1013c6bb671SDimitry Andric extern void __KAI_KMPC_CONVENTION omp_destroy_nest_lock (omp_nest_lock_t *); 1023c6bb671SDimitry Andric extern int __KAI_KMPC_CONVENTION omp_test_nest_lock (omp_nest_lock_t *); 1033c6bb671SDimitry Andric 1043c6bb671SDimitry Andric /* OpenMP 5.0 Synchronization hints*/ 1053c6bb671SDimitry Andric typedef enum omp_sync_hint_t { 1063c6bb671SDimitry Andric omp_sync_hint_none = 0, 1073c6bb671SDimitry Andric omp_lock_hint_none = omp_sync_hint_none, 1083c6bb671SDimitry Andric omp_sync_hint_uncontended = 1, 1093c6bb671SDimitry Andric omp_lock_hint_uncontended = omp_sync_hint_uncontended, 1103c6bb671SDimitry Andric omp_sync_hint_contended = (1<<1), 1113c6bb671SDimitry Andric omp_lock_hint_contended = omp_sync_hint_contended, 1123c6bb671SDimitry Andric omp_sync_hint_nonspeculative = (1<<2), 1133c6bb671SDimitry Andric omp_lock_hint_nonspeculative = omp_sync_hint_nonspeculative, 1143c6bb671SDimitry Andric omp_sync_hint_speculative = (1<<3), 1153c6bb671SDimitry Andric omp_lock_hint_speculative = omp_sync_hint_speculative, 1163c6bb671SDimitry Andric kmp_lock_hint_hle = (1<<16), 1173c6bb671SDimitry Andric kmp_lock_hint_rtm = (1<<17), 1183c6bb671SDimitry Andric kmp_lock_hint_adaptive = (1<<18) 1193c6bb671SDimitry Andric } omp_sync_hint_t; 1203c6bb671SDimitry Andric 1213c6bb671SDimitry Andric /* lock hint type for dynamic user lock */ 1223c6bb671SDimitry Andric typedef omp_sync_hint_t omp_lock_hint_t; 1233c6bb671SDimitry Andric 1243c6bb671SDimitry Andric /* hinted lock initializers */ 1253c6bb671SDimitry Andric extern void __KAI_KMPC_CONVENTION omp_init_lock_with_hint(omp_lock_t *, omp_lock_hint_t); 1263c6bb671SDimitry Andric extern void __KAI_KMPC_CONVENTION omp_init_nest_lock_with_hint(omp_nest_lock_t *, omp_lock_hint_t); 1273c6bb671SDimitry Andric 1283c6bb671SDimitry Andric /* time API functions */ 1293c6bb671SDimitry Andric extern double __KAI_KMPC_CONVENTION omp_get_wtime (void); 1303c6bb671SDimitry Andric extern double __KAI_KMPC_CONVENTION omp_get_wtick (void); 1313c6bb671SDimitry Andric 1323c6bb671SDimitry Andric /* OpenMP 4.0 */ 1333c6bb671SDimitry Andric extern int __KAI_KMPC_CONVENTION omp_get_default_device (void); 1343c6bb671SDimitry Andric extern void __KAI_KMPC_CONVENTION omp_set_default_device (int); 1353c6bb671SDimitry Andric extern int __KAI_KMPC_CONVENTION omp_is_initial_device (void); 1363c6bb671SDimitry Andric extern int __KAI_KMPC_CONVENTION omp_get_num_devices (void); 1373c6bb671SDimitry Andric extern int __KAI_KMPC_CONVENTION omp_get_num_teams (void); 1383c6bb671SDimitry Andric extern int __KAI_KMPC_CONVENTION omp_get_team_num (void); 1393c6bb671SDimitry Andric extern int __KAI_KMPC_CONVENTION omp_get_cancellation (void); 1403c6bb671SDimitry Andric 1413c6bb671SDimitry Andric /* OpenMP 4.5 */ 1423c6bb671SDimitry Andric extern int __KAI_KMPC_CONVENTION omp_get_initial_device (void); 1433c6bb671SDimitry Andric extern void* __KAI_KMPC_CONVENTION omp_target_alloc(size_t, int); 1443c6bb671SDimitry Andric extern void __KAI_KMPC_CONVENTION omp_target_free(void *, int); 1456e75b2fbSDimitry Andric extern int __KAI_KMPC_CONVENTION omp_target_is_present(const void *, int); 1466e75b2fbSDimitry Andric extern int __KAI_KMPC_CONVENTION omp_target_memcpy(void *, const void *, size_t, size_t, size_t, int, int); 1476e75b2fbSDimitry Andric extern int __KAI_KMPC_CONVENTION omp_target_memcpy_rect(void *, const void *, size_t, int, const size_t *, 1483c6bb671SDimitry Andric const size_t *, const size_t *, const size_t *, const size_t *, int, int); 1496e75b2fbSDimitry Andric extern int __KAI_KMPC_CONVENTION omp_target_associate_ptr(const void *, const void *, size_t, size_t, int); 1506e75b2fbSDimitry Andric extern int __KAI_KMPC_CONVENTION omp_target_disassociate_ptr(const void *, int); 1513c6bb671SDimitry Andric 1523c6bb671SDimitry Andric /* OpenMP 5.0 */ 1533c6bb671SDimitry Andric extern int __KAI_KMPC_CONVENTION omp_get_device_num (void); 154dac87cc0SDimitry Andric typedef void * omp_depend_t; 1553c6bb671SDimitry Andric 156d409305fSDimitry Andric /* OpenMP 5.1 interop */ 157d409305fSDimitry Andric typedef intptr_t omp_intptr_t; 158d409305fSDimitry Andric 159d409305fSDimitry Andric /* 0..omp_get_num_interop_properties()-1 are reserved for implementation-defined properties */ 160d409305fSDimitry Andric typedef enum omp_interop_property { 161d409305fSDimitry Andric omp_ipr_fr_id = -1, 162d409305fSDimitry Andric omp_ipr_fr_name = -2, 163d409305fSDimitry Andric omp_ipr_vendor = -3, 164d409305fSDimitry Andric omp_ipr_vendor_name = -4, 165d409305fSDimitry Andric omp_ipr_device_num = -5, 166d409305fSDimitry Andric omp_ipr_platform = -6, 167d409305fSDimitry Andric omp_ipr_device = -7, 168d409305fSDimitry Andric omp_ipr_device_context = -8, 169d409305fSDimitry Andric omp_ipr_targetsync = -9, 170d409305fSDimitry Andric omp_ipr_first = -9 171d409305fSDimitry Andric } omp_interop_property_t; 172d409305fSDimitry Andric 173d409305fSDimitry Andric #define omp_interop_none 0 174d409305fSDimitry Andric 175d409305fSDimitry Andric typedef enum omp_interop_rc { 176d409305fSDimitry Andric omp_irc_no_value = 1, 177d409305fSDimitry Andric omp_irc_success = 0, 178d409305fSDimitry Andric omp_irc_empty = -1, 179d409305fSDimitry Andric omp_irc_out_of_range = -2, 180d409305fSDimitry Andric omp_irc_type_int = -3, 181d409305fSDimitry Andric omp_irc_type_ptr = -4, 182d409305fSDimitry Andric omp_irc_type_str = -5, 183d409305fSDimitry Andric omp_irc_other = -6 184d409305fSDimitry Andric } omp_interop_rc_t; 185d409305fSDimitry Andric 1866e75b2fbSDimitry Andric typedef enum omp_interop_fr { 1876e75b2fbSDimitry Andric omp_ifr_cuda = 1, 1886e75b2fbSDimitry Andric omp_ifr_cuda_driver = 2, 1896e75b2fbSDimitry Andric omp_ifr_opencl = 3, 1906e75b2fbSDimitry Andric omp_ifr_sycl = 4, 1916e75b2fbSDimitry Andric omp_ifr_hip = 5, 1926e75b2fbSDimitry Andric omp_ifr_level_zero = 6, 1936e75b2fbSDimitry Andric omp_ifr_last = 7 1946e75b2fbSDimitry Andric } omp_interop_fr_t; 1956e75b2fbSDimitry Andric 196d409305fSDimitry Andric typedef void * omp_interop_t; 197d409305fSDimitry Andric 198d409305fSDimitry Andric /*! 199d409305fSDimitry Andric * The `omp_get_num_interop_properties` routine retrieves the number of implementation-defined properties available for an `omp_interop_t` object. 200d409305fSDimitry Andric */ 201d409305fSDimitry Andric extern int __KAI_KMPC_CONVENTION omp_get_num_interop_properties(const omp_interop_t); 202d409305fSDimitry Andric /*! 203d409305fSDimitry Andric * The `omp_get_interop_int` routine retrieves an integer property from an `omp_interop_t` object. 204d409305fSDimitry Andric */ 205d409305fSDimitry Andric extern omp_intptr_t __KAI_KMPC_CONVENTION omp_get_interop_int(const omp_interop_t, omp_interop_property_t, int *); 206d409305fSDimitry Andric /*! 207d409305fSDimitry Andric * The `omp_get_interop_ptr` routine retrieves a pointer property from an `omp_interop_t` object. 208d409305fSDimitry Andric */ 209d409305fSDimitry Andric extern void * __KAI_KMPC_CONVENTION omp_get_interop_ptr(const omp_interop_t, omp_interop_property_t, int *); 210d409305fSDimitry Andric /*! 211d409305fSDimitry Andric * The `omp_get_interop_str` routine retrieves a string property from an `omp_interop_t` object. 212d409305fSDimitry Andric */ 213d409305fSDimitry Andric extern const char * __KAI_KMPC_CONVENTION omp_get_interop_str(const omp_interop_t, omp_interop_property_t, int *); 214d409305fSDimitry Andric /*! 215d409305fSDimitry Andric * The `omp_get_interop_name` routine retrieves a property name from an `omp_interop_t` object. 216d409305fSDimitry Andric */ 217d409305fSDimitry Andric extern const char * __KAI_KMPC_CONVENTION omp_get_interop_name(const omp_interop_t, omp_interop_property_t); 218d409305fSDimitry Andric /*! 219d409305fSDimitry Andric * The `omp_get_interop_type_desc` routine retrieves a description of the type of a property associated with an `omp_interop_t` object. 220d409305fSDimitry Andric */ 221d409305fSDimitry Andric extern const char * __KAI_KMPC_CONVENTION omp_get_interop_type_desc(const omp_interop_t, omp_interop_property_t); 222d409305fSDimitry Andric /*! 223d409305fSDimitry Andric * The `omp_get_interop_rc_desc` routine retrieves a description of the return code associated with an `omp_interop_t` object. 224d409305fSDimitry Andric */ 2256e75b2fbSDimitry Andric extern const char * __KAI_KMPC_CONVENTION omp_get_interop_rc_desc(const omp_interop_t, omp_interop_rc_t); 226d409305fSDimitry Andric 227d409305fSDimitry Andric /* OpenMP 5.1 device memory routines */ 228d409305fSDimitry Andric 229d409305fSDimitry Andric /*! 230d409305fSDimitry Andric * The `omp_target_memcpy_async` routine asynchronously performs a copy between any combination of host and device pointers. 231d409305fSDimitry Andric */ 232d409305fSDimitry Andric extern int __KAI_KMPC_CONVENTION omp_target_memcpy_async(void *, const void *, size_t, size_t, size_t, int, 233d409305fSDimitry Andric int, int, omp_depend_t *); 234d409305fSDimitry Andric /*! 235d409305fSDimitry Andric * The `omp_target_memcpy_rect_async` routine asynchronously performs a copy between any combination of host and device pointers. 236d409305fSDimitry Andric */ 237d409305fSDimitry Andric extern int __KAI_KMPC_CONVENTION omp_target_memcpy_rect_async(void *, const void *, size_t, int, const size_t *, 238d409305fSDimitry Andric const size_t *, const size_t *, const size_t *, const size_t *, int, int, 239d409305fSDimitry Andric int, omp_depend_t *); 240*5f757f3fSDimitry Andric 241*5f757f3fSDimitry Andric /* OpenMP 6.0 device memory routines */ 242*5f757f3fSDimitry Andric extern void * __KAI_KMPC_CONVENTION omp_target_memset(void *, int, size_t, int); 243*5f757f3fSDimitry Andric extern void * __KAI_KMPC_CONVENTION omp_target_memset_async(void *, int, size_t, int, int, omp_depend_t *); 244*5f757f3fSDimitry Andric 245d409305fSDimitry Andric /*! 246d409305fSDimitry Andric * The `omp_get_mapped_ptr` routine returns the device pointer that is associated with a host pointer for a given device. 247d409305fSDimitry Andric */ 248d409305fSDimitry Andric extern void * __KAI_KMPC_CONVENTION omp_get_mapped_ptr(const void *, int); 2496e75b2fbSDimitry Andric extern int __KAI_KMPC_CONVENTION omp_target_is_accessible(const void *, size_t, int); 250d409305fSDimitry Andric 2513c6bb671SDimitry Andric /* kmp API functions */ 2523c6bb671SDimitry Andric extern int __KAI_KMPC_CONVENTION kmp_get_stacksize (void); 2533c6bb671SDimitry Andric extern void __KAI_KMPC_CONVENTION kmp_set_stacksize (int); 2543c6bb671SDimitry Andric extern size_t __KAI_KMPC_CONVENTION kmp_get_stacksize_s (void); 2553c6bb671SDimitry Andric extern void __KAI_KMPC_CONVENTION kmp_set_stacksize_s (size_t); 2563c6bb671SDimitry Andric extern int __KAI_KMPC_CONVENTION kmp_get_blocktime (void); 2573c6bb671SDimitry Andric extern int __KAI_KMPC_CONVENTION kmp_get_library (void); 2583c6bb671SDimitry Andric extern void __KAI_KMPC_CONVENTION kmp_set_blocktime (int); 2593c6bb671SDimitry Andric extern void __KAI_KMPC_CONVENTION kmp_set_library (int); 2603c6bb671SDimitry Andric extern void __KAI_KMPC_CONVENTION kmp_set_library_serial (void); 2613c6bb671SDimitry Andric extern void __KAI_KMPC_CONVENTION kmp_set_library_turnaround (void); 2623c6bb671SDimitry Andric extern void __KAI_KMPC_CONVENTION kmp_set_library_throughput (void); 2633c6bb671SDimitry Andric extern void __KAI_KMPC_CONVENTION kmp_set_defaults (char const *); 2643c6bb671SDimitry Andric extern void __KAI_KMPC_CONVENTION kmp_set_disp_num_buffers (int); 2653c6bb671SDimitry Andric 2663c6bb671SDimitry Andric /* Intel affinity API */ 2673c6bb671SDimitry Andric typedef void * kmp_affinity_mask_t; 2683c6bb671SDimitry Andric 2693c6bb671SDimitry Andric extern int __KAI_KMPC_CONVENTION kmp_set_affinity (kmp_affinity_mask_t *); 2703c6bb671SDimitry Andric extern int __KAI_KMPC_CONVENTION kmp_get_affinity (kmp_affinity_mask_t *); 2713c6bb671SDimitry Andric extern int __KAI_KMPC_CONVENTION kmp_get_affinity_max_proc (void); 2723c6bb671SDimitry Andric extern void __KAI_KMPC_CONVENTION kmp_create_affinity_mask (kmp_affinity_mask_t *); 2733c6bb671SDimitry Andric extern void __KAI_KMPC_CONVENTION kmp_destroy_affinity_mask (kmp_affinity_mask_t *); 2743c6bb671SDimitry Andric extern int __KAI_KMPC_CONVENTION kmp_set_affinity_mask_proc (int, kmp_affinity_mask_t *); 2753c6bb671SDimitry Andric extern int __KAI_KMPC_CONVENTION kmp_unset_affinity_mask_proc (int, kmp_affinity_mask_t *); 2763c6bb671SDimitry Andric extern int __KAI_KMPC_CONVENTION kmp_get_affinity_mask_proc (int, kmp_affinity_mask_t *); 2773c6bb671SDimitry Andric 2783c6bb671SDimitry Andric /* OpenMP 4.0 affinity API */ 2793c6bb671SDimitry Andric typedef enum omp_proc_bind_t { 2803c6bb671SDimitry Andric omp_proc_bind_false = 0, 2813c6bb671SDimitry Andric omp_proc_bind_true = 1, 2823c6bb671SDimitry Andric omp_proc_bind_master = 2, 2833c6bb671SDimitry Andric omp_proc_bind_close = 3, 2843c6bb671SDimitry Andric omp_proc_bind_spread = 4 2853c6bb671SDimitry Andric } omp_proc_bind_t; 2863c6bb671SDimitry Andric 2873c6bb671SDimitry Andric extern omp_proc_bind_t __KAI_KMPC_CONVENTION omp_get_proc_bind (void); 2883c6bb671SDimitry Andric 2893c6bb671SDimitry Andric /* OpenMP 4.5 affinity API */ 2903c6bb671SDimitry Andric extern int __KAI_KMPC_CONVENTION omp_get_num_places (void); 2913c6bb671SDimitry Andric extern int __KAI_KMPC_CONVENTION omp_get_place_num_procs (int); 2923c6bb671SDimitry Andric extern void __KAI_KMPC_CONVENTION omp_get_place_proc_ids (int, int *); 2933c6bb671SDimitry Andric extern int __KAI_KMPC_CONVENTION omp_get_place_num (void); 2943c6bb671SDimitry Andric extern int __KAI_KMPC_CONVENTION omp_get_partition_num_places (void); 2953c6bb671SDimitry Andric extern void __KAI_KMPC_CONVENTION omp_get_partition_place_nums (int *); 2963c6bb671SDimitry Andric 2973c6bb671SDimitry Andric extern void * __KAI_KMPC_CONVENTION kmp_malloc (size_t); 2983c6bb671SDimitry Andric extern void * __KAI_KMPC_CONVENTION kmp_aligned_malloc (size_t, size_t); 2993c6bb671SDimitry Andric extern void * __KAI_KMPC_CONVENTION kmp_calloc (size_t, size_t); 3003c6bb671SDimitry Andric extern void * __KAI_KMPC_CONVENTION kmp_realloc (void *, size_t); 3013c6bb671SDimitry Andric extern void __KAI_KMPC_CONVENTION kmp_free (void *); 3023c6bb671SDimitry Andric 3033c6bb671SDimitry Andric extern void __KAI_KMPC_CONVENTION kmp_set_warnings_on(void); 3043c6bb671SDimitry Andric extern void __KAI_KMPC_CONVENTION kmp_set_warnings_off(void); 3053c6bb671SDimitry Andric 3063c6bb671SDimitry Andric /* OpenMP 5.0 Tool Control */ 3073c6bb671SDimitry Andric typedef enum omp_control_tool_result_t { 3083c6bb671SDimitry Andric omp_control_tool_notool = -2, 3093c6bb671SDimitry Andric omp_control_tool_nocallback = -1, 3103c6bb671SDimitry Andric omp_control_tool_success = 0, 3113c6bb671SDimitry Andric omp_control_tool_ignored = 1 3123c6bb671SDimitry Andric } omp_control_tool_result_t; 3133c6bb671SDimitry Andric 3143c6bb671SDimitry Andric typedef enum omp_control_tool_t { 3153c6bb671SDimitry Andric omp_control_tool_start = 1, 3163c6bb671SDimitry Andric omp_control_tool_pause = 2, 3173c6bb671SDimitry Andric omp_control_tool_flush = 3, 3183c6bb671SDimitry Andric omp_control_tool_end = 4 3193c6bb671SDimitry Andric } omp_control_tool_t; 3203c6bb671SDimitry Andric 3213c6bb671SDimitry Andric extern int __KAI_KMPC_CONVENTION omp_control_tool(int, int, void*); 3223c6bb671SDimitry Andric 3233c6bb671SDimitry Andric /* OpenMP 5.0 Memory Management */ 324dac87cc0SDimitry Andric typedef uintptr_t omp_uintptr_t; 3253c6bb671SDimitry Andric 326dac87cc0SDimitry Andric typedef enum { 327d409305fSDimitry Andric omp_atk_sync_hint = 1, 328d409305fSDimitry Andric omp_atk_alignment = 2, 329d409305fSDimitry Andric omp_atk_access = 3, 330d409305fSDimitry Andric omp_atk_pool_size = 4, 331d409305fSDimitry Andric omp_atk_fallback = 5, 332d409305fSDimitry Andric omp_atk_fb_data = 6, 333d409305fSDimitry Andric omp_atk_pinned = 7, 334d409305fSDimitry Andric omp_atk_partition = 8 335dac87cc0SDimitry Andric } omp_alloctrait_key_t; 336dac87cc0SDimitry Andric 337dac87cc0SDimitry Andric typedef enum { 338d409305fSDimitry Andric omp_atv_false = 0, 339d409305fSDimitry Andric omp_atv_true = 1, 340d409305fSDimitry Andric omp_atv_contended = 3, 341d409305fSDimitry Andric omp_atv_uncontended = 4, 342d409305fSDimitry Andric omp_atv_serialized = 5, 343d409305fSDimitry Andric omp_atv_sequential = omp_atv_serialized, // (deprecated) 344d409305fSDimitry Andric omp_atv_private = 6, 345d409305fSDimitry Andric omp_atv_all = 7, 346d409305fSDimitry Andric omp_atv_thread = 8, 347d409305fSDimitry Andric omp_atv_pteam = 9, 348d409305fSDimitry Andric omp_atv_cgroup = 10, 349d409305fSDimitry Andric omp_atv_default_mem_fb = 11, 350d409305fSDimitry Andric omp_atv_null_fb = 12, 351d409305fSDimitry Andric omp_atv_abort_fb = 13, 352d409305fSDimitry Andric omp_atv_allocator_fb = 14, 353d409305fSDimitry Andric omp_atv_environment = 15, 354d409305fSDimitry Andric omp_atv_nearest = 16, 355d409305fSDimitry Andric omp_atv_blocked = 17, 356d409305fSDimitry Andric omp_atv_interleaved = 18 357dac87cc0SDimitry Andric } omp_alloctrait_value_t; 358d409305fSDimitry Andric #define omp_atv_default ((omp_uintptr_t)-1) 359dac87cc0SDimitry Andric 360dac87cc0SDimitry Andric typedef struct { 361dac87cc0SDimitry Andric omp_alloctrait_key_t key; 362dac87cc0SDimitry Andric omp_uintptr_t value; 363dac87cc0SDimitry Andric } omp_alloctrait_t; 364dac87cc0SDimitry Andric 365dac87cc0SDimitry Andric # if defined(_WIN32) 366dac87cc0SDimitry Andric // On Windows cl and icl do not support 64-bit enum, let's use integer then. 367dac87cc0SDimitry Andric typedef omp_uintptr_t omp_allocator_handle_t; 368dac87cc0SDimitry Andric extern __KMP_IMP omp_allocator_handle_t const omp_null_allocator; 369dac87cc0SDimitry Andric extern __KMP_IMP omp_allocator_handle_t const omp_default_mem_alloc; 370dac87cc0SDimitry Andric extern __KMP_IMP omp_allocator_handle_t const omp_large_cap_mem_alloc; 371dac87cc0SDimitry Andric extern __KMP_IMP omp_allocator_handle_t const omp_const_mem_alloc; 372dac87cc0SDimitry Andric extern __KMP_IMP omp_allocator_handle_t const omp_high_bw_mem_alloc; 373dac87cc0SDimitry Andric extern __KMP_IMP omp_allocator_handle_t const omp_low_lat_mem_alloc; 374dac87cc0SDimitry Andric extern __KMP_IMP omp_allocator_handle_t const omp_cgroup_mem_alloc; 375dac87cc0SDimitry Andric extern __KMP_IMP omp_allocator_handle_t const omp_pteam_mem_alloc; 376dac87cc0SDimitry Andric extern __KMP_IMP omp_allocator_handle_t const omp_thread_mem_alloc; 3776e75b2fbSDimitry Andric extern __KMP_IMP omp_allocator_handle_t const llvm_omp_target_host_mem_alloc; 3786e75b2fbSDimitry Andric extern __KMP_IMP omp_allocator_handle_t const llvm_omp_target_shared_mem_alloc; 3796e75b2fbSDimitry Andric extern __KMP_IMP omp_allocator_handle_t const llvm_omp_target_device_mem_alloc; 3806e75b2fbSDimitry Andric 381dac87cc0SDimitry Andric typedef omp_uintptr_t omp_memspace_handle_t; 382dac87cc0SDimitry Andric extern __KMP_IMP omp_memspace_handle_t const omp_default_mem_space; 383dac87cc0SDimitry Andric extern __KMP_IMP omp_memspace_handle_t const omp_large_cap_mem_space; 384dac87cc0SDimitry Andric extern __KMP_IMP omp_memspace_handle_t const omp_const_mem_space; 385dac87cc0SDimitry Andric extern __KMP_IMP omp_memspace_handle_t const omp_high_bw_mem_space; 386dac87cc0SDimitry Andric extern __KMP_IMP omp_memspace_handle_t const omp_low_lat_mem_space; 3876e75b2fbSDimitry Andric extern __KMP_IMP omp_memspace_handle_t const llvm_omp_target_host_mem_space; 3886e75b2fbSDimitry Andric extern __KMP_IMP omp_memspace_handle_t const llvm_omp_target_shared_mem_space; 3896e75b2fbSDimitry Andric extern __KMP_IMP omp_memspace_handle_t const llvm_omp_target_device_mem_space; 3903c6bb671SDimitry Andric # else 391dac87cc0SDimitry Andric # if __cplusplus >= 201103 392dac87cc0SDimitry Andric typedef enum omp_allocator_handle_t : omp_uintptr_t 393dac87cc0SDimitry Andric # else 394dac87cc0SDimitry Andric typedef enum omp_allocator_handle_t 395dac87cc0SDimitry Andric # endif 396dac87cc0SDimitry Andric { 397dac87cc0SDimitry Andric omp_null_allocator = 0, 398dac87cc0SDimitry Andric omp_default_mem_alloc = 1, 399dac87cc0SDimitry Andric omp_large_cap_mem_alloc = 2, 400dac87cc0SDimitry Andric omp_const_mem_alloc = 3, 401dac87cc0SDimitry Andric omp_high_bw_mem_alloc = 4, 402dac87cc0SDimitry Andric omp_low_lat_mem_alloc = 5, 403dac87cc0SDimitry Andric omp_cgroup_mem_alloc = 6, 404dac87cc0SDimitry Andric omp_pteam_mem_alloc = 7, 405dac87cc0SDimitry Andric omp_thread_mem_alloc = 8, 4066e75b2fbSDimitry Andric llvm_omp_target_host_mem_alloc = 100, 4076e75b2fbSDimitry Andric llvm_omp_target_shared_mem_alloc = 101, 4086e75b2fbSDimitry Andric llvm_omp_target_device_mem_alloc = 102, 409dac87cc0SDimitry Andric KMP_ALLOCATOR_MAX_HANDLE = UINTPTR_MAX 410dac87cc0SDimitry Andric } omp_allocator_handle_t; 411dac87cc0SDimitry Andric # if __cplusplus >= 201103 412dac87cc0SDimitry Andric typedef enum omp_memspace_handle_t : omp_uintptr_t 413dac87cc0SDimitry Andric # else 414dac87cc0SDimitry Andric typedef enum omp_memspace_handle_t 415dac87cc0SDimitry Andric # endif 416dac87cc0SDimitry Andric { 417dac87cc0SDimitry Andric omp_default_mem_space = 0, 418dac87cc0SDimitry Andric omp_large_cap_mem_space = 1, 419dac87cc0SDimitry Andric omp_const_mem_space = 2, 420dac87cc0SDimitry Andric omp_high_bw_mem_space = 3, 421dac87cc0SDimitry Andric omp_low_lat_mem_space = 4, 4226e75b2fbSDimitry Andric llvm_omp_target_host_mem_space = 100, 4236e75b2fbSDimitry Andric llvm_omp_target_shared_mem_space = 101, 4246e75b2fbSDimitry Andric llvm_omp_target_device_mem_space = 102, 425dac87cc0SDimitry Andric KMP_MEMSPACE_MAX_HANDLE = UINTPTR_MAX 426dac87cc0SDimitry Andric } omp_memspace_handle_t; 427dac87cc0SDimitry Andric # endif 428dac87cc0SDimitry Andric extern omp_allocator_handle_t __KAI_KMPC_CONVENTION omp_init_allocator(omp_memspace_handle_t m, 429dac87cc0SDimitry Andric int ntraits, omp_alloctrait_t traits[]); 430dac87cc0SDimitry Andric extern void __KAI_KMPC_CONVENTION omp_destroy_allocator(omp_allocator_handle_t allocator); 431dac87cc0SDimitry Andric 432dac87cc0SDimitry Andric extern void __KAI_KMPC_CONVENTION omp_set_default_allocator(omp_allocator_handle_t a); 433dac87cc0SDimitry Andric extern omp_allocator_handle_t __KAI_KMPC_CONVENTION omp_get_default_allocator(void); 434dac87cc0SDimitry Andric # ifdef __cplusplus 435dac87cc0SDimitry Andric extern void *__KAI_KMPC_CONVENTION omp_alloc(size_t size, omp_allocator_handle_t a = omp_null_allocator); 4365e801ac6SDimitry Andric extern void *__KAI_KMPC_CONVENTION omp_aligned_alloc(size_t align, size_t size, 4375e801ac6SDimitry Andric omp_allocator_handle_t a = omp_null_allocator); 4385e801ac6SDimitry Andric extern void *__KAI_KMPC_CONVENTION omp_calloc(size_t nmemb, size_t size, 4395e801ac6SDimitry Andric omp_allocator_handle_t a = omp_null_allocator); 4405e801ac6SDimitry Andric extern void *__KAI_KMPC_CONVENTION omp_aligned_calloc(size_t align, size_t nmemb, size_t size, 4415e801ac6SDimitry Andric omp_allocator_handle_t a = omp_null_allocator); 442d409305fSDimitry Andric extern void *__KAI_KMPC_CONVENTION omp_realloc(void *ptr, size_t size, 443d409305fSDimitry Andric omp_allocator_handle_t allocator = omp_null_allocator, 444d409305fSDimitry Andric omp_allocator_handle_t free_allocator = omp_null_allocator); 445dac87cc0SDimitry Andric extern void __KAI_KMPC_CONVENTION omp_free(void * ptr, omp_allocator_handle_t a = omp_null_allocator); 446dac87cc0SDimitry Andric # else 447dac87cc0SDimitry Andric extern void *__KAI_KMPC_CONVENTION omp_alloc(size_t size, omp_allocator_handle_t a); 4485e801ac6SDimitry Andric extern void *__KAI_KMPC_CONVENTION omp_aligned_alloc(size_t align, size_t size, 4495e801ac6SDimitry Andric omp_allocator_handle_t a); 450d409305fSDimitry Andric extern void *__KAI_KMPC_CONVENTION omp_calloc(size_t nmemb, size_t size, omp_allocator_handle_t a); 4515e801ac6SDimitry Andric extern void *__KAI_KMPC_CONVENTION omp_aligned_calloc(size_t align, size_t nmemb, size_t size, 4525e801ac6SDimitry Andric omp_allocator_handle_t a); 453d409305fSDimitry Andric extern void *__KAI_KMPC_CONVENTION omp_realloc(void *ptr, size_t size, omp_allocator_handle_t allocator, 454d409305fSDimitry Andric omp_allocator_handle_t free_allocator); 455dac87cc0SDimitry Andric extern void __KAI_KMPC_CONVENTION omp_free(void *ptr, omp_allocator_handle_t a); 4563c6bb671SDimitry Andric # endif 4573c6bb671SDimitry Andric 4583c6bb671SDimitry Andric /* OpenMP 5.0 Affinity Format */ 4593c6bb671SDimitry Andric extern void __KAI_KMPC_CONVENTION omp_set_affinity_format(char const *); 4603c6bb671SDimitry Andric extern size_t __KAI_KMPC_CONVENTION omp_get_affinity_format(char *, size_t); 4613c6bb671SDimitry Andric extern void __KAI_KMPC_CONVENTION omp_display_affinity(char const *); 4623c6bb671SDimitry Andric extern size_t __KAI_KMPC_CONVENTION omp_capture_affinity(char *, size_t, char const *); 4633c6bb671SDimitry Andric 464dac87cc0SDimitry Andric /* OpenMP 5.0 events */ 465dac87cc0SDimitry Andric # if defined(_WIN32) 466dac87cc0SDimitry Andric // On Windows cl and icl do not support 64-bit enum, let's use integer then. 467dac87cc0SDimitry Andric typedef omp_uintptr_t omp_event_handle_t; 468dac87cc0SDimitry Andric # else 469dac87cc0SDimitry Andric typedef enum omp_event_handle_t { KMP_EVENT_MAX_HANDLE = UINTPTR_MAX } omp_event_handle_t; 470dac87cc0SDimitry Andric # endif 471dac87cc0SDimitry Andric extern void __KAI_KMPC_CONVENTION omp_fulfill_event ( omp_event_handle_t event ); 472dac87cc0SDimitry Andric 473dac87cc0SDimitry Andric /* OpenMP 5.0 Pause Resources */ 474dac87cc0SDimitry Andric typedef enum omp_pause_resource_t { 475dac87cc0SDimitry Andric omp_pause_resume = 0, 476dac87cc0SDimitry Andric omp_pause_soft = 1, 477dac87cc0SDimitry Andric omp_pause_hard = 2 478dac87cc0SDimitry Andric } omp_pause_resource_t; 479dac87cc0SDimitry Andric extern int __KAI_KMPC_CONVENTION omp_pause_resource(omp_pause_resource_t, int); 480dac87cc0SDimitry Andric extern int __KAI_KMPC_CONVENTION omp_pause_resource_all(omp_pause_resource_t); 481dac87cc0SDimitry Andric 482dac87cc0SDimitry Andric extern int __KAI_KMPC_CONVENTION omp_get_supported_active_levels(void); 483dac87cc0SDimitry Andric 4846e75b2fbSDimitry Andric /* OpenMP 5.1 */ 4856e75b2fbSDimitry Andric extern void __KAI_KMPC_CONVENTION omp_set_num_teams(int num_teams); 4866e75b2fbSDimitry Andric extern int __KAI_KMPC_CONVENTION omp_get_max_teams(void); 4876e75b2fbSDimitry Andric extern void __KAI_KMPC_CONVENTION omp_set_teams_thread_limit(int limit); 4886e75b2fbSDimitry Andric extern int __KAI_KMPC_CONVENTION omp_get_teams_thread_limit(void); 4896e75b2fbSDimitry Andric 490d409305fSDimitry Andric /* OpenMP 5.1 Display Environment */ 491d409305fSDimitry Andric extern void omp_display_env(int verbose); 492d409305fSDimitry Andric 4936e75b2fbSDimitry Andric # if defined(_OPENMP) && _OPENMP >= 201811 4946e75b2fbSDimitry Andric #pragma omp begin declare variant match(device={kind(host)}) 4956e75b2fbSDimitry Andric static inline int omp_is_initial_device(void) { return 1; } 4966e75b2fbSDimitry Andric #pragma omp end declare variant 4976e75b2fbSDimitry Andric #pragma omp begin declare variant match(device={kind(nohost)}) 4986e75b2fbSDimitry Andric static inline int omp_is_initial_device(void) { return 0; } 4996e75b2fbSDimitry Andric #pragma omp end declare variant 5006e75b2fbSDimitry Andric # endif 5016e75b2fbSDimitry Andric 50281ad6265SDimitry Andric /* OpenMP 5.2 */ 50381ad6265SDimitry Andric extern int __KAI_KMPC_CONVENTION omp_in_explicit_task(void); 50481ad6265SDimitry Andric 50581ad6265SDimitry Andric /* LLVM Extensions */ 506*5f757f3fSDimitry Andric extern void *llvm_omp_target_dynamic_shared_alloc(void); 50781ad6265SDimitry Andric 5083c6bb671SDimitry Andric # undef __KAI_KMPC_CONVENTION 5093c6bb671SDimitry Andric # undef __KMP_IMP 5103c6bb671SDimitry Andric 5113c6bb671SDimitry Andric /* Warning: 5123c6bb671SDimitry Andric The following typedefs are not standard, deprecated and will be removed in a future release. 5133c6bb671SDimitry Andric */ 5143c6bb671SDimitry Andric typedef int omp_int_t; 5153c6bb671SDimitry Andric typedef double omp_wtime_t; 5163c6bb671SDimitry Andric 5173c6bb671SDimitry Andric # ifdef __cplusplus 5183c6bb671SDimitry Andric } 5193c6bb671SDimitry Andric # endif 5203c6bb671SDimitry Andric 5213c6bb671SDimitry Andric #endif /* __OMP_H */ 522