10b57cec5SDimitry Andric/* 20b57cec5SDimitry Andric * include/omp.h.var 30b57cec5SDimitry Andric */ 40b57cec5SDimitry Andric 50b57cec5SDimitry Andric 60b57cec5SDimitry Andric//===----------------------------------------------------------------------===// 70b57cec5SDimitry Andric// 80b57cec5SDimitry Andric// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 90b57cec5SDimitry Andric// See https://llvm.org/LICENSE.txt for license information. 100b57cec5SDimitry Andric// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 110b57cec5SDimitry Andric// 120b57cec5SDimitry Andric//===----------------------------------------------------------------------===// 130b57cec5SDimitry Andric 140b57cec5SDimitry Andric 150b57cec5SDimitry Andric#ifndef __OMP_H 160b57cec5SDimitry Andric# define __OMP_H 170b57cec5SDimitry Andric 180b57cec5SDimitry Andric# include <stdlib.h> 190b57cec5SDimitry Andric# include <stdint.h> 200b57cec5SDimitry Andric 210b57cec5SDimitry Andric# define KMP_VERSION_MAJOR @LIBOMP_VERSION_MAJOR@ 220b57cec5SDimitry Andric# define KMP_VERSION_MINOR @LIBOMP_VERSION_MINOR@ 230b57cec5SDimitry Andric# define KMP_VERSION_BUILD @LIBOMP_VERSION_BUILD@ 240b57cec5SDimitry Andric# define KMP_BUILD_DATE "@LIBOMP_BUILD_DATE@" 250b57cec5SDimitry Andric 260b57cec5SDimitry Andric# ifdef __cplusplus 270b57cec5SDimitry Andric extern "C" { 280b57cec5SDimitry Andric# endif 290b57cec5SDimitry Andric 300b57cec5SDimitry Andric# define omp_set_affinity_format ompc_set_affinity_format 310b57cec5SDimitry Andric# define omp_get_affinity_format ompc_get_affinity_format 320b57cec5SDimitry Andric# define omp_display_affinity ompc_display_affinity 330b57cec5SDimitry Andric# define omp_capture_affinity ompc_capture_affinity 340b57cec5SDimitry Andric 350b57cec5SDimitry Andric# if defined(_WIN32) 360b57cec5SDimitry Andric# define __KAI_KMPC_CONVENTION __cdecl 370b57cec5SDimitry Andric# ifndef __KMP_IMP 380b57cec5SDimitry Andric# define __KMP_IMP __declspec(dllimport) 390b57cec5SDimitry Andric# endif 400b57cec5SDimitry Andric# else 410b57cec5SDimitry Andric# define __KAI_KMPC_CONVENTION 420b57cec5SDimitry Andric# ifndef __KMP_IMP 430b57cec5SDimitry Andric# define __KMP_IMP 440b57cec5SDimitry Andric# endif 450b57cec5SDimitry Andric# endif 460b57cec5SDimitry Andric 470b57cec5SDimitry Andric /* schedule kind constants */ 480b57cec5SDimitry Andric typedef enum omp_sched_t { 490b57cec5SDimitry Andric omp_sched_static = 1, 500b57cec5SDimitry Andric omp_sched_dynamic = 2, 510b57cec5SDimitry Andric omp_sched_guided = 3, 520b57cec5SDimitry Andric omp_sched_auto = 4, 530b57cec5SDimitry Andric omp_sched_monotonic = 0x80000000 540b57cec5SDimitry Andric } omp_sched_t; 550b57cec5SDimitry Andric 560b57cec5SDimitry Andric /* set API functions */ 570b57cec5SDimitry Andric extern void __KAI_KMPC_CONVENTION omp_set_num_threads (int); 580b57cec5SDimitry Andric extern void __KAI_KMPC_CONVENTION omp_set_dynamic (int); 590b57cec5SDimitry Andric extern void __KAI_KMPC_CONVENTION omp_set_nested (int); 600b57cec5SDimitry Andric extern void __KAI_KMPC_CONVENTION omp_set_max_active_levels (int); 610b57cec5SDimitry Andric extern void __KAI_KMPC_CONVENTION omp_set_schedule (omp_sched_t, int); 620b57cec5SDimitry Andric 630b57cec5SDimitry Andric /* query API functions */ 640b57cec5SDimitry Andric extern int __KAI_KMPC_CONVENTION omp_get_num_threads (void); 650b57cec5SDimitry Andric extern int __KAI_KMPC_CONVENTION omp_get_dynamic (void); 660b57cec5SDimitry Andric extern int __KAI_KMPC_CONVENTION omp_get_nested (void); 670b57cec5SDimitry Andric extern int __KAI_KMPC_CONVENTION omp_get_max_threads (void); 680b57cec5SDimitry Andric extern int __KAI_KMPC_CONVENTION omp_get_thread_num (void); 690b57cec5SDimitry Andric extern int __KAI_KMPC_CONVENTION omp_get_num_procs (void); 700b57cec5SDimitry Andric extern int __KAI_KMPC_CONVENTION omp_in_parallel (void); 710b57cec5SDimitry Andric extern int __KAI_KMPC_CONVENTION omp_in_final (void); 720b57cec5SDimitry Andric extern int __KAI_KMPC_CONVENTION omp_get_active_level (void); 730b57cec5SDimitry Andric extern int __KAI_KMPC_CONVENTION omp_get_level (void); 740b57cec5SDimitry Andric extern int __KAI_KMPC_CONVENTION omp_get_ancestor_thread_num (int); 750b57cec5SDimitry Andric extern int __KAI_KMPC_CONVENTION omp_get_team_size (int); 760b57cec5SDimitry Andric extern int __KAI_KMPC_CONVENTION omp_get_thread_limit (void); 770b57cec5SDimitry Andric extern int __KAI_KMPC_CONVENTION omp_get_max_active_levels (void); 780b57cec5SDimitry Andric extern void __KAI_KMPC_CONVENTION omp_get_schedule (omp_sched_t *, int *); 790b57cec5SDimitry Andric extern int __KAI_KMPC_CONVENTION omp_get_max_task_priority (void); 800b57cec5SDimitry Andric 810b57cec5SDimitry Andric /* lock API functions */ 820b57cec5SDimitry Andric typedef struct omp_lock_t { 830b57cec5SDimitry Andric void * _lk; 840b57cec5SDimitry Andric } omp_lock_t; 850b57cec5SDimitry Andric 860b57cec5SDimitry Andric extern void __KAI_KMPC_CONVENTION omp_init_lock (omp_lock_t *); 870b57cec5SDimitry Andric extern void __KAI_KMPC_CONVENTION omp_set_lock (omp_lock_t *); 880b57cec5SDimitry Andric extern void __KAI_KMPC_CONVENTION omp_unset_lock (omp_lock_t *); 890b57cec5SDimitry Andric extern void __KAI_KMPC_CONVENTION omp_destroy_lock (omp_lock_t *); 900b57cec5SDimitry Andric extern int __KAI_KMPC_CONVENTION omp_test_lock (omp_lock_t *); 910b57cec5SDimitry Andric 920b57cec5SDimitry Andric /* nested lock API functions */ 930b57cec5SDimitry Andric typedef struct omp_nest_lock_t { 940b57cec5SDimitry Andric void * _lk; 950b57cec5SDimitry Andric } omp_nest_lock_t; 960b57cec5SDimitry Andric 970b57cec5SDimitry Andric extern void __KAI_KMPC_CONVENTION omp_init_nest_lock (omp_nest_lock_t *); 980b57cec5SDimitry Andric extern void __KAI_KMPC_CONVENTION omp_set_nest_lock (omp_nest_lock_t *); 990b57cec5SDimitry Andric extern void __KAI_KMPC_CONVENTION omp_unset_nest_lock (omp_nest_lock_t *); 1000b57cec5SDimitry Andric extern void __KAI_KMPC_CONVENTION omp_destroy_nest_lock (omp_nest_lock_t *); 1010b57cec5SDimitry Andric extern int __KAI_KMPC_CONVENTION omp_test_nest_lock (omp_nest_lock_t *); 1020b57cec5SDimitry Andric 1030b57cec5SDimitry Andric /* OpenMP 5.0 Synchronization hints*/ 1040b57cec5SDimitry Andric typedef enum omp_sync_hint_t { 1050b57cec5SDimitry Andric omp_sync_hint_none = 0, 1060b57cec5SDimitry Andric omp_lock_hint_none = omp_sync_hint_none, 1070b57cec5SDimitry Andric omp_sync_hint_uncontended = 1, 1080b57cec5SDimitry Andric omp_lock_hint_uncontended = omp_sync_hint_uncontended, 1090b57cec5SDimitry Andric omp_sync_hint_contended = (1<<1), 1100b57cec5SDimitry Andric omp_lock_hint_contended = omp_sync_hint_contended, 1110b57cec5SDimitry Andric omp_sync_hint_nonspeculative = (1<<2), 1120b57cec5SDimitry Andric omp_lock_hint_nonspeculative = omp_sync_hint_nonspeculative, 1130b57cec5SDimitry Andric omp_sync_hint_speculative = (1<<3), 1140b57cec5SDimitry Andric omp_lock_hint_speculative = omp_sync_hint_speculative, 1150b57cec5SDimitry Andric kmp_lock_hint_hle = (1<<16), 1160b57cec5SDimitry Andric kmp_lock_hint_rtm = (1<<17), 1170b57cec5SDimitry Andric kmp_lock_hint_adaptive = (1<<18) 1180b57cec5SDimitry Andric } omp_sync_hint_t; 1190b57cec5SDimitry Andric 1200b57cec5SDimitry Andric /* lock hint type for dynamic user lock */ 1210b57cec5SDimitry Andric typedef omp_sync_hint_t omp_lock_hint_t; 1220b57cec5SDimitry Andric 1230b57cec5SDimitry Andric /* hinted lock initializers */ 1240b57cec5SDimitry Andric extern void __KAI_KMPC_CONVENTION omp_init_lock_with_hint(omp_lock_t *, omp_lock_hint_t); 1250b57cec5SDimitry Andric extern void __KAI_KMPC_CONVENTION omp_init_nest_lock_with_hint(omp_nest_lock_t *, omp_lock_hint_t); 1260b57cec5SDimitry Andric 1270b57cec5SDimitry Andric /* time API functions */ 1280b57cec5SDimitry Andric extern double __KAI_KMPC_CONVENTION omp_get_wtime (void); 1290b57cec5SDimitry Andric extern double __KAI_KMPC_CONVENTION omp_get_wtick (void); 1300b57cec5SDimitry Andric 1310b57cec5SDimitry Andric /* OpenMP 4.0 */ 1320b57cec5SDimitry Andric extern int __KAI_KMPC_CONVENTION omp_get_default_device (void); 1330b57cec5SDimitry Andric extern void __KAI_KMPC_CONVENTION omp_set_default_device (int); 1340b57cec5SDimitry Andric extern int __KAI_KMPC_CONVENTION omp_is_initial_device (void); 1350b57cec5SDimitry Andric extern int __KAI_KMPC_CONVENTION omp_get_num_devices (void); 1360b57cec5SDimitry Andric extern int __KAI_KMPC_CONVENTION omp_get_num_teams (void); 1370b57cec5SDimitry Andric extern int __KAI_KMPC_CONVENTION omp_get_team_num (void); 1380b57cec5SDimitry Andric extern int __KAI_KMPC_CONVENTION omp_get_cancellation (void); 1390b57cec5SDimitry Andric 1400b57cec5SDimitry Andric /* OpenMP 4.5 */ 1410b57cec5SDimitry Andric extern int __KAI_KMPC_CONVENTION omp_get_initial_device (void); 1420b57cec5SDimitry Andric extern void* __KAI_KMPC_CONVENTION omp_target_alloc(size_t, int); 1430b57cec5SDimitry Andric extern void __KAI_KMPC_CONVENTION omp_target_free(void *, int); 144fe6060f1SDimitry Andric extern int __KAI_KMPC_CONVENTION omp_target_is_present(const void *, int); 145fe6060f1SDimitry Andric extern int __KAI_KMPC_CONVENTION omp_target_memcpy(void *, const void *, size_t, size_t, size_t, int, int); 146fe6060f1SDimitry Andric extern int __KAI_KMPC_CONVENTION omp_target_memcpy_rect(void *, const void *, size_t, int, const size_t *, 1470b57cec5SDimitry Andric const size_t *, const size_t *, const size_t *, const size_t *, int, int); 148fe6060f1SDimitry Andric extern int __KAI_KMPC_CONVENTION omp_target_associate_ptr(const void *, const void *, size_t, size_t, int); 149fe6060f1SDimitry Andric extern int __KAI_KMPC_CONVENTION omp_target_disassociate_ptr(const void *, int); 1500b57cec5SDimitry Andric 1510b57cec5SDimitry Andric /* OpenMP 5.0 */ 1520b57cec5SDimitry Andric extern int __KAI_KMPC_CONVENTION omp_get_device_num (void); 1530b57cec5SDimitry Andric typedef void * omp_depend_t; 1540b57cec5SDimitry Andric 155e8d8bef9SDimitry Andric /* OpenMP 5.1 interop */ 156e8d8bef9SDimitry Andric typedef intptr_t omp_intptr_t; 157e8d8bef9SDimitry Andric 158e8d8bef9SDimitry Andric /* 0..omp_get_num_interop_properties()-1 are reserved for implementation-defined properties */ 159e8d8bef9SDimitry Andric typedef enum omp_interop_property { 160e8d8bef9SDimitry Andric omp_ipr_fr_id = -1, 161e8d8bef9SDimitry Andric omp_ipr_fr_name = -2, 162e8d8bef9SDimitry Andric omp_ipr_vendor = -3, 163e8d8bef9SDimitry Andric omp_ipr_vendor_name = -4, 164e8d8bef9SDimitry Andric omp_ipr_device_num = -5, 165e8d8bef9SDimitry Andric omp_ipr_platform = -6, 166e8d8bef9SDimitry Andric omp_ipr_device = -7, 167e8d8bef9SDimitry Andric omp_ipr_device_context = -8, 168e8d8bef9SDimitry Andric omp_ipr_targetsync = -9, 169e8d8bef9SDimitry Andric omp_ipr_first = -9 170e8d8bef9SDimitry Andric } omp_interop_property_t; 171e8d8bef9SDimitry Andric 172e8d8bef9SDimitry Andric #define omp_interop_none 0 173e8d8bef9SDimitry Andric 174e8d8bef9SDimitry Andric typedef enum omp_interop_rc { 175e8d8bef9SDimitry Andric omp_irc_no_value = 1, 176e8d8bef9SDimitry Andric omp_irc_success = 0, 177e8d8bef9SDimitry Andric omp_irc_empty = -1, 178e8d8bef9SDimitry Andric omp_irc_out_of_range = -2, 179e8d8bef9SDimitry Andric omp_irc_type_int = -3, 180e8d8bef9SDimitry Andric omp_irc_type_ptr = -4, 181e8d8bef9SDimitry Andric omp_irc_type_str = -5, 182e8d8bef9SDimitry Andric omp_irc_other = -6 183e8d8bef9SDimitry Andric } omp_interop_rc_t; 184e8d8bef9SDimitry Andric 185fe6060f1SDimitry Andric typedef enum omp_interop_fr { 186fe6060f1SDimitry Andric omp_ifr_cuda = 1, 187fe6060f1SDimitry Andric omp_ifr_cuda_driver = 2, 188fe6060f1SDimitry Andric omp_ifr_opencl = 3, 189fe6060f1SDimitry Andric omp_ifr_sycl = 4, 190fe6060f1SDimitry Andric omp_ifr_hip = 5, 191fe6060f1SDimitry Andric omp_ifr_level_zero = 6, 192fe6060f1SDimitry Andric omp_ifr_last = 7 193fe6060f1SDimitry Andric } omp_interop_fr_t; 194fe6060f1SDimitry Andric 195e8d8bef9SDimitry Andric typedef void * omp_interop_t; 196e8d8bef9SDimitry Andric 197e8d8bef9SDimitry Andric /*! 198e8d8bef9SDimitry Andric * The `omp_get_num_interop_properties` routine retrieves the number of implementation-defined properties available for an `omp_interop_t` object. 199e8d8bef9SDimitry Andric */ 200e8d8bef9SDimitry Andric extern int __KAI_KMPC_CONVENTION omp_get_num_interop_properties(const omp_interop_t); 201e8d8bef9SDimitry Andric /*! 202e8d8bef9SDimitry Andric * The `omp_get_interop_int` routine retrieves an integer property from an `omp_interop_t` object. 203e8d8bef9SDimitry Andric */ 204e8d8bef9SDimitry Andric extern omp_intptr_t __KAI_KMPC_CONVENTION omp_get_interop_int(const omp_interop_t, omp_interop_property_t, int *); 205e8d8bef9SDimitry Andric /*! 206e8d8bef9SDimitry Andric * The `omp_get_interop_ptr` routine retrieves a pointer property from an `omp_interop_t` object. 207e8d8bef9SDimitry Andric */ 208e8d8bef9SDimitry Andric extern void * __KAI_KMPC_CONVENTION omp_get_interop_ptr(const omp_interop_t, omp_interop_property_t, int *); 209e8d8bef9SDimitry Andric /*! 210e8d8bef9SDimitry Andric * The `omp_get_interop_str` routine retrieves a string property from an `omp_interop_t` object. 211e8d8bef9SDimitry Andric */ 212e8d8bef9SDimitry Andric extern const char * __KAI_KMPC_CONVENTION omp_get_interop_str(const omp_interop_t, omp_interop_property_t, int *); 213e8d8bef9SDimitry Andric /*! 214e8d8bef9SDimitry Andric * The `omp_get_interop_name` routine retrieves a property name from an `omp_interop_t` object. 215e8d8bef9SDimitry Andric */ 216e8d8bef9SDimitry Andric extern const char * __KAI_KMPC_CONVENTION omp_get_interop_name(const omp_interop_t, omp_interop_property_t); 217e8d8bef9SDimitry Andric /*! 218e8d8bef9SDimitry Andric * The `omp_get_interop_type_desc` routine retrieves a description of the type of a property associated with an `omp_interop_t` object. 219e8d8bef9SDimitry Andric */ 220e8d8bef9SDimitry Andric extern const char * __KAI_KMPC_CONVENTION omp_get_interop_type_desc(const omp_interop_t, omp_interop_property_t); 221e8d8bef9SDimitry Andric /*! 222e8d8bef9SDimitry Andric * The `omp_get_interop_rc_desc` routine retrieves a description of the return code associated with an `omp_interop_t` object. 223e8d8bef9SDimitry Andric */ 224fe6060f1SDimitry Andric extern const char * __KAI_KMPC_CONVENTION omp_get_interop_rc_desc(const omp_interop_t, omp_interop_rc_t); 225e8d8bef9SDimitry Andric 226e8d8bef9SDimitry Andric /* OpenMP 5.1 device memory routines */ 227e8d8bef9SDimitry Andric 228e8d8bef9SDimitry Andric /*! 229e8d8bef9SDimitry Andric * The `omp_target_memcpy_async` routine asynchronously performs a copy between any combination of host and device pointers. 230e8d8bef9SDimitry Andric */ 231e8d8bef9SDimitry Andric extern int __KAI_KMPC_CONVENTION omp_target_memcpy_async(void *, const void *, size_t, size_t, size_t, int, 232e8d8bef9SDimitry Andric int, int, omp_depend_t *); 233e8d8bef9SDimitry Andric /*! 234e8d8bef9SDimitry Andric * The `omp_target_memcpy_rect_async` routine asynchronously performs a copy between any combination of host and device pointers. 235e8d8bef9SDimitry Andric */ 236e8d8bef9SDimitry Andric extern int __KAI_KMPC_CONVENTION omp_target_memcpy_rect_async(void *, const void *, size_t, int, const size_t *, 237e8d8bef9SDimitry Andric const size_t *, const size_t *, const size_t *, const size_t *, int, int, 238e8d8bef9SDimitry Andric int, omp_depend_t *); 239e8d8bef9SDimitry Andric /*! 240e8d8bef9SDimitry Andric * The `omp_get_mapped_ptr` routine returns the device pointer that is associated with a host pointer for a given device. 241e8d8bef9SDimitry Andric */ 242e8d8bef9SDimitry Andric extern void * __KAI_KMPC_CONVENTION omp_get_mapped_ptr(const void *, int); 243fe6060f1SDimitry Andric extern int __KAI_KMPC_CONVENTION omp_target_is_accessible(const void *, size_t, int); 244e8d8bef9SDimitry Andric 2450b57cec5SDimitry Andric /* kmp API functions */ 2460b57cec5SDimitry Andric extern int __KAI_KMPC_CONVENTION kmp_get_stacksize (void); 2470b57cec5SDimitry Andric extern void __KAI_KMPC_CONVENTION kmp_set_stacksize (int); 2480b57cec5SDimitry Andric extern size_t __KAI_KMPC_CONVENTION kmp_get_stacksize_s (void); 2490b57cec5SDimitry Andric extern void __KAI_KMPC_CONVENTION kmp_set_stacksize_s (size_t); 2500b57cec5SDimitry Andric extern int __KAI_KMPC_CONVENTION kmp_get_blocktime (void); 2510b57cec5SDimitry Andric extern int __KAI_KMPC_CONVENTION kmp_get_library (void); 2520b57cec5SDimitry Andric extern void __KAI_KMPC_CONVENTION kmp_set_blocktime (int); 2530b57cec5SDimitry Andric extern void __KAI_KMPC_CONVENTION kmp_set_library (int); 2540b57cec5SDimitry Andric extern void __KAI_KMPC_CONVENTION kmp_set_library_serial (void); 2550b57cec5SDimitry Andric extern void __KAI_KMPC_CONVENTION kmp_set_library_turnaround (void); 2560b57cec5SDimitry Andric extern void __KAI_KMPC_CONVENTION kmp_set_library_throughput (void); 2570b57cec5SDimitry Andric extern void __KAI_KMPC_CONVENTION kmp_set_defaults (char const *); 2580b57cec5SDimitry Andric extern void __KAI_KMPC_CONVENTION kmp_set_disp_num_buffers (int); 2590b57cec5SDimitry Andric 2600b57cec5SDimitry Andric /* Intel affinity API */ 2610b57cec5SDimitry Andric typedef void * kmp_affinity_mask_t; 2620b57cec5SDimitry Andric 2630b57cec5SDimitry Andric extern int __KAI_KMPC_CONVENTION kmp_set_affinity (kmp_affinity_mask_t *); 2640b57cec5SDimitry Andric extern int __KAI_KMPC_CONVENTION kmp_get_affinity (kmp_affinity_mask_t *); 2650b57cec5SDimitry Andric extern int __KAI_KMPC_CONVENTION kmp_get_affinity_max_proc (void); 2660b57cec5SDimitry Andric extern void __KAI_KMPC_CONVENTION kmp_create_affinity_mask (kmp_affinity_mask_t *); 2670b57cec5SDimitry Andric extern void __KAI_KMPC_CONVENTION kmp_destroy_affinity_mask (kmp_affinity_mask_t *); 2680b57cec5SDimitry Andric extern int __KAI_KMPC_CONVENTION kmp_set_affinity_mask_proc (int, kmp_affinity_mask_t *); 2690b57cec5SDimitry Andric extern int __KAI_KMPC_CONVENTION kmp_unset_affinity_mask_proc (int, kmp_affinity_mask_t *); 2700b57cec5SDimitry Andric extern int __KAI_KMPC_CONVENTION kmp_get_affinity_mask_proc (int, kmp_affinity_mask_t *); 2710b57cec5SDimitry Andric 2720b57cec5SDimitry Andric /* OpenMP 4.0 affinity API */ 2730b57cec5SDimitry Andric typedef enum omp_proc_bind_t { 2740b57cec5SDimitry Andric omp_proc_bind_false = 0, 2750b57cec5SDimitry Andric omp_proc_bind_true = 1, 2760b57cec5SDimitry Andric omp_proc_bind_master = 2, 2770b57cec5SDimitry Andric omp_proc_bind_close = 3, 2780b57cec5SDimitry Andric omp_proc_bind_spread = 4 2790b57cec5SDimitry Andric } omp_proc_bind_t; 2800b57cec5SDimitry Andric 2810b57cec5SDimitry Andric extern omp_proc_bind_t __KAI_KMPC_CONVENTION omp_get_proc_bind (void); 2820b57cec5SDimitry Andric 2830b57cec5SDimitry Andric /* OpenMP 4.5 affinity API */ 2840b57cec5SDimitry Andric extern int __KAI_KMPC_CONVENTION omp_get_num_places (void); 2850b57cec5SDimitry Andric extern int __KAI_KMPC_CONVENTION omp_get_place_num_procs (int); 2860b57cec5SDimitry Andric extern void __KAI_KMPC_CONVENTION omp_get_place_proc_ids (int, int *); 2870b57cec5SDimitry Andric extern int __KAI_KMPC_CONVENTION omp_get_place_num (void); 2880b57cec5SDimitry Andric extern int __KAI_KMPC_CONVENTION omp_get_partition_num_places (void); 2890b57cec5SDimitry Andric extern void __KAI_KMPC_CONVENTION omp_get_partition_place_nums (int *); 2900b57cec5SDimitry Andric 2910b57cec5SDimitry Andric extern void * __KAI_KMPC_CONVENTION kmp_malloc (size_t); 2920b57cec5SDimitry Andric extern void * __KAI_KMPC_CONVENTION kmp_aligned_malloc (size_t, size_t); 2930b57cec5SDimitry Andric extern void * __KAI_KMPC_CONVENTION kmp_calloc (size_t, size_t); 2940b57cec5SDimitry Andric extern void * __KAI_KMPC_CONVENTION kmp_realloc (void *, size_t); 2950b57cec5SDimitry Andric extern void __KAI_KMPC_CONVENTION kmp_free (void *); 2960b57cec5SDimitry Andric 2970b57cec5SDimitry Andric extern void __KAI_KMPC_CONVENTION kmp_set_warnings_on(void); 2980b57cec5SDimitry Andric extern void __KAI_KMPC_CONVENTION kmp_set_warnings_off(void); 2990b57cec5SDimitry Andric 3000b57cec5SDimitry Andric /* OpenMP 5.0 Tool Control */ 3010b57cec5SDimitry Andric typedef enum omp_control_tool_result_t { 3020b57cec5SDimitry Andric omp_control_tool_notool = -2, 3030b57cec5SDimitry Andric omp_control_tool_nocallback = -1, 3040b57cec5SDimitry Andric omp_control_tool_success = 0, 3050b57cec5SDimitry Andric omp_control_tool_ignored = 1 3060b57cec5SDimitry Andric } omp_control_tool_result_t; 3070b57cec5SDimitry Andric 3080b57cec5SDimitry Andric typedef enum omp_control_tool_t { 3090b57cec5SDimitry Andric omp_control_tool_start = 1, 3100b57cec5SDimitry Andric omp_control_tool_pause = 2, 3110b57cec5SDimitry Andric omp_control_tool_flush = 3, 3120b57cec5SDimitry Andric omp_control_tool_end = 4 3130b57cec5SDimitry Andric } omp_control_tool_t; 3140b57cec5SDimitry Andric 3150b57cec5SDimitry Andric extern int __KAI_KMPC_CONVENTION omp_control_tool(int, int, void*); 3160b57cec5SDimitry Andric 3170b57cec5SDimitry Andric /* OpenMP 5.0 Memory Management */ 3180b57cec5SDimitry Andric typedef uintptr_t omp_uintptr_t; 3190b57cec5SDimitry Andric 3200b57cec5SDimitry Andric typedef enum { 321e8d8bef9SDimitry Andric omp_atk_sync_hint = 1, 3225ffd83dbSDimitry Andric omp_atk_alignment = 2, 3235ffd83dbSDimitry Andric omp_atk_access = 3, 3245ffd83dbSDimitry Andric omp_atk_pool_size = 4, 3255ffd83dbSDimitry Andric omp_atk_fallback = 5, 3265ffd83dbSDimitry Andric omp_atk_fb_data = 6, 3275ffd83dbSDimitry Andric omp_atk_pinned = 7, 3285ffd83dbSDimitry Andric omp_atk_partition = 8 3290b57cec5SDimitry Andric } omp_alloctrait_key_t; 3300b57cec5SDimitry Andric 3310b57cec5SDimitry Andric typedef enum { 3325ffd83dbSDimitry Andric omp_atv_false = 0, 3335ffd83dbSDimitry Andric omp_atv_true = 1, 3345ffd83dbSDimitry Andric omp_atv_contended = 3, 3355ffd83dbSDimitry Andric omp_atv_uncontended = 4, 336e8d8bef9SDimitry Andric omp_atv_serialized = 5, 337e8d8bef9SDimitry Andric omp_atv_sequential = omp_atv_serialized, // (deprecated) 3385ffd83dbSDimitry Andric omp_atv_private = 6, 3395ffd83dbSDimitry Andric omp_atv_all = 7, 3405ffd83dbSDimitry Andric omp_atv_thread = 8, 3415ffd83dbSDimitry Andric omp_atv_pteam = 9, 3425ffd83dbSDimitry Andric omp_atv_cgroup = 10, 3435ffd83dbSDimitry Andric omp_atv_default_mem_fb = 11, 3445ffd83dbSDimitry Andric omp_atv_null_fb = 12, 3455ffd83dbSDimitry Andric omp_atv_abort_fb = 13, 3465ffd83dbSDimitry Andric omp_atv_allocator_fb = 14, 3475ffd83dbSDimitry Andric omp_atv_environment = 15, 3485ffd83dbSDimitry Andric omp_atv_nearest = 16, 3495ffd83dbSDimitry Andric omp_atv_blocked = 17, 3505ffd83dbSDimitry Andric omp_atv_interleaved = 18 3510b57cec5SDimitry Andric } omp_alloctrait_value_t; 352e8d8bef9SDimitry Andric #define omp_atv_default ((omp_uintptr_t)-1) 3530b57cec5SDimitry Andric 3540b57cec5SDimitry Andric typedef struct { 3550b57cec5SDimitry Andric omp_alloctrait_key_t key; 3560b57cec5SDimitry Andric omp_uintptr_t value; 3570b57cec5SDimitry Andric } omp_alloctrait_t; 3580b57cec5SDimitry Andric 3590b57cec5SDimitry Andric# if defined(_WIN32) 3600b57cec5SDimitry Andric // On Windows cl and icl do not support 64-bit enum, let's use integer then. 3610b57cec5SDimitry Andric typedef omp_uintptr_t omp_allocator_handle_t; 3620b57cec5SDimitry Andric extern __KMP_IMP omp_allocator_handle_t const omp_null_allocator; 3630b57cec5SDimitry Andric extern __KMP_IMP omp_allocator_handle_t const omp_default_mem_alloc; 3640b57cec5SDimitry Andric extern __KMP_IMP omp_allocator_handle_t const omp_large_cap_mem_alloc; 3650b57cec5SDimitry Andric extern __KMP_IMP omp_allocator_handle_t const omp_const_mem_alloc; 3660b57cec5SDimitry Andric extern __KMP_IMP omp_allocator_handle_t const omp_high_bw_mem_alloc; 3670b57cec5SDimitry Andric extern __KMP_IMP omp_allocator_handle_t const omp_low_lat_mem_alloc; 3680b57cec5SDimitry Andric extern __KMP_IMP omp_allocator_handle_t const omp_cgroup_mem_alloc; 3690b57cec5SDimitry Andric extern __KMP_IMP omp_allocator_handle_t const omp_pteam_mem_alloc; 3700b57cec5SDimitry Andric extern __KMP_IMP omp_allocator_handle_t const omp_thread_mem_alloc; 371fe6060f1SDimitry Andric /* Preview of target memory support */ 372fe6060f1SDimitry Andric extern __KMP_IMP omp_allocator_handle_t const llvm_omp_target_host_mem_alloc; 373fe6060f1SDimitry Andric extern __KMP_IMP omp_allocator_handle_t const llvm_omp_target_shared_mem_alloc; 374fe6060f1SDimitry Andric extern __KMP_IMP omp_allocator_handle_t const llvm_omp_target_device_mem_alloc; 375fe6060f1SDimitry Andric 3760b57cec5SDimitry Andric typedef omp_uintptr_t omp_memspace_handle_t; 3770b57cec5SDimitry Andric extern __KMP_IMP omp_memspace_handle_t const omp_default_mem_space; 3780b57cec5SDimitry Andric extern __KMP_IMP omp_memspace_handle_t const omp_large_cap_mem_space; 3790b57cec5SDimitry Andric extern __KMP_IMP omp_memspace_handle_t const omp_const_mem_space; 3800b57cec5SDimitry Andric extern __KMP_IMP omp_memspace_handle_t const omp_high_bw_mem_space; 3810b57cec5SDimitry Andric extern __KMP_IMP omp_memspace_handle_t const omp_low_lat_mem_space; 382fe6060f1SDimitry Andric /* Preview of target memory support */ 383fe6060f1SDimitry Andric extern __KMP_IMP omp_memspace_handle_t const llvm_omp_target_host_mem_space; 384fe6060f1SDimitry Andric extern __KMP_IMP omp_memspace_handle_t const llvm_omp_target_shared_mem_space; 385fe6060f1SDimitry Andric extern __KMP_IMP omp_memspace_handle_t const llvm_omp_target_device_mem_space; 3860b57cec5SDimitry Andric# else 3870b57cec5SDimitry Andric# if __cplusplus >= 201103 3880b57cec5SDimitry Andric typedef enum omp_allocator_handle_t : omp_uintptr_t 3890b57cec5SDimitry Andric# else 3900b57cec5SDimitry Andric typedef enum omp_allocator_handle_t 3910b57cec5SDimitry Andric# endif 3920b57cec5SDimitry Andric { 3930b57cec5SDimitry Andric omp_null_allocator = 0, 3940b57cec5SDimitry Andric omp_default_mem_alloc = 1, 3950b57cec5SDimitry Andric omp_large_cap_mem_alloc = 2, 3960b57cec5SDimitry Andric omp_const_mem_alloc = 3, 3970b57cec5SDimitry Andric omp_high_bw_mem_alloc = 4, 3980b57cec5SDimitry Andric omp_low_lat_mem_alloc = 5, 3990b57cec5SDimitry Andric omp_cgroup_mem_alloc = 6, 4000b57cec5SDimitry Andric omp_pteam_mem_alloc = 7, 4010b57cec5SDimitry Andric omp_thread_mem_alloc = 8, 402fe6060f1SDimitry Andric /* Preview of target memory support */ 403fe6060f1SDimitry Andric llvm_omp_target_host_mem_alloc = 100, 404fe6060f1SDimitry Andric llvm_omp_target_shared_mem_alloc = 101, 405fe6060f1SDimitry Andric llvm_omp_target_device_mem_alloc = 102, 4060b57cec5SDimitry Andric KMP_ALLOCATOR_MAX_HANDLE = UINTPTR_MAX 4070b57cec5SDimitry Andric } omp_allocator_handle_t; 4080b57cec5SDimitry Andric# if __cplusplus >= 201103 4090b57cec5SDimitry Andric typedef enum omp_memspace_handle_t : omp_uintptr_t 4100b57cec5SDimitry Andric# else 4110b57cec5SDimitry Andric typedef enum omp_memspace_handle_t 4120b57cec5SDimitry Andric# endif 4130b57cec5SDimitry Andric { 4140b57cec5SDimitry Andric omp_default_mem_space = 0, 4150b57cec5SDimitry Andric omp_large_cap_mem_space = 1, 4160b57cec5SDimitry Andric omp_const_mem_space = 2, 4170b57cec5SDimitry Andric omp_high_bw_mem_space = 3, 4180b57cec5SDimitry Andric omp_low_lat_mem_space = 4, 419fe6060f1SDimitry Andric /* Preview of target memory support */ 420fe6060f1SDimitry Andric llvm_omp_target_host_mem_space = 100, 421fe6060f1SDimitry Andric llvm_omp_target_shared_mem_space = 101, 422fe6060f1SDimitry Andric llvm_omp_target_device_mem_space = 102, 4230b57cec5SDimitry Andric KMP_MEMSPACE_MAX_HANDLE = UINTPTR_MAX 4240b57cec5SDimitry Andric } omp_memspace_handle_t; 4250b57cec5SDimitry Andric# endif 4260b57cec5SDimitry Andric extern omp_allocator_handle_t __KAI_KMPC_CONVENTION omp_init_allocator(omp_memspace_handle_t m, 4270b57cec5SDimitry Andric int ntraits, omp_alloctrait_t traits[]); 4280b57cec5SDimitry Andric extern void __KAI_KMPC_CONVENTION omp_destroy_allocator(omp_allocator_handle_t allocator); 4290b57cec5SDimitry Andric 4300b57cec5SDimitry Andric extern void __KAI_KMPC_CONVENTION omp_set_default_allocator(omp_allocator_handle_t a); 4310b57cec5SDimitry Andric extern omp_allocator_handle_t __KAI_KMPC_CONVENTION omp_get_default_allocator(void); 4320b57cec5SDimitry Andric# ifdef __cplusplus 4330b57cec5SDimitry Andric extern void *__KAI_KMPC_CONVENTION omp_alloc(size_t size, omp_allocator_handle_t a = omp_null_allocator); 434*349cc55cSDimitry Andric extern void *__KAI_KMPC_CONVENTION omp_aligned_alloc(size_t align, size_t size, 435*349cc55cSDimitry Andric omp_allocator_handle_t a = omp_null_allocator); 436*349cc55cSDimitry Andric extern void *__KAI_KMPC_CONVENTION omp_calloc(size_t nmemb, size_t size, 437*349cc55cSDimitry Andric omp_allocator_handle_t a = omp_null_allocator); 438*349cc55cSDimitry Andric extern void *__KAI_KMPC_CONVENTION omp_aligned_calloc(size_t align, size_t nmemb, size_t size, 439*349cc55cSDimitry Andric omp_allocator_handle_t a = omp_null_allocator); 440e8d8bef9SDimitry Andric extern void *__KAI_KMPC_CONVENTION omp_realloc(void *ptr, size_t size, 441e8d8bef9SDimitry Andric omp_allocator_handle_t allocator = omp_null_allocator, 442e8d8bef9SDimitry Andric omp_allocator_handle_t free_allocator = omp_null_allocator); 4430b57cec5SDimitry Andric extern void __KAI_KMPC_CONVENTION omp_free(void * ptr, omp_allocator_handle_t a = omp_null_allocator); 4440b57cec5SDimitry Andric# else 4450b57cec5SDimitry Andric extern void *__KAI_KMPC_CONVENTION omp_alloc(size_t size, omp_allocator_handle_t a); 446*349cc55cSDimitry Andric extern void *__KAI_KMPC_CONVENTION omp_aligned_alloc(size_t align, size_t size, 447*349cc55cSDimitry Andric omp_allocator_handle_t a); 448e8d8bef9SDimitry Andric extern void *__KAI_KMPC_CONVENTION omp_calloc(size_t nmemb, size_t size, omp_allocator_handle_t a); 449*349cc55cSDimitry Andric extern void *__KAI_KMPC_CONVENTION omp_aligned_calloc(size_t align, size_t nmemb, size_t size, 450*349cc55cSDimitry Andric omp_allocator_handle_t a); 451e8d8bef9SDimitry Andric extern void *__KAI_KMPC_CONVENTION omp_realloc(void *ptr, size_t size, omp_allocator_handle_t allocator, 452e8d8bef9SDimitry Andric omp_allocator_handle_t free_allocator); 4530b57cec5SDimitry Andric extern void __KAI_KMPC_CONVENTION omp_free(void *ptr, omp_allocator_handle_t a); 4540b57cec5SDimitry Andric# endif 4550b57cec5SDimitry Andric 4560b57cec5SDimitry Andric /* OpenMP 5.0 Affinity Format */ 4570b57cec5SDimitry Andric extern void __KAI_KMPC_CONVENTION omp_set_affinity_format(char const *); 4580b57cec5SDimitry Andric extern size_t __KAI_KMPC_CONVENTION omp_get_affinity_format(char *, size_t); 4590b57cec5SDimitry Andric extern void __KAI_KMPC_CONVENTION omp_display_affinity(char const *); 4600b57cec5SDimitry Andric extern size_t __KAI_KMPC_CONVENTION omp_capture_affinity(char *, size_t, char const *); 4610b57cec5SDimitry Andric 4620b57cec5SDimitry Andric /* OpenMP 5.0 events */ 4630b57cec5SDimitry Andric# if defined(_WIN32) 4640b57cec5SDimitry Andric // On Windows cl and icl do not support 64-bit enum, let's use integer then. 4650b57cec5SDimitry Andric typedef omp_uintptr_t omp_event_handle_t; 4660b57cec5SDimitry Andric# else 4670b57cec5SDimitry Andric typedef enum omp_event_handle_t { KMP_EVENT_MAX_HANDLE = UINTPTR_MAX } omp_event_handle_t; 4680b57cec5SDimitry Andric# endif 4690b57cec5SDimitry Andric extern void __KAI_KMPC_CONVENTION omp_fulfill_event ( omp_event_handle_t event ); 4700b57cec5SDimitry Andric 4710b57cec5SDimitry Andric /* OpenMP 5.0 Pause Resources */ 4720b57cec5SDimitry Andric typedef enum omp_pause_resource_t { 4730b57cec5SDimitry Andric omp_pause_resume = 0, 4740b57cec5SDimitry Andric omp_pause_soft = 1, 4750b57cec5SDimitry Andric omp_pause_hard = 2 4760b57cec5SDimitry Andric } omp_pause_resource_t; 4770b57cec5SDimitry Andric extern int __KAI_KMPC_CONVENTION omp_pause_resource(omp_pause_resource_t, int); 4780b57cec5SDimitry Andric extern int __KAI_KMPC_CONVENTION omp_pause_resource_all(omp_pause_resource_t); 4790b57cec5SDimitry Andric 4800b57cec5SDimitry Andric extern int __KAI_KMPC_CONVENTION omp_get_supported_active_levels(void); 4810b57cec5SDimitry Andric 482fe6060f1SDimitry Andric /* OpenMP 5.1 */ 483fe6060f1SDimitry Andric extern void __KAI_KMPC_CONVENTION omp_set_num_teams(int num_teams); 484fe6060f1SDimitry Andric extern int __KAI_KMPC_CONVENTION omp_get_max_teams(void); 485fe6060f1SDimitry Andric extern void __KAI_KMPC_CONVENTION omp_set_teams_thread_limit(int limit); 486fe6060f1SDimitry Andric extern int __KAI_KMPC_CONVENTION omp_get_teams_thread_limit(void); 487fe6060f1SDimitry Andric 4885ffd83dbSDimitry Andric /* OpenMP 5.1 Display Environment */ 4895ffd83dbSDimitry Andric extern void omp_display_env(int verbose); 4905ffd83dbSDimitry Andric 491fe6060f1SDimitry Andric# if defined(_OPENMP) && _OPENMP >= 201811 492fe6060f1SDimitry Andric #pragma omp begin declare variant match(device={kind(host)}) 493fe6060f1SDimitry Andric static inline int omp_is_initial_device(void) { return 1; } 494fe6060f1SDimitry Andric #pragma omp end declare variant 495fe6060f1SDimitry Andric #pragma omp begin declare variant match(device={kind(nohost)}) 496fe6060f1SDimitry Andric static inline int omp_is_initial_device(void) { return 0; } 497fe6060f1SDimitry Andric #pragma omp end declare variant 498fe6060f1SDimitry Andric# endif 499fe6060f1SDimitry Andric 5000b57cec5SDimitry Andric# undef __KAI_KMPC_CONVENTION 5010b57cec5SDimitry Andric# undef __KMP_IMP 5020b57cec5SDimitry Andric 5030b57cec5SDimitry Andric /* Warning: 5040b57cec5SDimitry Andric The following typedefs are not standard, deprecated and will be removed in a future release. 5050b57cec5SDimitry Andric */ 5060b57cec5SDimitry Andric typedef int omp_int_t; 5070b57cec5SDimitry Andric typedef double omp_wtime_t; 5080b57cec5SDimitry Andric 5090b57cec5SDimitry Andric# ifdef __cplusplus 5100b57cec5SDimitry Andric } 5110b57cec5SDimitry Andric# endif 5120b57cec5SDimitry Andric 5130b57cec5SDimitry Andric#endif /* __OMP_H */ 514