From 18959be84d25539b1fa719aa1daff181af10cc2f Mon Sep 17 00:00:00 2001 From: Shilei Tian Date: Wed, 11 Jan 2023 23:50:28 -0500 Subject: [PATCH] [OpenMP][DeviceRTL] Fix the support for tasking on the device MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit 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 | 6 +++--- openmp/libomptarget/DeviceRTL/src/Tasking.cpp | 9 ++++++--- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/openmp/libomptarget/DeviceRTL/include/Interface.h b/openmp/libomptarget/DeviceRTL/include/Interface.h index 58ca5b3..02c79a5 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 ad26b02..6555eae 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 -- 2.7.4