summaryrefslogtreecommitdiff
path: root/openmp/libomptarget
diff options
context:
space:
mode:
authorRafael A. Herrera Guaitero <randres2011@gmail.com>2023-04-03 20:29:16 +0000
committerJose Manuel Monsalve Diaz <josem@udel.edu>2023-04-03 20:33:55 +0000
commit64549f0903e244fbe2e7f0131698334b6e45dc10 (patch)
tree30640a8f3d29ad0183c415d9fb279041e1a082af /openmp/libomptarget
parent475dd6f626ee2679578ed570e9fb78f7e957a36d (diff)
downloadllvm-64549f0903e244fbe2e7f0131698334b6e45dc10.tar.gz
[OpenMP][5.1] Fix parallel masked is ignored #59939
Code generation support for 'parallel masked' directive. The `EmitOMPParallelMaskedDirective` was implemented. In addition, the appropiate device functions were added. Fix #59939. Reviewed By: jdoerfert Differential Revision: https://reviews.llvm.org/D143527
Diffstat (limited to 'openmp/libomptarget')
-rw-r--r--openmp/libomptarget/DeviceRTL/include/Interface.h4
-rw-r--r--openmp/libomptarget/DeviceRTL/src/Synchronization.cpp7
2 files changed, 11 insertions, 0 deletions
diff --git a/openmp/libomptarget/DeviceRTL/include/Interface.h b/openmp/libomptarget/DeviceRTL/include/Interface.h
index 02c79a5e7abd..648da49b86f5 100644
--- a/openmp/libomptarget/DeviceRTL/include/Interface.h
+++ b/openmp/libomptarget/DeviceRTL/include/Interface.h
@@ -260,6 +260,10 @@ int32_t __kmpc_master(IdentTy *Loc, int32_t TId);
void __kmpc_end_master(IdentTy *Loc, int32_t TId);
+int32_t __kmpc_masked(IdentTy *Loc, int32_t TId, int32_t Filter);
+
+void __kmpc_end_masked(IdentTy *Loc, int32_t TId);
+
int32_t __kmpc_single(IdentTy *Loc, int32_t TId);
void __kmpc_end_single(IdentTy *Loc, int32_t TId);
diff --git a/openmp/libomptarget/DeviceRTL/src/Synchronization.cpp b/openmp/libomptarget/DeviceRTL/src/Synchronization.cpp
index 90d03dd490b2..eddf37f851e7 100644
--- a/openmp/libomptarget/DeviceRTL/src/Synchronization.cpp
+++ b/openmp/libomptarget/DeviceRTL/src/Synchronization.cpp
@@ -520,6 +520,13 @@ int32_t __kmpc_master(IdentTy *Loc, int32_t TId) {
void __kmpc_end_master(IdentTy *Loc, int32_t TId) { FunctionTracingRAII(); }
+int32_t __kmpc_masked(IdentTy *Loc, int32_t TId, int32_t Filter) {
+ FunctionTracingRAII();
+ return omp_get_thread_num() == Filter;
+}
+
+void __kmpc_end_masked(IdentTy *Loc, int32_t TId) { FunctionTracingRAII(); }
+
int32_t __kmpc_single(IdentTy *Loc, int32_t TId) {
FunctionTracingRAII();
return __kmpc_master(Loc, TId);