[Openmp-commits] [PATCH] D60906: [OpenMP][libomptarget][WIP] Add math functions support in OpenMP offloading
Gheorghe-Teodor Bercea via Phabricator via Openmp-commits
openmp-commits at lists.llvm.org
Fri Apr 19 11:10:54 PDT 2019
gtbercea created this revision.
gtbercea added reviewers: ABataev, hfinkel, caomhin.
Herald added subscribers: openmp-commits, jdoerfert, guansong, mgorny.
Herald added a project: OpenMP.
Add kmpc function definition to libomptarget-nvptx.bc.
Repository:
rOMP OpenMP
https://reviews.llvm.org/D60906
Files:
libomptarget/deviceRTLs/nvptx/CMakeLists.txt
libomptarget/deviceRTLs/nvptx/src/interface.h
libomptarget/deviceRTLs/nvptx/src/math.cu
Index: libomptarget/deviceRTLs/nvptx/src/math.cu
===================================================================
--- /dev/null
+++ libomptarget/deviceRTLs/nvptx/src/math.cu
@@ -0,0 +1,18 @@
+//===------------ math.cu - NVPTX OpenMP math constructs --------- CUDA -*-===//
+//
+// 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
+//
+//===----------------------------------------------------------------------===//
+//
+// This file contains the implementation of math function not already handled.
+// Function in this file will end up as part of the .bc library of the
+// device and will call libdevice functions.
+//
+//===----------------------------------------------------------------------===//
+
+#include "omptarget-nvptx.h"
+
+EXTERN double __kmpc_pow(double a, double b) { return pow(a, b); }
+EXTERN double __kmpc_sin(double a) { return sin(a); }
Index: libomptarget/deviceRTLs/nvptx/src/interface.h
===================================================================
--- libomptarget/deviceRTLs/nvptx/src/interface.h
+++ libomptarget/deviceRTLs/nvptx/src/interface.h
@@ -567,4 +567,7 @@
EXTERN void __kmpc_restore_team_static_memory(int16_t isSPMDExecutionMode,
int16_t is_shared);
+EXTERN double __kmpc_pow(double, double);
+EXTERN double __kmpc_sin(double);
+
#endif
Index: libomptarget/deviceRTLs/nvptx/CMakeLists.txt
===================================================================
--- libomptarget/deviceRTLs/nvptx/CMakeLists.txt
+++ libomptarget/deviceRTLs/nvptx/CMakeLists.txt
@@ -53,6 +53,7 @@
src/reduction.cu
src/sync.cu
src/task.cu
+ src/math.cu
)
set(omp_data_objects src/omp_data.cu)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D60906.195887.patch
Type: text/x-patch
Size: 1854 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/openmp-commits/attachments/20190419/d454e1da/attachment.bin>
More information about the Openmp-commits
mailing list