[flang-commits] [flang] 02023bc - [Flang] [OpenMP] Add parser support for THREAD_LIMIT clause on OMP TARGET directive.

Raghu Maddhipatla via flang-commits flang-commits at lists.llvm.org
Wed Jan 11 21:06:54 PST 2023


Author: Raghu Maddhipatla
Date: 2023-01-11T23:06:49-06:00
New Revision: 02023bca7f7d6ac1b84a7f5aad8abf4f9c92095e

URL: https://github.com/llvm/llvm-project/commit/02023bca7f7d6ac1b84a7f5aad8abf4f9c92095e
DIFF: https://github.com/llvm/llvm-project/commit/02023bca7f7d6ac1b84a7f5aad8abf4f9c92095e.diff

LOG: [Flang] [OpenMP] Add parser support for THREAD_LIMIT clause on OMP TARGET directive.

OpenMP 5.1 adds support for the THREAD_LIMIT clause for OMP TARGET directive.

This patch adds parser support for it in flang.

Reviewed By: kiranchandramohan, TIFitis

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

Added: 
    

Modified: 
    flang/test/Semantics/OpenMP/omp-device-constructs.f90
    llvm/include/llvm/Frontend/OpenMP/OMP.td

Removed: 
    


################################################################################
diff  --git a/flang/test/Semantics/OpenMP/omp-device-constructs.f90 b/flang/test/Semantics/OpenMP/omp-device-constructs.f90
index 1b242657673ad..cbd377575339e 100644
--- a/flang/test/Semantics/OpenMP/omp-device-constructs.f90
+++ b/flang/test/Semantics/OpenMP/omp-device-constructs.f90
@@ -56,6 +56,19 @@ program main
   enddo
   !$omp end target
 
+  !$omp target thread_limit(4)
+  do i = 1, N
+     a = 3.14
+  enddo
+  !$omp end target
+
+  !ERROR: At most one THREAD_LIMIT clause can appear on the TARGET directive
+  !$omp target thread_limit(4) thread_limit(8)
+  do i = 1, N
+     a = 3.14
+  enddo
+  !$omp end target
+
   !$omp teams num_teams(3) thread_limit(10) default(shared) private(i) shared(a)
   do i = 1, N
      a = 3.14

diff  --git a/llvm/include/llvm/Frontend/OpenMP/OMP.td b/llvm/include/llvm/Frontend/OpenMP/OMP.td
index f2bd5b4c9eb88..0b90affb7a34d 100644
--- a/llvm/include/llvm/Frontend/OpenMP/OMP.td
+++ b/llvm/include/llvm/Frontend/OpenMP/OMP.td
@@ -625,6 +625,7 @@ def OMP_Target : Directive<"target"> {
   ];
   let allowedOnceClauses = [
     VersionedClause<OMPC_Device>,
+    VersionedClause<OMPC_ThreadLimit, 51>,
     VersionedClause<OMPC_DefaultMap>,
     VersionedClause<OMPC_NoWait>
   ];


        


More information about the flang-commits mailing list