[Openmp-commits] [openmp] [openmp] Added omp_get_max_teams() on device (PR #67867)

via Openmp-commits openmp-commits at lists.llvm.org
Fri Sep 29 16:52:12 PDT 2023


github-actions[bot] wrote:


<!--LLVM CODE FORMAT COMMENT: {clang-format}-->

:warning: C/C++ code formatter, clang-format found issues in your code. :warning:

<details>
<summary>
You can test this locally with the following command:
</summary>

``````````bash
git-clang-format --diff f88f090a2ef1eae500db9c398059a0eb4907ab4e e9dc1c01ea132343032ee131a9f04058ffbf4119 -- openmp/libomptarget/test/api/omp_get_max_teams.c openmp/libomptarget/DeviceRTL/include/State.h openmp/libomptarget/DeviceRTL/src/State.cpp
``````````

</details>

<details>
<summary>
View the diff from clang-format here.
</summary>

``````````diff
diff --git a/openmp/libomptarget/DeviceRTL/include/State.h b/openmp/libomptarget/DeviceRTL/include/State.h
index ea65101d3..70ab8ba88 100644
--- a/openmp/libomptarget/DeviceRTL/include/State.h
+++ b/openmp/libomptarget/DeviceRTL/include/State.h
@@ -189,8 +189,7 @@ lookup32(ValueKind Kind, bool IsReadonly, IdentTy *Ident, bool ForceTeamState) {
   case state::VK_NTeams:
     if (IsReadonly)
       return lookupImpl(&ICVStateTy::NTeamsVar, ForceTeamState);
-    return lookupForModify32Impl(&ICVStateTy::NTeamsVar, Ident,
-                                 ForceTeamState);
+    return lookupForModify32Impl(&ICVStateTy::NTeamsVar, Ident, ForceTeamState);
   case state::VK_Level:
     if (IsReadonly)
       return lookupImpl(&ICVStateTy::LevelVar, ForceTeamState);
diff --git a/openmp/libomptarget/test/api/omp_get_max_teams.c b/openmp/libomptarget/test/api/omp_get_max_teams.c
index ee9ed546a..8f0705d2b 100644
--- a/openmp/libomptarget/test/api/omp_get_max_teams.c
+++ b/openmp/libomptarget/test/api/omp_get_max_teams.c
@@ -1,20 +1,18 @@
 // RUN: %libomptarget-compile-run-and-check-generic
 
-#include <stdio.h>
 #include <omp.h>
+#include <stdio.h>
 
 int test_get_max_teams(int offload) {
   int errors = 0;
   int max_teams;
   int num_teams = 0;
 
-  #pragma omp target map(tofrom: max_teams) if(offload)
-  {
-    max_teams = omp_get_max_teams();
-  }
-  #pragma omp target map(tofrom : num_teams) if(offload)
+#pragma omp target map(tofrom : max_teams) if (offload)
+  { max_teams = omp_get_max_teams(); }
+#pragma omp target map(tofrom : num_teams) if (offload)
   {
-    #pragma omp teams 
+#pragma omp teams
     {
       if (omp_get_team_num() == 0)
         num_teams = omp_get_num_teams();
@@ -22,7 +20,9 @@ int test_get_max_teams(int offload) {
   }
 
   if (max_teams > 0 && num_teams > max_teams) {
-    printf("Number of teams(=%d) reported exceeded max number of teams(=%d) (max no. > 0)", num_teams, max_teams);
+    printf("Number of teams(=%d) reported exceeded max number of teams(=%d) "
+           "(max no. > 0)",
+           num_teams, max_teams);
     errors++;
   }
 

``````````

</details>


https://github.com/llvm/llvm-project/pull/67867


More information about the Openmp-commits mailing list