From: Shilei Tian Date: Thu, 12 Jan 2023 04:50:28 +0000 (-0500) Subject: [OpenMP][DeviceRTL] Fix the support for tasking on the device X-Git-Tag: upstream/17.0.6~21273 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=18959be84d25539b1fa719aa1daff181af10cc2f;p=platform%2Fupstream%2Fllvm.git [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 --- 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