[clang] [openmp] [OpenMP][USM] Introduces -fopenmp-force-usm flag (PR #76571)

via cfe-commits cfe-commits at lists.llvm.org
Thu Jan 18 05:50:13 PST 2024


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 90802e652db348fd3218fcbfc3e6ac9e90702acd e093db3f1bc432654c2105430f2f647f6d2ab362 -- clang/test/OpenMP/force-usm.c openmp/libomptarget/test/offloading/force-usm.cpp clang/lib/CodeGen/CGOpenMPRuntime.cpp clang/lib/Driver/ToolChains/Clang.cpp
``````````

</details>

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

``````````diff
diff --git a/openmp/libomptarget/test/offloading/force-usm.cpp b/openmp/libomptarget/test/offloading/force-usm.cpp
index f51f7e782e..e961f315f8 100644
--- a/openmp/libomptarget/test/offloading/force-usm.cpp
+++ b/openmp/libomptarget/test/offloading/force-usm.cpp
@@ -1,9 +1,11 @@
 // RUN: %libomptarget-compilexx-generic
-// RUN: env LIBOMPTARGET_INFO=32 %libomptarget-run-generic 2>&1 | %fcheck-generic --check-prefix=NO-USM
+// RUN: env LIBOMPTARGET_INFO=32 %libomptarget-run-generic 2>&1 |
+// %fcheck-generic --check-prefix=NO-USM
 //
 // RUN: %libomptarget-compilexxx-generic-force-usm
 // RUN: env HSA_XNACK=1 LIBOMPTARGET_INFO=32 \
-// RUN:       %libomptarget-run-generic 2>&1 | %fcheck-generic --check-prefix=FORCE-USM
+// RUN:       %libomptarget-run-generic 2>&1 | %fcheck-generic
+// --check-prefix=FORCE-USM
 //
 // UNSUPPORTED: nvptx64-nvidia-cuda
 // UNSUPPORTED: nvptx64-nvidia-cuda-LTO
@@ -11,7 +13,6 @@
 #include <cstdio>
 #include <cstdlib>
 
-
 int GI;
 #pragma omp declare target
 int *pGI;
@@ -21,10 +22,10 @@ int main(void) {
 
   GI = 0;
 
-  pGI = (int *) malloc(sizeof(int));
+  pGI = (int *)malloc(sizeof(int));
   *pGI = 42;
 
-#pragma omp target map(pGI[:1], GI)
+#pragma omp target map(pGI[ : 1], GI)
   {
     GI = 1;
     *pGI = 2;
@@ -35,11 +36,13 @@ int main(void) {
   return 0;
 }
 
-// NO-USM: omptarget device 0 info: Copying data from host to device, HstPtr={{.*}}, TgtPtr={{.*}}, Size=4
-// NO-USM: omptarget device 0 info: Copying data from host to device, HstPtr={{.*}}, TgtPtr={{.*}}, Size=4
-// NO-USM: omptarget device 0 info: Copying data from host to device, HstPtr={{.*}}, TgtPtr={{.*}}, Size=8, Name=pGI
-// NO-USM: omptarget device 0 info: Copying data from device to host, TgtPtr={{.*}}, HstPtr={{.*}}, Size=4
-// NO-USM: omptarget device 0 info: Copying data from device to host, TgtPtr={{.*}}, HstPtr={{.*}}, Size=4
-// NO-USM: SUCCESS
+// NO-USM: omptarget device 0 info: Copying data from host to device,
+// HstPtr={{.*}}, TgtPtr={{.*}}, Size=4 NO-USM: omptarget device 0 info: Copying
+// data from host to device, HstPtr={{.*}}, TgtPtr={{.*}}, Size=4 NO-USM:
+// omptarget device 0 info: Copying data from host to device, HstPtr={{.*}},
+// TgtPtr={{.*}}, Size=8, Name=pGI NO-USM: omptarget device 0 info: Copying data
+// from device to host, TgtPtr={{.*}}, HstPtr={{.*}}, Size=4 NO-USM: omptarget
+// device 0 info: Copying data from device to host, TgtPtr={{.*}},
+// HstPtr={{.*}}, Size=4 NO-USM: SUCCESS
 
 // FORCE-USM: SUCCESS

``````````

</details>


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


More information about the cfe-commits mailing list