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 185f757f3fSDimitry 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 159*0fca6ea1SDimitry Andric extern void __KAI_KMPC_CONVENTION ompx_dump_mapping_tables(void); 160*0fca6ea1SDimitry Andric 161d409305fSDimitry Andric /* 0..omp_get_num_interop_properties()-1 are reserved for implementation-defined properties */ 162d409305fSDimitry Andric typedef enum omp_interop_property { 163d409305fSDimitry Andric omp_ipr_fr_id = -1, 164d409305fSDimitry Andric omp_ipr_fr_name = -2, 165d409305fSDimitry Andric omp_ipr_vendor = -3, 166d409305fSDimitry Andric omp_ipr_vendor_name = -4, 167d409305fSDimitry Andric omp_ipr_device_num = -5, 168d409305fSDimitry Andric omp_ipr_platform = -6, 169d409305fSDimitry Andric omp_ipr_device = -7, 170d409305fSDimitry Andric omp_ipr_device_context = -8, 171d409305fSDimitry Andric omp_ipr_targetsync = -9, 172d409305fSDimitry Andric omp_ipr_first = -9 173d409305fSDimitry Andric } omp_interop_property_t; 174d409305fSDimitry Andric 175d409305fSDimitry Andric #define omp_interop_none 0 176d409305fSDimitry Andric 177d409305fSDimitry Andric typedef enum omp_interop_rc { 178d409305fSDimitry Andric omp_irc_no_value = 1, 179d409305fSDimitry Andric omp_irc_success = 0, 180d409305fSDimitry Andric omp_irc_empty = -1, 181d409305fSDimitry Andric omp_irc_out_of_range = -2, 182d409305fSDimitry Andric omp_irc_type_int = -3, 183d409305fSDimitry Andric omp_irc_type_ptr = -4, 184d409305fSDimitry Andric omp_irc_type_str = -5, 185d409305fSDimitry Andric omp_irc_other = -6 186d409305fSDimitry Andric } omp_interop_rc_t; 187d409305fSDimitry Andric 1886e75b2fbSDimitry Andric typedef enum omp_interop_fr { 1896e75b2fbSDimitry Andric omp_ifr_cuda = 1, 1906e75b2fbSDimitry Andric omp_ifr_cuda_driver = 2, 1916e75b2fbSDimitry Andric omp_ifr_opencl = 3, 1926e75b2fbSDimitry Andric omp_ifr_sycl = 4, 1936e75b2fbSDimitry Andric omp_ifr_hip = 5, 1946e75b2fbSDimitry Andric omp_ifr_level_zero = 6, 1956e75b2fbSDimitry Andric omp_ifr_last = 7 1966e75b2fbSDimitry Andric } omp_interop_fr_t; 1976e75b2fbSDimitry Andric 198d409305fSDimitry Andric typedef void * omp_interop_t; 199d409305fSDimitry Andric 200d409305fSDimitry Andric /*! 201d409305fSDimitry Andric * The `omp_get_num_interop_properties` routine retrieves the number of implementation-defined properties available for an `omp_interop_t` object. 202d409305fSDimitry Andric */ 203d409305fSDimitry Andric extern int __KAI_KMPC_CONVENTION omp_get_num_interop_properties(const omp_interop_t); 204d409305fSDimitry Andric /*! 205d409305fSDimitry Andric * The `omp_get_interop_int` routine retrieves an integer property from an `omp_interop_t` object. 206d409305fSDimitry Andric */ 207d409305fSDimitry Andric extern omp_intptr_t __KAI_KMPC_CONVENTION omp_get_interop_int(const omp_interop_t, omp_interop_property_t, int *); 208d409305fSDimitry Andric /*! 209d409305fSDimitry Andric * The `omp_get_interop_ptr` routine retrieves a pointer property from an `omp_interop_t` object. 210d409305fSDimitry Andric */ 211d409305fSDimitry Andric extern void * __KAI_KMPC_CONVENTION omp_get_interop_ptr(const omp_interop_t, omp_interop_property_t, int *); 212d409305fSDimitry Andric /*! 213d409305fSDimitry Andric * The `omp_get_interop_str` routine retrieves a string property from an `omp_interop_t` object. 214d409305fSDimitry Andric */ 215d409305fSDimitry Andric extern const char * __KAI_KMPC_CONVENTION omp_get_interop_str(const omp_interop_t, omp_interop_property_t, int *); 216d409305fSDimitry Andric /*! 217d409305fSDimitry Andric * The `omp_get_interop_name` routine retrieves a property name from an `omp_interop_t` object. 218d409305fSDimitry Andric */ 219d409305fSDimitry Andric extern const char * __KAI_KMPC_CONVENTION omp_get_interop_name(const omp_interop_t, omp_interop_property_t); 220d409305fSDimitry Andric /*! 221d409305fSDimitry Andric * The `omp_get_interop_type_desc` routine retrieves a description of the type of a property associated with an `omp_interop_t` object. 222d409305fSDimitry Andric */ 223d409305fSDimitry Andric extern const char * __KAI_KMPC_CONVENTION omp_get_interop_type_desc(const omp_interop_t, omp_interop_property_t); 224d409305fSDimitry Andric /*! 225d409305fSDimitry Andric * The `omp_get_interop_rc_desc` routine retrieves a description of the return code associated with an `omp_interop_t` object. 226d409305fSDimitry Andric */ 2276e75b2fbSDimitry Andric extern const char * __KAI_KMPC_CONVENTION omp_get_interop_rc_desc(const omp_interop_t, omp_interop_rc_t); 228d409305fSDimitry Andric 229d409305fSDimitry Andric /* OpenMP 5.1 device memory routines */ 230d409305fSDimitry Andric 231d409305fSDimitry Andric /*! 232d409305fSDimitry Andric * The `omp_target_memcpy_async` routine asynchronously performs a copy between any combination of host and device pointers. 233d409305fSDimitry Andric */ 234d409305fSDimitry Andric extern int __KAI_KMPC_CONVENTION omp_target_memcpy_async(void *, const void *, size_t, size_t, size_t, int, 235d409305fSDimitry Andric int, int, omp_depend_t *); 236d409305fSDimitry Andric /*! 237d409305fSDimitry Andric * The `omp_target_memcpy_rect_async` routine asynchronously performs a copy between any combination of host and device pointers. 238d409305fSDimitry Andric */ 239d409305fSDimitry Andric extern int __KAI_KMPC_CONVENTION omp_target_memcpy_rect_async(void *, const void *, size_t, int, const size_t *, 240d409305fSDimitry Andric const size_t *, const size_t *, const size_t *, const size_t *, int, int, 241d409305fSDimitry Andric int, omp_depend_t *); 2425f757f3fSDimitry Andric 2435f757f3fSDimitry Andric /* OpenMP 6.0 device memory routines */ 2445f757f3fSDimitry Andric extern void * __KAI_KMPC_CONVENTION omp_target_memset(void *, int, size_t, int); 2455f757f3fSDimitry Andric extern void * __KAI_KMPC_CONVENTION omp_target_memset_async(void *, int, size_t, int, int, omp_depend_t *); 2465f757f3fSDimitry Andric 247d409305fSDimitry Andric /*! 248d409305fSDimitry Andric * The `omp_get_mapped_ptr` routine returns the device pointer that is associated with a host pointer for a given device. 249d409305fSDimitry Andric */ 250d409305fSDimitry Andric extern void * __KAI_KMPC_CONVENTION omp_get_mapped_ptr(const void *, int); 2516e75b2fbSDimitry Andric extern int __KAI_KMPC_CONVENTION omp_target_is_accessible(const void *, size_t, int); 252d409305fSDimitry Andric 2533c6bb671SDimitry Andric /* kmp API functions */ 2543c6bb671SDimitry Andric extern int __KAI_KMPC_CONVENTION kmp_get_stacksize (void); 2553c6bb671SDimitry Andric extern void __KAI_KMPC_CONVENTION kmp_set_stacksize (int); 2563c6bb671SDimitry Andric extern size_t __KAI_KMPC_CONVENTION kmp_get_stacksize_s (void); 2573c6bb671SDimitry Andric extern void __KAI_KMPC_CONVENTION kmp_set_stacksize_s (size_t); 2583c6bb671SDimitry Andric extern int __KAI_KMPC_CONVENTION kmp_get_blocktime (void); 2593c6bb671SDimitry Andric extern int __KAI_KMPC_CONVENTION kmp_get_library (void); 2603c6bb671SDimitry Andric extern void __KAI_KMPC_CONVENTION kmp_set_blocktime (int); 2613c6bb671SDimitry Andric extern void __KAI_KMPC_CONVENTION kmp_set_library (int); 2623c6bb671SDimitry Andric extern void __KAI_KMPC_CONVENTION kmp_set_library_serial (void); 2633c6bb671SDimitry Andric extern void __KAI_KMPC_CONVENTION kmp_set_library_turnaround (void); 2643c6bb671SDimitry Andric extern void __KAI_KMPC_CONVENTION kmp_set_library_throughput (void); 2653c6bb671SDimitry Andric extern void __KAI_KMPC_CONVENTION kmp_set_defaults (char const *); 2663c6bb671SDimitry Andric extern void __KAI_KMPC_CONVENTION kmp_set_disp_num_buffers (int); 2673c6bb671SDimitry Andric 2683c6bb671SDimitry Andric /* Intel affinity API */ 2693c6bb671SDimitry Andric typedef void * kmp_affinity_mask_t; 2703c6bb671SDimitry Andric 2713c6bb671SDimitry Andric extern int __KAI_KMPC_CONVENTION kmp_set_affinity (kmp_affinity_mask_t *); 2723c6bb671SDimitry Andric extern int __KAI_KMPC_CONVENTION kmp_get_affinity (kmp_affinity_mask_t *); 2733c6bb671SDimitry Andric extern int __KAI_KMPC_CONVENTION kmp_get_affinity_max_proc (void); 2743c6bb671SDimitry Andric extern void __KAI_KMPC_CONVENTION kmp_create_affinity_mask (kmp_affinity_mask_t *); 2753c6bb671SDimitry Andric extern void __KAI_KMPC_CONVENTION kmp_destroy_affinity_mask (kmp_affinity_mask_t *); 2763c6bb671SDimitry Andric extern int __KAI_KMPC_CONVENTION kmp_set_affinity_mask_proc (int, kmp_affinity_mask_t *); 2773c6bb671SDimitry Andric extern int __KAI_KMPC_CONVENTION kmp_unset_affinity_mask_proc (int, kmp_affinity_mask_t *); 2783c6bb671SDimitry Andric extern int __KAI_KMPC_CONVENTION kmp_get_affinity_mask_proc (int, kmp_affinity_mask_t *); 2793c6bb671SDimitry Andric 2803c6bb671SDimitry Andric /* OpenMP 4.0 affinity API */ 2813c6bb671SDimitry Andric typedef enum omp_proc_bind_t { 2823c6bb671SDimitry Andric omp_proc_bind_false = 0, 2833c6bb671SDimitry Andric omp_proc_bind_true = 1, 2843c6bb671SDimitry Andric omp_proc_bind_master = 2, 2853c6bb671SDimitry Andric omp_proc_bind_close = 3, 2863c6bb671SDimitry Andric omp_proc_bind_spread = 4 2873c6bb671SDimitry Andric } omp_proc_bind_t; 2883c6bb671SDimitry Andric 2893c6bb671SDimitry Andric extern omp_proc_bind_t __KAI_KMPC_CONVENTION omp_get_proc_bind (void); 2903c6bb671SDimitry Andric 2913c6bb671SDimitry Andric /* OpenMP 4.5 affinity API */ 2923c6bb671SDimitry Andric extern int __KAI_KMPC_CONVENTION omp_get_num_places (void); 2933c6bb671SDimitry Andric extern int __KAI_KMPC_CONVENTION omp_get_place_num_procs (int); 2943c6bb671SDimitry Andric extern void __KAI_KMPC_CONVENTION omp_get_place_proc_ids (int, int *); 2953c6bb671SDimitry Andric extern int __KAI_KMPC_CONVENTION omp_get_place_num (void); 2963c6bb671SDimitry Andric extern int __KAI_KMPC_CONVENTION omp_get_partition_num_places (void); 2973c6bb671SDimitry Andric extern void __KAI_KMPC_CONVENTION omp_get_partition_place_nums (int *); 2983c6bb671SDimitry Andric 2993c6bb671SDimitry Andric extern void * __KAI_KMPC_CONVENTION kmp_malloc (size_t); 3003c6bb671SDimitry Andric extern void * __KAI_KMPC_CONVENTION kmp_aligned_malloc (size_t, size_t); 3013c6bb671SDimitry Andric extern void * __KAI_KMPC_CONVENTION kmp_calloc (size_t, size_t); 3023c6bb671SDimitry Andric extern void * __KAI_KMPC_CONVENTION kmp_realloc (void *, size_t); 3033c6bb671SDimitry Andric extern void __KAI_KMPC_CONVENTION kmp_free (void *); 3043c6bb671SDimitry Andric 3053c6bb671SDimitry Andric extern void __KAI_KMPC_CONVENTION kmp_set_warnings_on(void); 3063c6bb671SDimitry Andric extern void __KAI_KMPC_CONVENTION kmp_set_warnings_off(void); 3073c6bb671SDimitry Andric 3083c6bb671SDimitry Andric /* OpenMP 5.0 Tool Control */ 3093c6bb671SDimitry Andric typedef enum omp_control_tool_result_t { 3103c6bb671SDimitry Andric omp_control_tool_notool = -2, 3113c6bb671SDimitry Andric omp_control_tool_nocallback = -1, 3123c6bb671SDimitry Andric omp_control_tool_success = 0, 3133c6bb671SDimitry Andric omp_control_tool_ignored = 1 3143c6bb671SDimitry Andric } omp_control_tool_result_t; 3153c6bb671SDimitry Andric 3163c6bb671SDimitry Andric typedef enum omp_control_tool_t { 3173c6bb671SDimitry Andric omp_control_tool_start = 1, 3183c6bb671SDimitry Andric omp_control_tool_pause = 2, 3193c6bb671SDimitry Andric omp_control_tool_flush = 3, 3203c6bb671SDimitry Andric omp_control_tool_end = 4 3213c6bb671SDimitry Andric } omp_control_tool_t; 3223c6bb671SDimitry Andric 3233c6bb671SDimitry Andric extern int __KAI_KMPC_CONVENTION omp_control_tool(int, int, void*); 3243c6bb671SDimitry Andric 3253c6bb671SDimitry Andric /* OpenMP 5.0 Memory Management */ 326dac87cc0SDimitry Andric typedef uintptr_t omp_uintptr_t; 3273c6bb671SDimitry Andric 328dac87cc0SDimitry Andric typedef enum { 329d409305fSDimitry Andric omp_atk_sync_hint = 1, 330d409305fSDimitry Andric omp_atk_alignment = 2, 331d409305fSDimitry Andric omp_atk_access = 3, 332d409305fSDimitry Andric omp_atk_pool_size = 4, 333d409305fSDimitry Andric omp_atk_fallback = 5, 334d409305fSDimitry Andric omp_atk_fb_data = 6, 335d409305fSDimitry Andric omp_atk_pinned = 7, 336d409305fSDimitry Andric omp_atk_partition = 8 337dac87cc0SDimitry Andric } omp_alloctrait_key_t; 338dac87cc0SDimitry Andric 339dac87cc0SDimitry Andric typedef enum { 340d409305fSDimitry Andric omp_atv_false = 0, 341d409305fSDimitry Andric omp_atv_true = 1, 342d409305fSDimitry Andric omp_atv_contended = 3, 343d409305fSDimitry Andric omp_atv_uncontended = 4, 344d409305fSDimitry Andric omp_atv_serialized = 5, 345d409305fSDimitry Andric omp_atv_sequential = omp_atv_serialized, // (deprecated) 346d409305fSDimitry Andric omp_atv_private = 6, 347d409305fSDimitry Andric omp_atv_all = 7, 348d409305fSDimitry Andric omp_atv_thread = 8, 349d409305fSDimitry Andric omp_atv_pteam = 9, 350d409305fSDimitry Andric omp_atv_cgroup = 10, 351d409305fSDimitry Andric omp_atv_default_mem_fb = 11, 352d409305fSDimitry Andric omp_atv_null_fb = 12, 353d409305fSDimitry Andric omp_atv_abort_fb = 13, 354d409305fSDimitry Andric omp_atv_allocator_fb = 14, 355d409305fSDimitry Andric omp_atv_environment = 15, 356d409305fSDimitry Andric omp_atv_nearest = 16, 357d409305fSDimitry Andric omp_atv_blocked = 17, 358d409305fSDimitry Andric omp_atv_interleaved = 18 359dac87cc0SDimitry Andric } omp_alloctrait_value_t; 360d409305fSDimitry Andric #define omp_atv_default ((omp_uintptr_t)-1) 361dac87cc0SDimitry Andric 362dac87cc0SDimitry Andric typedef struct { 363dac87cc0SDimitry Andric omp_alloctrait_key_t key; 364dac87cc0SDimitry Andric omp_uintptr_t value; 365dac87cc0SDimitry Andric } omp_alloctrait_t; 366dac87cc0SDimitry Andric 367dac87cc0SDimitry Andric # if defined(_WIN32) 368dac87cc0SDimitry Andric // On Windows cl and icl do not support 64-bit enum, let's use integer then. 369dac87cc0SDimitry Andric typedef omp_uintptr_t omp_allocator_handle_t; 370dac87cc0SDimitry Andric extern __KMP_IMP omp_allocator_handle_t const omp_null_allocator; 371dac87cc0SDimitry Andric extern __KMP_IMP omp_allocator_handle_t const omp_default_mem_alloc; 372dac87cc0SDimitry Andric extern __KMP_IMP omp_allocator_handle_t const omp_large_cap_mem_alloc; 373dac87cc0SDimitry Andric extern __KMP_IMP omp_allocator_handle_t const omp_const_mem_alloc; 374dac87cc0SDimitry Andric extern __KMP_IMP omp_allocator_handle_t const omp_high_bw_mem_alloc; 375dac87cc0SDimitry Andric extern __KMP_IMP omp_allocator_handle_t const omp_low_lat_mem_alloc; 376dac87cc0SDimitry Andric extern __KMP_IMP omp_allocator_handle_t const omp_cgroup_mem_alloc; 377dac87cc0SDimitry Andric extern __KMP_IMP omp_allocator_handle_t const omp_pteam_mem_alloc; 378dac87cc0SDimitry Andric extern __KMP_IMP omp_allocator_handle_t const omp_thread_mem_alloc; 3796e75b2fbSDimitry Andric extern __KMP_IMP omp_allocator_handle_t const llvm_omp_target_host_mem_alloc; 3806e75b2fbSDimitry Andric extern __KMP_IMP omp_allocator_handle_t const llvm_omp_target_shared_mem_alloc; 3816e75b2fbSDimitry Andric extern __KMP_IMP omp_allocator_handle_t const llvm_omp_target_device_mem_alloc; 3826e75b2fbSDimitry Andric 383dac87cc0SDimitry Andric typedef omp_uintptr_t omp_memspace_handle_t; 384dac87cc0SDimitry Andric extern __KMP_IMP omp_memspace_handle_t const omp_default_mem_space; 385dac87cc0SDimitry Andric extern __KMP_IMP omp_memspace_handle_t const omp_large_cap_mem_space; 386dac87cc0SDimitry Andric extern __KMP_IMP omp_memspace_handle_t const omp_const_mem_space; 387dac87cc0SDimitry Andric extern __KMP_IMP omp_memspace_handle_t const omp_high_bw_mem_space; 388dac87cc0SDimitry Andric extern __KMP_IMP omp_memspace_handle_t const omp_low_lat_mem_space; 3896e75b2fbSDimitry Andric extern __KMP_IMP omp_memspace_handle_t const llvm_omp_target_host_mem_space; 3906e75b2fbSDimitry Andric extern __KMP_IMP omp_memspace_handle_t const llvm_omp_target_shared_mem_space; 3916e75b2fbSDimitry Andric extern __KMP_IMP omp_memspace_handle_t const llvm_omp_target_device_mem_space; 3923c6bb671SDimitry Andric # else 393dac87cc0SDimitry Andric # if __cplusplus >= 201103 394dac87cc0SDimitry Andric typedef enum omp_allocator_handle_t : omp_uintptr_t 395dac87cc0SDimitry Andric # else 396dac87cc0SDimitry Andric typedef enum omp_allocator_handle_t 397dac87cc0SDimitry Andric # endif 398dac87cc0SDimitry Andric { 399dac87cc0SDimitry Andric omp_null_allocator = 0, 400dac87cc0SDimitry Andric omp_default_mem_alloc = 1, 401dac87cc0SDimitry Andric omp_large_cap_mem_alloc = 2, 402dac87cc0SDimitry Andric omp_const_mem_alloc = 3, 403dac87cc0SDimitry Andric omp_high_bw_mem_alloc = 4, 404dac87cc0SDimitry Andric omp_low_lat_mem_alloc = 5, 405dac87cc0SDimitry Andric omp_cgroup_mem_alloc = 6, 406dac87cc0SDimitry Andric omp_pteam_mem_alloc = 7, 407dac87cc0SDimitry Andric omp_thread_mem_alloc = 8, 4086e75b2fbSDimitry Andric llvm_omp_target_host_mem_alloc = 100, 4096e75b2fbSDimitry Andric llvm_omp_target_shared_mem_alloc = 101, 4106e75b2fbSDimitry Andric llvm_omp_target_device_mem_alloc = 102, 411dac87cc0SDimitry Andric KMP_ALLOCATOR_MAX_HANDLE = UINTPTR_MAX 412dac87cc0SDimitry Andric } omp_allocator_handle_t; 413dac87cc0SDimitry Andric # if __cplusplus >= 201103 414dac87cc0SDimitry Andric typedef enum omp_memspace_handle_t : omp_uintptr_t 415dac87cc0SDimitry Andric # else 416dac87cc0SDimitry Andric typedef enum omp_memspace_handle_t 417dac87cc0SDimitry Andric # endif 418dac87cc0SDimitry Andric { 419dac87cc0SDimitry Andric omp_default_mem_space = 0, 420dac87cc0SDimitry Andric omp_large_cap_mem_space = 1, 421dac87cc0SDimitry Andric omp_const_mem_space = 2, 422dac87cc0SDimitry Andric omp_high_bw_mem_space = 3, 423dac87cc0SDimitry Andric omp_low_lat_mem_space = 4, 4246e75b2fbSDimitry Andric llvm_omp_target_host_mem_space = 100, 4256e75b2fbSDimitry Andric llvm_omp_target_shared_mem_space = 101, 4266e75b2fbSDimitry Andric llvm_omp_target_device_mem_space = 102, 427dac87cc0SDimitry Andric KMP_MEMSPACE_MAX_HANDLE = UINTPTR_MAX 428dac87cc0SDimitry Andric } omp_memspace_handle_t; 429dac87cc0SDimitry Andric # endif 430dac87cc0SDimitry Andric extern omp_allocator_handle_t __KAI_KMPC_CONVENTION omp_init_allocator(omp_memspace_handle_t m, 431dac87cc0SDimitry Andric int ntraits, omp_alloctrait_t traits[]); 432dac87cc0SDimitry Andric extern void __KAI_KMPC_CONVENTION omp_destroy_allocator(omp_allocator_handle_t allocator); 433dac87cc0SDimitry Andric 434dac87cc0SDimitry Andric extern void __KAI_KMPC_CONVENTION omp_set_default_allocator(omp_allocator_handle_t a); 435dac87cc0SDimitry Andric extern omp_allocator_handle_t __KAI_KMPC_CONVENTION omp_get_default_allocator(void); 436dac87cc0SDimitry Andric # ifdef __cplusplus 437dac87cc0SDimitry Andric extern void *__KAI_KMPC_CONVENTION omp_alloc(size_t size, omp_allocator_handle_t a = omp_null_allocator); 4385e801ac6SDimitry Andric extern void *__KAI_KMPC_CONVENTION omp_aligned_alloc(size_t align, size_t size, 4395e801ac6SDimitry Andric omp_allocator_handle_t a = omp_null_allocator); 4405e801ac6SDimitry Andric extern void *__KAI_KMPC_CONVENTION omp_calloc(size_t nmemb, size_t size, 4415e801ac6SDimitry Andric omp_allocator_handle_t a = omp_null_allocator); 4425e801ac6SDimitry Andric extern void *__KAI_KMPC_CONVENTION omp_aligned_calloc(size_t align, size_t nmemb, size_t size, 4435e801ac6SDimitry Andric omp_allocator_handle_t a = omp_null_allocator); 444d409305fSDimitry Andric extern void *__KAI_KMPC_CONVENTION omp_realloc(void *ptr, size_t size, 445d409305fSDimitry Andric omp_allocator_handle_t allocator = omp_null_allocator, 446d409305fSDimitry Andric omp_allocator_handle_t free_allocator = omp_null_allocator); 447dac87cc0SDimitry Andric extern void __KAI_KMPC_CONVENTION omp_free(void * ptr, omp_allocator_handle_t a = omp_null_allocator); 448dac87cc0SDimitry Andric # else 449dac87cc0SDimitry Andric extern void *__KAI_KMPC_CONVENTION omp_alloc(size_t size, omp_allocator_handle_t a); 4505e801ac6SDimitry Andric extern void *__KAI_KMPC_CONVENTION omp_aligned_alloc(size_t align, size_t size, 4515e801ac6SDimitry Andric omp_allocator_handle_t a); 452d409305fSDimitry Andric extern void *__KAI_KMPC_CONVENTION omp_calloc(size_t nmemb, size_t size, omp_allocator_handle_t a); 4535e801ac6SDimitry Andric extern void *__KAI_KMPC_CONVENTION omp_aligned_calloc(size_t align, size_t nmemb, size_t size, 4545e801ac6SDimitry Andric omp_allocator_handle_t a); 455d409305fSDimitry Andric extern void *__KAI_KMPC_CONVENTION omp_realloc(void *ptr, size_t size, omp_allocator_handle_t allocator, 456d409305fSDimitry Andric omp_allocator_handle_t free_allocator); 457dac87cc0SDimitry Andric extern void __KAI_KMPC_CONVENTION omp_free(void *ptr, omp_allocator_handle_t a); 4583c6bb671SDimitry Andric # endif 4593c6bb671SDimitry Andric 4603c6bb671SDimitry Andric /* OpenMP 5.0 Affinity Format */ 4613c6bb671SDimitry Andric extern void __KAI_KMPC_CONVENTION omp_set_affinity_format(char const *); 4623c6bb671SDimitry Andric extern size_t __KAI_KMPC_CONVENTION omp_get_affinity_format(char *, size_t); 4633c6bb671SDimitry Andric extern void __KAI_KMPC_CONVENTION omp_display_affinity(char const *); 4643c6bb671SDimitry Andric extern size_t __KAI_KMPC_CONVENTION omp_capture_affinity(char *, size_t, char const *); 4653c6bb671SDimitry Andric 466dac87cc0SDimitry Andric /* OpenMP 5.0 events */ 467dac87cc0SDimitry Andric # if defined(_WIN32) 468dac87cc0SDimitry Andric // On Windows cl and icl do not support 64-bit enum, let's use integer then. 469dac87cc0SDimitry Andric typedef omp_uintptr_t omp_event_handle_t; 470dac87cc0SDimitry Andric # else 471dac87cc0SDimitry Andric typedef enum omp_event_handle_t { KMP_EVENT_MAX_HANDLE = UINTPTR_MAX } omp_event_handle_t; 472dac87cc0SDimitry Andric # endif 473dac87cc0SDimitry Andric extern void __KAI_KMPC_CONVENTION omp_fulfill_event ( omp_event_handle_t event ); 474dac87cc0SDimitry Andric 475dac87cc0SDimitry Andric /* OpenMP 5.0 Pause Resources */ 476dac87cc0SDimitry Andric typedef enum omp_pause_resource_t { 477dac87cc0SDimitry Andric omp_pause_resume = 0, 478dac87cc0SDimitry Andric omp_pause_soft = 1, 479dac87cc0SDimitry Andric omp_pause_hard = 2 480dac87cc0SDimitry Andric } omp_pause_resource_t; 481dac87cc0SDimitry Andric extern int __KAI_KMPC_CONVENTION omp_pause_resource(omp_pause_resource_t, int); 482dac87cc0SDimitry Andric extern int __KAI_KMPC_CONVENTION omp_pause_resource_all(omp_pause_resource_t); 483dac87cc0SDimitry Andric 484dac87cc0SDimitry Andric extern int __KAI_KMPC_CONVENTION omp_get_supported_active_levels(void); 485dac87cc0SDimitry Andric 4866e75b2fbSDimitry Andric /* OpenMP 5.1 */ 4876e75b2fbSDimitry Andric extern void __KAI_KMPC_CONVENTION omp_set_num_teams(int num_teams); 4886e75b2fbSDimitry Andric extern int __KAI_KMPC_CONVENTION omp_get_max_teams(void); 4896e75b2fbSDimitry Andric extern void __KAI_KMPC_CONVENTION omp_set_teams_thread_limit(int limit); 4906e75b2fbSDimitry Andric extern int __KAI_KMPC_CONVENTION omp_get_teams_thread_limit(void); 4916e75b2fbSDimitry Andric 492d409305fSDimitry Andric /* OpenMP 5.1 Display Environment */ 493d409305fSDimitry Andric extern void omp_display_env(int verbose); 494d409305fSDimitry Andric 4956e75b2fbSDimitry Andric # if defined(_OPENMP) && _OPENMP >= 201811 4966e75b2fbSDimitry Andric #pragma omp begin declare variant match(device={kind(host)}) omp_is_initial_device(void)4976e75b2fbSDimitry Andric static inline int omp_is_initial_device(void) { return 1; } 4986e75b2fbSDimitry Andric #pragma omp end declare variant 4996e75b2fbSDimitry Andric #pragma omp begin declare variant match(device={kind(nohost)}) omp_is_initial_device(void)5006e75b2fbSDimitry Andric static inline int omp_is_initial_device(void) { return 0; } 5016e75b2fbSDimitry Andric #pragma omp end declare variant 5026e75b2fbSDimitry Andric # endif 5036e75b2fbSDimitry Andric 50481ad6265SDimitry Andric /* OpenMP 5.2 */ 50581ad6265SDimitry Andric extern int __KAI_KMPC_CONVENTION omp_in_explicit_task(void); 50681ad6265SDimitry Andric 50781ad6265SDimitry Andric /* LLVM Extensions */ 5085f757f3fSDimitry Andric extern void *llvm_omp_target_dynamic_shared_alloc(void); 50981ad6265SDimitry Andric 5103c6bb671SDimitry Andric # undef __KAI_KMPC_CONVENTION 5113c6bb671SDimitry Andric # undef __KMP_IMP 5123c6bb671SDimitry Andric 5133c6bb671SDimitry Andric /* Warning: 5143c6bb671SDimitry Andric The following typedefs are not standard, deprecated and will be removed in a future release. 5153c6bb671SDimitry Andric */ 5163c6bb671SDimitry Andric typedef int omp_int_t; 5173c6bb671SDimitry Andric typedef double omp_wtime_t; 5183c6bb671SDimitry Andric 5193c6bb671SDimitry Andric # ifdef __cplusplus 5203c6bb671SDimitry Andric } 5213c6bb671SDimitry Andric # endif 5223c6bb671SDimitry Andric 5233c6bb671SDimitry Andric #endif /* __OMP_H */ 524