xref: /llvm-project/offload/include/OpenMP/InteropAPI.h (revision 330d8983d25d08580fc1642fea48b2473f47a9da)
1 //===-- OpenMP/InteropAPI.h - OpenMP interoperability types and API - 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 //===----------------------------------------------------------------------===//
10 
11 #ifndef OMPTARGET_OPENMP_INTEROP_API_H
12 #define OMPTARGET_OPENMP_INTEROP_API_H
13 
14 #include "omp.h"
15 
16 #include "omptarget.h"
17 
18 extern "C" {
19 
20 typedef enum kmp_interop_type_t {
21   kmp_interop_type_unknown = -1,
22   kmp_interop_type_platform,
23   kmp_interop_type_device,
24   kmp_interop_type_tasksync,
25 } kmp_interop_type_t;
26 
27 /// The interop value type, aka. the interop object.
28 typedef struct omp_interop_val_t {
29   /// Device and interop-type are determined at construction time and fix.
omp_interop_val_tomp_interop_val_t30   omp_interop_val_t(intptr_t device_id, kmp_interop_type_t interop_type)
31       : interop_type(interop_type), device_id(device_id) {}
32   const char *err_str = nullptr;
33   __tgt_async_info *async_info = nullptr;
34   __tgt_device_info device_info;
35   const kmp_interop_type_t interop_type;
36   const intptr_t device_id;
37   const omp_foreign_runtime_ids_t vendor_id = cuda;
38   const intptr_t backend_type_id = omp_interop_backend_type_cuda_1;
39 } omp_interop_val_t;
40 
41 } // extern "C"
42 
43 #endif // OMPTARGET_OPENMP_INTEROP_API_H
44