aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Headers/openmp_wrappers/__clang_openmp_device_functions.h
diff options
context:
space:
mode:
Diffstat (limited to 'clang/lib/Headers/openmp_wrappers/__clang_openmp_device_functions.h')
-rw-r--r--clang/lib/Headers/openmp_wrappers/__clang_openmp_device_functions.h42
1 files changed, 42 insertions, 0 deletions
diff --git a/clang/lib/Headers/openmp_wrappers/__clang_openmp_device_functions.h b/clang/lib/Headers/openmp_wrappers/__clang_openmp_device_functions.h
new file mode 100644
index 000000000000..406c9748e286
--- /dev/null
+++ b/clang/lib/Headers/openmp_wrappers/__clang_openmp_device_functions.h
@@ -0,0 +1,42 @@
+/*===- __clang_openmp_device_functions.h - OpenMP device function declares -===
+ *
+ * Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+ * See https://llvm.org/LICENSE.txt for license information.
+ * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+ *
+ *===-----------------------------------------------------------------------===
+ */
+
+#ifndef __CLANG_OPENMP_DEVICE_FUNCTIONS_H__
+#define __CLANG_OPENMP_DEVICE_FUNCTIONS_H__
+
+#ifndef _OPENMP
+#error "This file is for OpenMP compilation only."
+#endif
+
+#pragma omp begin declare variant match( \
+ device = {arch(nvptx, nvptx64)}, implementation = {extension(match_any)})
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define __CUDA__
+#define __OPENMP_NVPTX__
+
+/// Include declarations for libdevice functions.
+#include <__clang_cuda_libdevice_declares.h>
+
+/// Provide definitions for these functions.
+#include <__clang_cuda_device_functions.h>
+
+#undef __OPENMP_NVPTX__
+#undef __CUDA__
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
+#pragma omp end declare variant
+
+#endif