[Openmp-commits] [openmp] 18959be - [OpenMP][DeviceRTL] Fix the support for tasking on the device

Shilei Tian via Openmp-commits openmp-commits at lists.llvm.org
Wed Jan 11 20:50:40 PST 2023


Author: Shilei Tian
Date: 2023-01-11T23:50:35-05:00
New Revision: 18959be84d25539b1fa719aa1daff181af10cc2f

URL: https://github.com/llvm/llvm-project/commit/18959be84d25539b1fa719aa1daff181af10cc2f
DIFF: https://github.com/llvm/llvm-project/commit/18959be84d25539b1fa719aa1daff181af10cc2f.diff

LOG: [OpenMP][DeviceRTL] Fix the support for tasking on the device

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

Added: 
    

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

Removed: 
    


################################################################################
diff  --git a/openmp/libomptarget/DeviceRTL/include/Interface.h b/openmp/libomptarget/DeviceRTL/include/Interface.h
index 58ca5b3e0cb07..02c79a5e7abd7 100644
--- a/openmp/libomptarget/DeviceRTL/include/Interface.h
+++ b/openmp/libomptarget/DeviceRTL/include/Interface.h
@@ -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,

diff  --git a/openmp/libomptarget/DeviceRTL/src/Tasking.cpp b/openmp/libomptarget/DeviceRTL/src/Tasking.cpp
index ad26b0248a7a1..6555eae7fc280 100644
--- a/openmp/libomptarget/DeviceRTL/src/Tasking.cpp
+++ b/openmp/libomptarget/DeviceRTL/src/Tasking.cpp
@@ -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


        


More information about the Openmp-commits mailing list