[llvm] [OpenMP][offload] Add enhanced cross-team reduction test (PR #195940)

via llvm-commits llvm-commits at lists.llvm.org
Wed May 6 04:46:25 PDT 2026


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 origin/main HEAD --extensions h,cpp -- offload/test/offloading/multiple_reductions.cpp offload/test/offloading/perf/common.h offload/test/offloading/perf/reduction.cpp offload/test/offloading/perf/reduction.h --diff_from_common_commit
``````````

:warning:
The reproduction instructions above might return results for more than one PR
in a stack if you are using a stacked PR workflow. You can limit the results by
changing `origin/main` to the base branch/commit you want to compare against.
:warning:

</details>

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

``````````diff
diff --git a/offload/test/offloading/multiple_reductions.cpp b/offload/test/offloading/multiple_reductions.cpp
index ae19d1d6f..3187076d0 100644
--- a/offload/test/offloading/multiple_reductions.cpp
+++ b/offload/test/offloading/multiple_reductions.cpp
@@ -11,16 +11,14 @@
 
 #define N 10000
 
-template <typename T>
-static void init_data(T *a) {
+template <typename T> static void init_data(T *a) {
   for (int i = 0; i < N; ++i)
     a[i] = i;
 }
 
-template <typename T>
-void run_type(void) {
+template <typename T> void run_type(void) {
   T s1, s2;
-  
+
   T *in1 = static_cast<T *>(malloc(N * sizeof(T)));
   T *in2 = static_cast<T *>(malloc(N * sizeof(T)));
   assert(in1 && in2);
@@ -28,7 +26,7 @@ void run_type(void) {
   init_data(in1);
   init_data(in2);
 
-#pragma omp target enter data map(to: in1[0 : N], in2[0 : N])
+#pragma omp target enter data map(to : in1[0 : N], in2[0 : N])
 
   // Sum reduction
   s1 = T(0);
@@ -57,7 +55,8 @@ void run_type(void) {
 
   // Combined reduction (sum and max) - in the same loop ...
   s1 = s2 = T(0);
-#pragma omp target teams distribute parallel for reduction(+ : s1) reduction(max : s2)
+#pragma omp target teams distribute parallel for reduction(+ : s1)             \
+    reduction(max : s2)
   for (int i = 0; i < N; ++i) {
     s1 += in1[i];
     s2 = in1[i] > s2 ? in1[i] : s2;
@@ -104,7 +103,7 @@ void run_type(void) {
   // CHECK: 49995000
   std::cout << s1 << '\n';
 
-#pragma omp target exit data map(delete: in1[0 : N], in2[0 : N])
+#pragma omp target exit data map(delete : in1[0 : N], in2[0 : N])
 
   free(in1);
   free(in2);

``````````

</details>


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


More information about the llvm-commits mailing list