[OpenMP][DeviceRTL] Fix the support for tasking on the device
authorShilei Tian <i@tianshilei.me>
Thu, 12 Jan 2023 04:50:28 +0000 (23:50 -0500)
committerShilei Tian <i@tianshilei.me>
Thu, 12 Jan 2023 04:50:35 +0000 (23:50 -0500)
This patch fixes the support for tasking on the device.

Note: AMDGPU doesn't support it yet because of no support for `malloc` and `free`.

Fix #59946.

```
➜  ./test_parallel_master_device
[OMPVV_RESULT: test_parallel_master_device.c] Test passed on the device.
```

Reviewed By: jdoerfert

Differential Revision: https://reviews.llvm.org/D141562

openmp/libomptarget/DeviceRTL/include/Interface.h
openmp/libomptarget/DeviceRTL/src/Tasking.cpp

index 58ca5b3..02c79a5 100644 (file)
@@ -302,9 +302,9 @@ uint16_t __kmpc_parallel_level(IdentTy *Loc, uint32_t);
 /// Tasking
 ///
 ///{
-TaskDescriptorTy *__kmpc_omp_task_alloc(IdentTy *, uint32_t, int32_t,
-                                        uint32_t TaskSizeInclPrivateValues,
-                                        uint32_t SharedValuesSize,
+TaskDescriptorTy *__kmpc_omp_task_alloc(IdentTy *, int32_t, int32_t,
+                                        size_t TaskSizeInclPrivateValues,
+                                        size_t SharedValuesSize,
                                         TaskFnTy TaskFn);
 
 int32_t __kmpc_omp_task(IdentTy *Loc, uint32_t TId,
index ad26b02..6555eae 100644 (file)
@@ -22,9 +22,11 @@ using namespace ompx;
 
 #pragma omp begin declare target device_type(nohost)
 
-TaskDescriptorTy *__kmpc_omp_task_alloc(IdentTy *, uint32_t, int32_t,
-                                        uint64_t TaskSizeInclPrivateValues,
-                                        uint64_t SharedValuesSize,
+extern "C" {
+
+TaskDescriptorTy *__kmpc_omp_task_alloc(IdentTy *, int32_t, int32_t,
+                                        size_t TaskSizeInclPrivateValues,
+                                        size_t SharedValuesSize,
                                         TaskFnTy TaskFn) {
   FunctionTracingRAII();
   auto TaskSizeInclPrivateValuesPadded =
@@ -114,5 +116,6 @@ int omp_in_final(void) {
 }
 
 int omp_get_max_task_priority(void) { return 0; }
+}
 
 #pragma omp end declare target