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 185f757f3fSDimitry Andric# include <stddef.h> 190b57cec5SDimitry Andric# include <stdlib.h> 200b57cec5SDimitry Andric# include <stdint.h> 210b57cec5SDimitry Andric 220b57cec5SDimitry Andric# define KMP_VERSION_MAJOR @LIBOMP_VERSION_MAJOR@ 230b57cec5SDimitry Andric# define KMP_VERSION_MINOR @LIBOMP_VERSION_MINOR@ 240b57cec5SDimitry Andric# define KMP_VERSION_BUILD @LIBOMP_VERSION_BUILD@ 250b57cec5SDimitry Andric# define KMP_BUILD_DATE "@LIBOMP_BUILD_DATE@" 260b57cec5SDimitry Andric 270b57cec5SDimitry Andric# ifdef __cplusplus 280b57cec5SDimitry Andric extern "C" { 290b57cec5SDimitry Andric# endif 300b57cec5SDimitry Andric 310b57cec5SDimitry Andric# define omp_set_affinity_format ompc_set_affinity_format 320b57cec5SDimitry Andric# define omp_get_affinity_format ompc_get_affinity_format 330b57cec5SDimitry Andric# define omp_display_affinity ompc_display_affinity 340b57cec5SDimitry Andric# define omp_capture_affinity ompc_capture_affinity 350b57cec5SDimitry Andric 360b57cec5SDimitry Andric# if defined(_WIN32) 370b57cec5SDimitry Andric# define __KAI_KMPC_CONVENTION __cdecl 380b57cec5SDimitry Andric# ifndef __KMP_IMP 390b57cec5SDimitry Andric# define __KMP_IMP __declspec(dllimport) 400b57cec5SDimitry Andric# endif 410b57cec5SDimitry Andric# else 420b57cec5SDimitry Andric# define __KAI_KMPC_CONVENTION 430b57cec5SDimitry Andric# ifndef __KMP_IMP 440b57cec5SDimitry Andric# define __KMP_IMP 450b57cec5SDimitry Andric# endif 460b57cec5SDimitry Andric# endif 470b57cec5SDimitry Andric 480b57cec5SDimitry Andric /* schedule kind constants */ 490b57cec5SDimitry Andric typedef enum omp_sched_t { 500b57cec5SDimitry Andric omp_sched_static = 1, 510b57cec5SDimitry Andric omp_sched_dynamic = 2, 520b57cec5SDimitry Andric omp_sched_guided = 3, 530b57cec5SDimitry Andric omp_sched_auto = 4, 540b57cec5SDimitry Andric omp_sched_monotonic = 0x80000000 550b57cec5SDimitry Andric } omp_sched_t; 560b57cec5SDimitry Andric 570b57cec5SDimitry Andric /* set API functions */ 580b57cec5SDimitry Andric extern void __KAI_KMPC_CONVENTION omp_set_num_threads (int); 590b57cec5SDimitry Andric extern void __KAI_KMPC_CONVENTION omp_set_dynamic (int); 600b57cec5SDimitry Andric extern void __KAI_KMPC_CONVENTION omp_set_nested (int); 610b57cec5SDimitry Andric extern void __KAI_KMPC_CONVENTION omp_set_max_active_levels (int); 620b57cec5SDimitry Andric extern void __KAI_KMPC_CONVENTION omp_set_schedule (omp_sched_t, int); 630b57cec5SDimitry Andric 640b57cec5SDimitry Andric /* query API functions */ 650b57cec5SDimitry Andric extern int __KAI_KMPC_CONVENTION omp_get_num_threads (void); 660b57cec5SDimitry Andric extern int __KAI_KMPC_CONVENTION omp_get_dynamic (void); 670b57cec5SDimitry Andric extern int __KAI_KMPC_CONVENTION omp_get_nested (void); 680b57cec5SDimitry Andric extern int __KAI_KMPC_CONVENTION omp_get_max_threads (void); 690b57cec5SDimitry Andric extern int __KAI_KMPC_CONVENTION omp_get_thread_num (void); 700b57cec5SDimitry Andric extern int __KAI_KMPC_CONVENTION omp_get_num_procs (void); 710b57cec5SDimitry Andric extern int __KAI_KMPC_CONVENTION omp_in_parallel (void); 720b57cec5SDimitry Andric extern int __KAI_KMPC_CONVENTION omp_in_final (void); 730b57cec5SDimitry Andric extern int __KAI_KMPC_CONVENTION omp_get_active_level (void); 740b57cec5SDimitry Andric extern int __KAI_KMPC_CONVENTION omp_get_level (void); 750b57cec5SDimitry Andric extern int __KAI_KMPC_CONVENTION omp_get_ancestor_thread_num (int); 760b57cec5SDimitry Andric extern int __KAI_KMPC_CONVENTION omp_get_team_size (int); 770b57cec5SDimitry Andric extern int __KAI_KMPC_CONVENTION omp_get_thread_limit (void); 780b57cec5SDimitry Andric extern int __KAI_KMPC_CONVENTION omp_get_max_active_levels (void); 790b57cec5SDimitry Andric extern void __KAI_KMPC_CONVENTION omp_get_schedule (omp_sched_t *, int *); 800b57cec5SDimitry Andric extern int __KAI_KMPC_CONVENTION omp_get_max_task_priority (void); 810b57cec5SDimitry Andric 820b57cec5SDimitry Andric /* lock API functions */ 830b57cec5SDimitry Andric typedef struct omp_lock_t { 840b57cec5SDimitry Andric void * _lk; 850b57cec5SDimitry Andric } omp_lock_t; 860b57cec5SDimitry Andric 870b57cec5SDimitry Andric extern void __KAI_KMPC_CONVENTION omp_init_lock (omp_lock_t *); 880b57cec5SDimitry Andric extern void __KAI_KMPC_CONVENTION omp_set_lock (omp_lock_t *); 890b57cec5SDimitry Andric extern void __KAI_KMPC_CONVENTION omp_unset_lock (omp_lock_t *); 900b57cec5SDimitry Andric extern void __KAI_KMPC_CONVENTION omp_destroy_lock (omp_lock_t *); 910b57cec5SDimitry Andric extern int __KAI_KMPC_CONVENTION omp_test_lock (omp_lock_t *); 920b57cec5SDimitry Andric 930b57cec5SDimitry Andric /* nested lock API functions */ 940b57cec5SDimitry Andric typedef struct omp_nest_lock_t { 950b57cec5SDimitry Andric void * _lk; 960b57cec5SDimitry Andric } omp_nest_lock_t; 970b57cec5SDimitry Andric 980b57cec5SDimitry Andric extern void __KAI_KMPC_CONVENTION omp_init_nest_lock (omp_nest_lock_t *); 990b57cec5SDimitry Andric extern void __KAI_KMPC_CONVENTION omp_set_nest_lock (omp_nest_lock_t *); 1000b57cec5SDimitry Andric extern void __KAI_KMPC_CONVENTION omp_unset_nest_lock (omp_nest_lock_t *); 1010b57cec5SDimitry Andric extern void __KAI_KMPC_CONVENTION omp_destroy_nest_lock (omp_nest_lock_t *); 1020b57cec5SDimitry Andric extern int __KAI_KMPC_CONVENTION omp_test_nest_lock (omp_nest_lock_t *); 1030b57cec5SDimitry Andric 1040b57cec5SDimitry Andric /* OpenMP 5.0 Synchronization hints*/ 1050b57cec5SDimitry Andric typedef enum omp_sync_hint_t { 1060b57cec5SDimitry Andric omp_sync_hint_none = 0, 1070b57cec5SDimitry Andric omp_lock_hint_none = omp_sync_hint_none, 1080b57cec5SDimitry Andric omp_sync_hint_uncontended = 1, 1090b57cec5SDimitry Andric omp_lock_hint_uncontended = omp_sync_hint_uncontended, 1100b57cec5SDimitry Andric omp_sync_hint_contended = (1<<1), 1110b57cec5SDimitry Andric omp_lock_hint_contended = omp_sync_hint_contended, 1120b57cec5SDimitry Andric omp_sync_hint_nonspeculative = (1<<2), 1130b57cec5SDimitry Andric omp_lock_hint_nonspeculative = omp_sync_hint_nonspeculative, 1140b57cec5SDimitry Andric omp_sync_hint_speculative = (1<<3), 1150b57cec5SDimitry Andric omp_lock_hint_speculative = omp_sync_hint_speculative, 1160b57cec5SDimitry Andric kmp_lock_hint_hle = (1<<16), 1170b57cec5SDimitry Andric kmp_lock_hint_rtm = (1<<17), 1180b57cec5SDimitry Andric kmp_lock_hint_adaptive = (1<<18) 1190b57cec5SDimitry Andric } omp_sync_hint_t; 1200b57cec5SDimitry Andric 1210b57cec5SDimitry Andric /* lock hint type for dynamic user lock */ 1220b57cec5SDimitry Andric typedef omp_sync_hint_t omp_lock_hint_t; 1230b57cec5SDimitry Andric 1240b57cec5SDimitry Andric /* hinted lock initializers */ 1250b57cec5SDimitry Andric extern void __KAI_KMPC_CONVENTION omp_init_lock_with_hint(omp_lock_t *, omp_lock_hint_t); 1260b57cec5SDimitry Andric extern void __KAI_KMPC_CONVENTION omp_init_nest_lock_with_hint(omp_nest_lock_t *, omp_lock_hint_t); 1270b57cec5SDimitry Andric 1280b57cec5SDimitry Andric /* time API functions */ 1290b57cec5SDimitry Andric extern double __KAI_KMPC_CONVENTION omp_get_wtime (void); 1300b57cec5SDimitry Andric extern double __KAI_KMPC_CONVENTION omp_get_wtick (void); 1310b57cec5SDimitry Andric 1320b57cec5SDimitry Andric /* OpenMP 4.0 */ 1330b57cec5SDimitry Andric extern int __KAI_KMPC_CONVENTION omp_get_default_device (void); 1340b57cec5SDimitry Andric extern void __KAI_KMPC_CONVENTION omp_set_default_device (int); 1350b57cec5SDimitry Andric extern int __KAI_KMPC_CONVENTION omp_is_initial_device (void); 1360b57cec5SDimitry Andric extern int __KAI_KMPC_CONVENTION omp_get_num_devices (void); 1370b57cec5SDimitry Andric extern int __KAI_KMPC_CONVENTION omp_get_num_teams (void); 1380b57cec5SDimitry Andric extern int __KAI_KMPC_CONVENTION omp_get_team_num (void); 1390b57cec5SDimitry Andric extern int __KAI_KMPC_CONVENTION omp_get_cancellation (void); 1400b57cec5SDimitry Andric 1410b57cec5SDimitry Andric /* OpenMP 4.5 */ 1420b57cec5SDimitry Andric extern int __KAI_KMPC_CONVENTION omp_get_initial_device (void); 1430b57cec5SDimitry Andric extern void* __KAI_KMPC_CONVENTION omp_target_alloc(size_t, int); 1440b57cec5SDimitry Andric extern void __KAI_KMPC_CONVENTION omp_target_free(void *, int); 145fe6060f1SDimitry Andric extern int __KAI_KMPC_CONVENTION omp_target_is_present(const void *, int); 146fe6060f1SDimitry Andric extern int __KAI_KMPC_CONVENTION omp_target_memcpy(void *, const void *, size_t, size_t, size_t, int, int); 147fe6060f1SDimitry Andric extern int __KAI_KMPC_CONVENTION omp_target_memcpy_rect(void *, const void *, size_t, int, const size_t *, 1480b57cec5SDimitry Andric const size_t *, const size_t *, const size_t *, const size_t *, int, int); 149fe6060f1SDimitry Andric extern int __KAI_KMPC_CONVENTION omp_target_associate_ptr(const void *, const void *, size_t, size_t, int); 150fe6060f1SDimitry Andric extern int __KAI_KMPC_CONVENTION omp_target_disassociate_ptr(const void *, int); 1510b57cec5SDimitry Andric 1520b57cec5SDimitry Andric /* OpenMP 5.0 */ 1530b57cec5SDimitry Andric extern int __KAI_KMPC_CONVENTION omp_get_device_num (void); 1540b57cec5SDimitry Andric typedef void * omp_depend_t; 1550b57cec5SDimitry Andric 156e8d8bef9SDimitry Andric /* OpenMP 5.1 interop */ 157e8d8bef9SDimitry Andric typedef intptr_t omp_intptr_t; 158e8d8bef9SDimitry Andric 159*0fca6ea1SDimitry Andric extern void __KAI_KMPC_CONVENTION ompx_dump_mapping_tables(void); 160*0fca6ea1SDimitry Andric 161e8d8bef9SDimitry Andric /* 0..omp_get_num_interop_properties()-1 are reserved for implementation-defined properties */ 162e8d8bef9SDimitry Andric typedef enum omp_interop_property { 163e8d8bef9SDimitry Andric omp_ipr_fr_id = -1, 164e8d8bef9SDimitry Andric omp_ipr_fr_name = -2, 165e8d8bef9SDimitry Andric omp_ipr_vendor = -3, 166e8d8bef9SDimitry Andric omp_ipr_vendor_name = -4, 167e8d8bef9SDimitry Andric omp_ipr_device_num = -5, 168e8d8bef9SDimitry Andric omp_ipr_platform = -6, 169e8d8bef9SDimitry Andric omp_ipr_device = -7, 170e8d8bef9SDimitry Andric omp_ipr_device_context = -8, 171e8d8bef9SDimitry Andric omp_ipr_targetsync = -9, 172e8d8bef9SDimitry Andric omp_ipr_first = -9 173e8d8bef9SDimitry Andric } omp_interop_property_t; 174e8d8bef9SDimitry Andric 175e8d8bef9SDimitry Andric #define omp_interop_none 0 176e8d8bef9SDimitry Andric 177e8d8bef9SDimitry Andric typedef enum omp_interop_rc { 178e8d8bef9SDimitry Andric omp_irc_no_value = 1, 179e8d8bef9SDimitry Andric omp_irc_success = 0, 180e8d8bef9SDimitry Andric omp_irc_empty = -1, 181e8d8bef9SDimitry Andric omp_irc_out_of_range = -2, 182e8d8bef9SDimitry Andric omp_irc_type_int = -3, 183e8d8bef9SDimitry Andric omp_irc_type_ptr = -4, 184e8d8bef9SDimitry Andric omp_irc_type_str = -5, 185e8d8bef9SDimitry Andric omp_irc_other = -6 186e8d8bef9SDimitry Andric } omp_interop_rc_t; 187e8d8bef9SDimitry Andric 188fe6060f1SDimitry Andric typedef enum omp_interop_fr { 189fe6060f1SDimitry Andric omp_ifr_cuda = 1, 190fe6060f1SDimitry Andric omp_ifr_cuda_driver = 2, 191fe6060f1SDimitry Andric omp_ifr_opencl = 3, 192fe6060f1SDimitry Andric omp_ifr_sycl = 4, 193fe6060f1SDimitry Andric omp_ifr_hip = 5, 194fe6060f1SDimitry Andric omp_ifr_level_zero = 6, 195fe6060f1SDimitry Andric omp_ifr_last = 7 196fe6060f1SDimitry Andric } omp_interop_fr_t; 197fe6060f1SDimitry Andric 198e8d8bef9SDimitry Andric typedef void * omp_interop_t; 199e8d8bef9SDimitry Andric 200e8d8bef9SDimitry Andric /*! 201e8d8bef9SDimitry Andric * The `omp_get_num_interop_properties` routine retrieves the number of implementation-defined properties available for an `omp_interop_t` object. 202e8d8bef9SDimitry Andric */ 203e8d8bef9SDimitry Andric extern int __KAI_KMPC_CONVENTION omp_get_num_interop_properties(const omp_interop_t); 204e8d8bef9SDimitry Andric /*! 205e8d8bef9SDimitry Andric * The `omp_get_interop_int` routine retrieves an integer property from an `omp_interop_t` object. 206e8d8bef9SDimitry Andric */ 207e8d8bef9SDimitry Andric extern omp_intptr_t __KAI_KMPC_CONVENTION omp_get_interop_int(const omp_interop_t, omp_interop_property_t, int *); 208e8d8bef9SDimitry Andric /*! 209e8d8bef9SDimitry Andric * The `omp_get_interop_ptr` routine retrieves a pointer property from an `omp_interop_t` object. 210e8d8bef9SDimitry Andric */ 211e8d8bef9SDimitry Andric extern void * __KAI_KMPC_CONVENTION omp_get_interop_ptr(const omp_interop_t, omp_interop_property_t, int *); 212e8d8bef9SDimitry Andric /*! 213e8d8bef9SDimitry Andric * The `omp_get_interop_str` routine retrieves a string property from an `omp_interop_t` object. 214e8d8bef9SDimitry Andric */ 215e8d8bef9SDimitry Andric extern const char * __KAI_KMPC_CONVENTION omp_get_interop_str(const omp_interop_t, omp_interop_property_t, int *); 216e8d8bef9SDimitry Andric /*! 217e8d8bef9SDimitry Andric * The `omp_get_interop_name` routine retrieves a property name from an `omp_interop_t` object. 218e8d8bef9SDimitry Andric */ 219e8d8bef9SDimitry Andric extern const char * __KAI_KMPC_CONVENTION omp_get_interop_name(const omp_interop_t, omp_interop_property_t); 220e8d8bef9SDimitry Andric /*! 221e8d8bef9SDimitry Andric * The `omp_get_interop_type_desc` routine retrieves a description of the type of a property associated with an `omp_interop_t` object. 222e8d8bef9SDimitry Andric */ 223e8d8bef9SDimitry Andric extern const char * __KAI_KMPC_CONVENTION omp_get_interop_type_desc(const omp_interop_t, omp_interop_property_t); 224e8d8bef9SDimitry Andric /*! 225e8d8bef9SDimitry Andric * The `omp_get_interop_rc_desc` routine retrieves a description of the return code associated with an `omp_interop_t` object. 226e8d8bef9SDimitry Andric */ 227fe6060f1SDimitry Andric extern const char * __KAI_KMPC_CONVENTION omp_get_interop_rc_desc(const omp_interop_t, omp_interop_rc_t); 228e8d8bef9SDimitry Andric 229e8d8bef9SDimitry Andric /* OpenMP 5.1 device memory routines */ 230e8d8bef9SDimitry Andric 231e8d8bef9SDimitry Andric /*! 232e8d8bef9SDimitry Andric * The `omp_target_memcpy_async` routine asynchronously performs a copy between any combination of host and device pointers. 233e8d8bef9SDimitry Andric */ 234e8d8bef9SDimitry Andric extern int __KAI_KMPC_CONVENTION omp_target_memcpy_async(void *, const void *, size_t, size_t, size_t, int, 235e8d8bef9SDimitry Andric int, int, omp_depend_t *); 236e8d8bef9SDimitry Andric /*! 237e8d8bef9SDimitry Andric * The `omp_target_memcpy_rect_async` routine asynchronously performs a copy between any combination of host and device pointers. 238e8d8bef9SDimitry Andric */ 239e8d8bef9SDimitry Andric extern int __KAI_KMPC_CONVENTION omp_target_memcpy_rect_async(void *, const void *, size_t, int, const size_t *, 240e8d8bef9SDimitry Andric const size_t *, const size_t *, const size_t *, const size_t *, int, int, 241e8d8bef9SDimitry 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 247e8d8bef9SDimitry Andric /*! 248e8d8bef9SDimitry Andric * The `omp_get_mapped_ptr` routine returns the device pointer that is associated with a host pointer for a given device. 249e8d8bef9SDimitry Andric */ 250e8d8bef9SDimitry Andric extern void * __KAI_KMPC_CONVENTION omp_get_mapped_ptr(const void *, int); 251fe6060f1SDimitry Andric extern int __KAI_KMPC_CONVENTION omp_target_is_accessible(const void *, size_t, int); 252e8d8bef9SDimitry Andric 2530b57cec5SDimitry Andric /* kmp API functions */ 2540b57cec5SDimitry Andric extern int __KAI_KMPC_CONVENTION kmp_get_stacksize (void); 2550b57cec5SDimitry Andric extern void __KAI_KMPC_CONVENTION kmp_set_stacksize (int); 2560b57cec5SDimitry Andric extern size_t __KAI_KMPC_CONVENTION kmp_get_stacksize_s (void); 2570b57cec5SDimitry Andric extern void __KAI_KMPC_CONVENTION kmp_set_stacksize_s (size_t); 2580b57cec5SDimitry Andric extern int __KAI_KMPC_CONVENTION kmp_get_blocktime (void); 2590b57cec5SDimitry Andric extern int __KAI_KMPC_CONVENTION kmp_get_library (void); 2600b57cec5SDimitry Andric extern void __KAI_KMPC_CONVENTION kmp_set_blocktime (int); 2610b57cec5SDimitry Andric extern void __KAI_KMPC_CONVENTION kmp_set_library (int); 2620b57cec5SDimitry Andric extern void __KAI_KMPC_CONVENTION kmp_set_library_serial (void); 2630b57cec5SDimitry Andric extern void __KAI_KMPC_CONVENTION kmp_set_library_turnaround (void); 2640b57cec5SDimitry Andric extern void __KAI_KMPC_CONVENTION kmp_set_library_throughput (void); 2650b57cec5SDimitry Andric extern void __KAI_KMPC_CONVENTION kmp_set_defaults (char const *); 2660b57cec5SDimitry Andric extern void __KAI_KMPC_CONVENTION kmp_set_disp_num_buffers (int); 2670b57cec5SDimitry Andric 2680b57cec5SDimitry Andric /* Intel affinity API */ 2690b57cec5SDimitry Andric typedef void * kmp_affinity_mask_t; 2700b57cec5SDimitry Andric 2710b57cec5SDimitry Andric extern int __KAI_KMPC_CONVENTION kmp_set_affinity (kmp_affinity_mask_t *); 2720b57cec5SDimitry Andric extern int __KAI_KMPC_CONVENTION kmp_get_affinity (kmp_affinity_mask_t *); 2730b57cec5SDimitry Andric extern int __KAI_KMPC_CONVENTION kmp_get_affinity_max_proc (void); 2740b57cec5SDimitry Andric extern void __KAI_KMPC_CONVENTION kmp_create_affinity_mask (kmp_affinity_mask_t *); 2750b57cec5SDimitry Andric extern void __KAI_KMPC_CONVENTION kmp_destroy_affinity_mask (kmp_affinity_mask_t *); 2760b57cec5SDimitry Andric extern int __KAI_KMPC_CONVENTION kmp_set_affinity_mask_proc (int, kmp_affinity_mask_t *); 2770b57cec5SDimitry Andric extern int __KAI_KMPC_CONVENTION kmp_unset_affinity_mask_proc (int, kmp_affinity_mask_t *); 2780b57cec5SDimitry Andric extern int __KAI_KMPC_CONVENTION kmp_get_affinity_mask_proc (int, kmp_affinity_mask_t *); 2790b57cec5SDimitry Andric 2800b57cec5SDimitry Andric /* OpenMP 4.0 affinity API */ 2810b57cec5SDimitry Andric typedef enum omp_proc_bind_t { 2820b57cec5SDimitry Andric omp_proc_bind_false = 0, 2830b57cec5SDimitry Andric omp_proc_bind_true = 1, 2840b57cec5SDimitry Andric omp_proc_bind_master = 2, 2850b57cec5SDimitry Andric omp_proc_bind_close = 3, 2860b57cec5SDimitry Andric omp_proc_bind_spread = 4 2870b57cec5SDimitry Andric } omp_proc_bind_t; 2880b57cec5SDimitry Andric 2890b57cec5SDimitry Andric extern omp_proc_bind_t __KAI_KMPC_CONVENTION omp_get_proc_bind (void); 2900b57cec5SDimitry Andric 2910b57cec5SDimitry Andric /* OpenMP 4.5 affinity API */ 2920b57cec5SDimitry Andric extern int __KAI_KMPC_CONVENTION omp_get_num_places (void); 2930b57cec5SDimitry Andric extern int __KAI_KMPC_CONVENTION omp_get_place_num_procs (int); 2940b57cec5SDimitry Andric extern void __KAI_KMPC_CONVENTION omp_get_place_proc_ids (int, int *); 2950b57cec5SDimitry Andric extern int __KAI_KMPC_CONVENTION omp_get_place_num (void); 2960b57cec5SDimitry Andric extern int __KAI_KMPC_CONVENTION omp_get_partition_num_places (void); 2970b57cec5SDimitry Andric extern void __KAI_KMPC_CONVENTION omp_get_partition_place_nums (int *); 2980b57cec5SDimitry Andric 2990b57cec5SDimitry Andric extern void * __KAI_KMPC_CONVENTION kmp_malloc (size_t); 3000b57cec5SDimitry Andric extern void * __KAI_KMPC_CONVENTION kmp_aligned_malloc (size_t, size_t); 3010b57cec5SDimitry Andric extern void * __KAI_KMPC_CONVENTION kmp_calloc (size_t, size_t); 3020b57cec5SDimitry Andric extern void * __KAI_KMPC_CONVENTION kmp_realloc (void *, size_t); 3030b57cec5SDimitry Andric extern void __KAI_KMPC_CONVENTION kmp_free (void *); 3040b57cec5SDimitry Andric 3050b57cec5SDimitry Andric extern void __KAI_KMPC_CONVENTION kmp_set_warnings_on(void); 3060b57cec5SDimitry Andric extern void __KAI_KMPC_CONVENTION kmp_set_warnings_off(void); 3070b57cec5SDimitry Andric 3080b57cec5SDimitry Andric /* OpenMP 5.0 Tool Control */ 3090b57cec5SDimitry Andric typedef enum omp_control_tool_result_t { 3100b57cec5SDimitry Andric omp_control_tool_notool = -2, 3110b57cec5SDimitry Andric omp_control_tool_nocallback = -1, 3120b57cec5SDimitry Andric omp_control_tool_success = 0, 3130b57cec5SDimitry Andric omp_control_tool_ignored = 1 3140b57cec5SDimitry Andric } omp_control_tool_result_t; 3150b57cec5SDimitry Andric 3160b57cec5SDimitry Andric typedef enum omp_control_tool_t { 3170b57cec5SDimitry Andric omp_control_tool_start = 1, 3180b57cec5SDimitry Andric omp_control_tool_pause = 2, 3190b57cec5SDimitry Andric omp_control_tool_flush = 3, 3200b57cec5SDimitry Andric omp_control_tool_end = 4 3210b57cec5SDimitry Andric } omp_control_tool_t; 3220b57cec5SDimitry Andric 3230b57cec5SDimitry Andric extern int __KAI_KMPC_CONVENTION omp_control_tool(int, int, void*); 3240b57cec5SDimitry Andric 3250b57cec5SDimitry Andric /* OpenMP 5.0 Memory Management */ 3260b57cec5SDimitry Andric typedef uintptr_t omp_uintptr_t; 3270b57cec5SDimitry Andric 3280b57cec5SDimitry Andric typedef enum { 329e8d8bef9SDimitry Andric omp_atk_sync_hint = 1, 3305ffd83dbSDimitry Andric omp_atk_alignment = 2, 3315ffd83dbSDimitry Andric omp_atk_access = 3, 3325ffd83dbSDimitry Andric omp_atk_pool_size = 4, 3335ffd83dbSDimitry Andric omp_atk_fallback = 5, 3345ffd83dbSDimitry Andric omp_atk_fb_data = 6, 3355ffd83dbSDimitry Andric omp_atk_pinned = 7, 3365ffd83dbSDimitry Andric omp_atk_partition = 8 3370b57cec5SDimitry Andric } omp_alloctrait_key_t; 3380b57cec5SDimitry Andric 3390b57cec5SDimitry Andric typedef enum { 3405ffd83dbSDimitry Andric omp_atv_false = 0, 3415ffd83dbSDimitry Andric omp_atv_true = 1, 3425ffd83dbSDimitry Andric omp_atv_contended = 3, 3435ffd83dbSDimitry Andric omp_atv_uncontended = 4, 344e8d8bef9SDimitry Andric omp_atv_serialized = 5, 345e8d8bef9SDimitry Andric omp_atv_sequential = omp_atv_serialized, // (deprecated) 3465ffd83dbSDimitry Andric omp_atv_private = 6, 3475ffd83dbSDimitry Andric omp_atv_all = 7, 3485ffd83dbSDimitry Andric omp_atv_thread = 8, 3495ffd83dbSDimitry Andric omp_atv_pteam = 9, 3505ffd83dbSDimitry Andric omp_atv_cgroup = 10, 3515ffd83dbSDimitry Andric omp_atv_default_mem_fb = 11, 3525ffd83dbSDimitry Andric omp_atv_null_fb = 12, 3535ffd83dbSDimitry Andric omp_atv_abort_fb = 13, 3545ffd83dbSDimitry Andric omp_atv_allocator_fb = 14, 3555ffd83dbSDimitry Andric omp_atv_environment = 15, 3565ffd83dbSDimitry Andric omp_atv_nearest = 16, 3575ffd83dbSDimitry Andric omp_atv_blocked = 17, 3585ffd83dbSDimitry Andric omp_atv_interleaved = 18 3590b57cec5SDimitry Andric } omp_alloctrait_value_t; 360e8d8bef9SDimitry Andric #define omp_atv_default ((omp_uintptr_t)-1) 3610b57cec5SDimitry Andric 3620b57cec5SDimitry Andric typedef struct { 3630b57cec5SDimitry Andric omp_alloctrait_key_t key; 3640b57cec5SDimitry Andric omp_uintptr_t value; 3650b57cec5SDimitry Andric } omp_alloctrait_t; 3660b57cec5SDimitry Andric 3670b57cec5SDimitry Andric# if defined(_WIN32) 3680b57cec5SDimitry Andric // On Windows cl and icl do not support 64-bit enum, let's use integer then. 3690b57cec5SDimitry Andric typedef omp_uintptr_t omp_allocator_handle_t; 3700b57cec5SDimitry Andric extern __KMP_IMP omp_allocator_handle_t const omp_null_allocator; 3710b57cec5SDimitry Andric extern __KMP_IMP omp_allocator_handle_t const omp_default_mem_alloc; 3720b57cec5SDimitry Andric extern __KMP_IMP omp_allocator_handle_t const omp_large_cap_mem_alloc; 3730b57cec5SDimitry Andric extern __KMP_IMP omp_allocator_handle_t const omp_const_mem_alloc; 3740b57cec5SDimitry Andric extern __KMP_IMP omp_allocator_handle_t const omp_high_bw_mem_alloc; 3750b57cec5SDimitry Andric extern __KMP_IMP omp_allocator_handle_t const omp_low_lat_mem_alloc; 3760b57cec5SDimitry Andric extern __KMP_IMP omp_allocator_handle_t const omp_cgroup_mem_alloc; 3770b57cec5SDimitry Andric extern __KMP_IMP omp_allocator_handle_t const omp_pteam_mem_alloc; 3780b57cec5SDimitry Andric extern __KMP_IMP omp_allocator_handle_t const omp_thread_mem_alloc; 379fe6060f1SDimitry Andric extern __KMP_IMP omp_allocator_handle_t const llvm_omp_target_host_mem_alloc; 380fe6060f1SDimitry Andric extern __KMP_IMP omp_allocator_handle_t const llvm_omp_target_shared_mem_alloc; 381fe6060f1SDimitry Andric extern __KMP_IMP omp_allocator_handle_t const llvm_omp_target_device_mem_alloc; 382fe6060f1SDimitry Andric 3830b57cec5SDimitry Andric typedef omp_uintptr_t omp_memspace_handle_t; 3840b57cec5SDimitry Andric extern __KMP_IMP omp_memspace_handle_t const omp_default_mem_space; 3850b57cec5SDimitry Andric extern __KMP_IMP omp_memspace_handle_t const omp_large_cap_mem_space; 3860b57cec5SDimitry Andric extern __KMP_IMP omp_memspace_handle_t const omp_const_mem_space; 3870b57cec5SDimitry Andric extern __KMP_IMP omp_memspace_handle_t const omp_high_bw_mem_space; 3880b57cec5SDimitry Andric extern __KMP_IMP omp_memspace_handle_t const omp_low_lat_mem_space; 389fe6060f1SDimitry Andric extern __KMP_IMP omp_memspace_handle_t const llvm_omp_target_host_mem_space; 390fe6060f1SDimitry Andric extern __KMP_IMP omp_memspace_handle_t const llvm_omp_target_shared_mem_space; 391fe6060f1SDimitry Andric extern __KMP_IMP omp_memspace_handle_t const llvm_omp_target_device_mem_space; 3920b57cec5SDimitry Andric# else 3930b57cec5SDimitry Andric# if __cplusplus >= 201103 3940b57cec5SDimitry Andric typedef enum omp_allocator_handle_t : omp_uintptr_t 3950b57cec5SDimitry Andric# else 3960b57cec5SDimitry Andric typedef enum omp_allocator_handle_t 3970b57cec5SDimitry Andric# endif 3980b57cec5SDimitry Andric { 3990b57cec5SDimitry Andric omp_null_allocator = 0, 4000b57cec5SDimitry Andric omp_default_mem_alloc = 1, 4010b57cec5SDimitry Andric omp_large_cap_mem_alloc = 2, 4020b57cec5SDimitry Andric omp_const_mem_alloc = 3, 4030b57cec5SDimitry Andric omp_high_bw_mem_alloc = 4, 4040b57cec5SDimitry Andric omp_low_lat_mem_alloc = 5, 4050b57cec5SDimitry Andric omp_cgroup_mem_alloc = 6, 4060b57cec5SDimitry Andric omp_pteam_mem_alloc = 7, 4070b57cec5SDimitry Andric omp_thread_mem_alloc = 8, 408fe6060f1SDimitry Andric llvm_omp_target_host_mem_alloc = 100, 409fe6060f1SDimitry Andric llvm_omp_target_shared_mem_alloc = 101, 410fe6060f1SDimitry Andric llvm_omp_target_device_mem_alloc = 102, 4110b57cec5SDimitry Andric KMP_ALLOCATOR_MAX_HANDLE = UINTPTR_MAX 4120b57cec5SDimitry Andric } omp_allocator_handle_t; 4130b57cec5SDimitry Andric# if __cplusplus >= 201103 4140b57cec5SDimitry Andric typedef enum omp_memspace_handle_t : omp_uintptr_t 4150b57cec5SDimitry Andric# else 4160b57cec5SDimitry Andric typedef enum omp_memspace_handle_t 4170b57cec5SDimitry Andric# endif 4180b57cec5SDimitry Andric { 4190b57cec5SDimitry Andric omp_default_mem_space = 0, 4200b57cec5SDimitry Andric omp_large_cap_mem_space = 1, 4210b57cec5SDimitry Andric omp_const_mem_space = 2, 4220b57cec5SDimitry Andric omp_high_bw_mem_space = 3, 4230b57cec5SDimitry Andric omp_low_lat_mem_space = 4, 424fe6060f1SDimitry Andric llvm_omp_target_host_mem_space = 100, 425fe6060f1SDimitry Andric llvm_omp_target_shared_mem_space = 101, 426fe6060f1SDimitry Andric llvm_omp_target_device_mem_space = 102, 4270b57cec5SDimitry Andric KMP_MEMSPACE_MAX_HANDLE = UINTPTR_MAX 4280b57cec5SDimitry Andric } omp_memspace_handle_t; 4290b57cec5SDimitry Andric# endif 4300b57cec5SDimitry Andric extern omp_allocator_handle_t __KAI_KMPC_CONVENTION omp_init_allocator(omp_memspace_handle_t m, 4310b57cec5SDimitry Andric int ntraits, omp_alloctrait_t traits[]); 4320b57cec5SDimitry Andric extern void __KAI_KMPC_CONVENTION omp_destroy_allocator(omp_allocator_handle_t allocator); 4330b57cec5SDimitry Andric 4340b57cec5SDimitry Andric extern void __KAI_KMPC_CONVENTION omp_set_default_allocator(omp_allocator_handle_t a); 4350b57cec5SDimitry Andric extern omp_allocator_handle_t __KAI_KMPC_CONVENTION omp_get_default_allocator(void); 4360b57cec5SDimitry Andric# ifdef __cplusplus 4370b57cec5SDimitry Andric extern void *__KAI_KMPC_CONVENTION omp_alloc(size_t size, omp_allocator_handle_t a = omp_null_allocator); 438349cc55cSDimitry Andric extern void *__KAI_KMPC_CONVENTION omp_aligned_alloc(size_t align, size_t size, 439349cc55cSDimitry Andric omp_allocator_handle_t a = omp_null_allocator); 440349cc55cSDimitry Andric extern void *__KAI_KMPC_CONVENTION omp_calloc(size_t nmemb, size_t size, 441349cc55cSDimitry Andric omp_allocator_handle_t a = omp_null_allocator); 442349cc55cSDimitry Andric extern void *__KAI_KMPC_CONVENTION omp_aligned_calloc(size_t align, size_t nmemb, size_t size, 443349cc55cSDimitry Andric omp_allocator_handle_t a = omp_null_allocator); 444e8d8bef9SDimitry Andric extern void *__KAI_KMPC_CONVENTION omp_realloc(void *ptr, size_t size, 445e8d8bef9SDimitry Andric omp_allocator_handle_t allocator = omp_null_allocator, 446e8d8bef9SDimitry Andric omp_allocator_handle_t free_allocator = omp_null_allocator); 4470b57cec5SDimitry Andric extern void __KAI_KMPC_CONVENTION omp_free(void * ptr, omp_allocator_handle_t a = omp_null_allocator); 4480b57cec5SDimitry Andric# else 4490b57cec5SDimitry Andric extern void *__KAI_KMPC_CONVENTION omp_alloc(size_t size, omp_allocator_handle_t a); 450349cc55cSDimitry Andric extern void *__KAI_KMPC_CONVENTION omp_aligned_alloc(size_t align, size_t size, 451349cc55cSDimitry Andric omp_allocator_handle_t a); 452e8d8bef9SDimitry Andric extern void *__KAI_KMPC_CONVENTION omp_calloc(size_t nmemb, size_t size, omp_allocator_handle_t a); 453349cc55cSDimitry Andric extern void *__KAI_KMPC_CONVENTION omp_aligned_calloc(size_t align, size_t nmemb, size_t size, 454349cc55cSDimitry Andric omp_allocator_handle_t a); 455e8d8bef9SDimitry Andric extern void *__KAI_KMPC_CONVENTION omp_realloc(void *ptr, size_t size, omp_allocator_handle_t allocator, 456e8d8bef9SDimitry Andric omp_allocator_handle_t free_allocator); 4570b57cec5SDimitry Andric extern void __KAI_KMPC_CONVENTION omp_free(void *ptr, omp_allocator_handle_t a); 4580b57cec5SDimitry Andric# endif 4590b57cec5SDimitry Andric 4600b57cec5SDimitry Andric /* OpenMP 5.0 Affinity Format */ 4610b57cec5SDimitry Andric extern void __KAI_KMPC_CONVENTION omp_set_affinity_format(char const *); 4620b57cec5SDimitry Andric extern size_t __KAI_KMPC_CONVENTION omp_get_affinity_format(char *, size_t); 4630b57cec5SDimitry Andric extern void __KAI_KMPC_CONVENTION omp_display_affinity(char const *); 4640b57cec5SDimitry Andric extern size_t __KAI_KMPC_CONVENTION omp_capture_affinity(char *, size_t, char const *); 4650b57cec5SDimitry Andric 4660b57cec5SDimitry Andric /* OpenMP 5.0 events */ 4670b57cec5SDimitry Andric# if defined(_WIN32) 4680b57cec5SDimitry Andric // On Windows cl and icl do not support 64-bit enum, let's use integer then. 4690b57cec5SDimitry Andric typedef omp_uintptr_t omp_event_handle_t; 4700b57cec5SDimitry Andric# else 4710b57cec5SDimitry Andric typedef enum omp_event_handle_t { KMP_EVENT_MAX_HANDLE = UINTPTR_MAX } omp_event_handle_t; 4720b57cec5SDimitry Andric# endif 4730b57cec5SDimitry Andric extern void __KAI_KMPC_CONVENTION omp_fulfill_event ( omp_event_handle_t event ); 4740b57cec5SDimitry Andric 4750b57cec5SDimitry Andric /* OpenMP 5.0 Pause Resources */ 4760b57cec5SDimitry Andric typedef enum omp_pause_resource_t { 4770b57cec5SDimitry Andric omp_pause_resume = 0, 4780b57cec5SDimitry Andric omp_pause_soft = 1, 4790b57cec5SDimitry Andric omp_pause_hard = 2 4800b57cec5SDimitry Andric } omp_pause_resource_t; 4810b57cec5SDimitry Andric extern int __KAI_KMPC_CONVENTION omp_pause_resource(omp_pause_resource_t, int); 4820b57cec5SDimitry Andric extern int __KAI_KMPC_CONVENTION omp_pause_resource_all(omp_pause_resource_t); 4830b57cec5SDimitry Andric 4840b57cec5SDimitry Andric extern int __KAI_KMPC_CONVENTION omp_get_supported_active_levels(void); 4850b57cec5SDimitry Andric 486fe6060f1SDimitry Andric /* OpenMP 5.1 */ 487fe6060f1SDimitry Andric extern void __KAI_KMPC_CONVENTION omp_set_num_teams(int num_teams); 488fe6060f1SDimitry Andric extern int __KAI_KMPC_CONVENTION omp_get_max_teams(void); 489fe6060f1SDimitry Andric extern void __KAI_KMPC_CONVENTION omp_set_teams_thread_limit(int limit); 490fe6060f1SDimitry Andric extern int __KAI_KMPC_CONVENTION omp_get_teams_thread_limit(void); 491fe6060f1SDimitry Andric 4925ffd83dbSDimitry Andric /* OpenMP 5.1 Display Environment */ 4935ffd83dbSDimitry Andric extern void omp_display_env(int verbose); 4945ffd83dbSDimitry Andric 495fe6060f1SDimitry Andric# if defined(_OPENMP) && _OPENMP >= 201811 496fe6060f1SDimitry Andric #pragma omp begin declare variant match(device={kind(host)}) 497fe6060f1SDimitry Andric static inline int omp_is_initial_device(void) { return 1; } 498fe6060f1SDimitry Andric #pragma omp end declare variant 499fe6060f1SDimitry Andric #pragma omp begin declare variant match(device={kind(nohost)}) 500fe6060f1SDimitry Andric static inline int omp_is_initial_device(void) { return 0; } 501fe6060f1SDimitry Andric #pragma omp end declare variant 502fe6060f1SDimitry Andric# endif 503fe6060f1SDimitry 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 5100b57cec5SDimitry Andric# undef __KAI_KMPC_CONVENTION 5110b57cec5SDimitry Andric# undef __KMP_IMP 5120b57cec5SDimitry Andric 5130b57cec5SDimitry Andric /* Warning: 5140b57cec5SDimitry Andric The following typedefs are not standard, deprecated and will be removed in a future release. 5150b57cec5SDimitry Andric */ 5160b57cec5SDimitry Andric typedef int omp_int_t; 5170b57cec5SDimitry Andric typedef double omp_wtime_t; 5180b57cec5SDimitry Andric 5190b57cec5SDimitry Andric# ifdef __cplusplus 5200b57cec5SDimitry Andric } 5210b57cec5SDimitry Andric# endif 5220b57cec5SDimitry Andric 5230b57cec5SDimitry Andric#endif /* __OMP_H */ 524