Warning: This file is not a C or C++ file. It does not have highlighting.
| 1 | //===-- OpenMP/omp.h - Copies of OpenMP user facing types and APIs - C++ -===// |
|---|---|
| 2 | // |
| 3 | // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. |
| 4 | // See https://llvm.org/LICENSE.txt for license information. |
| 5 | // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
| 6 | // |
| 7 | //===----------------------------------------------------------------------===// |
| 8 | // |
| 9 | // This copies some OpenMP user facing types and APIs for easy reach within the |
| 10 | // implementation. |
| 11 | // |
| 12 | //===----------------------------------------------------------------------===// |
| 13 | |
| 14 | #ifndef OMPTARGET_OPENMP_OMP_H |
| 15 | #define OMPTARGET_OPENMP_OMP_H |
| 16 | |
| 17 | #include <cstdint> |
| 18 | |
| 19 | #if defined(_WIN32) |
| 20 | #define __KAI_KMPC_CONVENTION __cdecl |
| 21 | #ifndef __KMP_IMP |
| 22 | #define __KMP_IMP __declspec(dllimport) |
| 23 | #endif |
| 24 | #else |
| 25 | #define __KAI_KMPC_CONVENTION |
| 26 | #ifndef __KMP_IMP |
| 27 | #define __KMP_IMP |
| 28 | #endif |
| 29 | #endif |
| 30 | |
| 31 | extern "C" { |
| 32 | |
| 33 | /// Type declarations |
| 34 | ///{ |
| 35 | |
| 36 | typedef void *omp_depend_t; |
| 37 | |
| 38 | ///} |
| 39 | |
| 40 | /// API declarations |
| 41 | ///{ |
| 42 | |
| 43 | int omp_get_default_device(void) __attribute__((weak)); |
| 44 | |
| 45 | ///} |
| 46 | |
| 47 | /// InteropAPI |
| 48 | /// |
| 49 | ///{ |
| 50 | |
| 51 | /// TODO: Include the `omp.h` of the current build |
| 52 | /* OpenMP 5.1 interop */ |
| 53 | typedef intptr_t omp_intptr_t; |
| 54 | |
| 55 | /* 0..omp_get_num_interop_properties()-1 are reserved for implementation-defined |
| 56 | * properties */ |
| 57 | typedef enum omp_interop_property { |
| 58 | omp_ipr_fr_id = -1, |
| 59 | omp_ipr_fr_name = -2, |
| 60 | omp_ipr_vendor = -3, |
| 61 | omp_ipr_vendor_name = -4, |
| 62 | omp_ipr_device_num = -5, |
| 63 | omp_ipr_platform = -6, |
| 64 | omp_ipr_device = -7, |
| 65 | omp_ipr_device_context = -8, |
| 66 | omp_ipr_targetsync = -9, |
| 67 | omp_ipr_first = -9 |
| 68 | } omp_interop_property_t; |
| 69 | |
| 70 | #define omp_interop_none 0 |
| 71 | |
| 72 | typedef enum omp_interop_rc { |
| 73 | omp_irc_no_value = 1, |
| 74 | omp_irc_success = 0, |
| 75 | omp_irc_empty = -1, |
| 76 | omp_irc_out_of_range = -2, |
| 77 | omp_irc_type_int = -3, |
| 78 | omp_irc_type_ptr = -4, |
| 79 | omp_irc_type_str = -5, |
| 80 | omp_irc_other = -6 |
| 81 | } omp_interop_rc_t; |
| 82 | |
| 83 | typedef enum omp_interop_fr { |
| 84 | omp_ifr_cuda = 1, |
| 85 | omp_ifr_cuda_driver = 2, |
| 86 | omp_ifr_opencl = 3, |
| 87 | omp_ifr_sycl = 4, |
| 88 | omp_ifr_hip = 5, |
| 89 | omp_ifr_level_zero = 6, |
| 90 | omp_ifr_last = 7 |
| 91 | } omp_interop_fr_t; |
| 92 | |
| 93 | typedef void *omp_interop_t; |
| 94 | |
| 95 | /*! |
| 96 | * The `omp_get_num_interop_properties` routine retrieves the number of |
| 97 | * implementation-defined properties available for an `omp_interop_t` object. |
| 98 | */ |
| 99 | int __KAI_KMPC_CONVENTION omp_get_num_interop_properties(const omp_interop_t); |
| 100 | /*! |
| 101 | * The `omp_get_interop_int` routine retrieves an integer property from an |
| 102 | * `omp_interop_t` object. |
| 103 | */ |
| 104 | omp_intptr_t __KAI_KMPC_CONVENTION |
| 105 | omp_get_interop_int(const omp_interop_t, omp_interop_property_t, int *); |
| 106 | /*! |
| 107 | * The `omp_get_interop_ptr` routine retrieves a pointer property from an |
| 108 | * `omp_interop_t` object. |
| 109 | */ |
| 110 | void *__KAI_KMPC_CONVENTION omp_get_interop_ptr(const omp_interop_t, |
| 111 | omp_interop_property_t, int *); |
| 112 | /*! |
| 113 | * The `omp_get_interop_str` routine retrieves a string property from an |
| 114 | * `omp_interop_t` object. |
| 115 | */ |
| 116 | const char *__KAI_KMPC_CONVENTION |
| 117 | omp_get_interop_str(const omp_interop_t, omp_interop_property_t, int *); |
| 118 | /*! |
| 119 | * The `omp_get_interop_name` routine retrieves a property name from an |
| 120 | * `omp_interop_t` object. |
| 121 | */ |
| 122 | const char *__KAI_KMPC_CONVENTION omp_get_interop_name(const omp_interop_t, |
| 123 | omp_interop_property_t); |
| 124 | /*! |
| 125 | * The `omp_get_interop_type_desc` routine retrieves a description of the type |
| 126 | * of a property associated with an `omp_interop_t` object. |
| 127 | */ |
| 128 | const char *__KAI_KMPC_CONVENTION |
| 129 | omp_get_interop_type_desc(const omp_interop_t, omp_interop_property_t); |
| 130 | /*! |
| 131 | * The `omp_get_interop_rc_desc` routine retrieves a description of the return |
| 132 | * code associated with an `omp_interop_t` object. |
| 133 | */ |
| 134 | extern const char *__KAI_KMPC_CONVENTION |
| 135 | omp_get_interop_rc_desc(const omp_interop_t, omp_interop_rc_t); |
| 136 | |
| 137 | typedef enum omp_interop_backend_type_t { |
| 138 | // reserve 0 |
| 139 | omp_interop_backend_type_cuda_1 = 1, |
| 140 | } omp_interop_backend_type_t; |
| 141 | |
| 142 | typedef enum omp_foreign_runtime_ids { |
| 143 | cuda = 1, |
| 144 | cuda_driver = 2, |
| 145 | opencl = 3, |
| 146 | sycl = 4, |
| 147 | hip = 5, |
| 148 | level_zero = 6, |
| 149 | } omp_foreign_runtime_ids_t; |
| 150 | |
| 151 | ///} InteropAPI |
| 152 | |
| 153 | } // extern "C" |
| 154 | |
| 155 | #endif // OMPTARGET_OPENMP_OMP_H |
| 156 |
Warning: This file is not a C or C++ file. It does not have highlighting.
